pax_global_header00006660000000000000000000000064136005756770014532gustar00rootroot0000000000000052 comment=20231c22043499bc3726dcd389fbfa0998557878 core-js-3.6.1/000077500000000000000000000000001360057567700131035ustar00rootroot00000000000000core-js-3.6.1/.eslintignore000066400000000000000000000001521360057567700156040ustar00rootroot00000000000000node_modules/ /packages/core-js-bundle/ /packages/core-js-pure/override/ /tests/bundles/ !**/.eslintrc.js core-js-3.6.1/.eslintrc.js000066400000000000000000000605521360057567700153520ustar00rootroot00000000000000'use strict'; const SUPPORTED_NODE_VERSIONS = require('./package.json').engines.node; const webpack = require('./.webpack.config.js'); const base = { // possible errors: // enforce 'for' loop update clause moving the counter in the right direction 'for-direction': 'error', // disallow window alert / confirm / prompt calls 'no-alert': 'error', // disallow comparing against -0 'no-compare-neg-zero': 'error', // disallow use of console 'no-console': 'error', // disallow constant expressions in conditions 'no-constant-condition': ['error', { checkLoops: false }], // disallow control characters in regular expressions 'no-control-regex': 'error', // disallow use of debugger 'no-debugger': 'error', // disallow duplicate arguments in functions 'no-dupe-args': 'error', // disallow duplicate keys when creating object literals 'no-dupe-keys': 'error', // disallow a duplicate case label. 'no-duplicate-case': 'error', // disallow else after a return in an if 'no-else-return': 'error', // disallow empty statements 'no-empty': 'error', // disallow the use of empty character classes in regular expressions 'no-empty-character-class': 'error', // disallow unnecessary boolean casts 'no-extra-boolean-cast': 'error', // disallow unnecessary semicolons 'no-extra-semi': 'error', // disallow assigning to the exception in a catch block 'no-ex-assign': 'error', // disallow overwriting functions written as function declarations 'no-func-assign': 'error', // disallow invalid regular expression strings in the RegExp constructor 'no-invalid-regexp': 'error', // disallow irregular whitespace outside of strings and comments 'no-irregular-whitespace': 'error', // disallow characters which are made with multiple code points in character class syntax 'no-misleading-character-class': 'error', // disallow the use of object properties of the global object (Math and JSON) as functions 'no-obj-calls': 'error', // disallow use of Object.prototypes builtins directly 'no-prototype-builtins': 'error', // disallow multiple spaces in a regular expression literal 'no-regex-spaces': 'error', // disallow returning values from setters 'no-setter-return': 'error', // disallow sparse arrays 'no-sparse-arrays': 'error', // disallow template literal placeholder syntax in regular strings 'no-template-curly-in-string': 'error', // avoid code that looks like two expressions but is actually one 'no-unexpected-multiline': 'error', // disallow negation of the left operand of an in expression 'no-unsafe-negation': 'error', // disallow comparisons with the value NaN 'use-isnan': 'error', // disallow unreachable statements after a return, throw, continue, or break statement 'no-unreachable': 'error', // ensure that the results of typeof are compared against a valid string 'valid-typeof': 'error', // best practices: // enforces return statements in callbacks of array's methods 'array-callback-return': 'error', // encourages use of dot notation whenever possible 'dot-notation': ['error', { allowKeywords: true }], // enforce newline before and after dot 'dot-location': ['error', 'property'], // disallow use of arguments.caller or arguments.callee 'no-caller': 'error', // disallow lexical declarations in case/default clauses 'no-case-declarations': 'error', // disallow duplicate conditions in if-else-if chains 'no-dupe-else-if': 'error', // disallow empty functions, except for standalone funcs/arrows 'no-empty-function': 'error', // disallow empty destructuring patterns 'no-empty-pattern': 'error', // disallow use of eval() 'no-eval': 'error', // disallow adding to native types 'no-extend-native': 'error', // disallow unnecessary function binding 'no-extra-bind': 'error', // disallow unnecessary labels 'no-extra-label': 'error', // disallow fallthrough of case statements 'no-fallthrough': 'error', // disallow the use of leading or trailing decimal points in numeric literals 'no-floating-decimal': 'error', // disallow reassignments of native objects 'no-global-assign': 'error', // disallow use of eval()-like methods 'no-implied-eval': 'error', // disallow usage of __iterator__ property 'no-iterator': 'error', // disallow use of labels for anything other then loops and switches 'no-labels': ['error', { allowLoop: false, allowSwitch: false }], // disallow unnecessary nested blocks 'no-lone-blocks': 'error', // disallow function declarations and expressions inside loop statements 'no-loop-func': 'error', // disallow use of multiple spaces 'no-multi-spaces': ['error', { ignoreEOLComments: true }], // disallow use of multiline strings 'no-multi-str': 'error', // disallow use of new operator when not part of the assignment or comparison 'no-new': 'error', // disallow use of new operator for Function object 'no-new-func': 'error', // disallows creating new instances of String, Number, and Boolean 'no-new-wrappers': 'error', // disallow use of (old style) octal literals 'no-octal': 'error', // disallow use of octal escape sequences in string literals, such as var foo = 'Copyright \251'; 'no-octal-escape': 'error', // disallow usage of __proto__ property 'no-proto': 'error', // disallow declaring the same variable more then once 'no-redeclare': 'error', // disallow unnecessary calls to `.call()` and `.apply()` 'no-useless-call': 'error', // disallow redundant return statements 'no-useless-return': 'error', // disallow use of `javascript:` urls. 'no-script-url': 'error', // disallow self assignment 'no-self-assign': 'error', // disallow comparisons where both sides are exactly the same 'no-self-compare': 'error', // disallow use of comma operator 'no-sequences': 'error', // restrict what can be thrown as an exception 'no-throw-literal': 'error', // disallow usage of expressions in statement position 'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }], // disallow unused labels 'no-unused-labels': 'error', // disallow unnecessary catch clauses 'no-useless-catch': 'error', // disallow useless string concatenation 'no-useless-concat': 'error', // disallow unnecessary string escaping 'no-useless-escape': 'error', // disallow void operators 'no-void': 'error', // disallow use of the with statement 'no-with': 'error', // require use of the second argument for parseInt() radix: 'error', // variables: // disallow catch clause parameters from shadowing variables in the outer scope 'no-catch-shadow': 'error', // disallow deletion of variables 'no-delete-var': 'error', // disallow labels that share a name with a variable 'no-label-var': 'error', // disallow declaration of variables already declared in the outer scope 'no-shadow': 'error', // disallow shadowing of names such as arguments 'no-shadow-restricted-names': 'error', // disallow use of undeclared variables unless mentioned in a /*global */ block 'no-undef': ['error'], // disallow initializing variables to undefined 'no-undef-init': 'error', // disallow declaration of variables that are not used in the code 'no-unused-vars': ['error', { vars: 'local', args: 'after-used', ignoreRestSiblings: true }], // stylistic issues: // enforce spacing inside array brackets 'array-bracket-spacing': ['error', 'never'], // enforce spacing inside single-line blocks 'block-spacing': ['error', 'always'], // enforce one true brace style 'brace-style': ['error', '1tbs', { allowSingleLine: true }], // require camel case names camelcase: ['error', { properties: 'never' }], // enforce trailing commas in multiline object literals 'comma-dangle': ['error', 'always-multiline'], // enforce spacing after comma 'comma-spacing': 'error', // enforce one true comma style 'comma-style': ['error', 'last', { exceptions: { VariableDeclaration: true } }], // disallow padding inside computed properties 'computed-property-spacing': ['error', 'never'], // enforce one newline at the end of files 'eol-last': ['error', 'always'], // disallow space between function identifier and application 'func-call-spacing': 'error', // this option sets a specific tab width for your code 'indent-legacy': ['error', 2, { VariableDeclarator: 2, SwitchCase: 1 }], // require a space before & after certain keywords 'keyword-spacing': ['error', { before: true, after: true }], // enforces spacing between keys and values in object literal properties 'key-spacing': ['error', { beforeColon: false, afterColon: true }], // enforce consistent linebreak style 'linebreak-style': ['error', 'unix'], // specify the maximum length of a line in your program 'max-len': ['error', 120, 2], // enforce a maximum depth that callbacks can be nested 'max-nested-callbacks': ['error', 4], // specify the maximum number of statement allowed in a function 'max-statements': ['error', 40], // require a capital letter for constructors 'new-cap': ['error', { newIsCap: true, capIsNew: false }], // require parentheses when invoking a constructor with no arguments 'new-parens': 'error', // disallow if as the only statement in an else block 'no-lonely-if': 'error', // disallow mixed spaces and tabs for indentation 'no-mixed-spaces-and-tabs': 'error', // disallow multiple empty lines and only one newline at the end 'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 1 }], // disallow tabs 'no-tabs': 'error', // disallow trailing whitespace at the end of lines 'no-trailing-spaces': 'error', // disallow the use of boolean literals in conditional expressions and prefer `a || b` over `a ? a : b` 'no-unneeded-ternary': ['error', { defaultAssignment: false }], // disallow whitespace before properties 'no-whitespace-before-property': 'error', // enforce the location of single-line statements 'nonblock-statement-body-position': ['error', 'beside'], // enforce spaces inside braces 'object-curly-spacing': ['error', 'always'], // require newlines around variable declarations with initializations 'one-var-declaration-per-line': ['error', 'initializations'], // enforce padding within blocks 'padded-blocks': ['error', 'never'], // specify whether double or single quotes should be used quotes: ['error', 'single', 'avoid-escape'], // require or disallow use of quotes around object literal property names 'quote-props': ['error', 'as-needed', { keywords: false }], // require or disallow use of semicolons instead of ASI semi: ['error', 'always'], // enforce spacing before and after semicolons 'semi-spacing': 'error', // enforce location of semicolons 'semi-style': ['error', 'last'], // require or disallow space before blocks 'space-before-blocks': 'error', // require or disallow space before function opening parenthesis 'space-before-function-paren': ['error', { anonymous: 'always', named: 'never' }], // require or disallow spaces inside parentheses 'space-in-parens': 'error', // require spaces around operators 'space-infix-ops': 'error', // Require or disallow spaces before/after unary operators 'space-unary-ops': 'error', // require or disallow a space immediately following the // or /* in a comment 'spaced-comment': ['error', 'always', { line: { exceptions: ['/'] }, block: { exceptions: ['*'] } }], // enforce spacing around colons of switch statements 'switch-colon-spacing': 'error', // require or disallow the Unicode Byte Order Mark 'unicode-bom': ['error', 'never'], // commonjs: // require require() calls to be placed at top-level module scope 'global-require': 'error', // disallow require calls to be mixed with regular variable declarations 'no-mixed-requires': ['error', { grouping: true, allowCall: false }], // disallow new operators with calls to require 'no-new-require': 'error', // disallow string concatenation with `__dirname` and `__filename` 'no-path-concat': 'error', // import: // ensure all imports appear before other statements 'import/first': 'error', // forbid AMD imports 'import/no-amd': 'error', // forbid cycle dependencies 'import/no-cycle': ['error', { commonjs: true }], // ensure imports point to files / modules that can be resolved 'import/no-unresolved': ['error', { commonjs: true }], // forbid import of modules using absolute paths 'import/no-absolute-path': 'error', // forbid `require()` calls with expressions 'import/no-dynamic-require': 'error', // disallow importing from the same path more than once 'import/no-duplicates': 'error', // forbid a module from importing itself 'import/no-self-import': 'error', // forbid useless path segments 'import/no-useless-path-segments': 'error', // node: // enforce the style of file extensions in `import` declarations 'node/file-extension-in-import': ['error', 'never'], // disallow the assignment to `exports` 'node/no-exports-assign': 'error', // es6+: // require parentheses around arrow function arguments 'arrow-parens': ['error', 'as-needed'], // enforce consistent spacing before and after the arrow in arrow functions 'arrow-spacing': 'error', // enforce the location of arrow function bodies 'implicit-arrow-linebreak': ['error', 'beside'], // disallow unnecessary computed property keys in object literals 'no-useless-computed-key': 'error', // disallow unnecessary constructors 'no-useless-constructor': 'error', // require let or const instead of var 'no-var': 'error', // disallow renaming import, export, and destructured assignments to the same name 'no-useless-rename': 'error', // require or disallow method and property shorthand syntax for object literals 'object-shorthand': 'error', // require using arrow functions for callbacks 'prefer-arrow-callback': 'error', // require const declarations for variables that are never reassigned after declared 'prefer-const': ['error', { destructuring: 'all' }], // require destructuring from arrays and/or objects 'prefer-destructuring': 'error', // prefer the exponentiation operator over `Math.pow()` 'prefer-exponentiation-operator': 'error', // require template literals instead of string concatenation 'prefer-template': 'error', // enforce spacing between rest and spread operators and their expressions 'rest-spread-spacing': 'error', // require or disallow spacing around embedded expressions of template strings 'template-curly-spacing': ['error', 'always'], // require strict mode directives strict: ['error', 'global'], // unicorn // enforce a specific parameter name in catch clauses 'unicorn/catch-error-name': ['error', { name: 'error', caughtErrorsIgnorePattern: '^err' }], // enforce passing a message value when throwing a built-in error 'unicorn/error-message': 'error', // require escape sequences to use uppercase values 'unicorn/escape-case': 'error', // enforce a case style for filenames 'unicorn/filename-case': ['error', { case: 'kebabCase' }], // enforce importing index files with `.` 'unicorn/import-index': 'error', // enforce specifying rules to disable in eslint-disable comments 'unicorn/no-abusive-eslint-disable': 'error', // do not use leading/trailing space between `console.log` parameters 'unicorn/no-console-spaces': 'error', // enforce the use of unicode escapes instead of hexadecimal escapes 'unicorn/no-hex-escape': 'error', // disallow unreadable array destructuring 'unicorn/no-unreadable-array-destructuring': 'error', // disallow unsafe regular expressions 'unicorn/no-unsafe-regex': 'error', // disallow unused object properties 'unicorn/no-unused-properties': 'error', // enforce lowercase identifier and uppercase value for number literals 'unicorn/number-literal-case': 'error', // prefer `String#slice` over `String#{ substr, substring }` 'unicorn/prefer-string-slice': 'error', // enforce the use of regex shorthands to improve readability 'unicorn/regex-shorthand': 'error', // optimize regex literals 'optimize-regex/optimize-regex': 'error', // sonarjs // merging collapsible if statements increases the code's readability 'sonarjs/no-collapsible-if': 'error', // collection sizes and array length comparisons should make sense 'sonarjs/no-collection-size-mischeck': 'error', // two branches in a conditional structure should not have exactly the same implementation 'sonarjs/no-duplicated-branches': 'error', // collection elements should not be replaced unconditionally 'sonarjs/no-element-overwrite': 'error', // function calls should not pass extra arguments 'sonarjs/no-extra-arguments': 'error', // functions should not have identical implementations 'sonarjs/no-identical-functions': 'error', // boolean checks should not be inverted 'sonarjs/no-inverted-boolean-check': 'error', // loops with at most one iteration should be refactored 'sonarjs/no-one-iteration-loop': 'error', // boolean literals should not be redundant 'sonarjs/no-redundant-boolean': 'error', // jump statements should not be redundant 'sonarjs/no-redundant-jump': 'error', // conditionals should start on new lines 'sonarjs/no-same-line-conditional': 'error', // collection and array contents should be used 'sonarjs/no-unused-collection': 'error', // the output of functions that don't return anything should not be used 'sonarjs/no-use-of-empty-return-value': 'error', // local variables should not be declared and then immediately returned or thrown 'sonarjs/prefer-immediate-return': 'error', // object literal syntax should be used 'sonarjs/prefer-object-literal': 'error', // return of boolean expressions should not be wrapped into an `if-then-else` statement 'sonarjs/prefer-single-boolean-return': 'error', // a `while` loop should be used instead of a `for` loop with condition only 'sonarjs/prefer-while': 'error', }; const es3 = { // disallow trailing commas in multiline object literals 'comma-dangle': ['error', 'never'], // encourages use of dot notation whenever possible 'dot-notation': ['error', { allowKeywords: false }], // disallow function or variable declarations in nested blocks 'no-inner-declarations': 'error', // require let or const instead of var 'no-var': 'off', // require or disallow method and property shorthand syntax for object literals 'object-shorthand': 'off', // require using arrow functions for callbacks 'prefer-arrow-callback': 'off', // require const declarations for variables that are never reassigned after declared 'prefer-const': 'off', // require destructuring from arrays and/or objects 'prefer-destructuring': 'off', // prefer the exponentiation operator over `Math.pow()` 'prefer-exponentiation-operator': 'off', // require template literals instead of string concatenation 'prefer-template': 'off', // require or disallow use of quotes around object literal property names 'quote-props': ['error', 'as-needed', { keywords: true }], // require strict mode directives strict: 'off', }; const node = { // disallow deprecated APIs 'node/no-deprecated-api': 'error', // disallow unsupported ECMAScript built-ins on the specified version 'node/no-unsupported-features/es-builtins': ['error', { version: SUPPORTED_NODE_VERSIONS }], // disallow unsupported ECMAScript syntax on the specified version 'node/no-unsupported-features/es-syntax': ['error', { version: SUPPORTED_NODE_VERSIONS }], }; const tests = { // require strict mode directives strict: 'off', // relax for testing: // enforces return statements in callbacks of array's methods 'array-callback-return': 'off', // specify the maximum length of a line in your program 'max-len': ['error', 180, 2], // specify the maximum number of statement allowed in a function 'max-statements': 'off', // disallow function declarations and expressions inside loop statements 'no-loop-func': 'off', // disallow use of new operator when not part of the assignment or comparison 'no-new': 'off', // disallow use of new operator for Function object 'no-new-func': 'off', // disallows creating new instances of String, Number, and Boolean 'no-new-wrappers': 'off', // restrict what can be thrown as an exception 'no-throw-literal': 'off', // disallow usage of expressions in statement position 'no-unused-expressions': 'off', // disallow unnecessary calls to `.call()` and `.apply()` 'no-useless-call': 'off', // enforce passing a message value when throwing a built-in error 'unicorn/error-message': 'off', // functions should not have identical implementations 'sonarjs/no-identical-functions': 'off', }; const qunit = { // ensure the correct number of assert arguments is used 'qunit/assert-args': 'error', // forbid the use of assert.equal 'qunit/no-assert-equal': 'error', // forbid binary logical expressions in assert arguments 'qunit/no-assert-logical-expression': 'error', // forbid async calls in loops 'qunit/no-async-in-loops': 'error', // forbid the use of asyncTest 'qunit/no-async-test': 'error', // forbid commented tests 'qunit/no-commented-tests': 'error', // forbid comparing relational expression to boolean in assertions 'qunit/no-compare-relation-boolean': 'error', // prevent early return in a qunit test 'qunit/no-early-return': 'error', // forbid the use of global qunit assertions 'qunit/no-global-assertions': 'error', // forbid the use of global expect 'qunit/no-global-expect': 'error', // forbid the use of global module / test / asyncTest 'qunit/no-global-module-test': 'error', // forbid use of global stop / start 'qunit/no-global-stop-start': 'error', // forbid identical test and module names 'qunit/no-identical-names': 'error', // forbid use of QUnit.init 'qunit/no-init': 'error', // forbid use of QUnit.jsDump 'qunit/no-jsdump': 'error', // forbid equality comparisons in assert.{ok, notOk} 'qunit/no-ok-equality': 'error', // forbid the use of QUnit.push 'qunit/no-qunit-push': 'error', // forbid QUnit.start within tests or test hooks 'qunit/no-qunit-start-in-tests': 'error', // forbid the use of QUnit.stop 'qunit/no-qunit-stop': 'error', // forbid overwriting of QUnit logging callbacks 'qunit/no-reassign-log-callbacks': 'error', // forbid use of QUnit.reset 'qunit/no-reset': 'error', // forbid setup / teardown module hooks 'qunit/no-setup-teardown': 'error', // forbid expect argument in QUnit.test 'qunit/no-test-expect-argument': 'error', // forbid assert.throws() with block, string, and message 'qunit/no-throws-string': 'error', // require that all async calls should be resolved in tests 'qunit/resolve-async': 'error', }; module.exports = { root: true, parserOptions: { ecmaVersion: 2020, }, env: { browser: true, node: true, worker: true, }, plugins: [ 'import', 'node', 'optimize-regex', 'qunit', 'sonarjs', 'unicorn', ], settings: { 'import/resolver': { webpack: { config: webpack.options, }, }, }, reportUnusedDisableDirectives: true, rules: base, overrides: [ { files: [ 'packages/core-js/**', 'packages/core-js-pure/**', 'tests/promises-aplus/**', 'tests/compat/**', ], parserOptions: { ecmaVersion: 3, }, rules: es3, }, { files: [ 'tests/helpers/**', 'tests/pure/**', 'tests/tests/**', 'tests/wpt-url-resources/**', 'tests/commonjs.js', 'tests/commonjs-entries-content.js', 'tests/targets-parser.js', ], parserOptions: { sourceType: 'module', }, rules: tests, }, { files: [ 'tests/helpers/**', 'tests/pure/**', 'tests/tests/**', ], env: { qunit: true, }, rules: qunit, }, { files: [ 'packages/core-js-builder/**', 'packages/core-js-compat/**', 'tests/commonjs.js', 'tests/commonjs-entries-content.js', 'tests/targets-parser.js', '.eslintrc.js', '.webpack.config.js', 'babel.config.js', 'Gruntfile.js', ], env: { es6: true, }, rules: node, }, { files: [ 'tests/tests/**', 'tests/compat/**', ], env: { es6: true, }, globals: { compositeKey: true, compositeSymbol: true, globalThis: true, queueMicrotask: true, AggregateError: true, AsyncIterator: true, Iterator: true, Observable: true, }, }, ], }; core-js-3.6.1/.gitattributes000066400000000000000000000000151360057567700157720ustar00rootroot00000000000000* text eol=lfcore-js-3.6.1/.github/000077500000000000000000000000001360057567700144435ustar00rootroot00000000000000core-js-3.6.1/.github/FUNDING.yml000066400000000000000000000001011360057567700162500ustar00rootroot00000000000000open_collective: core-js patreon: zloirock tidelift: npm/core-js core-js-3.6.1/.gitignore000066400000000000000000000017121360057567700150740ustar00rootroot00000000000000npm-shrinkwrap.json package-lock.json yarn.lock node_modules/ *.tmp *.log *.bak *.swp /packages/core-js/LICENSE /packages/core-js-builder/LICENSE /packages/core-js-bundle/LICENSE /packages/core-js-bundle/index.js /packages/core-js-bundle/minified.js /packages/core-js-bundle/minified.js.map /packages/core-js-bundle/postinstall.js /packages/core-js-compat/LICENSE /packages/core-js-compat/data.json /packages/core-js-compat/entries.json /packages/core-js-compat/external.json /packages/core-js-compat/modules.json /packages/core-js-compat/modules-by-versions.json /packages/core-js-pure/es/ /packages/core-js-pure/features/ /packages/core-js-pure/internals/ /packages/core-js-pure/modules/ /packages/core-js-pure/proposals/ /packages/core-js-pure/stable/ /packages/core-js-pure/stage/ /packages/core-js-pure/web/ /packages/core-js-pure/LICENSE /packages/core-js-pure/index.js /packages/core-js-pure/configurator.js /packages/core-js-pure/postinstall.js /tests/bundles/ core-js-3.6.1/.npmrc000066400000000000000000000000231360057567700142160ustar00rootroot00000000000000package-lock=false core-js-3.6.1/.travis.yml000066400000000000000000000002261360057567700152140ustar00rootroot00000000000000language: node_js node_js: - '13' - '12.13' - '10.13' - '8.16' # TODO: remove from `core-js@4` os: - windows - linux - osx sudo: false core-js-3.6.1/.webpack.config.js000066400000000000000000000020331360057567700163750ustar00rootroot00000000000000'use strict'; const resolve = require('path').resolve; module.exports = { options: { mode: 'none', module: { rules: [{ test: /\.js$/, exclude: /modules/, use: { loader: 'babel-loader', }, }], }, resolve: { alias: { 'core-js': resolve(__dirname, './packages/core-js'), 'core-js-pure': resolve(__dirname, './packages/core-js-pure'), }, }, node: { global: false, process: false, setImmediate: false, }, stats: false, output: { path: resolve(__dirname, './tests/bundles'), }, }, helpers: { entry: './tests/helpers/qunit-helpers.js', output: { filename: 'qunit-helpers.js' }, }, pure: { entry: './tests/pure/index.js', output: { filename: 'pure.js' }, }, tests: { entry: './tests/tests/index.js', output: { filename: 'tests.js' }, }, 'promises-aplus-tests': { entry: 'promises-aplus-tests/lib/testFiles.js', output: { filename: 'promises-aplus.js' }, }, }; core-js-3.6.1/CHANGELOG.md000066400000000000000000002225001360057567700147150ustar00rootroot00000000000000## Changelog ##### 3.6.1 - 2019.12.25 - Fixed a bug related `Symbol` with multiple copies of `core-js` (for `3.4.2-3.6.0`), [#736](https://github.com/zloirock/core-js/issues/736) - Refactored some tools ##### 3.6.0 - 2019.12.19 - Added support of sticky (`y`) `RegExp` flag, [#372](https://github.com/zloirock/core-js/issues/372), [#732](https://github.com/zloirock/core-js/issues/732), [#492](https://github.com/zloirock/core-js/issues/492), thanks [@cvle](https://github.com/cvle) and [@nicolo-ribaudo](https://github.com/nicolo-ribaudo) - Added `RegExp#test` delegation to `RegExp#exec`, [#732](https://github.com/zloirock/core-js/issues/732), thanks [@cvle](https://github.com/cvle) - Fixed some cases of `Object.create(null)` in IE8-, [#727](https://github.com/zloirock/core-js/issues/727), [#728](https://github.com/zloirock/core-js/issues/728), thanks [@aleen42](https://github.com/aleen42) - Allowed object of minimum environment versions as `core-js-compat` and `core-js-builder` `targets` argument - Allowed corresponding to Babel `targets.esmodules`, `targets.browsers`, `targets.node` options in `core-js-compat` and `core-js-builder` - Engines in compat data and results of targets parsing sorted alphabetically - Fixed `features/instance/match-all` entry compat data - Fixed `Array.prototype[@@unscopables]` descriptor (was writable) - Added Samsung Internet 11 compat data mapping ##### 3.5.0 - 2019.12.12 - Added [object iteratoration stage 1 proposal](https://github.com/tc39/proposal-object-iteration): - `Object.iterateKeys` - `Object.iterateValues` - `Object.iterateEntries` ##### 3.4.8 - 2019.12.09 - Added one more workaround for broken in previous versions `inspectSource` helper, [#719](https://github.com/zloirock/core-js/issues/719) - Added Opera Mobile compat data - Updated Samsung Internet, iOS, old Node and Android compat data mapping - `es.string.match-all` marked as completely supported in FF73 - Generate `core-js-compat/modules` since often we need just the list of `core-js` modules ##### 2.6.11 [LEGACY] - 2019.12.09 - Returned usage of `node -e` in the `postinstall` scripts for better cross-platform compatibility, [#582](https://github.com/zloirock/core-js/issues/582) - Improved CI detection in the `postinstall` script, [#707](https://github.com/zloirock/core-js/issues/707) ##### 3.4.7 - 2019.12.03 - Fixed an NPM publishing issue ##### 3.4.6 - 2019.12.03 - Improved iOS compat data - added missed mapping iOS 12.2 -> Safari 12.1, added bug fixes from patch releases - Added Safari 13.1 compat data - Added missed in `core-js-compat` helpers `ie_mob` normalization - Normalize the result of `getModulesListForTargetVersion` `core-js-compat` helper - Improved CI detection in the `postinstall` script, [#707](https://github.com/zloirock/core-js/issues/707) ##### 3.4.5 - 2019.11.28 - Detect incorrect order of operations in `Object.assign`, MS Edge bug - Detect usage of `ToLength` in `Array#{ filter, map }`, FF48-49 and MS Edge 14- issues - Detect incorrect MS Edge 17-18 `Reflect.set` which allows setting the property to object with non-writable property on the prototype - Fixed `inspectSource` helper with multiple `core-js` copies and some related features like some edge cases of `Promise` feature detection ##### 3.4.4 - 2019.11.27 - Added feature detection for Safari [non-generic `Promise#finally` bug](https://bugs.webkit.org/show_bug.cgi?id=200829) **(critical for `core-js-pure`)** - Fixed missed `esnext.string.code-points` in `core-js/features/string` entry point - Updated `Iterator` proposal feature detection for the case of non-standard `Iterator` in FF44- ##### 3.4.3 - 2019.11.26 - Fixed missed `es.json.stringify` and some modules from iteration helpers proposal in some entry points **(includes the root entry point)** - Added a workaround of `String#{ endsWith, startsWith }` MDN polyfills bugs, [#702](https://github.com/zloirock/core-js/issues/702) - Fixed `.size` property descriptor of `Map` / `Set` in the pure version - Refactoring, some internal improvements ##### 3.4.2 - 2019.11.22 - Don't use polyfilled symbols as internal uids, a workaround for some incorrect use cases - `String#replaceAll` is available only in nightly FF builds - Improved `Promise` feature detection for the case of V8 6.6 with multiple `core-js` copies - Some internals optimizations - Added Node 13.2 -> V8 7.9 compat data mapping - Returned usage of `node -e` in `postinstall` scripts ##### 3.4.1 - 2019.11.12 - Throw when `(Async)Iterator#flatMap` mapper returns a non-iterable, per [tc39/proposal-iterator-helpers/55](https://github.com/tc39/proposal-iterator-helpers/issues/55) and [tc39/proposal-iterator-helpers/59](https://github.com/tc39/proposal-iterator-helpers/pull/59) - Removed own `AggregateError#toString`, per [tc39/proposal-promise-any/49](https://github.com/tc39/proposal-promise-any/pull/49) - Global `core-js` `Promise` polyfill passes feature detection in the pure versions - Fixed indexes in `String#replaceAll` callbacks - `String#replaceAll` marked as supported by FF72 ##### 3.4.0 - 2019.11.07 - Added [well-formed `JSON.stringify`](https://github.com/tc39/proposal-well-formed-stringify), ES2019 feature, thanks [@ExE-Boss](https://github.com/ExE-Boss) and [@WebReflection](https://github.com/WebReflection) for the idea - Fixed `Math.signbit`, [#687](https://github.com/zloirock/core-js/issues/687), thanks [@chicoxyzzy](https://github.com/chicoxyzzy) ##### 3.3.6 - 2019.11.01 - Don't detect Chakra-based Edge as Chrome in the `userAgent` parsing - Fixed inheritance in typed array constructors wrappers, [#683](https://github.com/zloirock/core-js/issues/683) - Added one more workaround for correct work of early `fetch` implementations with polyfilled `URLSearchParams`, [#680](https://github.com/zloirock/core-js/issues/680) ##### 3.3.5 - 2019.10.29 - Added a workaround of V8 deoptimization which causes serious performance degradation (~4x in my tests) of `Array#concat`, [#679](https://github.com/zloirock/core-js/issues/679) - Added a workaround of V8 deoptimization which causes slightly performance degradation of `Promise`, [#679](https://github.com/zloirock/core-js/issues/679) - Added `(Async)Iterator.prototype.constructor -> (Async)Iterator` per [this issue](https://github.com/tc39/proposal-iterator-helpers/issues/60) - Added compat data for Chromium-based Edge ##### 3.3.4 - 2019.10.25 - Added a workaround of V8 deoptimization which causes serious performance degradation (~20x in my tests) of some `RegExp`-related methods like `String#split`, [#306](https://github.com/zloirock/core-js/issues/306) - Added a workaround of V8 deoptimization which causes serious performance degradation (up to 100x in my tests) of `Array#splice` and slightly `Array#{ filter, map }`, [#677](https://github.com/zloirock/core-js/issues/677) - Fixed work of `fetch` with polyfilled `URLSearchParams`, [#674](https://github.com/zloirock/core-js/issues/674) - Fixed an edge case of `String#replaceAll` with an empty search value - Added compat data for Chrome 80 - `package-lock.json` no longer generated in libraries ##### 3.3.3 - 2019.10.22 - `gopher` removed from `URL` special cases per [this issue](https://github.com/whatwg/url/issues/342) and [this PR](https://github.com/whatwg/url/pull/453) - Added compat data for iOS 13 and Node 13.0 ##### 3.3.2 - 2019.10.14 - Fixed compatibility of `core-js-compat` with Node 6 and Yarn, [#669](https://github.com/zloirock/core-js/issues/669) ##### 3.3.1 - 2019.10.13 - Fixed an NPM publishing issue ##### 3.3.0 - 2019.10.13 - **`String#{ matchAll, replaceAll }` throws an error on non-global regex argument per [the decision from TC39 meetings](https://github.com/tc39/ecma262/pull/1716) (+ [this PR](https://github.com/tc39/proposal-string-replaceall/pull/24)). It's a breaking change, but since it's a breaking change in the ES spec, it's added at the minor release** - `globalThis` moved to stable ES, [per October TC39 meeting](https://github.com/babel/proposals/issues/60#issuecomment-537217903) - `Promise.any` moved to stage 3, some minor internal changes, [per October TC39 meeting](https://github.com/babel/proposals/issues/60#issuecomment-538084885) - `String#replaceAll` moved to stage 3, [per October TC39 meeting](https://github.com/babel/proposals/issues/60#issuecomment-537530013) - Added [iterator helpers stage 2 proposal](https://github.com/tc39/proposal-iterator-helpers): - `Iterator` - `Iterator.from` - `Iterator#asIndexedPairs` - `Iterator#drop` - `Iterator#every` - `Iterator#filter` - `Iterator#find` - `Iterator#flatMap` - `Iterator#forEach` - `Iterator#map` - `Iterator#reduce` - `Iterator#some` - `Iterator#take` - `Iterator#toArray` - `Iterator#@@toStringTag` - `AsyncIterator` - `AsyncIterator.from` - `AsyncIterator#asIndexedPairs` - `AsyncIterator#drop` - `AsyncIterator#every` - `AsyncIterator#filter` - `AsyncIterator#find` - `AsyncIterator#flatMap` - `AsyncIterator#forEach` - `AsyncIterator#map` - `AsyncIterator#reduce` - `AsyncIterator#some` - `AsyncIterator#take` - `AsyncIterator#toArray` - `AsyncIterator#@@toStringTag` - Updated `Map#upsert` (`Map#updateOrInsert` before) [proposal](https://github.com/thumbsupep/proposal-upsert) - Moved to stage 2, [per October TC39 meeting](https://github.com/babel/proposals/issues/60#issuecomment-537606117) - `Map#updateOrInsert` renamed to `Map#upsert` - Added `WeakMap#upsert` - You can don't pass one of the callbacks - Added a workaround for iOS Safari MessageChannel + bfcache bug, [#624](https://github.com/zloirock/core-js/issues/624) - Added a workaround for Chrome 33 / Android 4.4.4 `Promise` bug, [#640](https://github.com/zloirock/core-js/issues/640) - Replaced broken `URL` constructor in Safari and `URLSearchParams` in Chrome 66-, [#656](https://github.com/zloirock/core-js/issues/656) - Added compat data for Node up to 12.11, FF 69, Samsung up to 10.2 and Phantom 1.9 - `Math.hypot` marked as not supported in Chrome 77 since [a bug in this method](https://bugs.chromium.org/p/v8/issues/detail?id=9546) was not fixed before the stable Chrome 77 release - Fixed unnecessary exposing on `Symbol.matchAll` in `esnext.string.match-all`, [#626](https://github.com/zloirock/core-js/issues/626) - Fixed missed cases [access the `.next` method once, at the beginning, of the iteration protocol](https://github.com/tc39/ecma262/issues/976) - Show similar `postinstall` messages only once per `npm i`, [#597](https://github.com/zloirock/core-js/issues/597), thanks [@remy](https://github.com/remy) ##### 2.6.10 [LEGACY] - 2019.10.13 - Show similar `postinstall` messages only once per `npm i`, [#597](https://github.com/zloirock/core-js/issues/597) ##### 3.2.1 - 2019.08.12 - Added a workaround for possible recursion in microtasks caused by conflicts with other `Promise` polyfills, [#615](https://github.com/zloirock/core-js/issues/615) ##### 3.2.0 - 2019.08.09 - `Promise.allSettled` moved to stable ES, per July TC39 meeting - `Promise.any` moved to stage 2, `.errors` property of `AggregateError` instances maked non-enumerable, per July TC39 meeting - `using` statement proposal moved to stage 2, added `Symbol.asyncDispose`, per July TC39 meeting - Added `Array.isTemplateObject` [stage 2 proposal](https://github.com/tc39/proposal-array-is-template-object), per June TC39 meeting - Added `Map#updateOrInsert` [stage 1 proposal](https://docs.google.com/presentation/d/1_xtrGSoN1-l2Q74eCXPHBbbrBHsVyqArWN0ebnW-pVQ/), per July TC39 meeting - Added a fix for [`Math.hypot` V8 7.7 bug](https://bugs.chromium.org/p/v8/issues/detail?id=9546), since it's still not stable without adding results to `core-js-compat` - Added a workaround for APIs where not possible to replace broken native `Promise`, [#579](https://github.com/zloirock/core-js/issues/579) - added `.finally` and patched `.then` to / on native `Promise` prototype - Fixed crashing of Opera Presto, [#595](https://github.com/zloirock/core-js/issues/595) - Fixed incorrect early breaking of `{ Map, Set, WeakMap, WeakSet }.deleteAll` - Fixed some missed dependencies in entry points - Added compat data for Node 12.5, FF 67, Safari 13 - Added support of `DISABLE_OPENCOLLECTIVE` env variable to `postinstall` script - Removed `core-js-pure` dependency from `core-js-compat`, [#590](https://github.com/zloirock/core-js/issues/590) - Fixed generation of `core-js-compat` on Windows, [#606](https://github.com/zloirock/core-js/issues/606) ##### 3.1.4 - 2019.06.15 - Refactoring. Many minor internal improvements and fixes like: - Improved `Symbol.keyFor` complexity to `O(1)` - Fixed the order of arguments validation in `String.prototype.{ endsWith, includes, startsWith }` - Internal implementation of `RegExp#flags` helper now respect `dotAll` flag (mainly ralated to the `pure` version) - Performace optimizations related old V8 - Etc. ##### 3.1.3 - 2019.05.27 - Fixed `core-js/features/reflect/delete-metadata` entry point - Some fixes and improvements of the `postinstall` script like support `npm` color config ([#556](https://github.com/zloirock/core-js/issues/556)) or adding support of `ADBLOCK` env variable - Refactoring and some minor fixes ##### 2.6.9 [LEGACY] - 2019.05.27 - Some fixes and improvements of the `postinstall` script like support `npm` color config ([#556](https://github.com/zloirock/core-js/issues/556)) or adding support of `ADBLOCK` env variable ##### 3.1.2 - 2019.05.22 - Added a workaround of a strange `npx` bug on `postinstall`, [#551](https://github.com/zloirock/core-js/issues/551) ##### 2.6.8 [LEGACY] - 2019.05.22 - Added a workaround of a strange `npx` bug on `postinstall`, [#551](https://github.com/zloirock/core-js/issues/551) ##### 3.1.1 - 2019.05.21 - Added one more workaround of alternative not completely correct `Symbol` polyfills, [#550](https://github.com/zloirock/core-js/issues/550), [#554](https://github.com/zloirock/core-js/issues/554) - Reverted `esnext.string.match-all` in some entry points for fix autogeneration of `core-js-compat/entries` and backward `@babel/preset-env` compatibility ##### 2.6.7 [LEGACY] - 2019.05.21 - Added one more workaround of alternative not completely correct `Symbol` polyfills, [#550](https://github.com/zloirock/core-js/issues/550), [#554](https://github.com/zloirock/core-js/issues/554) ##### 3.1.0 - 2019.05.20 - `String#matchAll` moved to stable ES, exposed `Symbol.matchAll`, [#516](https://github.com/zloirock/core-js/issues/516) - `Promise.allSettled` moved to stage 3, [#515](https://github.com/zloirock/core-js/issues/515) - `String#replaceAll` moved to stage 2, behavior updated by the spec draft, [#524](https://github.com/zloirock/core-js/issues/524) - `Promise.any` moved to stage 1, [#517](https://github.com/zloirock/core-js/issues/517) - Removed `es.regexp.flags` dependency from `es.regexp.to-string`, [#536](https://github.com/zloirock/core-js/issues/536), [#537](https://github.com/zloirock/core-js/issues/537) - Fixed IE8- non-enumerable properties support in `Object.{ assign, entries, values }`, [#541](https://github.com/zloirock/core-js/issues/541) - Fixed support of primitives in `Object.getOwnPropertySymbols` in Chrome 38 / 39, [#539](https://github.com/zloirock/core-js/issues/539) - `window.postMessage`-based task implementation uses location origin over `'*'`, [#542](https://github.com/zloirock/core-js/issues/542) - Lookup `PromiseConstructor.resolve` only once in `Promise` combinators, [tc39/ecma262#1506](https://github.com/tc39/ecma262/pull/1506) - Temporarily removed `core-js` dependency from `core-js-compat` since it's required for missed at this moment feature - Show a message on `postinstall` - Added compat data for Chrome 76, FF 67, Node 12 ##### 2.6.6 [LEGACY] - 2019.05.20 - Fixed IE8- non-enumerable properties support in `Object.{ assign, entries, values }`, [#541](https://github.com/zloirock/core-js/issues/541) - Fixed support of primitives in `Object.getOwnPropertySymbols` in Chrome 38 / 39, [#539](https://github.com/zloirock/core-js/issues/539) - Show a message on `postinstall` ##### 3.0.1 - 2019.04.06 - Fixed some cases of work with malformed URI sequences in `URLSearchParams`, [#525](https://github.com/zloirock/core-js/issues/525) - Added a workaround for a rollup issue, [#513](https://github.com/zloirock/core-js/issues/513) ##### 3.0.0 - 2019.03.19 - Features - Add new features: - `Object.fromEntries` ([ECMAScript 2019](https://github.com/tc39/proposal-object-from-entries)) - `Symbol#description` ([ECMAScript 2019](https://tc39.github.io/ecma262/#sec-symbol.prototype.description)) - New `Set` methods ([stage 2 proposal](https://github.com/tc39/proposal-set-methods)) - `Set#difference` - `Set#intersection` - `Set#isDisjointFrom` - `Set#isSubsetOf` - `Set#isSupersetOf` - `Set#symmetricDifference` - `Set#union` - `Promise.allSettled` ([stage 2 proposal](https://github.com/tc39/proposal-promise-allSettled)) - Getting last item from `Array` ([stage 1 proposal](https://github.com/keithamus/proposal-array-last)) - `Array#lastItem` - `Array#lastIndex` - `String#replaceAll` ([stage 1 proposal](https://github.com/tc39/proposal-string-replace-all)) - `String#codePoints` ([stage 1 proposal](https://github.com/tc39/proposal-string-prototype-codepoints)) - New collections methods ([stage 1 proposal](https://github.com/tc39/collection-methods)) - `Map.groupBy` - `Map.keyBy` - `Map#deleteAll` - `Map#every` - `Map#filter` - `Map#find` - `Map#findKey` - `Map#includes` - `Map#keyOf` - `Map#mapKeys` - `Map#mapValues` - `Map#merge` - `Map#reduce` - `Map#some` - `Map#update` - `Set#addAll` - `Set#deleteAll` - `Set#every` - `Set#filter` - `Set#find` - `Set#join` - `Set#map` - `Set#reduce` - `Set#some` - `WeakMap#deleteAll` - `WeakSet#addAll` - `WeakSet#deleteAll` - `compositeKey` and `compositeSymbol` methods ([stage 1 proposal](https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey)) - `Number.fromString` ([stage 1 proposal](https://github.com/tc39/proposal-number-fromstring)) - `Math.seededPRNG` ([stage 1 proposal](https://github.com/tc39/proposal-seeded-random)) - `Symbol.patternMatch` ([for stage 1 pattern matching proposal](https://github.com/tc39/proposal-pattern-matching)) - `Symbol.dispose` ([for stage 1 `using` statement proposal](https://github.com/tc39/proposal-using-statement)) - `Promise.any` (with `AggregateError`) ([stage 0 proposal](https://github.com/tc39/proposal-promise-any)) - `URL` and `URLSearchParam` [from `URL` standard](https://url.spec.whatwg.org/), also [stage 0 proposal to ECMAScript](https://github.com/jasnell/proposal-url) - `URL` - `URL#href` - `URL#origin` - `URL#protocol` - `URL#username` - `URL#password` - `URL#host` - `URL#hostname` - `URL#port` - `URL#pathname` - `URL#search` - `URL#searchParams` - `URL#hash` - `URL#toString` - `URL#toJSON` - `URLSearchParams` - `URLSearchParams#append` - `URLSearchParams#delete` - `URLSearchParams#get` - `URLSearchParams#getAll` - `URLSearchParams#has` - `URLSearchParams#set` - `URLSearchParams#sort` - `URLSearchParams#toString` - `URLSearchParams#keys` - `URLSearchParams#values` - `URLSearchParams#entries` - `URLSearchParams#@@iterator` - `.forEach` method on iterable DOM collections ([#329](https://github.com/zloirock/core-js/issues/329)) - Improve existing features: - Add triggering unhandled `Promise` rejection events (instead of only global handlers), [#205](https://github.com/zloirock/core-js/issues/205). - Wrap `fetch` for correct with polyfilled `Promise` and preventing problems like [#178](https://github.com/zloirock/core-js/issues/178), [#332](https://github.com/zloirock/core-js/issues/332), [#371](https://github.com/zloirock/core-js/issues/371). - Add support of `@@isConcatSpreadable` to `Array#concat`. - Add support of `@@species` to `Array#{concat, filter, map, slice, splice}`. - Add direct `.exec` calling to `RegExp#{@@replace, @@split, @@match, @@search}`. Also, added fixes for `RegExp#exec` method. [#411](https://github.com/zloirock/core-js/issues/411), [#434](https://github.com/zloirock/core-js/issues/434), [#453](https://github.com/zloirock/core-js/issues/453), thanks [**@nicolo-ribaudo**](https://github.com/nicolo-ribaudo). - Correct iterators prototypes chain, related [#261](https://github.com/zloirock/core-js/issues/261). - Correct Typed Arrays prototypes chain, related [#378](https://github.com/zloirock/core-js/issues/378). - Make the internal state of polyfilled features completely unobservable, [#146](https://github.com/zloirock/core-js/issues/146). - Add validation of receiver's internal class to missed non-generic methods. - Fix descriptors of global properties. - In the version without global pollution, if `Object#toString` does not support `@@toStringTag`, add to wrapped prototypes own `toString` method with `@@toStringTag` logic, see [#199](https://github.com/zloirock/core-js/issues/199). - Update standard features and proposals: - `asap` (old stage 0 proposal) replaced by `queueMicrotask` ([a part of HTML spec](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask)) - Update [`Observable`](https://github.com/tc39/proposal-observable) (#257, #276, etc.) - Update `Array#flatten` -> `Array#flat` and `Array#flatMap` - Update `global` [stage 3 proposal](https://github.com/tc39/proposal-global) - rename `global` to `globalThis` - Update `String#matchAll` ([proposal-string-matchall#17](https://github.com/tc39/proposal-string-matchall/pull/17), [proposal-string-matchall#38](https://github.com/tc39/proposal-string-matchall/pull/38), [proposal-string-matchall#41](https://github.com/tc39/proposal-string-matchall/pull/41), etc.) and move to the stage 3 - Update `.name` properties of `String#{trimStart, trimEnd , trimLeft, trimRight}`, move to the stage 3 - Remove mongolian vowel separator (U+180E) from the list of whitespaces for methods like `String#trim` (ES6 -> ES7) - Mark ES2016, ES2017, ES2018, ES2019 features as stable: - `Array#{ flat, flatMap }` - `{ Array, %TypedArray% }#includes` - `Object.{ values, entries}` - `Object.getOwnPropertyDescriptors` - `String#{ padStart, padEnd }` - `String#{ trimStart, trimEnd, trimLeft, trimRight }` - `Promise#finally` - `Symbol.asyncIterator` - `Object#__(define|lookup)[GS]etter__` - Remove obsolete features: - `Error.isError` (withdrawn) - `System.global` and `global` (replaced by `globalThis`) - `Map#toJSON` and `Set#toJSON` (rejected) - `RegExp.escape` (rejected) - `Reflect.enumerate` (removed from the spec) - Unnecessary iteration methods from `CSSRuleList`, `MediaList`, `StyleSheetList` - **No more non-standard features**, finally removed: - `Dict` - `Object.{classof, isObject, define, make}` - `Function#part` - `Number#@@iterator` - `String#{escapeHTML, unescapeHTML}` - `delay` - Add `.sham` flag to features which can't be properly polyfilled and / or not recommended for usage: - `Symbol` constructor - we can't add new primitives. `Object.prototype` accessors too expensive. - `Object.{create, defineProperty, defineProperties, getOwnPropertyDescriptor, getOwnPropertyDescriptos}`, `Reflect.{defineProperty, getOwnPropertyDescriptor}` can't be properly polyfilled without descriptors support. - `Object.{freeze, seal, preventExtensions}`, `Reflect.preventExtensions` can't be properly polyfilled in ES3 environment. - `Object.getPrototypeOf` can be deceived in ES3 environment. - `Reflect.construct` can't be polyfilled for a correct work with `newTarget` argument on built-ins. - Typed Array constructors polyfill is quite correct but too expensive. - `URL` constructor in engines without descriptors support. - Bug and compatibility fixes: - Fix deoptimisation of iterators in V8, [#377](https://github.com/zloirock/core-js/issues/377). - Fix import of property before constructor which should contain this property, [#262](https://github.com/zloirock/core-js/issues/262). - Fix some cases of IE11 `WeakMap` frozen keys fallback, [#384](https://github.com/zloirock/core-js/issues/384). - Fix non-enumerable integer keys issue because of Nashorn ~ JDK8 bug, [#389](https://github.com/zloirock/core-js/issues/389). - Fix [Safari 12.0 `Array#reverse` bug](https://bugs.webkit.org/show_bug.cgi?id=188794). - One more fix for microtasks in iOS related [#339](https://github.com/zloirock/core-js/issues/339). - Added a fallback for [Rhino bug](https://github.com/mozilla/rhino/issues/346), [#440](https://github.com/zloirock/core-js/issues/440). - Many other internal fixes and improvements. - Repository: - Change `core-js` repository structure to monorepo with packages in `/packages/` directory. - Clean-up it, remove all possible duplicates, generated files, etc. - Packages: - **Extract a version without global namespace pollution to a separate `core-js-pure` package (replacement for `core-js/library`).** - **Leave only one pair of bundles (global, with all polyfills) and move it to `core-js-bundle` package.** - Remove bundling logic from `core-js` package, leave it only in `core-js-builder` package. - Clean-up packages. - Because of all approaches, **reduce size of packages from ~2mb for `core-js@2` to**: - **~500kb for `core-js` package** - **~440kb for `core-js-pure` package** - Finally remove `bower.json` - CommonJS API, namespaces: - Add availability [configuration of aggressiveness](https://github.com/zloirock/core-js/blob/master/README.md#configurable-level-of-aggressiveness). - Move `core-js/library` to separate `core-js-pure` package. - Because of removing all non-standard features, we no longer need `core-js/shim` entry point, replace it just with `core-js`. - Move all features from ES5, ES2015, ES2016, ES2017, ES2018 and ES2019 to one namespace for stable ES - it's available as `core-js/es`, all those features in `modules` folder has `es.` prefix. - Change prefix for ES proposals from `es7.` to `esnext.`, they no longer available in `core-js/es7`, use `core-js/stage/*` instead of that. - Rename `core-js(/library)/fn` to `core-js(-pure)/features` for improve readability. - Allow more granular inclusion of features from `/es/` path (for example, `core-js/es/array/from`). - Add `/stable/` entry points as an equal of `/features/` for stable features, without proposals. - Add `/proposals/` entry points for allow include all features from one proposal (for example, `core-js/proposals/reflect-metadata`). - Add `/es|stable|features/instance/` entry points for getting polyfill of the related method for passed instance (could be used in cases like `babel-runtime`). - Split typed arrays polyfills. Now you can, for example, load only required method (for example, `core-js/es/typed-array/from`). - Extract well-known symbols definition from `es.symbol` module for loading only required features, for example, in MS Edge. - Rename `web.dom` namespace to `web.dom-collections`. - Rename `es6.regexp.{match, replace, search, split}` -> `es.string.{match, replace, search, split}` - mainly it's fixes / adding support of well-known symbols to string methods, only in second place adding related methods to regexp prototype. - Relax `/modules/` directory by moving internal modules to `/internals/` directory. - Remove deprecated array entry points: `core-js(/library)/fn/array/{pop, push, reverse, shift, unshift}`. - `core` object no longer available in the global version, entry points which previously returned it now returns `globalThis` object. Also, don't set global `core` property. - Add some missing entry points. - Tools, tests, code quality: - Added `core-js-compat` package with: - Data about the necessity of `core-js` modules and API for getting a list of required `core-js` modules by `browserslist` query, [#466](https://github.com/zloirock/core-js/issues/466). - Data which modules load by each entry point (mainly useful for tools like `@babel/preset-env`). - Data which modules added in minor versions (mainly useful for tools like `@babel/preset-env`). - `core-js-builder` package: - Added `targets` option with `browserslist` query. - Removed an option for generation bundle of a version without global namespace pollution - now it's an odd use case. - Removed UMD wrapper from a generated code of bundles - we don't need it for a global polyfill. - **Getting rid of LiveScript**, usage another language in JS standard library looks strange and impedes usage of tools like ESLint: - Tests are rewritten to JS. - Scripts are rewritten to JS. - Babel with minimalistic config (which should work anywhere) used on tests. - ESLint used on tests and tools. - Source code refactored for improving readability. ##### 2.6.5 - 2019.02.15 - Fixed buggy `String#padStart` and `String#padEnd` mobile Safari implementations, [#414](https://github.com/zloirock/core-js/issues/414). ##### 2.6.4 - 2019.02.07 - Added a workaround against crushing an old IE11.0.9600.16384 build, [#485](https://github.com/zloirock/core-js/issues/485). ##### 2.6.3 - 2019.01.22 - Added a workaround for `babel-minify` bug, [#479](https://github.com/zloirock/core-js/issues/479) ##### 2.6.2 - 2019.01.10 - Fixed handling of `$` in `String#replace`, [#471](https://github.com/zloirock/core-js/issues/471) ##### 2.6.1 - 2018.12.18 - Fixed an issue with minified version, [#463](https://github.com/zloirock/core-js/issues/463), [#465](https://github.com/zloirock/core-js/issues/465) ##### 2.6.0 - 2018.12.05 - Add direct `.exec` calling to `RegExp#{@@replace, @@split, @@match, @@search}`. Also, added fixes for `RegExp#exec` method. [#428](https://github.com/zloirock/core-js/issues/428), [#435](https://github.com/zloirock/core-js/issues/435), [#458](https://github.com/zloirock/core-js/issues/458), thanks [**@nicolo-ribaudo**](https://github.com/nicolo-ribaudo). ##### 2.5.7 - 2018.05.26 - Get rid of reserved variable name `final`, related [#400](https://github.com/zloirock/core-js/issues/400) ##### 2.5.6 - 2018.05.07 - Forced replace native `Promise` in V8 6.6 (Node 10 and Chrome 66) because of [a bug with resolving custom thenables](https://bugs.chromium.org/p/chromium/issues/detail?id=830565) - Added a workaround for usage buggy native LG WebOS 2 `Promise` in microtask implementation, [#396](https://github.com/zloirock/core-js/issues/396) - Added modern version internal debugging information about used versions ##### 2.5.5 - 2018.04.08 - Fix some edge cases of `Reflect.set`, [#392](https://github.com/zloirock/core-js/issues/392) and [#393](https://github.com/zloirock/core-js/issues/393) ##### 2.5.4 - 2018.03.27 - Fixed one case of deoptimization built-in iterators in V8, related [#377](https://github.com/zloirock/core-js/issues/377) - Fixed some cases of iterators feature detection, [#368](https://github.com/zloirock/core-js/issues/368) - Fixed manually entered NodeJS domains issue in `Promise`, [#367](https://github.com/zloirock/core-js/issues/367) - Fixed `Number.{parseInt, parseFloat}` entry points - Fixed `__(define|lookup)[GS]etter__` export in the `library` version ##### 2.5.3 - 2017.12.12 - Fixed calling `onunhandledrejectionhandler` multiple times for one `Promise` chain, [#318](https://github.com/zloirock/core-js/issues/318) - Forced replacement of `String#{padStart, padEnd}` in Safari 10 because of [a bug](https://bugs.webkit.org/show_bug.cgi?id=161944), [#280](https://github.com/zloirock/core-js/issues/280) - Fixed `Array#@@iterator` in a very rare version of `WebKit`, [#236](https://github.com/zloirock/core-js/issues/236) and [#237](https://github.com/zloirock/core-js/issues/237) - One more [#345](https://github.com/zloirock/core-js/issues/345)-related fix ##### 2.5.2 - 2017.12.09 - `MutationObserver` no longer used for microtask implementation in iOS Safari because of bug with scrolling, [#339](https://github.com/zloirock/core-js/issues/339) - Fixed `JSON.stringify(undefined, replacer)` case in the wrapper from the `Symbol` polyfill, [#345](https://github.com/zloirock/core-js/issues/345) - `Array()` calls changed to `new Array()` for V8 optimisation ##### 2.5.1 - 2017.09.01 - Updated `Promise#finally` per [tc39/proposal-promise-finally#37](https://github.com/tc39/proposal-promise-finally/issues/37) - Optimized usage of some internal helpers for reducing size of `shim` version - Fixed some entry points for virtual methods ##### 2.5.0 - 2017.08.05 - Added `Promise#finally` [stage 3 proposal](https://github.com/tc39/proposal-promise-finally), [#225](https://github.com/zloirock/core-js/issues/225) - Added `Promise.try` [stage 1 proposal](https://github.com/tc39/proposal-promise-try) - Added `Array#flatten` and `Array#flatMap` [stage 1 proposal](https://tc39.github.io/proposal-flatMap) - Added `.of` and `.from` methods on collection constructors [stage 1 proposal](https://github.com/tc39/proposal-setmap-offrom): - `Map.of` - `Set.of` - `WeakSet.of` - `WeakMap.of` - `Map.from` - `Set.from` - `WeakSet.from` - `WeakMap.from` - Added `Math` extensions [stage 1 proposal](https://github.com/rwaldron/proposal-math-extensions), [#226](https://github.com/zloirock/core-js/issues/226): - `Math.clamp` - `Math.DEG_PER_RAD` - `Math.degrees` - `Math.fscale` - `Math.RAD_PER_DEG` - `Math.radians` - `Math.scale` - Added `Math.signbit` [stage 1 proposal](http://jfbastien.github.io/papers/Math.signbit.html) - Updated `global` [stage 3 proposal](https://github.com/tc39/proposal-global) - added `global` global object, `System.global` deprecated - Updated `Object.getOwnPropertyDescriptors` to the [final version](https://tc39.github.io/ecma262/2017/#sec-object.getownpropertydescriptors) - it should not create properties if descriptors are `undefined` - Updated the list of iterable DOM collections, [#249](https://github.com/zloirock/core-js/issues/249), added: - `CSSStyleDeclaration#@@iterator` - `CSSValueList#@@iterator` - `ClientRectList#@@iterator` - `DOMRectList#@@iterator` - `DOMStringList#@@iterator` - `DataTransferItemList#@@iterator` - `FileList#@@iterator` - `HTMLAllCollection#@@iterator` - `HTMLCollection#@@iterator` - `HTMLFormElement#@@iterator` - `HTMLSelectElement#@@iterator` - `MimeTypeArray#@@iterator` - `NamedNodeMap#@@iterator` - `PaintRequestList#@@iterator` - `Plugin#@@iterator` - `PluginArray#@@iterator` - `SVGLengthList#@@iterator` - `SVGNumberList#@@iterator` - `SVGPathSegList#@@iterator` - `SVGPointList#@@iterator` - `SVGStringList#@@iterator` - `SVGTransformList#@@iterator` - `SourceBufferList#@@iterator` - `TextTrackCueList#@@iterator` - `TextTrackList#@@iterator` - `TouchList#@@iterator` - Updated stages of proposals: - [`Object.getOwnPropertyDescriptors`](https://github.com/tc39/proposal-object-getownpropertydescriptors) to [stage 4 (ES2017)](https://tc39.github.io/ecma262/2017/#sec-object.getownpropertydescriptors) - [String padding](https://github.com/tc39/proposal-string-pad-start-end) to [stage 4 (ES2017)](https://tc39.github.io/ecma262/2017/#sec-string.prototype.padend) - [`global`](https://github.com/tc39/proposal-global) to [stage 3](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-09/sept-28.md#revisit-systemglobal--global) - [String trimming](https://github.com/tc39/proposal-string-left-right-trim) to [stage 2](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-07/jul-27.md#10iic-trimstarttrimend) - Updated typed arrays to the modern (ES2016+) arguments validation, [#293](https://github.com/zloirock/core-js/pull/293) - Fixed `%TypedArray%.from` Safari bug, [#285](https://github.com/zloirock/core-js/issues/285) - Fixed compatibility with old version of Prototype.js, [#278](https://github.com/zloirock/core-js/issues/278), [#289](https://github.com/zloirock/core-js/issues/289) - `Function#name` no longer cache the result for correct behaviour with inherited constructors, [#296](https://github.com/zloirock/core-js/issues/296) - Added errors on incorrect context of collection methods, [#272](https://github.com/zloirock/core-js/issues/272) - Fixed conversion typed array constructors to string, fix [#300](https://github.com/zloirock/core-js/issues/300) - Fixed `Set#size` with debugger ReactNative for Android, [#297](https://github.com/zloirock/core-js/issues/297) - Fixed an issue with Electron-based debugger, [#230](https://github.com/zloirock/core-js/issues/230) - Fixed compatibility with incomplete third-party `WeakMap` polyfills, [#252](https://github.com/zloirock/core-js/pull/252) - Added a fallback for `Date#toJSON` in engines without native `Date#toISOString`, [#220](https://github.com/zloirock/core-js/issues/220) - Added support for Sphere Dispatch API, [#286](https://github.com/zloirock/core-js/pull/286) - Seriously changed the coding style and the [ESLint config](https://github.com/zloirock/core-js/blob/master/.eslintrc.js) - Updated many dev dependencies (`webpack`, `uglify`, etc) - Some other minor fixes and optimizations ##### 2.4.1 - 2016.07.18 - Fixed `script` tag for some parsers, [#204](https://github.com/zloirock/core-js/issues/204), [#216](https://github.com/zloirock/core-js/issues/216) - Removed some unused variables, [#217](https://github.com/zloirock/core-js/issues/217), [#218](https://github.com/zloirock/core-js/issues/218) - Fixed MS Edge `Reflect.construct` and `Reflect.apply` - they should not allow primitive as `argumentsList` argument ##### 1.2.7 [LEGACY] - 2016.07.18 - Some fixes for issues like [#159](https://github.com/zloirock/core-js/issues/159), [#186](https://github.com/zloirock/core-js/issues/186), [#194](https://github.com/zloirock/core-js/issues/194), [#207](https://github.com/zloirock/core-js/issues/207) ##### 2.4.0 - 2016.05.08 - Added `Observable`, [stage 1 proposal](https://github.com/zenparsing/es-observable) - Fixed behavior `Object.{getOwnPropertySymbols, getOwnPropertyDescriptor}` and `Object#propertyIsEnumerable` on `Object.prototype` - `Reflect.construct` and `Reflect.apply` should throw an error if `argumentsList` argument is not an object, [#194](https://github.com/zloirock/core-js/issues/194) ##### 2.3.0 - 2016.04.24 - Added `asap` for enqueuing microtasks, [stage 0 proposal](https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask) - Added well-known symbol `Symbol.asyncIterator` for [stage 2 async iteration proposal](https://github.com/tc39/proposal-async-iteration) - Added well-known symbol `Symbol.observable` for [stage 1 observables proposal](https://github.com/zenparsing/es-observable) - `String#{padStart, padEnd}` returns original string if filler is empty string, [TC39 meeting notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-03/march-29.md#stringprototypepadstartpadend) - `Object.values` and `Object.entries` moved to stage 4 from 3, [TC39 meeting notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-03/march-29.md#objectvalues--objectentries) - `System.global` moved to stage 2 from 1, [TC39 meeting notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-03/march-29.md#systemglobal) - `Map#toJSON` and `Set#toJSON` rejected and will be removed from the next major release, [TC39 meeting notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-03/march-31.md#mapprototypetojsonsetprototypetojson) - `Error.isError` withdrawn and will be removed from the next major release, [TC39 meeting notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-03/march-29.md#erroriserror) - Added fallback for `Function#name` on non-extensible functions and functions with broken `toString` conversion, [#193](https://github.com/zloirock/core-js/issues/193) ##### 2.2.2 - 2016.04.06 - Added conversion `-0` to `+0` to `Array#{indexOf, lastIndexOf}`, [ES2016 fix](https://github.com/tc39/ecma262/pull/316) - Added fixes for some `Math` methods in Tor Browser - `Array.{from, of}` no longer calls prototype setters - Added workaround over Chrome DevTools strange behavior, [#186](https://github.com/zloirock/core-js/issues/186) ##### 2.2.1 - 2016.03.19 - Fixed `Object.getOwnPropertyNames(window)` `2.1+` versions bug, [#181](https://github.com/zloirock/core-js/issues/181) ##### 2.2.0 - 2016.03.15 - Added `String#matchAll`, [proposal](https://github.com/tc39/String.prototype.matchAll) - Added `Object#__(define|lookup)[GS]etter__`, [annex B ES2017](https://github.com/tc39/ecma262/pull/381) - Added `@@toPrimitive` methods to `Date` and `Symbol` - Fixed `%TypedArray%#slice` in Edge ~ 13 (throws with `@@species` and wrapped / inherited constructor) - Some other minor fixes ##### 2.1.5 - 2016.03.12 - Improved support NodeJS domains in `Promise#then`, [#180](https://github.com/zloirock/core-js/issues/180) - Added fallback for `Date#toJSON` bug in Qt Script, [#173](https://github.com/zloirock/core-js/issues/173#issuecomment-193972502) ##### 2.1.4 - 2016.03.08 - Added fallback for `Symbol` polyfill in Qt Script, [#173](https://github.com/zloirock/core-js/issues/173) - Added one more fallback for IE11 `Script Access Denied` error with iframes, [#165](https://github.com/zloirock/core-js/issues/165) ##### 2.1.3 - 2016.02.29 - Added fallback for [`es6-promise` package bug](https://github.com/stefanpenner/es6-promise/issues/169), [#176](https://github.com/zloirock/core-js/issues/176) ##### 2.1.2 - 2016.02.29 - Some minor `Promise` fixes: - Browsers `rejectionhandled` event better HTML spec complaint - Errors in unhandled rejection handlers should not cause any problems - Fixed typo in feature detection ##### 2.1.1 - 2016.02.22 - Some `Promise` improvements: - Feature detection: - **Added detection unhandled rejection tracking support - now it's available everywhere**, [#140](https://github.com/zloirock/core-js/issues/140) - Added detection `@@species` pattern support for completely correct subclassing - Removed usage `Object.setPrototypeOf` from feature detection and noisy console message about it in FF - `Promise.all` fixed for some very specific cases ##### 2.1.0 - 2016.02.09 - **API**: - ES5 polyfills are split and logic, used in other polyfills, moved to internal modules - **All entry point works in ES3 environment like IE8- without `core-js/(library/)es5`** - **Added all missed single entry points for ES5 polyfills** - Separated ES5 polyfills moved to the ES6 namespace. Why? - Mainly, for prevent duplication features in different namespaces - logic of most required ES5 polyfills changed in ES6+: - Already added changes for: `Object` statics - should accept primitives, new whitespaces lists in `String#trim`, `parse(Int|float)`, `RegExp#toString` logic, `String#split`, etc - Should be changed in the future: `@@species` and `ToLength` logic in `Array` methods, `Date` parsing, `Function#bind`, etc - Should not be changed only several features like `Array.isArray` and `Date.now` - Some ES5 polyfills required for modern engines - All old entry points should work fine, but in the next major release API can be changed - `Object.getOwnPropertyDescriptors` moved to the stage 3, [January TC39 meeting](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-01/2016-01-28.md#objectgetownpropertydescriptors-to-stage-3-jordan-harband-low-priority-but-super-quick) - Added `umd` option for [custom build process](https://github.com/zloirock/core-js#custom-build-from-external-scripts), [#169](https://github.com/zloirock/core-js/issues/169) - Returned entry points for `Array` statics, removed in `2.0`, for compatibility with `babel` `6` and for future fixes - **Deprecated**: - `Reflect.enumerate` deprecated and will be removed from the next major release, [January TC39 meeting](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-01/2016-01-28.md#5xix-revisit-proxy-enumerate---revisit-decision-to-exhaust-iterator) - **New Features**: - Added [`Reflect` metadata API](https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md) as a pre-strawman feature, [#152](https://github.com/zloirock/core-js/issues/152): - `Reflect.defineMetadata` - `Reflect.deleteMetadata` - `Reflect.getMetadata` - `Reflect.getMetadataKeys` - `Reflect.getOwnMetadata` - `Reflect.getOwnMetadataKeys` - `Reflect.hasMetadata` - `Reflect.hasOwnMetadata` - `Reflect.metadata` - Implementation / fixes `Date#toJSON` - Fixes for `parseInt` and `Number.parseInt` - Fixes for `parseFloat` and `Number.parseFloat` - Fixes for `RegExp#toString` - Fixes for `Array#sort` - Fixes for `Number#toFixed` - Fixes for `Number#toPrecision` - Additional fixes for `String#split` (`RegExp#@@split`) - **Improvements**: - Correct subclassing wrapped collections, `Number` and `RegExp` constructors with native class syntax - Correct support `SharedArrayBuffer` and buffers from other realms in typed arrays wrappers - Additional validations for `Object.{defineProperty, getOwnPropertyDescriptor}` and `Reflect.defineProperty` - **Bug Fixes**: - Fixed some cases `Array#lastIndexOf` with negative second argument ##### 2.0.3 - 2016.01.11 - Added fallback for V8 ~ Chrome 49 `Promise` subclassing bug causes unhandled rejection on feature detection, [#159](https://github.com/zloirock/core-js/issues/159) - Added fix for very specific environments with global `window === null` ##### 2.0.2 - 2016.01.04 - Temporarily removed `length` validation from `Uint8Array` constructor wrapper. Reason - [bug in `ws` module](https://github.com/websockets/ws/pull/645) (-> `socket.io`) which passes to `Buffer` constructor -> `Uint8Array` float and uses [the `V8` bug](https://code.google.com/p/v8/issues/detail?id=4552) for conversion to int (by the spec should be thrown an error). [It creates problems for many people.](https://github.com/karma-runner/karma/issues/1768) I hope, it will be returned after fixing this bug in `V8`. ##### 2.0.1 - 2015.12.31 - Forced usage `Promise.resolve` polyfill in the `library` version for correct work with wrapper - `Object.assign` should be defined in the strict mode -> throw an error on extension non-extensible objects, [#154](https://github.com/zloirock/core-js/issues/154) ##### 2.0.0 - 2015.12.24 - Added implementations and fixes [Typed Arrays](https://github.com/zloirock/core-js#ecmascript-6-typed-arrays)-related features - `ArrayBuffer`, `ArrayBuffer.isView`, `ArrayBuffer#slice` - `DataView` with all getter / setter methods - `Int8Array`, `Uint8Array`, `Uint8ClampedArray`, `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array` and `Float64Array` constructors - `%TypedArray%.{for, of}`, `%TypedArray%#{copyWithin, every, fill, filter, find, findIndex, forEach, indexOf, includes, join, lastIndexOf, map, reduce, reduceRight, reverse, set, slice, some, sort, subarray, values, keys, entries, @@iterator, ...}` - Added [`System.global`](https://github.com/zloirock/core-js#ecmascript-7-proposals), [proposal](https://github.com/tc39/proposal-global), [November TC39 meeting](https://github.com/rwaldron/tc39-notes/tree/master/es7/2015-11/nov-19.md#systemglobal-jhd) - Added [`Error.isError`](https://github.com/zloirock/core-js#ecmascript-7-proposals), [proposal](https://github.com/ljharb/proposal-is-error), [November TC39 meeting](https://github.com/rwaldron/tc39-notes/tree/master/es7/2015-11/nov-19.md#jhd-erroriserror) - Added [`Math.{iaddh, isubh, imulh, umulh}`](https://github.com/zloirock/core-js#ecmascript-7-proposals), [proposal](https://gist.github.com/BrendanEich/4294d5c212a6d2254703) - `RegExp.escape` moved from the `es7` to the non-standard `core` namespace, [July TC39 meeting](https://github.com/rwaldron/tc39-notes/blob/master/es7/2015-07/july-28.md#62-regexpescape) - too slow, but it's condition of stability, [#116](https://github.com/zloirock/core-js/issues/116) - [`Promise`](https://github.com/zloirock/core-js#ecmascript-6-promise) - Some performance optimisations - Added basic support [`rejectionHandled` event / `onrejectionhandled` handler](https://github.com/zloirock/core-js#unhandled-rejection-tracking) to the polyfill - Removed usage `@@species` from `Promise.{all, race}`, [November TC39 meeting](https://github.com/rwaldron/tc39-notes/tree/master/es7/2015-11/nov-18.md#conclusionresolution-2) - Some improvements [collections polyfills](https://github.com/zloirock/core-js#ecmascript-6-collections) - `O(1)` and preventing possible leaks with frozen keys, [#134](https://github.com/zloirock/core-js/issues/134) - Correct observable state object keys - Renamed `String#{padLeft, padRight}` -> [`String#{padStart, padEnd}`](https://github.com/zloirock/core-js#ecmascript-7-proposals), [proposal](https://github.com/tc39/proposal-string-pad-start-end), [November TC39 meeting](https://github.com/rwaldron/tc39-notes/tree/master/es7/2015-11/nov-17.md#conclusionresolution-2) (they want to rename it on each meeting?O_o), [#132](https://github.com/zloirock/core-js/issues/132) - Added [`String#{trimStart, trimEnd}` as aliases for `String#{trimLeft, trimRight}`](https://github.com/zloirock/core-js#ecmascript-7-proposals), [proposal](https://github.com/sebmarkbage/ecmascript-string-left-right-trim), [November TC39 meeting](https://github.com/rwaldron/tc39-notes/tree/master/es7/2015-11/nov-17.md#conclusionresolution-2) - Added [annex B HTML methods](https://github.com/zloirock/core-js#ecmascript-6-string) - ugly, but also [the part of the spec](http://www.ecma-international.org/ecma-262/6.0/#sec-string.prototype.anchor) - Added little fix for [`Date#toString`](https://github.com/zloirock/core-js#ecmascript-6-date) - `new Date(NaN).toString()` [should be `'Invalid Date'`](http://www.ecma-international.org/ecma-262/6.0/#sec-todatestring) - Added [`{keys, values, entries, @@iterator}` methods to DOM collections](https://github.com/zloirock/core-js#iterable-dom-collections) which should have [iterable interface](https://heycam.github.io/webidl/#idl-iterable) or should be [inherited from `Array`](https://heycam.github.io/webidl/#LegacyArrayClass) - `NodeList`, `DOMTokenList`, `MediaList`, `StyleSheetList`, `CSSRuleList`. - Removed Mozilla `Array` generics - [deprecated and will be removed from FF](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#Array_generic_methods), [looks like strawman is dead](http://wiki.ecmascript.org/doku.php?id=strawman:array_statics), available [alternative shim](https://github.com/plusdude/array-generics) - Removed `core.log` module - CommonJS API - Added entry points for [virtual methods](https://github.com/zloirock/core-js#commonjs-and-prototype-methods-without-global-namespace-pollution) - Added entry points for [stages proposals](https://github.com/zloirock/core-js#ecmascript-7-proposals) - Some other minor changes - [Custom build from external scripts](https://github.com/zloirock/core-js#custom-build-from-external-scripts) moved to the separate package for preventing problems with dependencies - Changed `$` prefix for internal modules file names because Team Foundation Server does not support it, [#129](https://github.com/zloirock/core-js/issues/129) - Additional fix for `SameValueZero` in V8 ~ Chromium 39-42 collections - Additional fix for FF27 `Array` iterator - Removed usage shortcuts for `arguments` object - old WebKit bug, [#150](https://github.com/zloirock/core-js/issues/150) - `{Map, Set}#forEach` non-generic, [#144](https://github.com/zloirock/core-js/issues/144) - Many other improvements ##### 1.2.6 - 2015.11.09 * Reject with `TypeError` on attempt resolve promise itself * Correct behavior with broken `Promise` subclass constructors / methods * Added `Promise`-based fallback for microtask * Fixed V8 and FF `Array#{values, @@iterator}.name` * Fixed IE7- `[1, 2].join(undefined) -> '1,2'` * Some other fixes / improvements / optimizations ##### 1.2.5 - 2015.11.02 * Some more `Number` constructor fixes: * Fixed V8 ~ Node 0.8 bug: `Number('+0x1')` should be `NaN` * Fixed `Number(' 0b1\n')` case, should be `1` * Fixed `Number()` case, should be `0` ##### 1.2.4 - 2015.11.01 * Fixed `Number('0b12') -> NaN` case in the shim * Fixed V8 ~ Chromium 40- bug - `Weak(Map|Set)#{delete, get, has}` should not throw errors [#124](https://github.com/zloirock/core-js/issues/124) * Some other fixes and optimizations ##### 1.2.3 - 2015.10.23 * Fixed some problems related old V8 bug `Object('a').propertyIsEnumerable(0) // => false`, for example, `Object.assign({}, 'qwe')` from the last release * Fixed `.name` property and `Function#toString` conversion some polyfilled methods * Fixed `Math.imul` arity in Safari 8- ##### 1.2.2 - 2015.10.18 * Improved optimisations for V8 * Fixed build process from external packages, [#120](https://github.com/zloirock/core-js/pull/120) * One more `Object.{assign, values, entries}` fix for [**very** specific case](https://github.com/ljharb/proposal-object-values-entries/issues/5) ##### 1.2.1 - 2015.10.02 * Replaced fix `JSON.stringify` + `Symbol` behavior from `.toJSON` method to wrapping `JSON.stringify` - little more correct, [compat-table/642](https://github.com/kangax/compat-table/pull/642) * Fixed typo which broke tasks scheduler in WebWorkers in old FF, [#114](https://github.com/zloirock/core-js/pull/114) ##### 1.2.0 - 2015.09.27 * Added browser [`Promise` rejection hook](#unhandled-rejection-tracking), [#106](https://github.com/zloirock/core-js/issues/106) * Added correct [`IsRegExp`](http://www.ecma-international.org/ecma-262/6.0/#sec-isregexp) logic to [`String#{includes, startsWith, endsWith}`](https://github.com/zloirock/core-js/#ecmascript-6-string) and [`RegExp` constructor](https://github.com/zloirock/core-js/#ecmascript-6-regexp), `@@match` case, [example](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/match#Disabling_the_isRegExp_check) * Updated [`String#leftPad`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) [with proposal](https://github.com/ljharb/proposal-string-pad-left-right/issues/6): string filler truncated from the right side * Replaced V8 [`Object.assign`](https://github.com/zloirock/core-js/#ecmascript-6-object) - its properties order not only [incorrect](https://github.com/sindresorhus/object-assign/issues/22), it is non-deterministic and it causes some problems * Fixed behavior with deleted in getters properties for `Object.{`[`assign`](https://github.com/zloirock/core-js/#ecmascript-6-object)`, `[`entries, values`](https://github.com/zloirock/core-js/#ecmascript-7-proposals)`}`, [example](http://goo.gl/iQE01c) * Fixed [`Math.sinh`](https://github.com/zloirock/core-js/#ecmascript-6-math) with very small numbers in V8 near Chromium 38 * Some other fixes and optimizations ##### 1.1.4 - 2015.09.05 * Fixed support symbols in FF34-35 [`Object.assign`](https://github.com/zloirock/core-js/#ecmascript-6-object) * Fixed [collections iterators](https://github.com/zloirock/core-js/#ecmascript-6-iterators) in FF25-26 * Fixed non-generic WebKit [`Array.of`](https://github.com/zloirock/core-js/#ecmascript-6-array) * Some other fixes and optimizations ##### 1.1.3 - 2015.08.29 * Fixed support Node.js domains in [`Promise`](https://github.com/zloirock/core-js/#ecmascript-6-promise), [#103](https://github.com/zloirock/core-js/issues/103) ##### 1.1.2 - 2015.08.28 * Added `toJSON` method to [`Symbol`](https://github.com/zloirock/core-js/#ecmascript-6-symbol) polyfill and to MS Edge implementation for expected `JSON.stringify` result w/o patching this method * Replaced [`Reflect.construct`](https://github.com/zloirock/core-js/#ecmascript-6-reflect) implementations w/o correct support third argument * Fixed `global` detection with changed `document.domain` in ~IE8, [#100](https://github.com/zloirock/core-js/issues/100) ##### 1.1.1 - 2015.08.20 * Added more correct microtask implementation for [`Promise`](#ecmascript-6-promise) ##### 1.1.0 - 2015.08.17 * Updated [string padding](https://github.com/zloirock/core-js/#ecmascript-7-proposals) to [actual proposal](https://github.com/ljharb/proposal-string-pad-left-right) - renamed, minor internal changes: * `String#lpad` -> `String#padLeft` * `String#rpad` -> `String#padRight` * Added [string trim functions](#ecmascript-7-proposals) - [proposal](https://github.com/sebmarkbage/ecmascript-string-left-right-trim), defacto standard - required only for IE11- and fixed for some old engines: * `String#trimLeft` * `String#trimRight` * [`String#trim`](https://github.com/zloirock/core-js/#ecmascript-6-string) fixed for some engines by es6 spec and moved from `es5` to single `es6` module * Splitted [`es6.object.statics-accept-primitives`](https://github.com/zloirock/core-js/#ecmascript-6-object) * Caps for `freeze`-family `Object` methods moved from `es5` to `es6` namespace and joined with [es6 wrappers](https://github.com/zloirock/core-js/#ecmascript-6-object) * `es5` [namespace](https://github.com/zloirock/core-js/#commonjs) also includes modules, moved to `es6` namespace - you can use it as before * Increased `MessageChannel` priority in `$.task`, [#95](https://github.com/zloirock/core-js/issues/95) * Does not get `global.Symbol` on each getting iterator, if you wanna use alternative `Symbol` shim - add it before `core-js` * [`Reflect.construct`](https://github.com/zloirock/core-js/#ecmascript-6-reflect) optimized and fixed for some cases * Simplified [`Reflect.enumerate`](https://github.com/zloirock/core-js/#ecmascript-6-reflect), see [this question](https://esdiscuss.org/topic/question-about-enumerate-and-property-decision-timing) * Some corrections in [`Math.acosh`](https://github.com/zloirock/core-js/#ecmascript-6-math) * Fixed [`Math.imul`](https://github.com/zloirock/core-js/#ecmascript-6-math) for old WebKit * Some fixes in string / RegExp [well-known symbols](https://github.com/zloirock/core-js/#ecmascript-6-regexp) logic * Some other fixes and optimizations ##### 1.0.1 - 2015.07.31 * Some fixes for final MS Edge, replaced broken native `Reflect.defineProperty` * Some minor fixes and optimizations * Changed compression `client/*.min.js` options for safe `Function#name` and `Function#length`, should be fixed [#92](https://github.com/zloirock/core-js/issues/92) ##### 1.0.0 - 2015.07.22 * Added logic for [well-known symbols](https://github.com/zloirock/core-js/#ecmascript-6-regexp): * `Symbol.match` * `Symbol.replace` * `Symbol.split` * `Symbol.search` * Actualized and optimized work with iterables: * Optimized [`Map`, `Set`, `WeakMap`, `WeakSet` constructors](https://github.com/zloirock/core-js/#ecmascript-6-collections), [`Promise.all`, `Promise.race`](https://github.com/zloirock/core-js/#ecmascript-6-promise) for default `Array Iterator` * Optimized [`Array.from`](https://github.com/zloirock/core-js/#ecmascript-6-array) for default `Array Iterator` * Added [`core.getIteratorMethod`](https://github.com/zloirock/core-js/#ecmascript-6-iterators) helper * Uses enumerable properties in shimmed instances - collections, iterators, etc for optimize performance * Added support native constructors to [`Reflect.construct`](https://github.com/zloirock/core-js/#ecmascript-6-reflect) with 2 arguments * Added support native constructors to [`Function#bind`](https://github.com/zloirock/core-js/#ecmascript-5) shim with `new` * Removed obsolete `.clear` methods native [`Weak`-collections](https://github.com/zloirock/core-js/#ecmascript-6-collections) * Maximum modularity, reduced minimal custom build size, separated into submodules: * [`es6.reflect`](https://github.com/zloirock/core-js/#ecmascript-6-reflect) * [`es6.regexp`](https://github.com/zloirock/core-js/#ecmascript-6-regexp) * [`es6.math`](https://github.com/zloirock/core-js/#ecmascript-6-math) * [`es6.number`](https://github.com/zloirock/core-js/#ecmascript-6-number) * [`es7.object.to-array`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) * [`core.object`](https://github.com/zloirock/core-js/#object) * [`core.string`](https://github.com/zloirock/core-js/#escaping-strings) * [`core.iter-helpers`](https://github.com/zloirock/core-js/#ecmascript-6-iterators) * Internal modules (`$`, `$.iter`, etc) * Many other optimizations * Final cleaning non-standard features * Moved `$for` to [separate library](https://github.com/zloirock/forof). This work for syntax - `for-of` loop and comprehensions * Moved `Date#{format, formatUTC}` to [separate library](https://github.com/zloirock/dtf). Standard way for this - `ECMA-402` * Removed `Math` methods from `Number.prototype`. Slight sugar for simple `Math` methods calling * Removed `{Array#, Array, Dict}.turn` * Removed `core.global` * Uses `ToNumber` instead of `ToLength` in [`Number Iterator`](https://github.com/zloirock/core-js/#number-iterator), `Array.from(2.5)` will be `[0, 1, 2]` instead of `[0, 1]` * Fixed [#85](https://github.com/zloirock/core-js/issues/85) - invalid `Promise` unhandled rejection message in nested `setTimeout` * Fixed [#86](https://github.com/zloirock/core-js/issues/86) - support FF extensions * Fixed [#89](https://github.com/zloirock/core-js/issues/89) - behavior `Number` constructor in strange case ##### 0.9.18 - 2015.06.17 * Removed `/` from [`RegExp.escape`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) escaped characters ##### 0.9.17 - 2015.06.14 * Updated [`RegExp.escape`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) to the [latest proposal](https://github.com/benjamingr/RexExp.escape) * Fixed conflict with webpack dev server + IE buggy behavior ##### 0.9.16 - 2015.06.11 * More correct order resolving thenable in [`Promise`](https://github.com/zloirock/core-js/#ecmascript-6-promise) polyfill * Uses polyfill instead of [buggy V8 `Promise`](https://github.com/zloirock/core-js/issues/78) ##### 0.9.15 - 2015.06.09 * [Collections](https://github.com/zloirock/core-js/#ecmascript-6-collections) from `library` version return wrapped native instances * Fixed collections prototype methods in `library` version * Optimized [`Math.hypot`](https://github.com/zloirock/core-js/#ecmascript-6-math) ##### 0.9.14 - 2015.06.04 * Updated [`Promise.resolve` behavior](https://esdiscuss.org/topic/fixing-promise-resolve) * Added fallback for IE11 buggy `Object.getOwnPropertyNames` + iframe * Some other fixes ##### 0.9.13 - 2015.05.25 * Added fallback for [`Symbol` polyfill](https://github.com/zloirock/core-js/#ecmascript-6-symbol) for old Android * Some other fixes ##### 0.9.12 - 2015.05.24 * Different instances `core-js` should use / recognize the same symbols * Some fixes ##### 0.9.11 - 2015.05.18 * Simplified [custom build](https://github.com/zloirock/core-js/#custom-build) * Added custom build js api * Added `grunt-cli` to `devDependencies` for `npm run grunt` * Some fixes ##### 0.9.10 - 2015.05.16 * Wrapped `Function#toString` for correct work wrapped methods / constructors with methods similar to the [`lodash` `isNative`](https://github.com/lodash/lodash/issues/1197) * Added proto versions of methods to export object in `default` version for consistency with `library` version ##### 0.9.9 - 2015.05.14 * Wrapped `Object#propertyIsEnumerable` for [`Symbol` polyfill](https://github.com/zloirock/core-js/#ecmascript-6-symbol) * [Added proto versions of methods to `library` for ES7 bind syntax](https://github.com/zloirock/core-js/issues/65) * Some other fixes ##### 0.9.8 - 2015.05.12 * Fixed [`Math.hypot`](https://github.com/zloirock/core-js/#ecmascript-6-math) with negative arguments * Added `Object#toString.toString` as fallback for [`lodash` `isNative`](https://github.com/lodash/lodash/issues/1197) ##### 0.9.7 - 2015.05.07 * Added [support DOM collections](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice#Streamlining_cross-browser_behavior) to IE8- `Array#slice` ##### 0.9.6 - 2015.05.01 * Added [`String#lpad`, `String#rpad`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) ##### 0.9.5 - 2015.04.30 * Added cap for `Function#@@hasInstance` * Some fixes and optimizations ##### 0.9.4 - 2015.04.27 * Fixed `RegExp` constructor ##### 0.9.3 - 2015.04.26 * Some fixes and optimizations ##### 0.9.2 - 2015.04.25 * More correct [`Promise`](https://github.com/zloirock/core-js/#ecmascript-6-promise) unhandled rejection tracking and resolving / rejection priority ##### 0.9.1 - 2015.04.25 * Fixed `__proto__`-based [`Promise`](https://github.com/zloirock/core-js/#ecmascript-6-promise) subclassing in some environments ##### 0.9.0 - 2015.04.24 * Added correct [symbols](https://github.com/zloirock/core-js/#ecmascript-6-symbol) descriptors * Fixed behavior `Object.{assign, create, defineProperty, defineProperties, getOwnPropertyDescriptor, getOwnPropertyDescriptors}` with symbols * Added [single entry points](https://github.com/zloirock/core-js/#commonjs) for `Object.{create, defineProperty, defineProperties}` * Added [`Map#toJSON`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) * Removed non-standard methods `Object#[_]` and `Function#only` - they solves syntax problems, but now in compilers available arrows and ~~in near future will be available~~ [available](http://babeljs.io/blog/2015/05/14/function-bind/) [bind syntax](https://github.com/zenparsing/es-function-bind) * Removed non-standard undocumented methods `Symbol.{pure, set}` * Some fixes and internal changes ##### 0.8.4 - 2015.04.18 * Uses `webpack` instead of `browserify` for browser builds - more compression-friendly result ##### 0.8.3 - 2015.04.14 * Fixed `Array` statics with single entry points ##### 0.8.2 - 2015.04.13 * [`Math.fround`](https://github.com/zloirock/core-js/#ecmascript-6-math) now also works in IE9- * Added [`Set#toJSON`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) * Some optimizations and fixes ##### 0.8.1 - 2015.04.03 * Fixed `Symbol.keyFor` ##### 0.8.0 - 2015.04.02 * Changed [CommonJS API](https://github.com/zloirock/core-js/#commonjs) * Splitted and renamed some modules * Added support ES3 environment (ES5 polyfill) to **all** default versions - size increases slightly (+ ~4kb w/o gzip), many issues disappear, if you don't need it - [simply include only required namespaces / features / modules](https://github.com/zloirock/core-js/#commonjs) * Removed [abstract references](https://github.com/zenparsing/es-abstract-refs) support - proposal has been superseded =\ * [`$for.isIterable` -> `core.isIterable`, `$for.getIterator` -> `core.getIterator`](https://github.com/zloirock/core-js/#ecmascript-6-iterators), temporary available in old namespace * Fixed iterators support in v8 `Promise.all` and `Promise.race` * Many other fixes ##### 0.7.2 - 2015.03.09 * Some fixes ##### 0.7.1 - 2015.03.07 * Some fixes ##### 0.7.0 - 2015.03.06 * Rewritten and splitted into [CommonJS modules](https://github.com/zloirock/core-js/#commonjs) ##### 0.6.1 - 2015.02.24 * Fixed support [`Object.defineProperty`](https://github.com/zloirock/core-js/#ecmascript-5) with accessors on DOM elements on IE8 ##### 0.6.0 - 2015.02.23 * Added support safe closing iteration - calling `iterator.return` on abort iteration, if it exists * Added basic support [`Promise`](https://github.com/zloirock/core-js/#ecmascript-6-promise) unhandled rejection tracking in shim * Added [`Object.getOwnPropertyDescriptors`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) * Removed `console` cap - creates too many problems * Restructuring [namespaces](https://github.com/zloirock/core-js/#custom-build) * Some fixes ##### 0.5.4 - 2015.02.15 * Some fixes ##### 0.5.3 - 2015.02.14 * Added [support binary and octal literals](https://github.com/zloirock/core-js/#ecmascript-6-number) to `Number` constructor * Added [`Date#toISOString`](https://github.com/zloirock/core-js/#ecmascript-5) ##### 0.5.2 - 2015.02.10 * Some fixes ##### 0.5.1 - 2015.02.09 * Some fixes ##### 0.5.0 - 2015.02.08 * Systematization of modules * Splitted [`es6` module](https://github.com/zloirock/core-js/#ecmascript-6) * Splitted `console` module: `web.console` - only cap for missing methods, `core.log` - bound methods & additional features * Added [`delay` method](https://github.com/zloirock/core-js/#delay) * Some fixes ##### 0.4.10 - 2015.01.28 * [`Object.getOwnPropertySymbols`](https://github.com/zloirock/core-js/#ecmascript-6-symbol) polyfill returns array of wrapped keys ##### 0.4.9 - 2015.01.27 * FF20-24 fix ##### 0.4.8 - 2015.01.25 * Some [collections](https://github.com/zloirock/core-js/#ecmascript-6-collections) fixes ##### 0.4.7 - 2015.01.25 * Added support frozen objects as [collections](https://github.com/zloirock/core-js/#ecmascript-6-collections) keys ##### 0.4.6 - 2015.01.21 * Added [`Object.getOwnPropertySymbols`](https://github.com/zloirock/core-js/#ecmascript-6-symbol) * Added [`NodeList.prototype[@@iterator]`](https://github.com/zloirock/core-js/#ecmascript-6-iterators) * Added basic `@@species` logic - getter in native constructors * Removed `Function#by` * Some fixes ##### 0.4.5 - 2015.01.16 * Some fixes ##### 0.4.4 - 2015.01.11 * Enabled CSP support ##### 0.4.3 - 2015.01.10 * Added `Function` instances `name` property for IE9+ ##### 0.4.2 - 2015.01.10 * `Object` static methods accept primitives * `RegExp` constructor can alter flags (IE9+) * Added `Array.prototype[Symbol.unscopables]` ##### 0.4.1 - 2015.01.05 * Some fixes ##### 0.4.0 - 2015.01.03 * Added [`es6.reflect`](https://github.com/zloirock/core-js/#ecmascript-6-reflect) module: * Added `Reflect.apply` * Added `Reflect.construct` * Added `Reflect.defineProperty` * Added `Reflect.deleteProperty` * Added `Reflect.enumerate` * Added `Reflect.get` * Added `Reflect.getOwnPropertyDescriptor` * Added `Reflect.getPrototypeOf` * Added `Reflect.has` * Added `Reflect.isExtensible` * Added `Reflect.preventExtensions` * Added `Reflect.set` * Added `Reflect.setPrototypeOf` * `core-js` methods now can use external `Symbol.iterator` polyfill * Some fixes ##### 0.3.3 - 2014.12.28 * [Console cap](https://github.com/zloirock/core-js/#console) excluded from node.js default builds ##### 0.3.2 - 2014.12.25 * Added cap for [ES5](https://github.com/zloirock/core-js/#ecmascript-5) freeze-family methods * Fixed `console` bug ##### 0.3.1 - 2014.12.23 * Some fixes ##### 0.3.0 - 2014.12.23 * Optimize [`Map` & `Set`](https://github.com/zloirock/core-js/#ecmascript-6-collections): * Use entries chain on hash table * Fast & correct iteration * Iterators moved to [`es6`](https://github.com/zloirock/core-js/#ecmascript-6) and [`es6.collections`](https://github.com/zloirock/core-js/#ecmascript-6-collections) modules ##### 0.2.5 - 2014.12.20 * `console` no longer shortcut for `console.log` (compatibility problems) * Some fixes ##### 0.2.4 - 2014.12.17 * Better compliance of ES6 * Added [`Math.fround`](https://github.com/zloirock/core-js/#ecmascript-6-math) (IE10+) * Some fixes ##### 0.2.3 - 2014.12.15 * [Symbols](https://github.com/zloirock/core-js/#ecmascript-6-symbol): * Added option to disable addition setter to `Object.prototype` for Symbol polyfill: * Added `Symbol.useSimple` * Added `Symbol.useSetter` * Added cap for well-known Symbols: * Added `Symbol.hasInstance` * Added `Symbol.isConcatSpreadable` * Added `Symbol.match` * Added `Symbol.replace` * Added `Symbol.search` * Added `Symbol.species` * Added `Symbol.split` * Added `Symbol.toPrimitive` * Added `Symbol.unscopables` ##### 0.2.2 - 2014.12.13 * Added [`RegExp#flags`](https://github.com/zloirock/core-js/#ecmascript-6-regexp) ([December 2014 Draft Rev 29](http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts#december_6_2014_draft_rev_29)) * Added [`String.raw`](https://github.com/zloirock/core-js/#ecmascript-6-string) ##### 0.2.1 - 2014.12.12 * Repair converting -0 to +0 in [native collections](https://github.com/zloirock/core-js/#ecmascript-6-collections) ##### 0.2.0 - 2014.12.06 * Added [`es7.proposals`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) and [`es7.abstract-refs`](https://github.com/zenparsing/es-abstract-refs) modules * Added [`String#at`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) * Added real [`String Iterator`](https://github.com/zloirock/core-js/#ecmascript-6-iterators), older versions used Array Iterator * Added abstract references support: * Added `Symbol.referenceGet` * Added `Symbol.referenceSet` * Added `Symbol.referenceDelete` * Added `Function#@@referenceGet` * Added `Map#@@referenceGet` * Added `Map#@@referenceSet` * Added `Map#@@referenceDelete` * Added `WeakMap#@@referenceGet` * Added `WeakMap#@@referenceSet` * Added `WeakMap#@@referenceDelete` * Added `Dict.{...methods}[@@referenceGet]` * Removed deprecated `.contains` methods * Some fixes ##### 0.1.5 - 2014.12.01 * Added [`Array#copyWithin`](https://github.com/zloirock/core-js/#ecmascript-6-array) * Added [`String#codePointAt`](https://github.com/zloirock/core-js/#ecmascript-6-string) * Added [`String.fromCodePoint`](https://github.com/zloirock/core-js/#ecmascript-6-string) ##### 0.1.4 - 2014.11.27 * Added [`Dict.mapPairs`](https://github.com/zloirock/core-js/#dict) ##### 0.1.3 - 2014.11.20 * [TC39 November meeting](https://github.com/rwaldron/tc39-notes/tree/master/es6/2014-11): * [`.contains` -> `.includes`](https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-11/nov-18.md#51--44-arrayprototypecontains-and-stringprototypecontains) * `String#contains` -> [`String#includes`](https://github.com/zloirock/core-js/#ecmascript-6-string) * `Array#contains` -> [`Array#includes`](https://github.com/zloirock/core-js/#ecmascript-7-proposals) * `Dict.contains` -> [`Dict.includes`](https://github.com/zloirock/core-js/#dict) * [Removed `WeakMap#clear`](https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-11/nov-19.md#412-should-weakmapweakset-have-a-clear-method-markm) * [Removed `WeakSet#clear`](https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-11/nov-19.md#412-should-weakmapweakset-have-a-clear-method-markm) ##### 0.1.2 - 2014.11.19 * `Map` & `Set` bug fix ##### 0.1.1 - 2014.11.18 * Public releasecore-js-3.6.1/CONTRIBUTING.md000066400000000000000000000110231360057567700153310ustar00rootroot00000000000000# Contributing Contributions are always welcome. If you don't know how you can help, you can check [issues](https://github.com/zloirock/core-js/issues) or ask @zloirock. ## How to add a new polyfill - The polyfill implementation should be added to the [`packages/core-js/modules`](./packages/core-js/modules) directory. - Any shared helpers should be added to the [`packages/core-js/internals`](./packages/core-js/internals) directory. - If the implementation for the `pure` version differs from the global version, add it to [`packages/core-js-pure/override`](./packages/core-js-pure/override) directory. The rest parts of `core-js-pure` will be copied from `core-js` package. - For export the polyfill, in almost all cases use `internals/export` helper. - Add feature detection of the polyfill to [`tests/compat/tests.js`](./tests/compat/tests.js) and compatibility data to [`packages/core-js-compat/src/data.js`](./packages/core-js-compat/src/data.js) and [`packages/core-js-compat/src/modules-by-versions.js`](./packages/core-js-compat/src/modules-by-versions.js) (this data also used for getting the default list of polyfills at bundling). - Add it to entry points where it's required: directories [`packages/core-js/features`](./packages/core-js/features), [`packages/core-js/es`](./packages/core-js/es), [`packages/core-js/proposals`](./packages/core-js/proposals), [`packages/core-js/stage`](./packages/core-js/stage) and [`packages/core-js/web`](./packages/core-js/web). - Add unit tests to [`tests/tests`](./tests/tests) and [`tests/pure`](./tests/pure). - Add tests of entry points to [`tests/commonjs.js`](./tests/commonjs). - Add documentation to [README.md](./README.md). ## Style and standards The coding style should follow our [`.eslintrc`](./.eslintrc.js). You can test it by calling [`npm run lint`](#testing). Different places have different syntax and standard library limitations: - Polyfill implementations should use only ES3 syntax and standard library. Polyfills should not use another polyfill from the global namespace. - In unit tests should be used modern syntax with our [minimalistic Babel config](./babel.config.js). Unit tests for the `pure` version should not use any modern standard library features. - In building tools and tests, performed in Node.js, should be used only available in Node.js 4 syntax and standard library. File names should be in the kebab-case. Name of files with polyfills should follow naming convention `namespace.subnamespase-where-required.feature-name`, for example, `esnext.promise.try`. Top-level namespace could be `es` for stable ECMAScript features, `esnext` for ECMAScript proposals and `web` for other web standards. ## Testing Before testing, you should install dependencies: ``` $ npm i ``` You can run all tests by ``` $ npm run test ``` You can run parts of the test case separately: - Linting: ``` $ npm run lint ``` - Global version unit tests: ``` $ npm run unit-tests ``` - `pure` version unit tests: ``` $ npm run unit-tests-pure ``` - [Promises/A+ test case](https://github.com/promises-aplus/promises-tests): ``` $ npm run promises-tests ``` - [ECMAScript `Observable` test case](https://github.com/tc39/proposal-observable): ``` $ npm run observables-tests ``` - CommonJS entry points tests: ``` $ npm run commonjs-tests ``` If you want to run tests in a certain browser at first you should build packages and test bundles: ``` $ npm run build ``` - For running the global version of the unit test case use this file: ``` tests/tests.html ``` - For running the pure version of the unit test case use this file: ``` tests/pure.html ``` - Before running [Promises/A+ test case](https://github.com/promises-aplus/promises-tests) in the browser you should bundle it: ``` $ npm run bundle-promises-tests ``` and after that use this file: ``` tests/promises-aplus.html ``` ## Updating `core-js-compat` data For updating `core-js-compat` data: - Clone `core-js` repo. - If you wanna add new data for a browser, run in this browser `tests/compat/index.html` and you will see which `core-js` modules required for this browser. - If you wanna add new data for Node.js, run `tests/compat/node-runner.js` in required Node.js version and you will see results in the console. - After getting this data, add it to [`packages/core-js-compat/src/data.js`](./packages/core-js-compat/src/data.js). - If you wanna add new mapping (for example, add a new iOS Safari version based on Safari or Node.js based on Chrome), add it to [`packages/core-js-compat/src/mapping.js`](./packages/core-js-compat/src/mapping.js). - Add a pull request to `core-js` repo. core-js-3.6.1/Gruntfile.js000066400000000000000000000111121360057567700153740ustar00rootroot00000000000000/* eslint-disable unicorn/filename-case */ 'use strict'; const webpack = require('./.webpack.config.js'); const { banner } = require('./packages/core-js-builder/config'); process.env.CHROME_BIN = require('puppeteer').executablePath(); module.exports = grunt => { grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-karma'); grunt.loadNpmTasks('grunt-webpack'); grunt.initConfig({ pkg: grunt.file.readJSON('./package.json'), uglify: { build: { files: { './packages/core-js-bundle/minified.js': './packages/core-js-bundle/index.js', }, options: { mangle: { keep_fnames: true, }, compress: { keep_fnames: true, pure_getters: true, }, output: { max_line_len: 32000, }, ie8: true, sourceMap: true, banner, }, }, }, clean: { 'core-js': [ './packages/core-js/LICENSE', ], 'core-js-pure': [ './packages/core-js-pure/*', '!./packages/core-js-pure/override', '!./packages/core-js-pure/.npmignore', '!./packages/core-js-pure/package.json', '!./packages/core-js-pure/README.md', ], 'core-js-builder': [ './packages/core-js-builder/LICENSE', ], 'core-js-bundle': [ './packages/core-js-bundle/scripts', './packages/core-js-bundle/LICENSE', ], 'core-js-compat': [ './packages/core-js-compat/LICENSE', ], tests: [ './tests/bundles/*', ], }, copy: { 'core-js': { files: [ { expand: true, src: ['LICENSE'], dest: './packages/core-js/', }, ], }, 'core-js-pure': { files: [ { expand: true, src: ['LICENSE'], dest: './packages/core-js-pure/', }, { expand: true, cwd: './packages/core-js/', src: [ 'es/**', 'features/**', 'internals/**', 'modules/**', 'proposals/**', 'stable/**', 'stage/**', 'web/**', 'index.js', 'configurator.js', 'postinstall.js', ], dest: './packages/core-js-pure/', }, { expand: true, cwd: './packages/core-js-pure/override/', src: '**', dest: './packages/core-js-pure', }, ], }, 'core-js-builder': { files: [ { expand: true, src: ['LICENSE'], dest: './packages/core-js-builder/', }, ], }, 'core-js-bundle': { files: [ { expand: true, src: ['LICENSE'], dest: './packages/core-js-bundle/', }, { expand: true, cwd: './packages/core-js/', src: ['postinstall.js'], dest: './packages/core-js-bundle/', }, ], }, 'core-js-compat': { files: [ { expand: true, src: ['LICENSE'], dest: './packages/core-js-compat/', }, ], }, }, karma: { options: { frameworks: ['qunit'], basePath: '.', browsers: ['HeadlessChrome', 'PhantomJS'], customLaunchers: { HeadlessChrome: { base: 'ChromeHeadless', flags: ['--no-sandbox', '--disable-setuid-sandbox'], }, }, singleRun: true, }, tests: { files: [ 'tests/bundles/qunit-helpers.js', 'packages/core-js-bundle/index.js', 'tests/bundles/tests.js', ].map(src => ({ src })), }, pure: { files: [ 'tests/bundles/qunit-helpers.js', 'tests/bundles/pure.js', ].map(src => ({ src })), }, }, webpack, }); grunt.registerTask('bundle', function () { // some dependencies of this module generated in grunt tasks, so we should load it here // eslint-disable-next-line global-require const builder = require('./packages/core-js-builder'); const done = this.async(); builder({ filename: './packages/core-js-bundle/index.js' }).then(done).catch(error => { // eslint-disable-next-line no-console console.error(error); process.exit(1); }); }); }; core-js-3.6.1/LICENSE000066400000000000000000000020501360057567700141050ustar00rootroot00000000000000Copyright (c) 2014-2019 Denis Pushkarev 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. core-js-3.6.1/README.md000066400000000000000000004374611360057567700144010ustar00rootroot00000000000000# core-js [![Sponsors on Open Collective](https://opencollective.com/core-js/sponsors/badge.svg)](#raising-funds) [![Backers on Open Collective](https://opencollective.com/core-js/backers/badge.svg)](#raising-funds) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/zloirock/core-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![version](https://img.shields.io/npm/v/core-js.svg)](https://www.npmjs.com/package/core-js) [![npm downloads](https://img.shields.io/npm/dm/core-js.svg)](https://npm-stat.com/charts.html?package=core-js&package=core-js-pure&package=core-js-compat&from=2014-11-18) [![Build Status](https://travis-ci.org/zloirock/core-js.svg)](https://travis-ci.org/zloirock/core-js) [![devDependency status](https://david-dm.org/zloirock/core-js/dev-status.svg)](https://david-dm.org/zloirock/core-js?type=dev) > Modular standard library for JavaScript. Includes polyfills for [ECMAScript up to 2020](#ecmascript): [promises](#ecmascript-promise), [symbols](#ecmascript-symbol), [collections](#ecmascript-collections), iterators, [typed arrays](#ecmascript-typed-arrays), many other features, [ECMAScript proposals](#ecmascript-proposals), [some cross-platform WHATWG / W3C features and proposals](#web-standards) like [`URL`](#url-and-urlsearchparams). You can load only required features or use it without global namespace pollution. **If you looking documentation for obsolete `core-js@2`, please, check [this branch](https://github.com/zloirock/core-js/tree/v2).** ## As advertising: the author is looking for a good job -) ## [core-js@3, babel and a look into the future](https://github.com/zloirock/core-js/tree/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md) ## Raising funds `core-js` isn't backed by a company, so the future of this project depends on you. Become a sponsor or a backer [**on Open Collective**](https://opencollective.com/core-js) or [**on Patreon**](https://www.patreon.com/zloirock) if you are interested in `core-js`. --- --- --- ### For enterprise Available as part of the Tidelift Subscription. The maintainers of `core-js` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-core-js?utm_source=npm-core-js&utm_medium=referral&utm_campaign=enterprise) --- [*Example of usage*](http://goo.gl/a2xexl): ```js import 'core-js'; // <- at the top of your entry point Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] [1, [2, 3], [4, [5]]].flat(2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` *You can load only required features*: ```js import 'core-js/features/array/from'; // <- at the top of your entry point import 'core-js/features/array/flat'; // <- at the top of your entry point import 'core-js/features/set'; // <- at the top of your entry point import 'core-js/features/promise'; // <- at the top of your entry point Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] [1, [2, 3], [4, [5]]].flat(2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` *Or use it without global namespace pollution*: ```js import from from 'core-js-pure/features/array/from'; import flat from 'core-js-pure/features/array/flat'; import Set from 'core-js-pure/features/set'; import Promise from 'core-js-pure/features/promise'; from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] flat([1, [2, 3], [4, [5]]], 2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` ### Index - [Usage](#usage) - [Installation](#installation) - [`postinstall` message](#postinstall-message) - [CommonJS API](#commonjs-api) - [Babel](#babel) - [`@babel/polyfill`](#babelpolyfill) - [`@babel/preset-env`](#babelpreset-env) - [`@babel/runtime`](#babelruntime) - [Configurable level of aggressiveness](#configurable-level-of-aggressiveness) - [Custom build](#custom-build) - [Compatibility data](#compatibility-data) - [Supported engines](#supported-engines) - [Features](#features) - [ECMAScript](#ecmascript) - [ECMAScript: Object](#ecmascript-object) - [ECMAScript: Function](#ecmascript-function) - [ECMAScript: Array](#ecmascript-array) - [ECMAScript: String and RegExp](#ecmascript-string-and-regexp) - [ECMAScript: Number](#ecmascript-number) - [ECMAScript: Math](#ecmascript-math) - [ECMAScript: Date](#ecmascript-date) - [ECMAScript: Promise](#ecmascript-promise) - [ECMAScript: Symbol](#ecmascript-symbol) - [ECMAScript: Collections](#ecmascript-collections) - [ECMAScript: Typed Arrays](#ecmascript-typed-arrays) - [ECMAScript: Reflect](#ecmascript-reflect) - [ECMAScript: JSON](#ecmascript-json) - [ECMAScript: globalThis](#ecmascript-globalthis) - [ECMAScript proposals](#ecmascript-proposals) - [stage 4 proposals](#stage-4-proposals) - [stage 3 proposals](#stage-3-proposals) - [stage 2 proposals](#stage-2-proposals) - [stage 1 proposals](#stage-1-proposals) - [stage 0 proposals](#stage-0-proposals) - [pre-stage 0 proposals](#pre-stage-0-proposals) - [Web standards](#web-standards) - [`setTimeout` and `setInterval`](#settimeout-and-setinterval) - [`setImmediate`](#setimmediate) - [`queueMicrotask`](#queuemicrotask) - [`URL` and `URLSearchParams`](#url-and-urlsearchparams) - [iterable DOM collections](#iterable-dom-collections) - [Iteration helpers](#iteration-helpers) - [Missing polyfills](#missing-polyfills) - [Contributing](./CONTRIBUTING.md) - [Security policy](https://github.com/zloirock/core-js/blob/master/SECURITY.md) - [Changelog](./CHANGELOG.md) ## Usage ### Installation: ``` // global version npm install --save core-js@3.6.1 // version without global namespace pollution npm install --save core-js-pure@3.6.1 // bundled global version npm install --save core-js-bundle@3.6.1 ``` Already bundled version of `core-js` [on CDN](https://unpkg.com/core-js-bundle@3.6.1) ([minified version](https://unpkg.com/core-js-bundle@3.6.1/minified.js)). ### `postinstall` message The `core-js` project needs your help, so the package shows a message about it after installation. If it causes problems for you, you can disable it: ``` ADBLOCK=true npm install // or DISABLE_OPENCOLLECTIVE=true npm install // or npm install --loglevel silent ``` ### CommonJS API You can import only-required-for-you polyfills, like in examples at the top of `README.md`. Available CommonJS entry points for all polyfilled methods / constructors and namespaces. Just some examples: ```js // polyfill all `core-js` features: import "core-js"; // polyfill only stable `core-js` features - ES and web standards: import "core-js/stable"; // polyfill only stable ES features: import "core-js/es"; // if you want to polyfill `Set`: // all `Set`-related features, with ES proposals: import "core-js/features/set"; // stable required for `Set` ES features and features from web standards // (DOM collections iterator in this case): import "core-js/stable/set"; // only stable ES features required for `Set`: import "core-js/es/set"; // the same without global namespace pollution: import Set from "core-js-pure/features/set"; import Set from "core-js-pure/stable/set"; import Set from "core-js-pure/es/set"; // if you want to polyfill just required methods: import "core-js/features/set/intersection"; import "core-js/stable/queue-microtask"; import "core-js/es/array/from"; // polyfill reflect metadata proposal: import "core-js/proposals/reflect-metadata"; // polyfill all stage 2+ proposals: import "core-js/stage/2"; ``` ##### Caveats when using CommonJS API: * `modules` path is an internal API, does not inject all required dependencies and can be changed in minor or patch releases. Use it only for a custom build and/or if you know what are you doing. * If you use `core-js` with the extension of native objects, recommended load all `core-js` modules at the top of the entry point of your application, otherwise, you can have conflicts. * `core-js` is extremely modular and uses a lot of very tiny modules, because of that for usage in browsers bundle up `core-js` instead of usage loader for each file, otherwise, you will have hundreds of requests. #### CommonJS and prototype methods without global namespace pollution In the `pure` version, we can't pollute prototypes of native constructors. Because of that, prototype methods transformed into static methods like in examples above. But with transpilers, we can use one more trick - [bind operator and virtual methods](https://github.com/tc39/proposal-bind-operator). Special for that, available `/virtual/` entry points. Example: ```js import fill from 'core-js-pure/features/array/virtual/fill'; import findIndex from 'core-js-pure/features/array/virtual/find-index'; Array(10)::fill(0).map((a, b) => b * b)::findIndex(it => it && !(it % 8)); // => 4 // or import { fill, findIndex } from 'core-js-pure/features/array/virtual'; Array(10)::fill(0).map((a, b) => b * b)::findIndex(it => it && !(it % 8)); // => 4 ``` ### Babel `core-js` is integrated with `babel` and is the base for polyfilling-related `babel` features: #### `@babel/polyfill` [`@babel/polyfill`](http://babeljs.io/docs/usage/polyfill) [**IS** just the import of stable `core-js` features and `regenerator-runtime`](https://github.com/babel/babel/blob/c8bb4500326700e7dc68ce8c4b90b6482c48d82f/packages/babel-polyfill/src/index.js) for generators and async functions, so if you load `@babel/polyfill` - you load the global version of `core-js` without ES proposals. Now it's deprecated in favour of separate inclusion of required parts of `core-js` and `regenerator-runtime` and, for preventing breaking changes, left on `core-js@2`. As a full equal of `@babel/polyfill`, you can use this: ```js import 'core-js/stable'; import 'regenerator-runtime/runtime'; ``` #### `@babel/preset-env` [`@babel/preset-env`](https://github.com/babel/babel/tree/master/packages/babel-preset-env) has `useBuiltIns` option, which optimizes working with global version of `core-js`. With `useBuiltIns` option, you should also set `corejs` option to used version of `core-js`, like `corejs: '3.6'`. - `useBuiltIns: 'entry'` replaces imports of `core-js` to import only required for a target environment modules. So, for example, ```js import 'core-js/stable'; ``` with `chrome 71` target will be replaced just to: ```js import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.immediate"; ``` It works for all entry points of global version of `core-js` and their combinations, for example for ```js import 'core-js/es'; import 'core-js/proposals/set-methods'; import 'core-js/features/set/map'; ``` with `chrome 71` target you will have as a result: ```js import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/esnext.set.difference"; import "core-js/modules/esnext.set.intersection"; import "core-js/modules/esnext.set.is-disjoint-from"; import "core-js/modules/esnext.set.is-subset-of"; import "core-js/modules/esnext.set.is-superset-of"; import "core-js/modules/esnext.set.map"; import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; ``` - `useBuiltIns: 'usage'` adds to the top of each file import of polyfills for features used in this file and not supported by target environments, so for: ```js // first file: var set = new Set([1, 2, 3]); // second file: var array = Array.of(1, 2, 3); ``` if target contains an old environment like `IE 11` we will have something like: ```js // first file: import 'core-js/modules/es.array.iterator'; import 'core-js/modules/es.object.to-string'; import 'core-js/modules/es.set'; var set = new Set([1, 2, 3]); // second file: import 'core-js/modules/es.array.of'; var array = Array.of(1, 2, 3); ``` By default, `@babel/preset-env` with `useBuiltIns: 'usage'` option only polyfills stable features, but you can enable polyfilling of proposals by `proposals` option, as `corejs: { version: '3.6', proposals: true }`. #### `@babel/runtime` [`@babel/runtime`](http://babeljs.io/docs/plugins/transform-runtime/) with `corejs: 3` option simplifies work with `core-js-pure`. It automatically replaces usage of modern features from JS standard library to imports from the version of `core-js` without global namespace pollution, so instead of: ```js import from from 'core-js-pure/stable/array/from'; import flat from 'core-js-pure/stable/array/flat'; import Set from 'core-js-pure/stable/set'; import Promise from 'core-js-pure/stable/promise'; from(new Set([1, 2, 3, 2, 1])); flat([1, [2, 3], [4, [5]]], 2); Promise.resolve(32).then(x => console.log(x)); ``` you can write just: ```js Array.from(new Set([1, 2, 3, 2, 1])); [1, [2, 3], [4, [5]]].flat(2); Promise.resolve(32).then(x => console.log(x)); ``` By default, `@babel/runtime` only polyfills stable features, but like in `@babel/preset-env`, you can enable polyfilling of proposals by `proposals` option, as `corejs: { version: 3, proposals: true }`. **Warning!** If you use `@babel/preset-env` and `@babel/runtime` together, use `corejs` option only in one place since it's duplicate functionality and will cause conflicts. ### Configurable level of aggressiveness By default, `core-js` sets polyfills only when they are required. That means that `core-js` checks if a feature is available and works correctly or not and if it has no problems, `core-js` use native implementation. But sometimes `core-js` feature detection could be too strict for your case. For example, `Promise` constructor requires the support of unhandled rejection tracking and `@@species`. Sometimes we could have inverse problem - knowingly broken environment with problems not covered by `core-js` feature detection. For those cases, we could redefine this behaviour for certain polyfills: ```js const configurator = require('core-js/configurator'); configurator({ useNative: ['Promise'], // polyfills will be used only if natives completely unavailable usePolyfill: ['Array.from', 'String.prototype.padEnd'], // polyfills will be used anyway useFeatureDetection: ['Map', 'Set'], // default behaviour }); require('core-js'); ``` It does not work with some features. Also, if you change the default behaviour, even `core-js` internals may not work correctly. ### Custom build For some cases could be useful adding a blacklist of features or generation a polyfill for target engines. You could use [`core-js-builder`](/packages/core-js-builder) package for that. ### Compatibility data [`core-js-compat`](/packages/core-js-compat) package contains data about the necessity of `core-js` modules and API for getting a list of required `core-js` modules by `browserslist` query. ## Supported engines **Tested in:** - Chrome 26+ - Firefox 4+ - Safari 5+ - Opera 12+ - Internet Explorer 8+ (sure, IE8 with ES3 limitations; IE7- also should work, but no longer tested) - Edge - Android Browser 2.3+ - iOS Safari 5.1+ - PhantomJS 1.9+ - NodeJS 0.8+ ...and it doesn't mean `core-js` will not work in other engines, they just have not been tested. ## Features: [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure) ``` ### ECMAScript [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es ``` #### ECMAScript: Object Modules [`es.object.assign`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.assign.js), [`es.object.is`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.is.js), [`es.object.set-prototype-of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.set-prototype-of.js), [`es.object.to-string`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.to-string.js), [`es.object.freeze`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.freeze.js), [`es.object.seal`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.seal.js), [`es.object.prevent-extensions`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.prevent-extensions.js), [`es.object.is-frozen`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.is-frozen.js), [`es.object.is-sealed`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.is-sealed.js), [`es.object.is-extensible`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.is-extensible.js), [`es.object.get-own-property-descriptor`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.get-own-property-descriptor.js), [`es.object.get-own-property-descriptors`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.get-own-property-descriptors.js), [`es.object.get-prototype-of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.get-prototype-of.js), [`es.object.keys`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.keys.js), [`es.object.values`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.values.js), [`es.object.entries`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.entries.js), [`es.object.get-own-property-names`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.get-own-property-names.js) and [`es.object.from-entries`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.from-entries.js). Just ES5 features: [`es.object.create`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.create.js), [`es.object.define-property`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.define-property.js) and [`es.object.define-properties`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.es.object.define-properties.js). [ES2017 Annex B](https://tc39.github.io/ecma262/#sec-object.prototype.__defineGetter__) - modules [`es.object.define-setter`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.define-setter.js), [`es.object.define-getter`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.define-getter.js), [`es.object.lookup-setter`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.lookup-setter.js) and [`es.object.lookup-getter`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.object.lookup-getter.js) ```js class Object { toString(): string; // ES2015+ fix: @@toStringTag support __defineGetter__(property: PropertyKey, getter: Function): void; __defineSetter__(property: PropertyKey, setter: Function): void; __lookupGetter__(property: PropertyKey): Function | void; __lookupSetter__(property: PropertyKey): Function | void; static assign(target: Object, ...sources: Array): Object; static create(prototype: Object | null, properties?: { [property: PropertyKey]: PropertyDescriptor }): Object; static defineProperties(object: Object, properties: { [property: PropertyKey]: PropertyDescriptor })): Object; static defineProperty(object: Object, property: PropertyKey, attributes: PropertyDescriptor): Object; static entries(object: Object): Array<[string, mixed]>; static freeze(object: any): any; static fromEntries(iterable: Iterable<[key, value]>): Object; static getOwnPropertyDescriptor(object: any, property: PropertyKey): PropertyDescriptor | void; static getOwnPropertyDescriptors(object: any): { [property: PropertyKey]: PropertyDescriptor }; static getOwnPropertyNames(object: any): Array; static getPrototypeOf(object: any): Object | null; static is(value1: any, value2: any): boolean; static isExtensible(object: any): boolean; static isFrozen(object: any): boolean; static isSealed(object: any): boolean; static keys(object: any): Array; static preventExtensions(object: any): any; static seal(object: any): any; static setPrototypeOf(target: any, prototype: Object | null): any; // required __proto__ - IE11+ static values(object: any): Array; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/object core-js(-pure)/es|stable|features/object/assign core-js(-pure)/es|stable|features/object/is core-js(-pure)/es|stable|features/object/set-prototype-of core-js(-pure)/es|stable|features/object/get-prototype-of core-js(-pure)/es|stable|features/object/create core-js(-pure)/es|stable|features/object/define-property core-js(-pure)/es|stable|features/object/define-properties core-js(-pure)/es|stable|features/object/get-own-property-descriptor core-js(-pure)/es|stable|features/object/get-own-property-descriptors core-js(-pure)/es|stable|features/object/keys core-js(-pure)/es|stable|features/object/values core-js(-pure)/es|stable|features/object/entries core-js(-pure)/es|stable|features/object/get-own-property-names core-js(-pure)/es|stable|features/object/freeze core-js(-pure)/es|stable|features/object/from-entries core-js(-pure)/es|stable|features/object/seal core-js(-pure)/es|stable|features/object/prevent-extensions core-js(-pure)/es|stable|features/object/is-frozen core-js(-pure)/es|stable|features/object/is-sealed core-js(-pure)/es|stable|features/object/is-extensible core-js/es|stable|features/object/to-string core-js(-pure)/es|stable|features/object/define-getter core-js(-pure)/es|stable|features/object/define-setter core-js(-pure)/es|stable|features/object/lookup-getter core-js(-pure)/es|stable|features/object/lookup-setter ``` [*Examples*](https://goo.gl/sqY5mD): ```js let foo = { q: 1, w: 2 }; let bar = { e: 3, r: 4 }; let baz = { t: 5, y: 6 }; Object.assign(foo, bar, baz); // => foo = { q: 1, w: 2, e: 3, r: 4, t: 5, y: 6 } Object.is(NaN, NaN); // => true Object.is(0, -0); // => false Object.is(42, 42); // => true Object.is(42, '42'); // => false function Parent() {} function Child() {} Object.setPrototypeOf(Child.prototype, Parent.prototype); new Child() instanceof Child; // => true new Child() instanceof Parent; // => true let object = { [Symbol.toStringTag]: 'Foo' }; '' + object; // => '[object Foo]' Object.keys('qwe'); // => ['0', '1', '2'] Object.getPrototypeOf('qwe') === String.prototype; // => true Object.values({ a: 1, b: 2, c: 3 }); // => [1, 2, 3] Object.entries({ a: 1, b: 2, c: 3 }); // => [['a', 1], ['b', 2], ['c', 3]] for (let [key, value] of Object.entries({ a: 1, b: 2, c: 3 })) { console.log(key); // => 'a', 'b', 'c' console.log(value); // => 1, 2, 3 } // Shallow object cloning with prototype and descriptors: let copy = Object.create(Object.getPrototypeOf(object), Object.getOwnPropertyDescriptors(object)); // Mixin: Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); const map = new Map([['a', 1], ['b', 2]]); Object.fromEntries(map); // => { a: 1, b: 2 } class Unit { constructor(id) { this.id = id; } toString() { return `unit${ this.id }`; } } const units = new Set([new Unit(101), new Unit(102)]); Object.fromEntries(units.entries()); // => { unit101: Unit { id: 101 }, unit102: Unit { id: 102 } } ``` #### ECMAScript: Function Modules [`es.function.name`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.function.name.js), [`es.function.has-instance`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.function.has-instance.js). Just ES5: [`es.function.bind`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.function.bind.js). ```js class Function { name: string; bind(thisArg: any, ...args: Array): Function; @@hasInstance(value: any): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/es|stable|features/function core-js/es|stable|features/function/name core-js/es|stable|features/function/has-instance core-js/es|stable|features/function/bind core-js/es|stable|features/function/virtual/bind ``` [*Example*](http://goo.gl/zqu3Wp): ```js (function foo() {}).name // => 'foo' console.log.bind(console, 42)(43); // => 42 43 ``` #### ECMAScript: Array Modules [`es.array.from`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.from.js), [`es.array.is-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.is-array.js), [`es.array.of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.of.js), [`es.array.copy-within`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.copy-within.js), [`es.array.fill`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.fill.js), [`es.array.find`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.find.js), [`es.array.find-index`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.find-index.js), [`es.array.iterator`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.iterator.js), [`es.array.includes`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.includes.js), [`es.array.slice`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.slice.js), [`es.array.join`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.join.js), [`es.array.index-of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.index-of.js), [`es.array.last-index-of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.last-index-of.js), [`es.array.every`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.every.js), [`es.array.some`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.some.js), [`es.array.for-each`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.for-each.js), [`es.array.map`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.map.js), [`es.array.filter`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.filter.js), [`es.array.reduce`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.reduce.js), [`es.array.reduce-right`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.reduce-right.js), [`es.array.reverse`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.reverse.js), [`es.array.sort`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.sort.js), [`es.array.flat`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.flat.js), [`es.array.flat-map`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.flat-map.js), [`es.array.unscopables.flat`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.unscopables.flat.js) and [`es.array.unscopables.flat-map`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array.unscopables.flat-map.js) ```js class Array { concat(...args: Array): Array; // with adding support of @@isConcatSpreadable and @@species copyWithin(target: number, start: number, end?: number): this; entries(): Iterator<[index, value]>; every(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): boolean; fill(value: any, start?: number, end?: number): this; filter(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): Array; // with adding support of @@species find(callbackfn: (value: any, index: number, target: any) => boolean), thisArg?: any): any; findIndex(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): number; flat(depthArg?: number = 1): Array; flatMap(mapFn: (value: any, index: number, target: any) => any, thisArg: any): Array; forEach(callbackfn: (value: any, index: number, target: any) => void, thisArg?: any): void; includes(searchElement: any, from?: number): boolean; indexOf(searchElement: any, from?: number): number; join(separator: string = ','): string; keys(): Iterator; lastIndexOf(searchElement: any, from?: number): number; map(mapFn: (value: any, index: number, target: any) => any, thisArg?: any): Array; // with adding support of @@species reduce(callbackfn: (memo: any, value: any, index: number, target: any) => any, initialValue?: any): any; reduceRight(callbackfn: (memo: any, value: any, index: number, target: any) => any, initialValue?: any): any; reverse(): this; // Safari 12.0 bug fix slice(start?: number, end?: number): Array; // with adding support of @@species splice(start?: number, deleteCount?: number, ...items: Array): Array; // with adding support of @@species some(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): boolean; sort(comparefn?: (a: any, b: any) => number): this; values(): Iterator; @@iterator(): Iterator; @@unscopables: { [newMethodNames: string]: true }; static from(items: Iterable | ArrayLike, mapFn?: (value: any, index: number) => any, thisArg?: any): Array; static isArray(value: any): boolean; static of(...args: Array): Array; } class Arguments { @@iterator(): Iterator; // available only in core-js methods } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/array core-js(-pure)/es|stable|features/array/from core-js(-pure)/es|stable|features/array/of core-js(-pure)/es|stable|features/array/is-array core-js(-pure)/es|stable|features/array/concat core-js(-pure)/es|stable|features/array/entries core-js(-pure)/es|stable|features/array/every core-js(-pure)/es|stable|features/array/copy-within core-js(-pure)/es|stable|features/array/fill core-js(-pure)/es|stable|features/array/filter core-js(-pure)/es|stable|features/array/find core-js(-pure)/es|stable|features/array/find-index core-js(-pure)/es|stable|features/array/flat core-js(-pure)/es|stable|features/array/flat-map core-js(-pure)/es|stable|features/array/for-each core-js(-pure)/es|stable|features/array/includes core-js(-pure)/es|stable|features/array/index-of core-js(-pure)/es|stable|features/array/iterator core-js(-pure)/es|stable|features/array/join core-js(-pure)/es|stable|features/array/keys core-js(-pure)/es|stable|features/array/last-index-of core-js(-pure)/es|stable|features/array/map core-js(-pure)/es|stable|features/array/reduce core-js(-pure)/es|stable|features/array/reduce-right core-js(-pure)/es|stable|features/array/reverse core-js(-pure)/es|stable|features/array/slice core-js(-pure)/es|stable|features/array/splice core-js(-pure)/es|stable|features/array/some core-js(-pure)/es|stable|features/array/sort core-js(-pure)/es|stable|features/array/values core-js(-pure)/es|stable|features/array/virtual/concat core-js(-pure)/es|stable|features/array/virtual/copy-within core-js(-pure)/es|stable|features/array/virtual/entries core-js(-pure)/es|stable|features/array/virtual/every core-js(-pure)/es|stable|features/array/virtual/fill core-js(-pure)/es|stable|features/array/virtual/filter core-js(-pure)/es|stable|features/array/virtual/find core-js(-pure)/es|stable|features/array/virtual/find-index core-js(-pure)/es|stable|features/array/virtual/flat core-js(-pure)/es|stable|features/array/virtual/flat-map core-js(-pure)/es|stable|features/array/virtual/for-each core-js(-pure)/es|stable|features/array/virtual/includes core-js(-pure)/es|stable|features/array/virtual/index-of core-js(-pure)/es|stable|features/array/virtual/iterator core-js(-pure)/es|stable|features/array/virtual/join core-js(-pure)/es|stable|features/array/virtual/keys core-js(-pure)/es|stable|features/array/virtual/last-index-of core-js(-pure)/es|stable|features/array/virtual/map core-js(-pure)/es|stable|features/array/virtual/reduce core-js(-pure)/es|stable|features/array/virtual/reduce-right core-js(-pure)/es|stable|features/array/virtual/reverse core-js(-pure)/es|stable|features/array/virtual/slice core-js(-pure)/es|stable|features/array/virtual/some core-js(-pure)/es|stable|features/array/virtual/sort core-js(-pure)/es|stable|features/array/virtual/splice core-js(-pure)/es|stable|features/array/virtual/values ``` [*Examples*](https://goo.gl/Tegvq4): ```js Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] Array.from({ 0: 1, 1: 2, 2: 3, length: 3 }); // => [1, 2, 3] Array.from('123', Number); // => [1, 2, 3] Array.from('123', it => it * it); // => [1, 4, 9] Array.of(1); // => [1] Array.of(1, 2, 3); // => [1, 2, 3] let array = ['a', 'b', 'c']; for (let value of array) console.log(value); // => 'a', 'b', 'c' for (let value of array.values()) console.log(value); // => 'a', 'b', 'c' for (let key of array.keys()) console.log(key); // => 0, 1, 2 for (let [key, value] of array.entries()) { console.log(key); // => 0, 1, 2 console.log(value); // => 'a', 'b', 'c' } function isOdd(value) { return value % 2; } [4, 8, 15, 16, 23, 42].find(isOdd); // => 15 [4, 8, 15, 16, 23, 42].findIndex(isOdd); // => 2 [4, 8, 15, 16, 23, 42].find(isNaN); // => undefined [4, 8, 15, 16, 23, 42].findIndex(isNaN); // => -1 Array(5).fill(42); // => [42, 42, 42, 42, 42] [1, 2, 3, 4, 5].copyWithin(0, 3); // => [4, 5, 3, 4, 5] [1, 2, 3].includes(2); // => true [1, 2, 3].includes(4); // => false [1, 2, 3].includes(2, 2); // => false [NaN].indexOf(NaN); // => -1 [NaN].includes(NaN); // => true Array(1).indexOf(undefined); // => -1 Array(1).includes(undefined); // => true [1, [2, 3], [4, 5]].flat(); // => [1, 2, 3, 4, 5] [1, [2, [3, [4]]], 5].flat(); // => [1, 2, [3, [4]], 5] [1, [2, [3, [4]]], 5].flat(3); // => [1, 2, 3, 4, 5] [{ a: 1, b: 2 }, { a: 3, b: 4 }, { a: 5, b: 6 }].flatMap(it => [it.a, it.b]); // => [1, 2, 3, 4, 5, 6] ``` #### ECMAScript: String and RegExp The main part of `String` features: modules [`es.string.from-code-point`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.from-code-point.js), [`es.string.raw`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.raw.js), [`es.string.iterator`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.iterator.js), [`es.string.split`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.split.js), [`es.string.code-point-at`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.code-point-at.js), [`es.string.ends-with`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.ends-with.js), [`es.string.includes`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.includes.js), [`es.string.repeat`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.repeat.js), [`es.string.pad-start`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.pad-start.js), [`es.string.pad-end`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.pad-end.js), [`es.string.starts-with`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.starts-with.js), [`es.string.trim`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.trim.js), [`es.string.trim-start`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.trim-start.js), [`es.string.trim-end`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.trim-end.js), [`es.string.match-all`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.match-all.js). Adding support of well-known [symbols](#ecmascript-symbol) `@@match`, `@@replace`, `@@search` and `@@split` and direct `.exec` calls to related `String` methods, modules [`es.string.match`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.match.js), [`es.string.replace`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.replace.js), [`es.string.search`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.search.js) and [`es.string.split`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.split.js). Annex B HTML methods. Ugly, but it's also the part of the spec. Modules [`es.string.anchor`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.anchor.js), [`es.string.big`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.big.js), [`es.string.blink`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.blink.js), [`es.string.bold`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.bold.js), [`es.string.fixed`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.fixed.js), [`es.string.fontcolor`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.fontcolor.js), [`es.string.fontsize`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.fontsize.js), [`es.string.italics`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.italics.js), [`es.string.link`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.link.js), [`es.string.small`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.small.js), [`es.string.strike`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.strike.js), [`es.string.sub`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.sub.js) and [`es.string.sup`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.string.sup.js). `RegExp` features: modules [`es.regexp.constructor`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.regexp.constructor.js), [`es.regexp.flags`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.regexp.flags.js), [`es.regexp.sticky`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.regexp.sticky.js) and [`es.regexp.test`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.regexp.test.js). ```js class String { static fromCodePoint(...codePoints: Array): string; static raw({ raw: Array }, ...substitutions: Array): string; split(separator: string, limit?: number): Array; includes(searchString: string, position?: number): boolean; startsWith(searchString: string, position?: number): boolean; endsWith(searchString: string, position?: number): boolean; repeat(count: number): string; padStart(length: number, fillStr?: string = ' '): string; padEnd(length: number, fillStr?: string = ' '): string; codePointAt(pos: number): number | void; match(template: any): any; // ES2015+ fix for support @@match matchAll(regexp: RegExp): Iterator; replace(template: any, replacer: any): any; // ES2015+ fix for support @@replace search(template: any): any; // ES2015+ fix for support @@search split(template: any, limit: any): any; // ES2015+ fix for support @@split, some fixes for old engines trim(): string; trimLeft(): string; trimRight(): string; trimStart(): string; trimEnd(): string; anchor(name: string): string; big(): string; blink(): string; bold(): string; fixed(): string; fontcolor(color: string): string; fontsize(size: any): string; italics(): string; link(url: string): string; small(): string; strike(): string; sub(): string; sup(): string; @@iterator(): Iterator; } class RegExp { constructor(pattern: RegExp | string, flags?: string): RegExp; // support of sticky (`y`) flag; can alter flags exec(): Array | null; // IE8 fixes test(string: string): boolean; // delegation to `.exec` toString(): string; // ES2015+ fix - generic @@match(string: string): Array | null; @@replace(string: string, replaceValue: Function | string): string; @@search(string: string): number; @@split(string: string, limit: number): Array; readonly attribute flags: string; // IE9+ readonly attribute sticky: boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/string core-js(-pure)/es|stable|features/string/from-code-point core-js(-pure)/es|stable|features/string/raw core-js(-pure)/es|stable|features/string/code-point-at core-js(-pure)/es|stable|features/string/ends-with core-js(-pure)/es|stable|features/string/includes core-js(-pure)/es|stable|features/string/starts-with core-js/es|stable|features/string/match core-js(-pure)/es|stable|features/string/match-all core-js(-pure)/es|stable|features/string/repeat core-js(-pure)/es|stable|features/string/pad-start core-js(-pure)/es|stable|features/string/pad-end core-js/es|stable|features/string/replace core-js/es|stable|features/string/search core-js/es|stable|features/string/split core-js(-pure)/es|stable|features/string/trim core-js(-pure)/es|stable|features/string/trim-start core-js(-pure)/es|stable|features/string/trim-end core-js(-pure)/es|stable|features/string/trim-left core-js(-pure)/es|stable|features/string/trim-right core-js(-pure)/es|stable|features/string/anchor core-js(-pure)/es|stable|features/string/big core-js(-pure)/es|stable|features/string/blink core-js(-pure)/es|stable|features/string/bold core-js(-pure)/es|stable|features/string/fixed core-js(-pure)/es|stable|features/string/fontcolor core-js(-pure)/es|stable|features/string/fontsize core-js(-pure)/es|stable|features/string/italics core-js(-pure)/es|stable|features/string/link core-js(-pure)/es|stable|features/string/small core-js(-pure)/es|stable|features/string/strike core-js(-pure)/es|stable|features/string/sub core-js(-pure)/es|stable|features/string/sup core-js(-pure)/es|stable|features/string/iterator core-js(-pure)/es|stable|features/string/virtual/includes core-js(-pure)/es|stable|features/string/virtual/starts-with core-js(-pure)/es|stable|features/string/virtual/ends-with core-js(-pure)/es|stable|features/string/virtual/match-all core-js(-pure)/es|stable|features/string/virtual/repeat core-js(-pure)/es|stable|features/string/virtual/pad-start core-js(-pure)/es|stable|features/string/virtual/pad-end core-js(-pure)/es|stable|features/string/virtual/code-point-at core-js(-pure)/es|stable|features/string/virtual/trim core-js(-pure)/es|stable|features/string/virtual/trim-start core-js(-pure)/es|stable|features/string/virtual/trim-end core-js(-pure)/es|stable|features/string/virtual/trim-left core-js(-pure)/es|stable|features/string/virtual/trim-right core-js(-pure)/es|stable|features/string/virtual/anchor core-js(-pure)/es|stable|features/string/virtual/big core-js(-pure)/es|stable|features/string/virtual/blink core-js(-pure)/es|stable|features/string/virtual/bold core-js(-pure)/es|stable|features/string/virtual/fixed core-js(-pure)/es|stable|features/string/virtual/fontcolor core-js(-pure)/es|stable|features/string/virtual/fontsize core-js(-pure)/es|stable|features/string/virtual/italics core-js(-pure)/es|stable|features/string/virtual/link core-js(-pure)/es|stable|features/string/virtual/small core-js(-pure)/es|stable|features/string/virtual/strike core-js(-pure)/es|stable|features/string/virtual/sub core-js(-pure)/es|stable|features/string/virtual/sup core-js(-pure)/es|stable|features/string/virtual/iterator core-js/es|stable|features/regexp core-js/es|stable|features/regexp/constructor core-js(-pure)/es|stable|features/regexp/flags core-js/es|stable|features/regexp/sticky core-js/es|stable|features/regexp/test core-js/es|stable|features/regexp/to-string ``` [*Examples*](http://es6.zloirock.ru/#for(var%20val%20of%20'a%F0%A0%AE%B7b')%7B%0A%20%20log(val)%3B%20%2F%2F%20%3D%3E%20'a'%2C%20'%F0%A0%AE%B7'%2C%20'b'%0A%7D%0A%0Alog('foobarbaz'.includes('bar'))%3B%20%20%20%20%20%20%2F%2F%20%3D%3E%20true%0Alog('foobarbaz'.includes('bar'%2C%204))%3B%20%20%20%2F%2F%20%3D%3E%20false%0Alog('foobarbaz'.startsWith('foo'))%3B%20%20%20%20%2F%2F%20%3D%3E%20true%0Alog('foobarbaz'.startsWith('bar'%2C%203))%3B%20%2F%2F%20%3D%3E%20true%0Alog('foobarbaz'.endsWith('baz'))%3B%20%20%20%20%20%20%2F%2F%20%3D%3E%20true%0Alog('foobarbaz'.endsWith('bar'%2C%206))%3B%20%20%20%2F%2F%20%3D%3E%20true%0A%0Alog('string'.repeat(3))%3B%20%2F%2F%20%3D%3E%20'stringstringstring'%0A%0Alog('hello'.padStart(10))%3B%20%20%20%20%20%20%20%20%20%2F%2F%20%3D%3E%20'%20%20%20%20%20hello'%0Alog('hello'.padStart(10%2C%20'1234'))%3B%20%2F%2F%20%3D%3E%20'12341hello'%0Alog('hello'.padEnd(10))%3B%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%3D%3E%20'hello%20%20%20%20%20'%0Alog('hello'.padEnd(10%2C%20'1234'))%3B%20%20%20%2F%2F%20%3D%3E%20'hello12341'%0A%0Alog('%F0%A0%AE%B7'.codePointAt(0))%3B%20%2F%2F%20%3D%3E%20134071%0A%0Avar%20name%20%3D%20'Bob'%3B%0Alog(String.raw%60Hi%5Cn%24%7Bname%7D!%60)%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%3D%3E%20'Hi%5C%5CnBob!'%20(ES6%20template%20string%20syntax)%0Alog(String.raw(%7B%20raw%3A%20'test'%20%7D%2C%200%2C%201%2C%202))%3B%20%2F%2F%20%3D%3E%20%2F%2F%20't0e1s2t'%0A%0Alog('foo'.bold())%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%3D%3E%20'%3Cb%3Efoo%3C%2Fb%3E'%0Alog('bar'.anchor('a%22b'))%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%3D%3E%20'%3Ca%20name%3D%22a%26quot%3Bb%22%3Ebar%3C%2Fa%3E'%0Alog('baz'.link('http%3A%2F%2Fexample.com'))%3B%20%2F%2F%20%3D%3E%20'%3Ca%20href%3D%22http%3A%2F%2Fexample.com%22%3Ebaz%3C%2Fa%3E'%0A%0Alog(RegExp(%2F.%2Fg%2C%20'm'))%3B%20%2F%2F%20%3D%3E%20%2F.%2Fm%0A%0Alog(%2Ffoo%2F.flags)%3B%20%20%20%20%2F%2F%20%3D%3E%20''%0Alog(%2Ffoo%2Fgim.flags)%3B%20%2F%2F%20%3D%3E%20'gim'%0A%0Alog(RegExp('foo'%2C%20'y').sticky)%3B%20%2F%2F%20%3D%3E%20true%0A%0Aconst%20text%20%3D%20'First%20line%5CnSecond%20line'%3B%0Aconst%20regex%20%3D%20RegExp('(%5C%5CS%2B)%20line%5C%5Cn%3F'%2C%20'y')%3B%0A%0Alog(regex.exec(text)%5B1%5D)%3B%20%2F%2F%20%3D%3E%20'First'%0Alog(regex.exec(text)%5B1%5D)%3B%20%2F%2F%20%3D%3E%20'Second'%0Alog(regex.exec(text))%3B%20%20%20%20%2F%2F%20%3D%3E%20null%0A%0Alog('foo'.match(%7B%5BSymbol.match%5D%3A%20_%20%3D%3E%201%7D))%3B%20%20%20%20%20%2F%2F%20%3D%3E%201%0Alog('foo'.replace(%7B%5BSymbol.replace%5D%3A%20_%20%3D%3E%202%7D))%3B%20%2F%2F%20%3D%3E%202%0Alog('foo'.search(%7B%5BSymbol.search%5D%3A%20_%20%3D%3E%203%7D))%3B%20%20%20%2F%2F%20%3D%3E%203%0Alog('foo'.split(%7B%5BSymbol.split%5D%3A%20_%20%3D%3E%204%7D))%3B%20%20%20%20%20%2F%2F%20%3D%3E%204%0A%0Alog(RegExp.prototype.toString.call(%7Bsource%3A%20'foo'%2C%20flags%3A%20'bar'%7D))%3B%0A%0Alog('%20%20%20hello%20%20%20'.trimLeft())%3B%20%20%2F%2F%20%3D%3E%20'hello%20%20%20'%0Alog('%20%20%20hello%20%20%20'.trimRight())%3B%20%2F%2F%20%3D%3E%20'%20%20%20hello'%0Alog('%20%20%20hello%20%20%20'.trimStart())%3B%20%2F%2F%20%3D%3E%20'hello%20%20%20'%0Alog('%20%20%20hello%20%20%20'.trimEnd())%3B%20%20%20%2F%2F%20%3D%3E%20'%20%20%20hello'%0A%0Afor%20(let%20%5B_%2C%20d%2C%20D%5D%20of%20'1111a2b3cccc'.matchAll(%2F(%5Cd)(%5CD)%2Fg))%20%7B%0A%20%20log(d%2C%20D)%3B%20%2F%2F%20%3D%3E%201%20a%2C%202%20b%2C%203%20c%0A%7D): ```js for (let value of 'a𠮷b') { console.log(value); // => 'a', '𠮷', 'b' } 'foobarbaz'.includes('bar'); // => true 'foobarbaz'.includes('bar', 4); // => false 'foobarbaz'.startsWith('foo'); // => true 'foobarbaz'.startsWith('bar', 3); // => true 'foobarbaz'.endsWith('baz'); // => true 'foobarbaz'.endsWith('bar', 6); // => true 'string'.repeat(3); // => 'stringstringstring' 'hello'.padStart(10); // => ' hello' 'hello'.padStart(10, '1234'); // => '12341hello' 'hello'.padEnd(10); // => 'hello ' 'hello'.padEnd(10, '1234'); // => 'hello12341' '𠮷'.codePointAt(0); // => 134071 String.fromCodePoint(97, 134071, 98); // => 'a𠮷b' let name = 'Bob'; String.raw`Hi\n${name}!`; // => 'Hi\\nBob!' (ES2015 template string syntax) String.raw({ raw: 'test' }, 0, 1, 2); // => 't0e1s2t' 'foo'.bold(); // => 'foo' 'bar'.anchor('a"b'); // => 'bar' 'baz'.link('http://example.com'); // => 'baz' RegExp(/./g, 'm'); // => /./m /foo/.flags; // => '' /foo/gim.flags; // => 'gim' RegExp('foo', 'y').sticky; // => true const text = 'First line\nSecond line'; const regex = RegExp('(\\S+) line\\n?', 'y'); regex.exec(text)[1]; // => 'First' regex.exec(text)[1]; // => 'Second' regex.exec(text); // => null 'foo'.match({ [Symbol.match]: () => 1 }); // => 1 'foo'.replace({ [Symbol.replace]: () => 2 }); // => 2 'foo'.search({ [Symbol.search]: () => 3 }); // => 3 'foo'.split({ [Symbol.split]: () => 4 }); // => 4 RegExp.prototype.toString.call({ source: 'foo', flags: 'bar' }); // => '/foo/bar' ' hello '.trimLeft(); // => 'hello ' ' hello '.trimRight(); // => ' hello' ' hello '.trimStart(); // => 'hello ' ' hello '.trimEnd(); // => ' hello' for (let [_, d, D] of '1111a2b3cccc'.matchAll(/(\d)(\D)/g)) { console.log(d, D); // => 1 a, 2 b, 3 c } ``` #### ECMAScript: Number Module [`es.number.constructor`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.constructor.js). `Number` constructor support binary and octal literals, [*example*](http://goo.gl/jRd6b3): ```js Number('0b1010101'); // => 85 Number('0o7654321'); // => 2054353 ``` Modules [`es.number.epsilon`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.epsilon.js), [`es.number.is-finite`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.is-finite.js), [`es.number.is-integer`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.is-integer.js), [`es.number.is-nan`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.is-nan.js), [`es.number.is-safe-integer`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.is-safe-integer.js), [`es.number.max-safe-integer`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.max-safe-integer.js), [`es.number.min-safe-integer`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.min-safe-integer.js), [`es.number.parse-float`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.parse-float.js), [`es.number.parse-int`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.parse-int.js), [`es.number.to-fixed`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.to-fixed.js), [`es.number.to-precision`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.number.to-precision.js), [`es.parse-int`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.parse-int.js), [`es.parse-float`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.parse-float.js). ```js class Number { constructor(value: any): number; toFixed(digits: number): string; toPrecision(precision: number): string; static isFinite(number: any): boolean; static isNaN(number: any): boolean; static isInteger(number: any): boolean; static isSafeInteger(number: any): boolean; static parseFloat(string: string): number; static parseInt(string: string, radix?: number = 10): number; static EPSILON: number; static MAX_SAFE_INTEGER: number; static MIN_SAFE_INTEGER: number; } function parseFloat(string: string): number; function parseInt(string: string, radix?: number = 10): number; ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/number core-js/es|stable|features/number/constructor core-js(-pure)/es|stable|features/number/is-finite core-js(-pure)/es|stable|features/number/is-nan core-js(-pure)/es|stable|features/number/is-integer core-js(-pure)/es|stable|features/number/is-safe-integer core-js(-pure)/es|stable|features/number/parse-float core-js(-pure)/es|stable|features/number/parse-int core-js(-pure)/es|stable|features/number/epsilon core-js(-pure)/es|stable|features/number/max-safe-integer core-js(-pure)/es|stable|features/number/min-safe-integer core-js(-pure)/es|stable|features/number/to-fixed core-js(-pure)/es|stable|features/number/to-precision core-js(-pure)/es|stable|features/parse-float core-js(-pure)/es|stable|features/parse-int ``` #### ECMAScript: Math Modules [`es.math.acosh`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.acosh.js), [`es.math.asinh`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.asinh.js), [`es.math.atanh`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.atanh.js), [`es.math.cbrt`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.cbrt.js), [`es.math.clz32`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.clz32.js), [`es.math.cosh`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.cosh.js), [`es.math.expm1`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.expm1.js), [`es.math.fround`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.fround.js), [`es.math.hypot`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.hypot.js), [`es.math.imul`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.imul.js), [`es.math.log10`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.log10.js), [`es.math.log1p`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.log1p.js), [`es.math.log2`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.log2.js), [`es.math.sign`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.sign.js), [`es.math.sinh`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.sinh.js), [`es.math.tanh`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.tanh.js), [`es.math.trunc`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.trunc.js). ```js namespace Math { acosh(number: number): number; asinh(number: number): number; atanh(number: number): number; cbrt(number: number): number; clz32(number: number): number; cosh(number: number): number; expm1(number: number): number; fround(number: number): number; hypot(...args: Array): number; imul(number1: number, number2: number): number; log1p(number: number): number; log10(number: number): number; log2(number: number): number; sign(number: number): 1 | -1 | 0 | -0 | NaN; sinh(number: number): number; tanh(number: number): number; trunc(number: number): number; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/math core-js(-pure)/es|stable|features/math/acosh core-js(-pure)/es|stable|features/math/asinh core-js(-pure)/es|stable|features/math/atanh core-js(-pure)/es|stable|features/math/cbrt core-js(-pure)/es|stable|features/math/clz32 core-js(-pure)/es|stable|features/math/cosh core-js(-pure)/es|stable|features/math/expm1 core-js(-pure)/es|stable|features/math/fround core-js(-pure)/es|stable|features/math/hypot core-js(-pure)/es|stable|features/math/imul core-js(-pure)/es|stable|features/math/log1p core-js(-pure)/es|stable|features/math/log10 core-js(-pure)/es|stable|features/math/log2 core-js(-pure)/es|stable|features/math/sign core-js(-pure)/es|stable|features/math/sinh core-js(-pure)/es|stable|features/math/tanh core-js(-pure)/es|stable|features/math/trunc ``` #### ECMAScript: Date Modules [`es.date.to-string`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.date.to-string.js), ES5 features with fixes: [`es.date.now`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.date.now.js), [`es.date.to-iso-string`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.date.to-iso-string.js), [`es.date.to-json`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.date.to-json.js) and [`es.date.to-primitive`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.date.to-primitive.js). ```js class Date { toISOString(): string; toJSON(): string; toString(): string; @@toPrimitive(hint: 'default' | 'number' | 'string'): string | number; static now(): number; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/es|stable|features/date core-js/es|stable|features/date/to-string core-js(-pure)/es|stable|features/date/now core-js(-pure)/es|stable|features/date/to-iso-string core-js(-pure)/es|stable|features/date/to-json core-js(-pure)/es|stable|features/date/to-primitive ``` [*Example*](http://goo.gl/haeHLR): ```js new Date(NaN).toString(); // => 'Invalid Date' ``` #### ECMAScript: Promise Modules [`es.promise`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.promise.js), [`es.promise.all-settled`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.promise.all-settled.js) and [`es.promise.finally`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.promise.finally.js). ```js class Promise { constructor(executor: (resolve: Function, reject: Function) => void): Promise; then(onFulfilled: Function, onRejected: Function): Promise; catch(onRejected: Function): Promise; finally(onFinally: Function): Promise; static resolve(x: any): Promise; static reject(r: any): Promise; static all(iterable: Iterable): Promise; static allSettled(iterable: Iterable): Promise; static race(iterable: Iterable): Promise; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/promise core-js(-pure)/es|stable|features/promise/all-settled core-js(-pure)/es|stable|features/promise/finally ``` Basic [*example*](http://goo.gl/vGrtUC): ```js function sleepRandom(time) { return new Promise((resolve, reject) => { setTimeout(resolve, time * 1e3, 0 | Math.random() * 1e3); }); } console.log('Run'); // => Run sleepRandom(5).then(result => { console.log(result); // => 869, after 5 sec. return sleepRandom(10); }).then(result => { console.log(result); // => 202, after 10 sec. }).then(() => { console.log('immediately after'); // => immediately after throw Error('Irror!'); }).then(() => { console.log('will not be displayed'); }).catch(x => console.log(x)); // => => Error: Irror! ``` `Promise.resolve` and `Promise.reject` [*example*](http://goo.gl/vr8TN3): ```js Promise.resolve(42).then(x => console.log(x)); // => 42 Promise.reject(42).catch(x => console.log(x)); // => 42 Promise.resolve($.getJSON('/data.json')); // => ES promise ``` `Promise#finally` [*example*](https://goo.gl/AhyBbJ): ```js Promise.resolve(42).finally(() => console.log('You will see it anyway')); Promise.reject(42).finally(() => console.log('You will see it anyway')); ``` `Promise.all` [*example*](http://goo.gl/RdoDBZ): ```js Promise.all([ 'foo', sleepRandom(5), sleepRandom(15), sleepRandom(10) // after 15 sec: ]).then(x => console.log(x)); // => ['foo', 956, 85, 382] ``` `Promise.race` [*example*](http://goo.gl/L8ovkJ): ```js function timeLimit(promise, time) { return Promise.race([promise, new Promise((resolve, reject) => { setTimeout(reject, time * 1e3, Error('Await > ' + time + ' sec')); })]); } timeLimit(sleepRandom(5), 10).then(x => console.log(x)); // => 853, after 5 sec. timeLimit(sleepRandom(15), 10).catch(x => console.log(x)); // Error: Await > 10 sec ``` `Promise.allSettled` [*example*](https://goo.gl/PXXLNJ): ```js Promise.allSettled([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(console.log); // => [{ value: 1, status: 'fulfilled' }, { reason: 2, status: 'rejected' }, { value: 3, status: 'fulfilled' }] ``` [Example](http://goo.gl/wnQS4j) with async functions: ```js let delay = time => new Promise(resolve => setTimeout(resolve, time)) async function sleepRandom(time) { await delay(time * 1e3); return 0 | Math.random() * 1e3; } async function sleepError(time, msg) { await delay(time * 1e3); throw Error(msg); } (async () => { try { console.log('Run'); // => Run console.log(await sleepRandom(5)); // => 936, after 5 sec. let [a, b, c] = await Promise.all([ sleepRandom(5), sleepRandom(15), sleepRandom(10) ]); console.log(a, b, c); // => 210 445 71, after 15 sec. await sleepError(5, 'Error!'); console.log('Will not be displayed'); } catch (e) { console.log(e); // => Error: 'Error!', after 5 sec. } })(); ``` ##### Unhandled rejection tracking In Node.js, like in native implementation, available events [`unhandledRejection`](https://nodejs.org/api/process.html#process_event_unhandledrejection) and [`rejectionHandled`](https://nodejs.org/api/process.html#process_event_rejectionhandled): ```js process.on('unhandledRejection', (reason, promise) => console.log('unhandled', reason, promise)); process.on('rejectionHandled', (promise) => console.log('handled', promise)); let promise = Promise.reject(42); // unhandled 42 [object Promise] setTimeout(() => promise.catch(() => {}), 1e3); // handled [object Promise] ``` In a browser on rejection, by default, you will see notify in the console, or you can add a custom handler and a handler on handling unhandled, [*example*](http://goo.gl/Wozskl): ```js window.addEventListener('unhandledrejection', e => console.log('unhandled', e.reason, e.promise)); window.addEventListener('rejectionhandled', e => console.log('handled', e.reason, e.promise)); // or window.onunhandledrejection = e => console.log('unhandled', e.reason, e.promise); window.onrejectionhandled = e => console.log('handled', e.reason, e.promise); let promise = Promise.reject(42); // => unhandled 42 [object Promise] setTimeout(() => promise.catch(() => {}), 1e3); // => handled 42 [object Promise] ``` #### ECMAScript: Symbol Modules [`es.symbol`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.js), [`es.symbol.async-iterator`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.async-iterator.js), [`es.symbol.description`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.description.js), [`es.symbol.has-instance`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.has-instance.js), [`es.symbol.is-concat-spreadable`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.is-concat-spreadable.js), [`es.symbol.iterator`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.iterator.js), [`es.symbol.match`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.match.js), [`es.symbol.replace`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.replace.js), [`es.symbol.search`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.search.js), [`es.symbol.species`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.species.js), [`es.symbol.split`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.split.js), [`es.symbol.to-primitive`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.to-primitive.js), [`es.symbol.to-string-tag`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.to-string-tag.js), [`es.symbol.unscopables`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.symbol.unscopables.js), [`es.math.to-string-tag`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.math.to-string-tag.js). ```js class Symbol { constructor(description?): symbol; readonly attribute description: string | void; static asyncIterator: @@asyncIterator; static hasInstance: @@hasInstance; static isConcatSpreadable: @@isConcatSpreadable; static iterator: @@iterator; static match: @@match; static replace: @@replace; static search: @@search; static species: @@species; static split: @@split; static toPrimitive: @@toPrimitive; static toStringTag: @@toStringTag; static unscopables: @@unscopables; static for(key: string): symbol; static keyFor(sym: symbol): string; static useSimple(): void; static useSetter(): void; } class Object { static getOwnPropertySymbols(object: any): Array; } ``` Also wrapped some methods for correct work with `Symbol` polyfill. ```js class Object { static create(prototype: Object | null, properties?: { [property: PropertyKey]: PropertyDescriptor }): Object; static defineProperties(object: Object, properties: { [property: PropertyKey]: PropertyDescriptor })): Object; static defineProperty(object: Object, property: PropertyKey, attributes: PropertyDescriptor): Object; static getOwnPropertyDescriptor(object: any, property: PropertyKey): PropertyDescriptor | void; static getOwnPropertyNames(object: any): Array; propertyIsEnumerable(key: PropertyKey): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/symbol core-js(-pure)/es|stable|features/symbol/async-iterator core-js/es|stable|features/symbol/description core-js(-pure)/es|stable|features/symbol/has-instance core-js(-pure)/es|stable|features/symbol/is-concat-spreadable core-js(-pure)/es|stable|features/symbol/iterator core-js(-pure)/es|stable|features/symbol/match core-js(-pure)/es|stable|features/symbol/replace core-js(-pure)/es|stable|features/symbol/search core-js(-pure)/es|stable|features/symbol/species core-js(-pure)/es|stable|features/symbol/split core-js(-pure)/es|stable|features/symbol/to-primitive core-js(-pure)/es|stable|features/symbol/to-string-tag core-js(-pure)/es|stable|features/symbol/unscopables core-js(-pure)/es|stable|features/symbol/for core-js(-pure)/es|stable|features/symbol/key-for core-js(-pure)/es|stable|features/object/get-own-property-symbols core-js(-pure)/es|stable|features/math/to-string-tag ``` [*Basic example*](http://goo.gl/BbvWFc): ```js let Person = (() => { let NAME = Symbol('name'); return class { constructor(name) { this[NAME] = name; } getName() { return this[NAME]; } } })(); let person = new Person('Vasya'); console.log(person.getName()); // => 'Vasya' console.log(person['name']); // => undefined console.log(person[Symbol('name')]); // => undefined, symbols are uniq for (let key in person) console.log(key); // => nothing, symbols are not enumerable ``` `Symbol.for` & `Symbol.keyFor` [*example*](http://goo.gl/0pdJjX): ```js let symbol = Symbol.for('key'); symbol === Symbol.for('key'); // true Symbol.keyFor(symbol); // 'key' ``` [*Example*](http://goo.gl/mKVOQJ) with methods for getting own object keys: ```js let object = { a: 1 }; Object.defineProperty(object, 'b', { value: 2 }); object[Symbol('c')] = 3; Object.keys(object); // => ['a'] Object.getOwnPropertyNames(object); // => ['a', 'b'] Object.getOwnPropertySymbols(object); // => [Symbol(c)] Reflect.ownKeys(object); // => ['a', 'b', Symbol(c)] ``` [*Symbol#description getter*](https://goo.gl/MWizfc): ```js Symbol('foo').description; // => 'foo' Symbol().description; // => undefined ``` ##### Caveats when using `Symbol` polyfill: * We can't add new primitive type, `Symbol` returns object. * `Symbol.for` and `Symbol.keyFor` can't be shimmed cross-realm. * By default, to hide the keys, `Symbol` polyfill defines setter in `Object.prototype`. For this reason, uncontrolled creation of symbols can cause memory leak and the `in` operator is not working correctly with `Symbol` polyfill: `Symbol() in {} // => true`. You can disable defining setters in `Object.prototype`. [Example](http://goo.gl/N5UD7J): ```js Symbol.useSimple(); let symbol1 = Symbol('symbol1'); let object1 = {}; object1[symbol1] = true; for (let key in object1) console.log(key); // => 'Symbol(symbol1)_t.qamkg9f3q', w/o native Symbol Symbol.useSetter(); let symbol2 = Symbol('symbol2'); let object2 = {}; object2[symbol2] = true; for (let key in object2) console.log(key); // nothing ``` * Currently, `core-js` not adds setters to `Object.prototype` for well-known symbols for correct work something like `Symbol.iterator in foo`. It can cause problems with their enumerability. * Some problems possible with environment exotic objects (for example, IE `localStorage`). #### ECMAScript: Collections `core-js` uses native collections in most case, just fixes methods / constructor, if it's required, and in old environment uses fast polyfill (O(1) lookup). #### Map Module [`es.map`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.map.js). ```js class Map { constructor(iterable?: Iterable<[key, value]>): Map; clear(): void; delete(key: any): boolean; forEach(callbackfn: (value: any, key: any, target: any) => void, thisArg: any): void; get(key: any): any; has(key: any): boolean; set(key: any, val: any): this; values(): Iterator; keys(): Iterator; entries(): Iterator<[key, value]>; @@iterator(): Iterator<[key, value]>; readonly attribute size: number; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/map ``` [*Examples*](http://goo.gl/GWR7NI): ```js let array = [1]; let map = new Map([['a', 1], [42, 2]]); map.set(array, 3).set(true, 4); console.log(map.size); // => 4 console.log(map.has(array)); // => true console.log(map.has([1])); // => false console.log(map.get(array)); // => 3 map.forEach((val, key) => { console.log(val); // => 1, 2, 3, 4 console.log(key); // => 'a', 42, [1], true }); map.delete(array); console.log(map.size); // => 3 console.log(map.get(array)); // => undefined console.log(Array.from(map)); // => [['a', 1], [42, 2], [true, 4]] let map = new Map([['a', 1], ['b', 2], ['c', 3]]); for (let [key, value] of map) { console.log(key); // => 'a', 'b', 'c' console.log(value); // => 1, 2, 3 } for (let value of map.values()) console.log(value); // => 1, 2, 3 for (let key of map.keys()) console.log(key); // => 'a', 'b', 'c' for (let [key, value] of map.entries()) { console.log(key); // => 'a', 'b', 'c' console.log(value); // => 1, 2, 3 } ``` #### Set Module [`es.set`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.set.js). ```js class Set { constructor(iterable?: Iterable): Set; add(key: any): this; clear(): void; delete(key: any): boolean; forEach((value: any, key: any, target: any) => void, thisArg: any): void; has(key: any): boolean; values(): Iterator; keys(): Iterator; entries(): Iterator<[value, value]>; @@iterator(): Iterator; readonly attribute size: number; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/set ``` [*Examples*](http://goo.gl/bmhLwg): ```js let set = new Set(['a', 'b', 'a', 'c']); set.add('d').add('b').add('e'); console.log(set.size); // => 5 console.log(set.has('b')); // => true set.forEach(it => { console.log(it); // => 'a', 'b', 'c', 'd', 'e' }); set.delete('b'); console.log(set.size); // => 4 console.log(set.has('b')); // => false console.log(Array.from(set)); // => ['a', 'c', 'd', 'e'] let set = new Set([1, 2, 3, 2, 1]); for (let value of set) console.log(value); // => 1, 2, 3 for (let value of set.values()) console.log(value); // => 1, 2, 3 for (let key of set.keys()) console.log(key); // => 1, 2, 3 for (let [key, value] of set.entries()) { console.log(key); // => 1, 2, 3 console.log(value); // => 1, 2, 3 } ``` #### WeakMap Module [`es.weak-map`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.weak-map.js). ```js class WeakMap { constructor(iterable?: Iterable<[key, value]>): WeakMap; delete(key: Object): boolean; get(key: Object): any; has(key: Object): boolean; set(key: Object, val: any): this; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/weak-map ``` [*Examples*](http://goo.gl/SILXyw): ```js let a = [1]; let b = [2]; let c = [3]; let weakmap = new WeakMap([[a, 1], [b, 2]]); weakmap.set(c, 3).set(b, 4); console.log(weakmap.has(a)); // => true console.log(weakmap.has([1])); // => false console.log(weakmap.get(a)); // => 1 weakmap.delete(a); console.log(weakmap.get(a)); // => undefined // Private properties store: let Person = (() => { let names = new WeakMap; return class { constructor(name) { names.set(this, name); } getName() { return names.get(this); } } })(); let person = new Person('Vasya'); console.log(person.getName()); // => 'Vasya' for (let key in person) console.log(key); // => only 'getName' ``` #### WeakSet Module [`es.weak-set`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.weak-set.js). ```js class WeakSet { constructor(iterable?: Iterable): WeakSet; add(key: Object): this; delete(key: Object): boolean; has(key: Object): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/weak-set ``` [*Examples*](http://goo.gl/TdFbEx): ```js let a = [1]; let b = [2]; let c = [3]; let weakset = new WeakSet([a, b, a]); weakset.add(c).add(b).add(c); console.log(weakset.has(b)); // => true console.log(weakset.has([2])); // => false weakset.delete(b); console.log(weakset.has(b)); // => false ``` ##### Caveats when using collections polyfill: * Weak-collections polyfill stores values as hidden properties of keys. It works correct and not leak in most cases. However, it is desirable to store a collection longer than its keys. #### ECMAScript: Typed Arrays Implementations and fixes for `ArrayBuffer`, `DataView`, Typed Arrays constructors, static and prototype methods. Typed arrays work only in environments with support descriptors (IE9+), `ArrayBuffer` and `DataView` should work anywhere. Modules [`es.array-buffer.constructor`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array-buffer.constructor.js), [`es.array-buffer.is-view`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array-buffer.is-view.js), [`es.array-buffer.slice`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.array-buffer.slice.js), [`es.data-view`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.data-view.js), [`es.typed-array.int8-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.int8-array.js), [`es.typed-array.uint8-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.uint8-array.js), [`es.typed-array.uint8-clamped-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.uint8-clamped-array.js), [`es.typed-array.int16-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.int16-array.js), [`es.typed-array.uint16-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.uint16-array.js), [`es.typed-array.int32-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed.int32-array.js), [`es.typed-array.uint32-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.uint32-array.js), [`es.typed-array.float32-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.float32-array.js), [`es.typed-array.float64-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.float64-array.js), [`es.typed-array.copy-within`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.copy-within.js), [`es.typed-array.every`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.every.js), [`es.typed-array.fill`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.fill.js), [`es.typed-array.filter`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.filter.js), [`es.typed-array.find`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.find.js), [`es.typed-array.find-index`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.find-index.js), [`es.typed-array.for-each`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.for-each.js), [`es.typed-array.from`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.from.js), [`es.typed-array.includes`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.includes.js), [`es.typed-array.index-of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.index-of.js), [`es.typed-array.iterator`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.iterator.js), [`es.typed-array.last-index-of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.last-index-of.js), [`es.typed-array.map`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.map.js), [`es.typed-array.of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.of.js), [`es.typed-array.reduce`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.reduce.js), [`es.typed-array.reduce-right`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.reduce-right.js), [`es.typed-array.reverse`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.reverse.js), [`es.typed-array.set`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.set.js), [`es.typed-array.slice`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.slice.js), [`es.typed-array.some`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.some.js), [`es.typed-array.sort`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.sort.js), [`es.typed-array.subarray`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.subarray.js), [`es.typed-array.to-locale-string`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.to-locale-string.js) and [`es.typed-array.to-string`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.typed-array.to-string.js). ```js class ArrayBuffer { constructor(length: any): ArrayBuffer; slice(start: any, end: any): ArrayBuffer; readonly attribute byteLength: number; static isView(arg: any): boolean; } class DataView { constructor(buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; getInt8(offset: any): int8; getUint8(offset: any): uint8 getInt16(offset: any, littleEndian?: boolean = false): int16; getUint16(offset: any, littleEndian?: boolean = false): uint16; getInt32(offset: any, littleEndian?: boolean = false): int32; getUint32(offset: any, littleEndian?: boolean = false): uint32; getFloat32(offset: any, littleEndian?: boolean = false): float32; getFloat64(offset: any, littleEndian?: boolean = false): float64; setInt8(offset: any, value: any): void; setUint8(offset: any, value: any): void; setInt16(offset: any, value: any, littleEndian?: boolean = false): void; setUint16(offset: any, value: any, littleEndian?: boolean = false): void; setInt32(offset: any, value: any, littleEndian?: boolean = false): void; setUint32(offset: any, value: any, littleEndian?: boolean = false): void; setFloat32(offset: any, value: any, littleEndian?: boolean = false): void; setFloat64(offset: any, value: any, littleEndian?: boolean = false): void; readonly attribute buffer: ArrayBuffer; readonly attribute byteLength: number; readonly attribute byteOffset: number; } class [ Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, ] { constructor(length: number): %TypedArray%; constructor(object: %TypedArray% | Iterable | ArrayLike): %TypedArray%; constructor(buffer: ArrayBuffer, byteOffset?: number, length?: number): %TypedArray%; copyWithin(target: number, start: number, end?: number): this; every(callbackfn: (value: number, index: number, target: any) => boolean, thisArg?: any): boolean; fill(value: number, start?: number, end?: number): this; filter(callbackfn: (value: number, index: number, target: any) => boolean, thisArg?: any): %TypedArray%; find(callbackfn: (value: number, index: number, target: any) => boolean), thisArg?: any): any; findIndex(callbackfn: (value: number, index: number, target: any) => boolean, thisArg?: any): number; forEach(callbackfn: (value: number, index: number, target: any) => void, thisArg?: any): void; includes(searchElement: any, from?: number): boolean; indexOf(searchElement: any, from?: number): number; join(separator: string = ','): string; lastIndexOf(searchElement: any, from?: number): number; map(mapFn: (value: number, index: number, target: any) => number, thisArg?: any): %TypedArray%; reduce(callbackfn: (memo: any, value: number, index: number, target: any) => any, initialValue?: any): any; reduceRight(callbackfn: (memo: any, value: number, index: number, target: any) => any, initialValue?: any): any; reverse(): this; set(array: ArrayLike, offset?: number): void; slice(start?: number, end?: number): %TypedArray%; some(callbackfn: (value: number, index: number, target: any) => boolean, thisArg?: any): boolean; sort(comparefn?: (a: number, b: number) => number): this; subarray(begin?: number, end?: number): %TypedArray%; toString(): string; toLocaleString(): string; values(): Iterator; keys(): Iterator; entries(): Iterator<[index, value]>; @@iterator(): Iterator; readonly attribute buffer: ArrayBuffer; readonly attribute byteLength: number; readonly attribute byteOffset: number; readonly attribute length: number; BYTES_PER_ELEMENT: number; static from(items: Iterable | ArrayLike, mapFn?: (value: any, index: number) => any, thisArg?: any): %TypedArray%; static of(...args: Array): %TypedArray%; static BYTES_PER_ELEMENT: number; } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js/es|stable|features/array-buffer core-js/es|stable|features/array-buffer/constructor core-js/es|stable|features/array-buffer/is-view core-js/es|stable|features/array-buffer/slice core-js/es|stable|features/data-view core-js/es|stable|features/typed-array core-js/es|stable|features/typed-array/int8-array core-js/es|stable|features/typed-array/uint8-array core-js/es|stable|features/typed-array/uint8-clamped-array core-js/es|stable|features/typed-array/int16-array core-js/es|stable|features/typed-array/uint16-array core-js/es|stable|features/typed-array/int32-array core-js/es|stable|features/typed-array/uint32-array core-js/es|stable|features/typed-array/float32-array core-js/es|stable|features/typed-array/float64-array core-js/es|stable|features/typed-array/copy-within core-js/es|stable|features/typed-array/entries core-js/es|stable|features/typed-array/every core-js/es|stable|features/typed-array/fill core-js/es|stable|features/typed-array/filter core-js/es|stable|features/typed-array/find core-js/es|stable|features/typed-array/find-index core-js/es|stable|features/typed-array/for-each core-js/es|stable|features/typed-array/from core-js/es|stable|features/typed-array/includes core-js/es|stable|features/typed-array/index-of core-js/es|stable|features/typed-array/iterator core-js/es|stable|features/typed-array/join core-js/es|stable|features/typed-array/keys core-js/es|stable|features/typed-array/last-index-of core-js/es|stable|features/typed-array/map core-js/es|stable|features/typed-array/of core-js/es|stable|features/typed-array/reduce core-js/es|stable|features/typed-array/reduce-right core-js/es|stable|features/typed-array/reverse core-js/es|stable|features/typed-array/set core-js/es|stable|features/typed-array/slice core-js/es|stable|features/typed-array/some core-js/es|stable|features/typed-array/sort core-js/es|stable|features/typed-array/subarray core-js/es|stable|features/typed-array/to-locale-string core-js/es|stable|features/typed-array/to-string core-js/es|stable|features/typed-array/values ``` [*Examples*](http://goo.gl/yla75z): ```js new Int32Array(4); // => [0, 0, 0, 0] new Uint8ClampedArray([1, 2, 3, 666]); // => [1, 2, 3, 255] new Float32Array(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] let buffer = new ArrayBuffer(8); let view = new DataView(buffer); view.setFloat64(0, 123.456, true); new Uint8Array(buffer.slice(4)); // => [47, 221, 94, 64] Int8Array.of(1, 1.5, 5.7, 745); // => [1, 1, 5, -23] Uint8Array.from([1, 1.5, 5.7, 745]); // => [1, 1, 5, 233] let typed = new Uint8Array([1, 2, 3]); let a = typed.slice(1); // => [2, 3] typed.buffer === a.buffer; // => false let b = typed.subarray(1); // => [2, 3] typed.buffer === b.buffer; // => true typed.filter(it => it % 2); // => [1, 3] typed.map(it => it * 1.5); // => [1, 3, 4] for (let value of typed) console.log(value); // => 1, 2, 3 for (let value of typed.values()) console.log(value); // => 1, 2, 3 for (let key of typed.keys()) console.log(key); // => 0, 1, 2 for (let [key, value] of typed.entries()) { console.log(key); // => 0, 1, 2 console.log(value); // => 1, 2, 3 } ``` ##### Caveats when using typed arrays polyfills: * Polyfills of Typed Arrays constructors work completely how should work by the spec, but because of internal usage of getters / setters on each instance, are slow and consumes significant memory. However, polyfills of Typed Arrays constructors required mainly for old IE, all modern engines have native Typed Arrays constructors and require only fixes of constructors and polyfills of methods. #### ECMAScript: Reflect Modules [`es.reflect.apply`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.apply.js), [`es.reflect.construct`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.construct.js), [`es.reflect.define-property`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.define-property.js), [`es.reflect.delete-property`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.delete-property.js), [`es.reflect.get`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.get.js), [`es.reflect.get-own-property-descriptor`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.get-own-property-descriptor.js), [`es.reflect.get-prototype-of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.get-prototype-of.js), [`es.reflect.has`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.has.js), [`es.reflect.is-extensible`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.is-extensible.js), [`es.reflect.own-keys`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.own-keys.js), [`es.reflect.prevent-extensions`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.prevent-extensions.js), [`es.reflect.set`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.set.js), [`es.reflect.set-prototype-of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.reflect.set-prototype-of.js). ```js namespace Reflect { apply(target: Function, thisArgument: any, argumentsList: Array): any; construct(target: Function, argumentsList: Array, newTarget?: Function): Object; defineProperty(target: Object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; deleteProperty(target: Object, propertyKey: PropertyKey): boolean; get(target: Object, propertyKey: PropertyKey, receiver?: any): any; getOwnPropertyDescriptor(target: Object, propertyKey: PropertyKey): PropertyDescriptor | void; getPrototypeOf(target: Object): Object | null; has(target: Object, propertyKey: PropertyKey): boolean; isExtensible(target: Object): boolean; ownKeys(target: Object): Array; preventExtensions(target: Object): boolean; set(target: Object, propertyKey: PropertyKey, V: any, receiver?: any): boolean; setPrototypeOf(target: Object, proto: Object | null): boolean; // required __proto__ - IE11+ } ``` [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/es|stable|features/reflect core-js(-pure)/es|stable|features/reflect/apply core-js(-pure)/es|stable|features/reflect/construct core-js(-pure)/es|stable|features/reflect/define-property core-js(-pure)/es|stable|features/reflect/delete-property core-js(-pure)/es|stable|features/reflect/get core-js(-pure)/es|stable|features/reflect/get-own-property-descriptor core-js(-pure)/es|stable|features/reflect/get-prototype-of core-js(-pure)/es|stable|features/reflect/has core-js(-pure)/es|stable|features/reflect/is-extensible core-js(-pure)/es|stable|features/reflect/own-keys core-js(-pure)/es|stable|features/reflect/prevent-extensions core-js(-pure)/es|stable|features/reflect/set core-js(-pure)/es|stable|features/reflect/set-prototype-of ``` [*Examples*](http://goo.gl/gVT0cH): ```js let object = { a: 1 }; Object.defineProperty(object, 'b', { value: 2 }); object[Symbol('c')] = 3; Reflect.ownKeys(object); // => ['a', 'b', Symbol(c)] function C(a, b) { this.c = a + b; } let instance = Reflect.construct(C, [20, 22]); instance.c; // => 42 ``` #### ECMAScript: JSON Since `JSON` object is missed only in very old engines like IE7-, `core-js` does not provide a full `JSON` polyfill, however, fix already existing implementations by the current standard, for example, [well-formed `JSON.stringify`](https://github.com/tc39/proposal-well-formed-stringify). `JSON` also fixed in other modules - for example, `Symbol` polyfill fixes `JSON.stringify` for correct work with symbols. Module [`es.json.to-string-tag`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.json.to-string-tag.js) and [`es.json.stringify`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.json.stringify.js). ```js namespace JSON { stringify(target: any, replacer?: Function | Array, space?: string | number): string | void; @@toStringTag: 'JSON'; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/es|stable|features/json/stringify core-js(-pure)/es|stable|features/json/to-string-tag ``` [*Examples*](http://es6.zloirock.ru/#log(JSON.stringify(%7B%20'%F0%A0%AE%B7'%3A%20%5B'%5CuDF06%5CuD834'%5D%20%7D))%3B%20%2F%2F%20%3D%3E%20'%7B%22%F0%A0%AE%B7%22%3A%5B%22%5C%5Cudf06%5C%5Cud834%22%5D%7D'): ```js JSON.stringify({ '𠮷': ['\uDF06\uD834'] }); // => '{"𠮷":["\\udf06\\ud834"]}' ``` #### ECMAScript: globalThis Module [`es.global-this`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/es.global-this.js). ```js let globalThis: Object; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/es|stable|features/global-this ``` [*Examples*](https://goo.gl/LAifsc): ```js globalThis.Array === Array; // => true ``` ### ECMAScript proposals [The TC39 process.](https://tc39.github.io/process-document/) `core-js/stage/4` entry point contains only stage 4 proposals, `core-js/stage/3` - stage 3 and stage 4, etc. #### Stage 4 proposals Stage 4 proposals already marked in `core-js` as stable ECMAScript, they will be removed from proposals namespace in the next major `core-js` version. [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stage/4 ``` ##### [`globalThis`](https://github.com/tc39/proposal-global) Module [`esnext.global-this`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.global-this.js). ```js let globalThis: Object; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/global-this core-js(-pure)/features/global-this ``` [*Examples*](https://goo.gl/LAifsc): ```js globalThis.Array === Array; // => true ``` ##### [`String#matchAll`](https://github.com/tc39/proposal-string-matchall) Module [`esnext.string.match-all`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.string.match-all.js). ```js class String { matchAll(regexp: RegExp): Iterator; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/string-match-all ``` ##### [`Promise.allSettled`](https://github.com/tc39/proposal-promise-allSettled) Module [`esnext.promise.all-settled`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.promise.all-settled.js) ```js class Promise { static allSettled(iterable: Iterable): Promise; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/promise-all-settled ``` #### Stage 3 proposals [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stage/3 ``` ##### [`Promise.any`](https://github.com/tc39/proposal-promise-any) Modules [`esnext.promise.any`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.promise.any.js) and [`esnext.aggregate-error`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.aggregate-error.js) ```js class AggregateError { constructor(errors: Iterable, message: string): AggregateError; errors: Array; message: string; } class Promise { static any(promises: Iterable): Promise; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/promise-any core-js(-pure)/features/promise/any core-js(-pure)/features/aggregate-error ``` [*Examples*](https://goo.gl/iErvmp): ```js Promise.any([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(console.log); // => 1 Promise.any([ Promise.reject(1), Promise.reject(2), Promise.reject(3), ]).catch(({ errors }) => console.log(errors)); // => [1, 2, 3] ``` ##### [`String#replaceAll`](https://github.com/tc39/proposal-string-replace-all) Module [`esnext.string.replace-all`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.string.replace-all.js) ```js class String { replaceAll(searchValue: string | RegExp, replaceString: string | (searchValue, index, this) => string): string; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/string-replace-all core-js/features/string/replace-all ``` [*Examples*](https://goo.gl/wUXNXN): ```js 'Test abc test test abc test.'.replaceAll('abc', 'foo'); // -> 'Test foo test test foo test.' ``` #### Stage 2 proposals [*CommonJS entry points:*](#commonjs-api) ``` core-js(-pure)/stage/2 ``` ##### [New `Set` methods](https://github.com/tc39/proposal-set-methods) Modules [`esnext.set.difference`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.difference.js), [`esnext.set.intersection`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.intersection.js), [`esnext.set.is-disjoint-from`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.is-disjoint-from.js), [`esnext.set.is-subset-of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.is-subset-of.js), [`esnext.set.is-superset-of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.is-superset-of.js), [`esnext.set.symmetric-difference`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.symmetric-difference.js), [`esnext.set.union`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.union.js) ```js class Set { difference(iterable: Iterable): Set; intersection(iterable: Iterable): Set; isDisjointFrom(iterable: Iterable): boolean; isSubsetOf(iterable: Iterable): boolean; isSupersetOf(iterable: Iterable): boolean; symmetricDifference(iterable: Iterable): Set; union(iterable: Iterable): Set; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/set-methods core-js(-pure)/features/set/difference core-js(-pure)/features/set/intersection core-js(-pure)/features/set/is-disjoint-from core-js(-pure)/features/set/is-subset-of core-js(-pure)/features/set/is-superset-of core-js(-pure)/features/set/symmetric-difference core-js(-pure)/features/set/union ``` [*Examples*](https://goo.gl/QMQdaJ): ```js new Set([1, 2, 3]).union([3, 4, 5]); // => Set {1, 2, 3, 4, 5} new Set([1, 2, 3]).intersection([3, 4, 5]); // => Set {3} new Set([1, 2, 3]).difference([3, 4, 5]); // => Set {1, 2} new Set([1, 2, 3]).symmetricDifference([3, 4, 5]); // => Set {1, 2, 4, 5} new Set([1, 2, 3]).isDisjointFrom([4, 5, 6]); // => true new Set([1, 2, 3]).isSubsetOf([5, 4, 3, 2, 1]); // => true new Set([5, 4, 3, 2, 1]).isSupersetOf([1, 2, 3]); // => true ``` ##### [`Symbol.{ asyncDispose, dispose }` for `using` statement](https://github.com/tc39/proposal-using-statement) Modules [`esnext.symbol.dispose`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.symbol.dispose.js) and [`esnext.symbol.async-dispose`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.symbol.async-dispose.js). ```js class Symbol { static asyncDispose: @@asyncDispose; static dispose: @@dispose; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/using-statement core-js(-pure)/features/symbol/async-dispose core-js(-pure)/features/symbol/dispose ``` ##### [`Array.isTemplateObject`](https://github.com/tc39/proposal-array-is-template-object) Module [`esnext.array.is-template-object`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.array.is-template-object.js) ```js class Array { static isTemplateObject(value: any): boolean } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/array-is-template-object core-js(-pure)/features/array/is-template-object ``` *Example*: ```js console.log(Array.isTemplateObject((it => it)`qwe${ 123 }asd`)); // => true ``` ##### [Iterator helpers](https://github.com/tc39/proposal-iterator-helpers) Modules [`esnext.async-iterator.constructor`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.constructor.js), [`esnext.async-iterator.as-indexed-pairs`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.as-indexed-pairs.js), [`esnext.async-iterator.drop`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.drop.js), [`esnext.async-iterator.every`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.every.js), [`esnext.async-iterator.filter`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.filter.js), [`esnext.async-iterator.find`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.find.js), [`esnext.async-iterator.flat-map`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.flat-map.js), [`esnext.async-iterator.for-each`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.for-each.js), [`esnext.async-iterator.from`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.from.js), [`esnext.async-iterator.map`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.map.js), [`esnext.async-iterator.reduce`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.reduce.js), [`esnext.async-iterator.some`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.some.js), [`esnext.async-iterator.take`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.take.js), [`esnext.async-iterator.to-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.async-iterator.to-array.js), [`esnext.iterator.constructor`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.constructor.js), [`esnext.iterator.as-indexed-pairs`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.as-indexed-pairs.js), [`esnext.iterator.drop`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.drop.js), [`esnext.iterator.every`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.every.js), [`esnext.iterator.filter`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.filter.js), [`esnext.iterator.find`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.find.js), [`esnext.iterator.flat-map`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.flat-map.js), [`esnext.iterator.for-each`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.for-each.js), [`esnext.iterator.from`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.from.js), [`esnext.iterator.map`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.map.js), [`esnext.iterator.reduce`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.reduce.js), [`esnext.iterator.some`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.some.js), [`esnext.iterator.take`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.take.js) and [`esnext.iterator.to-array`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.iterator.to-array.js) ```js class Iterator { static from(iterable: Iterable): Iterator; asIndexedPairs(): Iterator<[index, any]>; drop(limit: uint): Iterator; every(callbackfn: value: any => boolean): boolean; filter(callbackfn: value: any => boolean): Iterator; find(callbackfn: value: any => boolean)): any; flatMap(callbackfn: value => any: Iterable): Iterator; forEach(callbackfn: value => void): void; map(callbackfn: value => any): Iterator; reduce(callbackfn: (memo: any, value: any) => any, initialValue: any): any; some(callbackfn: value: any => boolean): boolean; take(limit: uint): Iterator; toArray(): Array; @@toStringTag: 'Iterator' } class AsyncIterator { static from(iterable: Iterable): AsyncIterator; asIndexedPairs(): AsyncIterator<[index, any]>; drop(limit: uint): AsyncIterator; every(async callbackfn: value: any => boolean): Promise; filter(async callbackfn: value: any => boolean): AsyncIterator; find(async callbackfn: value: any => boolean)): Promise; flatMap(async callbackfn: value => any: Iterable): AsyncIterator; forEach(async callbackfn: value => void): Promise; map(async callbackfn: value => any): AsyncIterator; reduce(async callbackfn: (memo: any, value: any) => any, initialValue: any): Promise; some(async callbackfn: value: any => boolean): Promise; take(limit: uint): AsyncIterator; toArray(): Promise; @@toStringTag: 'AsyncIterator' } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/iterator-helpers core-js(-pure)/features/async-iterator core-js(-pure)/features/async-iterator/as-indexed-pairs core-js(-pure)/features/async-iterator/drop core-js(-pure)/features/async-iterator/every core-js(-pure)/features/async-iterator/filter core-js(-pure)/features/async-iterator/find core-js(-pure)/features/async-iterator/flat-map core-js(-pure)/features/async-iterator/for-each core-js(-pure)/features/async-iterator/from core-js(-pure)/features/async-iterator/map core-js(-pure)/features/async-iterator/reduce core-js(-pure)/features/async-iterator/some core-js(-pure)/features/async-iterator/take core-js(-pure)/features/async-iterator/to-array core-js(-pure)/features/iterator core-js(-pure)/features/iterator/as-indexed-pairs core-js(-pure)/features/iterator/drop core-js(-pure)/features/iterator/every core-js(-pure)/features/iterator/filter core-js(-pure)/features/iterator/find core-js(-pure)/features/iterator/flat-map core-js(-pure)/features/iterator/for-each core-js(-pure)/features/iterator/from core-js(-pure)/features/iterator/map core-js(-pure)/features/iterator/reduce core-js(-pure)/features/iterator/some core-js(-pure)/features/iterator/take core-js(-pure)/features/iterator/to-array ``` [Examples](http://es6.zloirock.ru/#log(%5B1%2C%202%2C%203%2C%204%2C%205%2C%206%2C%207%5D.values()%0A%20%20.drop(1)%0A%20%20.take(5)%0A%20%20.filter(it%20%3D%3E%20it%20%25%202)%0A%20%20.map(it%20%3D%3E%20it%20**%202)%0A%20%20.toArray())%3B%20%2F%2F%20%3D%3E%20%5B9%2C%2025%5D%0A%0Alog(Iterator.from(%7B%0A%20%20next%3A%20()%20%3D%3E%20(%7B%20done%3A%20Math.random()%20%3E%20.9%2C%20value%3A%20Math.random()%20*%2010%20%7C%200%20%7D)%0A%7D).toArray())%3B%20%2F%2F%20%3D%3E%20%5B7%2C%206%2C%203%2C%200%2C%202%2C%208%5D%0A%0AAsyncIterator.from(%5B1%2C%202%2C%203%2C%204%2C%205%2C%206%2C%207%5D)%0A%20%20.drop(1)%0A%20%20.take(5)%0A%20%20.filter(it%20%3D%3E%20it%20%25%202)%0A%20%20.map(it%20%3D%3E%20it%20**%202)%0A%20%20.toArray()%0A%20%20.then(log)%3B%20%2F%2F%20%3D%3E%20%5B9%2C%2025%5D): ```js [1, 2, 3, 4, 5, 6, 7].values() .drop(1) .take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray(); // => [9, 25] Iterator.from({ next: () => ({ done: Math.random() > .9, value: Math.random() * 10 | 0 }) }).toArray(); // => [7, 6, 3, 0, 2, 8] AsyncIterator.from([1, 2, 3, 4, 5, 6, 7]) .drop(1) .take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray() .then(console.log); // => [9, 25] ``` ###### Caveats: - For preventing prototypes pollution, in the `pure` version, new `%IteratorPrototype%` methods are not added to the real `%IteratorPrototype%`, they available only on wrappers - instead of `[].values().map(fn)` use `Iterator.from([]).map(fn)`. - Now, we have access to the real `%AsyncIteratorPrototype%` only with usage async generators syntax. So, for compatibility the library with old browsers, we should use `Function` constructor. However, that breaks compatibility with CSP. So, if you wanna use the real `%AsyncIteratorPrototype%`, you should set `USE_FUNCTION_CONSTRUCTOR` option in the `core-js/configurator` to `true`: ```js const configurator = require('core-js/configurator'); configurator({ USE_FUNCTION_CONSTRUCTOR: true }); require('core-js'); (async function * () { /* empty */ })() instanceof AsyncIterator; // => true ``` ##### [`Map#upsert`](https://github.com/thumbsupep/proposal-upsert) Modules [`esnext.map.upsert`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.upsert.js) and [`esnext.weak-map.upsert`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.weak-map.upsert.js) ```js class Map { upsert(key: any, onUpdate: (value: any) => updated: any, onInsert: () => value: any): updated | value; } class WeakMap { upsert(key: Object, onUpdate: (value: any) => updated: any, onInsert: () => value: any): updated | value; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/map-upsert core-js(-pure)/features/map/upsert core-js(-pure)/features/weak-map/upsert ``` [*Examples*](http://es6.zloirock.ru/#const%20map%20%3D%20new%20Map(%5B%5B'a'%2C%202%5D%5D)%3B%0A%0Amap.upsert('a'%2C%20it%20%3D%3E%20it%20**%202%2C%20()%20%3D%3E%203)%3B%20%2F%2F%20%3D%3E%204%0A%0Amap.upsert('b'%2C%20it%20%3D%3E%20it%20**%202%2C%20()%20%3D%3E%203)%3B%20%2F%2F%20%3D%3E%203%0A%0Alog(map)%3B%20%2F%2F%20%3D%3E%20%7B%20'a'%3A%204%2C%20'b'%3A%203%20%7D): ```js const map = new Map([['a', 2]]); map.upsert('a', it => it ** 2, () => 3); // => 4 map.upsert('b', it => it ** 2, () => 3); // => 3 console.log(map); // => Map { 'a': 4, 'b': 3 } ``` #### Stage 1 proposals [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stage/1 ``` ##### [Getting last item from `Array`](https://github.com/keithamus/proposal-array-last) Modules [`esnext.array.last-item`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.array.last-item.js) and [`esnext.array.last-index`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.array.last-index.js) ```js class Array { attribute lastItem: any; readonly attribute lastIndex: uint; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/array-last core-js/features/array/last-item core-js/features/array/last-index ``` [*Examples*](https://goo.gl/2TmcMT): ```js [1, 2, 3].lastItem; // => 3 [1, 2, 3].lastIndex; // => 2 const array = [1, 2, 3]; array.lastItem = 4; array; // => [1, 2, 4] ``` ##### [`Promise.try`](https://github.com/tc39/proposal-promise-try) Module [`esnext.promise.try`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.promise.try.js) ```js class Promise { static try(callbackfn: Function): promise; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/promise-try core-js(-pure)/features/promise/try ``` [*Examples*](https://goo.gl/k5GGRo): ```js Promise.try(() => 42).then(it => console.log(`Promise, resolved as ${it}`)); Promise.try(() => { throw 42; }).catch(it => console.log(`Promise, rejected as ${it}`)); ``` #### New collections methods: ##### [New `Set` and `Map` methods](https://github.com/tc39/proposal-collection-methods) Modules [`esnext.set.add-all`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.add-all.js), [`esnext.set.delete-all`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.delete-all.js), [`esnext.set.every`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.every.js), [`esnext.set.filter`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.filter.js), [`esnext.set.find`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.find.js), [`esnext.set.join`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.join.js), [`esnext.set.map`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.map.js), [`esnext.set.reduce`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.reduce.js), [`esnext.set.some`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.some.js), [`esnext.map.delete-all`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.delete-all.js), [`esnext.map.every`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.every.js), [`esnext.map.filter`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.filter.js), [`esnext.map.find`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.find.js), [`esnext.map.find-key`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.find-key.js), [`esnext.map.group-by`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.group-by.js), [`esnext.map.includes`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.includes.js), [`esnext.map.key-by`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.key-by.js), [`esnext.map.key-of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.key-of.js), [`esnext.map.map-keys`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.map-keys.js), [`esnext.map.map-values`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.map-values.js), [`esnext.map.merge`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.merge.js), [`esnext.map.reduce`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.reduce.js), [`esnext.map.some`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.some.js), [`esnext.map.update`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.update.js), [`esnext.weak-set.add-all`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.weak-set.add-all.js), [`esnext.weak-set.delete-all`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.weak-set.delete-all.js), [`esnext.weak-map.delete-all`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.weak-map.delete-all.js) ##### [`.of` and `.from` methods on collection constructors](https://github.com/tc39/proposal-setmap-offrom) Modules [`esnext.set.of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.of.js), [`esnext.set.from`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.set.from.js), [`esnext.map.of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.of.js), [`esnext.map.from`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.map.from.js), [`esnext.weak-set.of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.weak-set.of.js), [`esnext.weak-set.from`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.weak-set.from.js), [`esnext.weak-map.of`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.weak-map.of.js), [`esnext.weak-map.from`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.weak-map.from.js) ```js class Set { static of(...args: Array): Set; static from(iterable: Iterable, mapFn?: (value: any, index: number) => any, thisArg?: any): Set; addAll(...args: Array): this; deleteAll(...args: Array): boolean; every(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): boolean; filter(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): Set; find(callbackfn: (value: any, key: any, target: any) => boolean), thisArg?: any): any; join(separator: string = ','): string; map(callbackfn: (value: any, key: any, target: any) => any, thisArg?: any): Set; reduce(callbackfn: (memo: any, value: any, key: any, target: any) => any, initialValue?: any): any; some(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): boolean; } class Map { static groupBy(iterable: Iterable, callbackfn?: (value: any) => any): Map; static of(...args: Array<[key, value]>): Map; static from(iterable: Iterable, mapFn?: (value: any, index: number) => [key: any, value: any], thisArg?: any): Map; static keyBy(iterable: Iterable, callbackfn?: (value: any) => any): Map; deleteAll(...args: Array): boolean; every(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): boolean; filter(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): Map; find(callbackfn: (value: any, key: any, target: any) => boolean), thisArg?: any): any; findKey(callbackfn: (value: any, key: any, target: any) => boolean), thisArg?: any): any; includes(searchElement: any): boolean; keyOf(searchElement: any): any; mapKeys(mapFn: (value: any, index: number, target: any) => any, thisArg?: any): Map; mapValues(mapFn: (value: any, index: number, target: any) => any, thisArg?: any): Map; merge(...iterables: Array): this; reduce(callbackfn: (memo: any, value: any, key: any, target: any) => any, initialValue?: any): any; some(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): boolean; update(key: any, callbackfn: (value: any, key: any, target: any) => any, thunk?: (key: any, target: any) => any): this; } class WeakSet { static of(...args: Array): WeakSet; static from(iterable: Iterable, mapFn?: (value: any, index: number) => Object, thisArg?: any): WeakSet; addAll(...args: Array): this; deleteAll(...args: Array): boolean; } class WeakMap { static of(...args: Array<[key, value]>): WeakMap; static from(iterable: Iterable, mapFn?: (value: any, index: number) => [key: Object, value: any], thisArg?: any): WeakMap; deleteAll(...args: Array): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/collection-methods core-js/proposals/collection-of-from core-js(-pure)/features/set/add-all core-js(-pure)/features/set/delete-all core-js(-pure)/features/set/every core-js(-pure)/features/set/filter core-js(-pure)/features/set/find core-js(-pure)/features/set/from core-js(-pure)/features/set/join core-js(-pure)/features/set/map core-js(-pure)/features/set/of core-js(-pure)/features/set/reduce core-js(-pure)/features/set/some core-js(-pure)/features/map/delete-all core-js(-pure)/features/map/every core-js(-pure)/features/map/filter core-js(-pure)/features/map/find core-js(-pure)/features/map/find-key core-js(-pure)/features/map/from core-js(-pure)/features/map/group-by core-js(-pure)/features/map/includes core-js(-pure)/features/map/key-by core-js(-pure)/features/map/key-of core-js(-pure)/features/map/map-keys core-js(-pure)/features/map/map-values core-js(-pure)/features/map/merge core-js(-pure)/features/map/of core-js(-pure)/features/map/reduce core-js(-pure)/features/map/some core-js(-pure)/features/map/update core-js(-pure)/features/weak-set/add-all core-js(-pure)/features/weak-set/delete-all core-js(-pure)/features/weak-set/of core-js(-pure)/features/weak-set/from core-js(-pure)/features/weak-map/delete-all core-js(-pure)/features/weak-map/of core-js(-pure)/features/weak-map/from ``` `.of` / `.from` [*examples*](https://goo.gl/mSC7eU): ```js Set.of(1, 2, 3, 2, 1); // => Set {1, 2, 3} Map.from([[1, 2], [3, 4]], ([key, value]) => [key ** 2, value ** 2]); // => Map { 1: 4, 9: 16 } ``` ##### [`compositeKey` and `compositeSymbol` methods](https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey) Modules [`esnext.composite-key`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.composite-key.js) and [`esnext.composite-symbol`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.composite-symbol.js) ```js function compositeKey(...args: Array): object; function compositeSymbol(...args: Array): symbol; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/keys-composition core-js(-pure)/features/composite-key core-js(-pure)/features/composite-symbol ``` [*Examples*](https://goo.gl/2oPAH7): ```js // returns a symbol const symbol = compositeSymbol({}); console.log(typeof symbol); // => 'symbol' // works the same, but returns a plain frozen object without a prototype const key = compositeKey({}); console.log(typeof key); // => 'object' console.log({}.toString.call(key)); // => '[object Object]' console.log(Object.getPrototypeOf(key)); // => null console.log(Object.isFrozen(key)); // => true const a = ['a']; const b = ['b']; const c = ['c']; console.log(compositeSymbol(a) === compositeSymbol(a)); // => true console.log(compositeSymbol(a) !== compositeSymbol(['a'])); // => true console.log(compositeSymbol(a, 1) === compositeSymbol(a, 1)); // => true console.log(compositeSymbol(a, b) !== compositeSymbol(b, a)); // => true console.log(compositeSymbol(a, b, c) === compositeSymbol(a, b, c)); // => true console.log(compositeSymbol(1, a) === compositeSymbol(1, a)); // => true console.log(compositeSymbol(1, a, 2, b) === compositeSymbol(1, a, 2, b)); // => true console.log(compositeSymbol(a, a) === compositeSymbol(a, a)); // => true ``` ##### [`Observable`](https://github.com/zenparsing/es-observable) Modules [`esnext.observable`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.observable.js) and [`esnext.symbol.observable`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.symbol.observable.js) ```js class Observable { constructor(subscriber: Function): Observable; subscribe(observer: Function | { next?: Function, error?: Function, complete?: Function }): Subscription; @@observable(): this; static of(...items: Aray): Observable; static from(x: Observable | Iterable): Observable; static readonly attribute @@species: this; } class Symbol { static observable: @@observable; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/observable core-js(-pure)/features/observable core-js(-pure)/features/symbol/observable ``` [*Examples*](http://goo.gl/1LDywi): ```js new Observable(observer => { observer.next('hello'); observer.next('world'); observer.complete(); }).subscribe({ next(it) { console.log(it); }, complete() { console.log('!'); } }); ``` ##### [`Math` extensions](https://github.com/rwaldron/proposal-math-extensions) Modules [`esnext.math.clamp`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.clamp.js), [`esnext.math.deg-per-rad`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.deg-per-rad.js), [`esnext.math.degrees`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.degrees.js), [`esnext.math.fscale`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.fscale.js), [`esnext.math.rad-per-deg`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.rad-per-deg.js), [`esnext.math.radians`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.radians.js) and [`esnext.math.scale`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.scale.js) ```js namespace Math { DEG_PER_RAD: number; RAD_PER_DEG: number; clamp(x: number, lower: number, upper: number): number; degrees(radians: number): number; fscale(x: number, inLow: number, inHigh: number, outLow: number, outHigh: number): number; radians(degrees: number): number; scale(x: number, inLow: number, inHigh: number, outLow: number, outHigh: number): number; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/math-extensions core-js(-pure)/features/math/clamp core-js(-pure)/features/math/deg-per-rad core-js(-pure)/features/math/degrees core-js(-pure)/features/math/fscale core-js(-pure)/features/math/rad-per-deg core-js(-pure)/features/math/radians core-js(-pure)/features/math/scale ``` ##### [`Math.signbit`](https://github.com/tc39/proposal-Math.signbit) Module [`esnext.math.signbit`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.signbit.js) ```js namespace Math { signbit(x: number): boolean; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/math-signbit core-js(-pure)/features/math/signbit ``` [*Examples*](https://goo.gl/rPWbzZ): ```js Math.signbit(NaN); // => false Math.signbit(1); // => false Math.signbit(-1); // => true Math.signbit(0); // => false Math.signbit(-0); // => true ``` ##### [`Number.fromString`](https://github.com/tc39/proposal-number-fromstring) Module [`esnext.number.from-string`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.number.from-string.js) ```js class Number { fromString(string: string, radix: number): number; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/number-from-string core-js(-pure)/features/number/from-string ``` ##### [`String#codePoints`](https://github.com/tc39/proposal-string-prototype-codepoints) Module [`esnext.string.code-points`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.string.code-points.js) ```js class String { codePoints(): Iterator<{ codePoint, position }>; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/string-code-points core-js(-pure)/features/string/code-points ``` [*Example*](https://goo.gl/Jt7SsD): ```js for (let { codePoint, position } of 'qwe'.codePoints()) { console.log(codePoint); // => 113, 119, 101 console.log(position); // => 0, 1, 2 } ``` ##### [Seeded pseudo-random numbers](https://github.com/tc39/proposal-seeded-random) Module [`esnext.math.seeded-prng`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.seeded-prng.js) ```js class Math { seededPRNG({ seed: number }): Iterator; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/seeded-random core-js(-pure)/features/math/seeded-prng ``` [*Example*](https://goo.gl/oj3WgQ): ```js for (let x of Math.seededPRNG({ seed: 42 })) { console.log(x); // => 0.16461519912315087, 0.2203933906000046, 0.8249682894209105 if (x > .8) break; } ``` ##### [`Symbol.patternMatch` for pattern matching](https://github.com/tc39/proposal-pattern-matching) Module [`esnext.symbol.pattern-match`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.symbol.pattern-match.js). ```js class Symbol { static patternMatch: @@patternMatch; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/pattern-matching core-js(-pure)/features/symbol/pattern-match ``` ##### [Object iteration](https://github.com/tc39/proposal-object-iteration) Modules [`esnext.object.iterate-keys`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.object.iterate-keys.js), [`esnext.object.iterate-values`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.object.iterate-values.js), [`esnext.object.iterate-entries`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.object.iterate-entries.js). ```js class Object { iterateKeys(object: any): Iterator; iterateValues(object: any): Iterator; iterateEntries(object: any): Iterator<[string, any]>; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/object-iteration core-js(-pure)/features/object/iterate-keys core-js(-pure)/features/object/iterate-values core-js(-pure)/features/object/iterate-entries ``` [*Example*](http://es6.zloirock.ru/#const%20obj%20%3D%20%7B%20foo%3A%20'bar'%2C%20baz%3A%20'blah'%20%7D%3B%0A%0Afor%20(const%20%5Bkey%2C%20value%5D%20of%20Object.iterateEntries(obj))%20%7B%0A%20%20log(%60%24%7Bkey%7D%20-%3E%20%24%7Bvalue%7D%60)%3B%0A%7D%0A%0Afor%20(const%20key%20of%20Object.iterateKeys(obj))%20%7B%0A%20%20log(key)%3B%0A%7D%0A%0Afor%20(const%20value%20of%20Object.iterateValues(obj))%20%7B%0A%20%20log(value)%3B%0A%7D): ```js const obj = { foo: 'bar', baz: 'blah' }; for (const [key, value] of Object.iterateEntries(obj)) { console.log(`${key} -> ${value}`); } for (const key of Object.iterateKeys(obj)) { console.log(key); } for (const value of Object.iterateValues(obj)) { console.log(value); } ``` #### Stage 0 proposals [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stage/0 ``` ##### [`URL`](https://github.com/jasnell/proposal-url) See more info [in web standards namespace](#url-and-urlsearchparams) ##### [`String#at`](https://github.com/mathiasbynens/String.prototype.at) Module [`esnext.string.at`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.string.at.js) ```js class String { at(index: number): string; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/string-at core-js(-pure)/features/string/at core-js(-pure)/features/string/virtual/at ``` [*Examples*](http://goo.gl/XluXI8): ```js 'a𠮷b'.at(1); // => '𠮷' 'a𠮷b'.at(1).length; // => 2 ``` ##### [Efficient 64 bit arithmetic](https://gist.github.com/BrendanEich/4294d5c212a6d2254703) Modules [`esnext.math.iaddh`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.iaddh.js), [`esnext.math.isubh`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.isubh.js), [`esnext.math.imulh`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.imulh.js) and [`esnext.math.umulh`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.math.umulh.js) ```js namespace Math { iaddh(lo0: number, hi0: number, lo1: number, hi1: number): number; isubh(lo0: number, hi0: number, lo1: number, hi1: number): number; imulh(a: number, b: number): number; umulh(a: number, b: number): number; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/efficient-64-bit-arithmetic core-js(-pure)/features/math/iaddh core-js(-pure)/features/math/isubh core-js(-pure)/features/math/imulh core-js(-pure)/features/math/umulh ``` #### Pre-stage 0 proposals [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/stage/pre ``` ##### [`Reflect` metadata](https://github.com/rbuckton/reflect-metadata) Modules [`esnext.reflect.define-metadata`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.reflect.define-metadata.js), [`esnext.reflect.delete-metadata`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.reflect.delete-metadata.js), [`esnext.reflect.get-metadata`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.reflect.get-metadata.js), [`esnext.reflect.get-metadata-keys`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.reflect.get-metadata-keys.js), [`esnext.reflect.get-own-metadata`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.reflect.get-own-metadata.js), [`esnext.reflect.get-own-metadata-keys`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.reflect.get-own-metadata-keys.js), [`esnext.reflect.has-metadata`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.reflect.has-metadata.js), [`esnext.reflect.has-own-metadata`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.reflect.has-own-metadata.js) and [`esnext.reflect.metadata`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/esnext.reflect.metadata.js). ```js namespace Reflect { defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey?: PropertyKey): void; getMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): any; getOwnMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): any; hasMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): boolean; hasOwnMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): boolean; deleteMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): boolean; getMetadataKeys(target: Object, propertyKey?: PropertyKey): Array; getOwnMetadataKeys(target: Object, propertyKey?: PropertyKey): Array; metadata(metadataKey: any, metadataValue: any): decorator(target: Object, targetKey?: PropertyKey) => void; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/reflect-metadata core-js(-pure)/features/reflect/define-metadata core-js(-pure)/features/reflect/delete-metadata core-js(-pure)/features/reflect/get-metadata core-js(-pure)/features/reflect/get-metadata-keys core-js(-pure)/features/reflect/get-own-metadata core-js(-pure)/features/reflect/get-own-metadata-keys core-js(-pure)/features/reflect/has-metadata core-js(-pure)/features/reflect/has-own-metadata core-js(-pure)/features/reflect/metadata ``` [*Examples*](http://goo.gl/KCo3PS): ```js let object = {}; Reflect.defineMetadata('foo', 'bar', object); Reflect.ownKeys(object); // => [] Reflect.getOwnMetadataKeys(object); // => ['foo'] Reflect.getOwnMetadata('foo', object); // => 'bar' ``` ### Web standards [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/web ``` #### `setTimeout` and `setInterval` Module [`web.timers`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/web.timers.js). Additional arguments fix for IE9-. ```js function setTimeout(callback: any, time: any, ...args: Array): number; function setInterval(callback: any, time: any, ...args: Array): number; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/web/timers core-js(-pure)/stable|features/set-timeout core-js(-pure)/stable|features/set-interval ``` ```js // Before: setTimeout(log.bind(null, 42), 1000); // After: setTimeout(log, 1000, 42); ``` #### `setImmediate` Module [`web.immediate`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/web.immediate.js). [`setImmediate`](http://w3c.github.io/setImmediate/) polyfill. ```js function setImmediate(callback: any, ...args: Array): number; function clearImmediate(id: number): void; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/web/immediate core-js(-pure)/stable|features/set-immediate core-js(-pure)/stable|features/clear-immediate ``` [*Examples*](http://goo.gl/6nXGrx): ```js setImmediate((arg1, arg2) => { console.log(arg1, arg2); // => Message will be displayed with minimum delay }, 'Message will be displayed', 'with minimum delay'); clearImmediate(setImmediate(() => { console.log('Message will not be displayed'); })); ``` #### `queueMicrotask` [Spec](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask), module [`web.queue-microtask`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/web.queue-microtask.js) ```js function queueMicrotask(fn: Function): void; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/web/queue-microtask core-js(-pure)/stable|features/queue-microtask ``` [*Examples*](https://goo.gl/nsW8P9): ```js queueMicrotask(() => console.log('called as microtask')); ``` #### `URL` and `URLSearchParams` [`URL` standard](https://url.spec.whatwg.org/) implementation. Modules [`web.url`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/web.url.js), [`web.url.to-json`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/web.url.to-json.js), [`web.url-search-params`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/web.url-search-params.js). ```js class URL { constructor(url: string, base?: string); attribute href: string; readonly attribute origin: string; attribute protocol: string; attribute username: string; attribute password: string; attribute host: string; attribute hostname: string; attribute port: string; attribute pathname: string; attribute search: string; readonly attribute searchParams: URLSearchParams; attribute hash: string; toJSON(): string; toString(): string; } class URLSearchParams { constructor(params?: string | Iterable<[key, value]> | Object); append(name: string, value: string): void; delete(name: string): void; get(name: string): string | void; getAll(name: string): Array; has(name: string): boolean; set(name: string, value: string): void; sort(): void; toString(): string; forEach(callbackfn: (value: any, index: number, target: any) => void, thisArg: any): void; entries(): Iterator<[key, value]>; keys(): Iterator; values(): Iterator; @@iterator(): Iterator<[key, value]>; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js/proposals/url core-js(-pure)/web/url core-js(-pure)/web/url-search-params core-js(-pure)/stable|features/url core-js/stable|features/url/to-json core-js(-pure)/stable|features/url-search-params core-js/stable|features/url-search-params/sort ``` [*Examples*](https://goo.gl/kksjwV): ```js const url = new URL('http://login:password@example.com:8080/foo/bar?a=1&b=2&a=3#fragment'); console.log(url.href); // => 'http://login:password@example.com:8080/foo/bar?a=1&b=2#fragment' console.log(url.origin); // => 'http://example.com:8080' console.log(url.protocol); // => 'http:' console.log(url.username); // => 'login' console.log(url.password); // => 'password' console.log(url.host); // => 'example.com:8080' console.log(url.hostname); // => 'example.com' console.log(url.port); // => '8080' console.log(url.pathname); // => '/foo/bar' console.log(url.search); // => '?a=1&b=2&a=3' console.log(url.hash); // => '#fragment' console.log(url.toJSON()); // => 'http://login:password@example.com:8080/foo/bar?a=1&b=2&a=3#fragment' console.log(url.toString()); // => 'http://login:password@example.com:8080/foo/bar?a=1&b=2&a=3#fragment' for (let [key, value] of url.searchParams) { console.log(key); // => 'a', 'b' console.log(value); // => '1', '2' } url.pathname = ''; url.searchParams.append('c', 3); console.log(url.search); // => '?a=1&b=2&c=3' console.log(url.href); // => 'http://login:password@example.com:8080/?a=1&a=3&b=2&c=4#fragment' const params = new URLSearchParams('?a=1&b=2&a=3'); params.append('c', 4); params.append('a', 2); params.sort(); for (let [key, value] of params) { console.log(key); // => 'a', 'a', 'a', 'b', 'c' console.log(value); // => '1', '3', '2', '2', '4' } console.log(params.toString()); // => 'a=1&a=3&a=2&b=2&c=4' ``` ##### Caveats when using `URL` and `URLSearchParams`: - IE8 does not support setters, so they do not work on `URL` instances. However, `URL` constructor can be used for basic `URL` parsing. - Legacy encodings in a search query are not supported. Also, `core-js` implementation has some other encoding-related issues. - `URL` implementations from all of the popular browsers have much more problems than `core-js`, however, replacing all of them does not looks like a good idea. You can customize the aggressiveness of polyfill [by your requirements](#configurable-level-of-aggressiveness). #### Iterable DOM collections Some DOM collections should have [iterable interface](https://heycam.github.io/webidl/#idl-iterable) or should be [inherited from `Array`](https://heycam.github.io/webidl/#LegacyArrayClass). That means they should have `forEach`, `keys`, `values`, `entries` and `@@iterator` methods for iteration. So add them. Modules [`web.dom-collections.iterator`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/web.dom-collections.iterator.js) and [`web.dom-collections.for-each`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/web.dom-collections.for-each.js). ```js class [ CSSRuleList, CSSStyleDeclaration, CSSValueList, ClientRectList, DOMRectList, DOMStringList, DataTransferItemList, FileList, HTMLAllCollection, HTMLCollection, HTMLFormElement, HTMLSelectElement, MediaList, MimeTypeArray, NamedNodeMap, PaintRequestList, Plugin, PluginArray, SVGLengthList, SVGNumberList, SVGPathSegList, SVGPointList, SVGStringList, SVGTransformList, SourceBufferList, StyleSheetList, TextTrackCueList, TextTrackList, TouchList, ] { @@iterator(): Iterator; } class [DOMTokenList, NodeList] { forEach(callbackfn: (value: any, index: number, target: any) => void, thisArg: any): void; entries(): Iterator<[key, value]>; keys(): Iterator; values(): Iterator; @@iterator(): Iterator; } ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js(-pure)/web/dom-collections core-js(-pure)/stable|features/dom-collections/iterator core-js/stable|features/dom-collections/for-each ``` [*Examples*](http://goo.gl/lfXVFl): ```js for (let { id } of document.querySelectorAll('*')) { if (id) console.log(id); } for (let [index, { id }] of document.querySelectorAll('*').entries()) { if (id) console.log(index, id); } document.querySelectorAll('*').forEach(it => console.log(it.id)); ``` ### Iteration helpers Modules [`core.is-iterable`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/core.is-iterable.js), [`core.get-iterator`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/core.get-iterator.js), [`core.get-iterator-method`](https://github.com/zloirock/core-js/blob/v3.6.1/packages/core-js/modules/core.get-iterator-method.js) - helpers for check iterability / get iterator in the `pure` version or, for example, for `arguments` object: ```js function isIterable(value: any): boolean; function getIterator(value: any): Object; function getIteratorMethod(value: any): Function | void; ``` [*CommonJS entry points:*](#commonjs-api) ```js core-js-pure/features/is-iterable core-js-pure/features/get-iterator core-js-pure/features/get-iterator-method ``` [*Examples*](http://goo.gl/SXsM6D): ```js import isIterable from 'core-js-pure/features/is-iterable'; import getIterator from 'core-js-pure/features/get-iterator'; import getIteratorMethod from 'core-js-pure/features/get-iterator-method'; let list = (function () { return arguments; })(1, 2, 3); console.log(isIterable(list)); // true; let iterator = getIterator(list); console.log(iterator.next().value); // 1 console.log(iterator.next().value); // 2 console.log(iterator.next().value); // 3 console.log(iterator.next().value); // undefined getIterator({}); // TypeError: [object Object] is not iterable! let method = getIteratorMethod(list); console.log(typeof method); // 'function' let iterator = method.call(list); console.log(iterator.next().value); // 1 console.log(iterator.next().value); // 2 console.log(iterator.next().value); // 3 console.log(iterator.next().value); // undefined console.log(getIteratorMethod({})); // undefined ``` ## Missing polyfills - ES `String#normalize` is not a very useful feature, but this polyfill will be very large. If you need it, you can use [unorm](https://github.com/walling/unorm/). - ES `Proxy` can't be polyfilled, you can try [`proxy-polyfill`](https://github.com/GoogleChrome/proxy-polyfill) which provides a very little subset of features. - `window.fetch` is not a cross-platform feature, in some environments, it makes no sense. For this reason, I don't think it should be in `core-js`. Looking at a large number of requests it *might be* added in the future. Now you can use, for example, [this polyfill](https://github.com/github/fetch). - ECMA-402 `Intl` is missed because of the size. You can use [this polyfill](https://github.com/andyearnshaw/Intl.js/). core-js-3.6.1/SECURITY.md000066400000000000000000000010031360057567700146660ustar00rootroot00000000000000# Security Policy ## Supported Versions This is the list of versions of `core-js` which are currently being supported with security updates. | Version | Supported | | -------- | ------------------ | | 3.x | :white_check_mark: | | < 3.0 | :x: | ## Reporting a Vulnerability To report a vulnerability please send an email with the details to zloirock@zloirock.ru. This will help us to assess the risk and start the necessary steps. Thanks for helping to keep `core-js` secure! core-js-3.6.1/babel.config.js000066400000000000000000000021271360057567700157540ustar00rootroot00000000000000'use strict'; module.exports = { // use transforms which does not use ES5+ builtins plugins: [ ['@babel/proposal-nullish-coalescing-operator'], ['@babel/proposal-optional-catch-binding'], ['@babel/proposal-optional-chaining'], ['@babel/transform-member-expression-literals'], ['@babel/transform-property-literals'], ['@babel/transform-arrow-functions'], ['@babel/transform-block-scoped-functions'], ['@babel/transform-block-scoping'], ['@babel/transform-classes', { loose: true }], ['@babel/transform-computed-properties', { loose: true }], ['@babel/transform-destructuring', { loose: true }], ['@babel/transform-literals'], ['@babel/transform-parameters'], ['@babel/transform-shorthand-properties'], ['@babel/transform-spread', { loose: true }], ['@babel/transform-template-literals', { loose: true, spec: true }], ['@babel/transform-exponentiation-operator'], ['transform-for-of-as-array'], // use it instead of webpack es modules for support engines without descriptors ['transform-es2015-modules-simple-commonjs'], ], }; core-js-3.6.1/docs/000077500000000000000000000000001360057567700140335ustar00rootroot00000000000000core-js-3.6.1/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md000066400000000000000000001131141360057567700251400ustar00rootroot00000000000000# core-js@3, babel and a look into the future After more than 1.5 years of development, dozens of pre-releases, many sleepless nights, **[`core-js@3`](https://github.com/zloirock/core-js)** is finally released. It's the largest set of changes in `core-js` and polyfilling-related **[`babel`](https://babeljs.io)** features of all time. What is `core-js`? - It is a polyfill of the JavaScript standard library, which supports: - The latest ECMAScript standard. - ECMAScript standard library proposals. - Some WHATWG / W3C standards (cross-platform or closely related ECMAScript). - It is maximally modular: you can easily choose to load only the features you will be using. - It can be used without polluting the global namespace. - It is [tightly integrated with `babel`](#Babel): this allows many optimizations of `core-js` import. It's the most universal and [the most popular](https://www.npmtrends.com/core-js-vs-es5-shim-vs-es6-shim-vs-airbnb-js-shims-vs-polyfill-library-vs-polyfill-service-vs-js-polyfills) way to polyfill JavaScript standard library, but a big part of developers just don't know that they use `core-js` indirectly 🙂 ## Contributing `core-js` is my own hobby project and it does not bring me any profit. It takes too much time and it is really costly: to finish work on `core-js@3`, I had left my job some months ago. This project facilitates the life of many people and companies. For these reasons, it makes sense to start raising funds to support the maintenance of `core-js`. If you interested in the `core-js` project or use it in your day-to-day work, you can become a sponsor on **[Open Collective](https://opencollective.com/core-js#sponsor)** or **[Patreon](https://www.patreon.com/zloirock)**. You can propose [me](http://zloirock.ru/) a good job where I will be able to work on something related. Or you can contribute in another way: you can help improving code, tests or documentation (currently, `core-js` documentation is terrible!). ## What changed in `core-js@3`? ### Changes in JavaScript standard library content Because of the following two reasons, this release is rich with new JavaScript polyfills: - `core-js` only has breaking changes in major releases, even if it is needed to reflect a change in a proposal. - `core-js@2` entered feature freeze 1.5 years ago; all new features were added only to the `core-js@3` branch. #### Stable ECMAScript features Stable ECMAScript features had already been almost completely supported by `core-js` for a long time, however, `core-js@3` introduced some new features: - Added support of [`@@isConcatSpreadable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/isConcatSpreadable) and [`@@species`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/species) well-known symbols, introduced in ECMAScript 2015, to all the methods which use them. - Added [`Array.prototype.flat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) and [`Array.prototype.flatMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap) methods from ECMAScript 2018 (`core-js@2` provided a polyfill for an old version of this proposal with `Array.prototype.flatten`). - Added [`Object.fromEntries`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries) method, introduced in ECMAScript 2019. - Added [`Symbol.prototype.description`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/description) accessor, introduced ECMAScript 2019. Some features that have already been available for a long time as proposals have been accepted in ES2016-ES2019 and are now marked as stable: - [`Array.prototype.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) and [`%TypedArray%.prototype.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/includes) methods (ECMAScript 2016) - [`Object.values`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values) and [`Object.entries`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries) methods (ECMAScript 2017) - [`Object.getOwnPropertyDescriptors`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors) method (ECMAScript 2017) - [`String.prototype.padStart`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart) and [`String.prototype.padEnd`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd) methods (ECMAScript 2017) - [`Promise.prototype.finally`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally) method (ECMAScript 2018) - [`Symbol.asyncIterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator) well-known symbol (ECMAScript 2018) - [`Object.prototype.__define(Getter|Setter)__`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__) and [`Object.prototype.__lookup(Getter|Setter)__`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__lookupGetter__) methods (ECMAScript 2018) - [`String.prototype.trim(Start|End|Left|Right)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart) methods (ECMAScript 2019) Added many fixes for browsers bugs/issues. For example, [Safari 12.0 `Array.prototype.reverse` bug](https://bugs.webkit.org/show_bug.cgi?id=188794) has been fixed. #### ECMAScript proposals In addition to supported before, `core-js@3` now supports the following ECMAScript proposals: - [`globalThis`](https://github.com/tc39/proposal-global) stage 3 proposal - before, we had `global` and `System.global` - [`Promise.allSettled`](https://github.com/tc39/proposal-promise-allSettled) stage 2 proposal - [New `Set` methods](https://github.com/tc39/proposal-set-methods) stage 2 proposal: - `Set.prototype.difference` - `Set.prototype.intersection` - `Set.prototype.isDisjointFrom` - `Set.prototype.isSubsetOf` - `Set.prototype.isSupersetOf` - `Set.prototype.symmetricDifference` - `Set.prototype.union` - [New collections methods](https://github.com/tc39/proposal-collection-methods) stage 1 proposal, which includes many new useful methods: - `Map.groupBy` - `Map.keyBy` - `Map.prototype.deleteAll` - `Map.prototype.every` - `Map.prototype.filter` - `Map.prototype.find` - `Map.prototype.findKey` - `Map.prototype.includes` - `Map.prototype.keyOf` - `Map.prototype.mapKeys` - `Map.prototype.mapValues` - `Map.prototype.merge` - `Map.prototype.reduce` - `Map.prototype.some` - `Map.prototype.update` - `Set.prototype.addAll` - `Set.prototype.deleteAll` - `Set.prototype.every` - `Set.prototype.filter` - `Set.prototype.find` - `Set.prototype.join` - `Set.prototype.map` - `Set.prototype.reduce` - `Set.prototype.some` - `WeakMap.prototype.deleteAll` - `WeakSet.prototype.addAll` - `WeakSet.prototype.deleteAll` - [`String.prototype.replaceAll`](https://github.com/tc39/proposal-string-replace-all) stage 1 proposal - [`String.prototype.codePoints`](https://github.com/tc39/proposal-string-prototype-codepoints) stage 1 proposal - [`Array.prototype.last(Item|Index)`](https://github.com/keithamus/proposal-array-last) stage 1 proposal - [`compositeKey` and `compositeSymbol` methods](https://github.com/bmeck/proposal-richer-keys/tree/master/compositeKey) stage 1 proposal - [`Number.fromString`](https://github.com/tc39/proposal-number-fromstring) stage 1 proposal - [`Math.seededPRNG`](https://github.com/tc39/proposal-seeded-random) stage 1 proposal - [`Promise.any` (with `AggregateError`)](https://github.com/tc39/proposal-promise-any) stage 0 proposal Some proposals have been largely changed, and `core-js` was updated accordingly: - [`String.prototype.matchAll`](https://github.com/tc39/proposal-string-matchall) stage 3 proposal - [`Observable`](https://github.com/tc39/proposal-observable) stage 1 proposal #### Web standards Many useful features have been added in this category. The most important one is support for [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) and [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams). It was [one of the most popular feature requests](https://github.com/zloirock/core-js/issues/117). Adding `URL` and `URLSearchParams`, making maximally spec compliant, supporting any environment keeping their source code small compact was [one of the hardest tasks](https://github.com/zloirock/core-js/pull/454/files) in the `core-js@3` development. `core-js@3` includes *a standard* method to create microtasks in JavaScript: [`queueMicrotask`](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#microtask-queuing). `core-js@2` provided the `asap` function which did the same thing and was an old ECMAScript proposal. `queueMicrotask` is defined in the HTML standard and it is already available in modern engines like Chromium or NodeJS. Another popular feature request was support for the [`.forEach` method on DOM collection](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach). Since `core-js` already polyfilled iterators of DOM collections, why not add also `.forEach` to `NodeList` and `DOMTokenList`? #### Removed obsolete featues: - `Reflect.enumerate` because it's removed from the spec - `System.global` and `global` since now they are replaced by `globalThis` - `Array.prototype.flatten` since it's replaced by `Array.prototype.flat` - `asap` since it's replaced by `queueMicrotask` - `Error.isError` has withdrawn a long time ago - `RegExp.escape` rejected a long time ago - `Map.prototype.toJSON` and `Set.prototype.toJSON` also rejected a long time ago - Unnecessary `CSSRuleList`, `MediaList`, `StyleSheetList` iteration methods which were added mistakenly #### No more non-standard non-proposed features Many years ago, I started writing a library which I needed as the core of my JavaScript applications: this library contained polyfills and some utilities for common needs. After some time, it was published as `core-js`. I think that at this moment most `core-js` users do not use non-standard `core-js` features. Almost all of them were removed in previous releases, and it's time to remove all the remaining ones from `core-js`. Starting from this release, `core-js` can be finally called a polyfill. ### Packages, entry points and modules names A popular issue was the big size (~2MB) of the `core-js` package and duplication of many of its files. For this reason, `core-js` was split into three packages: - [`core-js`](https://www.npmjs.com/package/core-js), which defines global polyfills. (~500KB, [40KB minified and gzipped](https://bundlephobia.com/result?p=core-js@3.0.0-beta.20)) - [`core-js-pure`](https://www.npmjs.com/package/core-js-pure), which provides polyfills without pollution the global environment. It's the equivalent of `core-js/library` from `core-js@2`. (~440KB) - [`core-js-bundle`](https://www.npmjs.com/package/core-js-bundle): a bundled version of `core-js` which defines global polyfills. In previous versions of `core-js`, modules with polyfills for stable ECMAScript features and ECMAScript proposals were prefixed with `es6.` and `es7.` respectively. It was a decision taken in 2014 when all the features which could be after ES6 were considered as ES7. In `core-js@3` all stable ECMAScript features are prefixed with `es.`, while ECMAScript proposals with `esnext.`. Almost all CommonJS entry points were changed. In `core-js@3` there are many more entry points than there were in `core-js@2`: they bring maximum flexibility, making it possible to include only the polyfills needed by your application. Here are some examples of how the new entry points can be used: ```js // polyfill all `core-js` features: import "core-js"; // polyfill only stable `core-js` features - ES and web standards: import "core-js/stable"; // polyfill only stable ES features: import "core-js/es"; // if you want to polyfill `Set`: // all `Set`-related features, with ES proposals: import "core-js/features/set"; // stable required for `Set` ES features and features from web standards // (DOM collections iterator in this case): import "core-js/stable/set"; // only stable ES features required for `Set`: import "core-js/es/set"; // the same without global namespace pollution: import Set from "core-js-pure/features/set"; import Set from "core-js-pure/stable/set"; import Set from "core-js-pure/es/set"; // if you want to polyfill just required methods: import "core-js/features/set/intersection"; import "core-js/stable/queue-microtask"; import "core-js/es/array/from"; // polyfill reflect metadata proposal: import "core-js/proposals/reflect-metadata"; // polyfill all stage 2+ proposals: import "core-js/stage/2"; ``` ### Some other important changes It's now possible to [configure the aggressiveness](https://github.com/zloirock/core-js/blob/master/README.md#configurable-level-of-aggressiveness) of `core-js` polyfills. If you think that `core-js` feature detection is too aggressive in some cases and that the native implementation is correct enough for your usecase, or if an incorrect implementation isn't detected by `core-js` as such, you can change the `core-js` default behavior. If a feature can't be implemented following the specification in every details, `core-js` adds a `.sham` property to the polyfill. For example, in IE11 `Symbol.sham` is `true`. No more LiveScript! When I started the `core-js` project, I mainly used [LiveScript](http://livescript.net/); after some time, I rewrote all the polyfills in JavaScript. Tests and helper tools in `core-js@2` still used LiveScript: it is a very interesting CoffeeScript-like language with powerful syntax sugar which allows writing very compact code, but now it's almost dead. Other than that, it was an additional barrier for contributing to `core-js` because most `core-js` users do not know this language. `core-js@3` tests and tools use modern ES syntax: it could be a good moment to start contributing to `core-js` 🙂 For almost all users, for optimization of `core-js` import, I recommend using [`babel`](#Babel). However, for some cases still useful [`core-js-builder`](http://npmjs.com/package/core-js-builder). Now it supports the `targets` argument which takes a [`browserslist`](https://github.com/browserslist/browserslist) query with target engines - you can create a bundle which contains only required for target engines polyfills. For cases like this, I made the [`core-js-compat`](http://npmjs.com/package/core-js-compat) package, more info about it you could find in [`@babel/preset-env` part of this article](#babelpreset-env). --- This is just the tip of the iceberg, much more changes were done internally. You can find more info about `core-js` changes in the [changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md#300). ## Babel As mentioned above, `babel` and `core-js` are tightly integrated: `babel` gives the possibility of optimizing the `core-js` import as much as possible. A serious part of work on `core-js@3` was improving `core-js`-related `babel` features (see [this PR](https://github.com/babel/babel/pull/7646)). Those changes are published in [Babel 7.4.0](https://babeljs.io/blog/2019/03/19/7.4.0). ### `@babel/polyfill` [`@babel/polyfill`](https://babeljs.io/docs/en/next/babel-polyfill.html) is a wrapper package which only includes imports of stable `core-js` features (in Babel 6 it also included proposals) and `regenerator-runtime/runtime`, needed by transpiled generators and async functions. This package doesn't make it possible to provide a smooth migration path from `core-js@2` to `core-js@3`: for this reason, it was decided to deprecate `@babel/polyfill` in favor of separate inclusion of required parts of `core-js` and `regenerator-runtime`. Instead of ```js import "@babel/polyfill"; ``` you should use those 2 lines: ```js import "core-js/stable"; import "regenerator-runtime/runtime"; ``` Don't forget install those dependencies directly! ```sh npm i --save core-js regenerator-runtime ``` ### `@babel/preset-env` [`@babel/preset-env`](https://babeljs.io/docs/en/next/babel-preset-env#usebuiltins) has 2 different modes, which can be enabled with the `useBuiltIns` option: `entry` and `usage`, which optimize imports of `core-js` in different ways. Babel 7.4.0 introduces both changes commons to the two modes and specific to each mode. Since `@babel/preset-env` now supports `core-js@2` and `core-js@3`, `useBuiltIns` requires setting a new option, `corejs`, which specifies the used version (`corejs: 2` or `corejs: 3`). If it isn't directly set, `corejs: 2` will be used by default and it will show a warning. To make it possible for Babel to support new `core-js` features introduced in future minor versions, you also can specify the minor `core-js` version used in your project. For example, if you want to use `core-js@3.1` and take advantage of new features added in that version, you can set the `corejs` option to `3.1`: `corejs: '3.1'` or `corejs: { version: '3.1' }`. One of the most important parts of `@babel/preset-env` was the source providing data about the features supported by different target engines, to understand whether something needs to be polyfilled by `core-js` or not. [`caniuse`](https://caniuse.com/), [`mdn`](https://developer.mozilla.org/en-US/) and [`compat-table`](http://kangax.github.io/compat-table/es6/) are good educational resources but aren't really meant to be used as data sources for developer tools: only the `compat-table` contains a good set of ES-related data and it is used by `@babel/preset-env`, but it has some limitations: - it contains data only about ECMAScript features and proposals, but not about web platform features like `setImmediate` or DOM collections iterators. So, up to now, `@babel/preset-env` added all web platform features from `core-js` even for targets where they are supported. - it does not contain any information about (even serious) bugs in engines: for example, already mentioned `Array#reverse` broken in Safari 12 but it isn't marked as unsupported by `compat-table`. On the other hand, `core-js` correctly fixes broken implementations, but with `compat-table` this capability wasn't taken advantage of. - it contains only some basic and naive tests, which do not check that features work as they should in real-word cases. For example, old Safari has broken iterators without `.next` method, but `compat-table` shows them as supported because it just check that `typeof` of methods which should return iterators is `"function"`. Some features like typed arrays are almost completely not covered. - `compat-table` is not designed for providing data for tools. I'm one of the `compat-table` maintainers, but [some of the other maintainers are against maintaining this functionality](https://github.com/kangax/compat-table/pull/1312). For this reason, I created the [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) package: it provides data about the necessity of `core-js` modules for different target engines. When using `core-js@3`, `@babel/preset-env` will use that new package instead of `compat-table`. [Please help us testing and providing data and mappings for missing engines! 😊](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md#updating-core-js-compat-data) Until Babel 7.3, `@babel/preset-env` had some problems related to the order polyfills were injected. Starting from version 7.4.0, `@babel/preset-env` will add the polyfills only when it know which of them required and in the recommended order. #### `useBuiltIns: entry` with `corejs: 3` When using this option, `@babel/preset-env` replaces direct imports of `core-js` to imports of only the specific modules required for a target environment. Before those changes, `@babel/preset-env` replaced only `import '@babel/polyfill'` and `import 'core-js'`, they were synonyms and used for polyfilling all stable JavaScript features. Since `@babel/polyfill` is now deprecated, `@babel/preset-env` doesn't transpile it when `corejs` is set to `3`. An equivalent replacement for `@babel/polyfill` with `core-js@3` is ```js import "core-js/stable"; import "regenerator-runtime/runtime"; ``` When targeting `chrome 72`, it will be transformed by `@babel/preset-env` to ```js import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.immediate"; ``` when targeting `chrome 73` (which completely support ES2019 standard library), it will just become a single smaller import: ```js import "core-js/modules/web.immediate"; ``` Since now `@babel/polyfill` is deprecated in favor of separate `core-js` and `regenerator-runtime` inclusion, we can optimize `regenerator-runtime` import. For this reason, `regenerator-runtime` import will be removed from the source code when targeting browsers that supports generators natively. Now, `@babel/preset-env` in `useBuiltIns: entry` mode transpile **all available** `core-js` entry points and their combinations. This means that you can customize it as much as you want, by using different `core-js` entry points, and it will be optimized for your target environment. For example, when targeting `chrome 72`, ```js import "core-js/es"; import "core-js/proposals/set-methods"; import "core-js/features/set/map"; ``` will be replaced with ```js import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/esnext.set.difference"; import "core-js/modules/esnext.set.intersection"; import "core-js/modules/esnext.set.is-disjoint-from"; import "core-js/modules/esnext.set.is-subset-of"; import "core-js/modules/esnext.set.is-superset-of"; import "core-js/modules/esnext.set.map"; import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; ``` #### `useBuiltIns: usage` with `corejs: 3` When using this option, `@babel/preset-env` adds at the top of each file imports of polyfills only for features used in the current and not supported by target environments. For example, ```js const set = new Set([1, 2, 3]); [1, 2, 3].includes(2); ``` when targeting an old browser like `ie 11`, will be transformed to ```js import "core-js/modules/es.array.includes"; import "core-js/modules/es.array.iterator"; import "core-js/modules/es.object.to-string"; import "core-js/modules/es.set"; const set = new Set([1, 2, 3]); [1, 2, 3].includes(2); ``` when targeting, for example, `chrome 72` no imports will be injected, since those polyfills not required for this target: ```js const set = new Set([1, 2, 3]); [1, 2, 3].includes(2); ``` Until Babel 7.3, `useBuiltIns: usage` was unstable and not fully reliable: many polyfills were not included, and many others were added without their required dependencies. In Babel 7.4, I tried to make it understand every possible usage pattern. I improved the techniques used to determine which polyfills should be added on property accesses, object destructuring, `in` operator, global object property accesses. `@babel/preset-env` now injections polyfills required for syntax features: iterators when using `for-of`, destructuring, spread and `yield` delegation; promises when using dynamic `import`, async functions and generators, etc. Babel 7.4 supports injecting proposals polyfills. By default, `@babel/preset-env` does not inject them, but you can opt-in using the `proposals` flag: `corejs: { version: 3, proposals: true }`. ### `@babel/runtime` When used with `core-js@3`, [`@babel/transform-runtime`](https://babeljs.io/docs/en/next/babel-plugin-transform-runtime#corejs) now injects polyfills from `core-js-pure`: a version of `core-js` which doesn't pollute the global namespace. `core-js@3` and `@babel/runtime` have been integrated together by adding a `corejs: 3` option to `@babel/transform-runtime` and creating the `@babel/runtime-corejs3` package. But what advantages did this bring? One of the most popular issue with `@babel/runtime` was that it did not support instance methods. Starting from `@babel/runtime-corejs3`, this problem has resolved. For example, ```js array.includes(something); ``` will be transpiled to ```js import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes"; _includesInstanceProperty(array).call(array, something); ``` Another notable change is the support of ECMAScript proposals. By default, `@babel/plugin-transform-runtime` does not inject polyfills for proposals and use entry points which do not include them but, exactly as you can do in `@babel/preset-env`, you can set the `proposals` flag to enable them: `corejs: { version: 3, proposals: true }`. Without `proposals` flag, ```js new Set([1, 2, 3, 2, 1]); string.matchAll(/something/g); ``` is transpiled to: ```js import _Set from "@babel/runtime-corejs3/core-js-stable/set"; new _Set([1, 2, 3, 2, 1]); string.matchAll(/something/g); ``` when proposals are enabled, it becomes: ```js import _Set from "@babel/runtime-corejs3/core-js/set"; import _matchAllInstanceProperty from "@babel/runtime-corejs3/core-js/instance/match-all"; new _Set([1, 2, 3, 2, 1]); _matchAllInstanceProperty(string).call(string, /something/g); ``` Some other old issues have been fixed. For example, this quite popular pattern didn't work when using `@babel/runtime-corejs2` but it is supported with `@babel/runtime-corejs3`. ```js myArrayLikeObject[Symbol.iterator] = Array.prototype[Symbol.iterator]; ``` Although previous versions of `@babel/runtime` did not work with instance methods, iterables (both `[Symbol.iterator]()` calls and its presence) were supported using some custom helper functions. Extracting the `[Symbol.iterator]` method was not supported, but now it works. As a cheap bonus, `@babel/runtime` now supports IE8-, with some limitations. For example, since IE8- does not support accessors, modules transform should be used in loose mode and `regenerator-runtime` (which internally use some ES5+ built-ins) needs to be transpiled by this plugin. ## Look into the future Much work has been done, but `core-js` is still far from perfect. How can the library and tools be improved in the future and how do language changes can affect it? ### Old engines support At this moment, `core-js` tries to support all possible engines and platforms where we can test it: it even supports IE8- or, for example, early Firefox versions. While it is useful for some users, only for a small part of developers using `core-js` need it. For many other users, it can cause some problems like bigger bundle size or slower runtime execution. The main problem comes from supporting ES3 engines (above all, IE8-): most modern ES features based on ES5 features, which aren't available in those very old browsers. The biggest missing important feature are property descriptors: when they aren't available, some features can't be polyfilled because they either are accessors (like `RegExp.prototype.flags` or `URL` properties setters) or are accessors-based (like typed arrays polyfill). In order to workaround this lack, we need to use different workarounds (for example, to keep `Set.prototype.size` updated). Maintenance of those workarounds sometimes is too painful, and removing them would highly simplify many polyfills. However, descriptors are just a part of this problem. The ES5 standard library contains many other features that can be considered as the basis of modern JavaScript: `Object.keys`, `Object.create`, `Object.getPrototypeOf`, `Array.prototype.forEach`, `Function.prototype.bind`, etc. Unlike the most modern features, `core-js` internally relies on them and [in order to implement even a simple modern function, `core-js` needs to load implementations of some of those "building blocks"](https://github.com/babel/babel/pull/7646#discussion_r179333093). It is a problem for users who want to create [a maximally minimalistic bundle](https://github.com/zloirock/core-js/issues/388) and only import just a few `core-js` polyfills. In some countries IE8 still is quite popular, but browsers should disappear at some point to allow the web to move forward. IE8 was released 19-03-2009; today it is 19-03-2019: it's the 10th birthday of IE8. IE6 is about to turn 18: I stopped testing new `core-js` versions in IE6 some months ago. We should drop IE8- and other engines without basic ES5 support in `core-js@4`. ### ECMAScript modules `core-js` use `CommonJS` modules. It has the most popular JavaScript modules format for a long time, but now ECMAScript provides its own modules format. Many engines already support them; some bundlers (like `rollup`) are based on them, and some other bundlers provide them as an alternative to `CommonJS`. It would make sense to provide an alternative version of `core-js` which uses ECMAScript modules format. ### Extended web standards support? `core-js` is currently focused on ECMAScript support, but it also supports a few web standards features which are available cross-platform and closely related to ECMAScript. Adding polyfills for web standards like `fetch` is a very popular feature request. The main reason why `core-js` doesn’t include them was that it would have seriously increased bundles size and it would have forced `core-js` users to load features which might not have been needed. Now `core-js` is maximally modular, user can include only some choosen features, there are tools like `@babel/preset-env` and `@babel/runtime` which helps to get rid of unused or unnecessary polyfills. Maybe it's time to revisit this old decision? ### `@babel/runtime` for target environment Currently, we can't set the target environment as `@babel/runtime` like we can do for `@babel/preset-env`. That means that `@babel/runtime` injects all possible polyfills even when targeting modern engines: it unnecessarily increases the size of the final bundle. Since `core-js-compat` contains all the necessary data, in the future, it will be possible to add support for compiling for a target environment to `@babel/runtime` and to add a `useBuiltIns: runtime` option to `@babel/preset-env`. ### Better optimization of polyfill loading As explained above, Babel plugins give us different ways of optimizing `core-js` usage, but they are not perfect: we can improve them. `@babel/preset-env` with `useBuiltIns: usage` now should work much better than before, but it could still fail in some uncommon cases: when the code can't be statically analyzed. For that case, we need to find a way for library developers to specify which polyfills are required by their library instead of directly loading them: some kind of metadata, which will be used to inject polyfills when creating the final bundle. Another issue of `useBuiltIns: usage` is the duplication of polyfills import. `useBuiltIns: usage` can inject dozens of `core-js` imports in each file. But what if in our project has thousands of files or even tenths of thousands? In this case, we will have more lines of code with `import "core-js/..."` than lines of code in `core-js` itself: we need a way to collect all imports to one file so that they can be deduplicated. Almost every `@babel/preset-env` user which targets old engines like IE11 uses a single bundle for every browser. That means that even modern engines with full ES2019 support will be loading the unnecessary polyfills only required by IE11. Sure, we can create different bundles for different targets and use, for example, the `type=module` / `nomodules` attributes: one bundle for modern engines with modules support, another for legacy engines. Unfortunately it’s not a complete solution to this problem: a service which bundles polyfills for the required target based on the user agent would be really useful. And we already have one - [`polyfill-service`](https://github.com/Financial-Times/polyfill-service). Although it is an interesting and popular service, polyfills quality leaves much to be desired. It’s not as bad as it was some years ago: the team of this project is actively working to improve it, but I wouldn't recommend using polyfills from this project if you want them to match native implementations. Some years ago was an attempt to use `core-js` as a polyfills source for this project, but it hadn't been possible because `polyfill-service` relies on files concatenation instead of modules (like `core-js` in the first few months after it was published 😊). A service like this one integrated with a good polyfills source like `core-js`, which only loads the needed polyfills by statically analyzing the source like Babel's `useBuiltIns: usage` option does could cause a revolution in the way we think about polyfills. ### New features proposals from TC39 and possible problems for `core-js` TC39 is working really hard to improve ECMAScript: you can see the progress by looking at all the new proposals implemented in `core-js`. However, I think that some features of some proposals could cause serious problems for polyfilling / transpiling. There would be enough to say about this topic to write a whole new post, but I'll try to summarize my thoughts here. #### Standard library proposal, stage 1 At this moment, TC39 is considering adding to ECMAScript [built-in modules](https://github.com/tc39/proposal-javascript-standard-library): a modular standard library. It would be a great addition to JavaScript, and `core-js` is the best place where it could be polyfilled. With the techniques used in `@babel/preset-env` and `@babel/runtime`, we could theoretically inject polyfills for required built-in modules in a very simple way. However, the current version of this proposal causes some serious problems which don't make it as straightforward. Polyfilling of built-in modules, [as stated by authors of the proposal](https://github.com/tc39/proposal-javascript-standard-library/issues/2), only means falling back to layered APIs or import maps. This means that if a native module will be missing, it will be possible to load a polyfill from a provided url. That's absolutely not what polyfills need, and it is incompatible with the architecture of `core-js` and every other popular polyfill projects. Import maps shouldn't be the only way to polyfill built-in modules. We will be able to get a built-in module just by usage ES modules syntax with a special prefix. This syntax haven't any equal based on the previous version of the language - transpiled modules will not be able to interact with not transpiled in modern engines - it will cause problems for package distribution. More other, it will work asynchronously. It's a critical problem for feature detection - scripts will not wait when you'll detect a feature and load a polyfill - feature detection should be done synchronously. [The first implementation of built-in modules without a proper way of transpiling / polyfilling already available](https://developers.google.com/web/updates/2019/03/kv-storage). If it will not be revised, built-in modules will not be able to be polyfilled in the current `core-js` format. The proposed way of polyfilling will seriously complicate the lives of developers. The issue with the standard library can be solved by adding a new global (maybe it will be the last one?): a registry of built-in modules which will allow getting and seting them synchronously, like ```js StandardLibraryRegistry.get(moduleName); StandardLibraryRegistry.set(moduleName, value); ``` Asynchronous fallbacks like layered APIs should be used only after this global registry. As a bonus point, it would simplify transpiling native modules import to old syntax. #### Decorators proposal, new iteration, stage 2 [In the new iteration](https://github.com/tc39/proposal-decorators) of this proposal, it has been seriously reworked. Decorator definitions aren't a syntax sugar anymore and, like with built-in modules, we will not be able to write a decorator in an old version of the language and use it as a native decorator. Other than that, decorators are not just usual identifiers - they live in a parallel lexical scope: this means that transpiled decorators can't interact with native decorators. The proposal authors recommend distributing packages with untranspiled decorators and leave to the library consumers the choice to transpile their dependencies. However, it's not possible in different scenarios. This approach could prevent `core-js` from polyfilling new built-in decorators when they will be added to the JS standard library. Decorators should be just an alternative way of applying functions on something, they should only be syntax sugar for wrappers. Why complicate things? --- If a new language feature does not introduce to the language something fundamentally new, an alternative for what couldn't be implemented in a previous version of the language, we should be able to transpile and/or polyfill it, and transpiled/polyfilled code should be able to interact with native feature in engines which supports this feature natively. I hope for the wisdom of the authors of those proposals and of the committee, that these proposals will be adapted so that it will be possible to properly transpile or polyfill them. --- If you are interested in the `core-js` project or use it in your day-to-day work, you can become a sponsor on **[Open Collective](https://opencollective.com/core-js#sponsor)** or **[Patreon](https://www.patreon.com/zloirock)**. `core-js` isn't backed by a company: its future depends on you. --- **Feel free to add comments to this article [here](https://github.com/zloirock/core-js/issues/496).** **[Denis Pushkarev](https://github.com/zloirock)**, **19-03-2019**, *thanks [Nicolò Ribaudo](https://github.com/nicolo-ribaudo) for redaction* core-js-3.6.1/lerna.json000066400000000000000000000001051360057567700150730ustar00rootroot00000000000000{ "packages": [ "packages/*" ], "version": "independent" } core-js-3.6.1/package.json000066400000000000000000000100241360057567700153660ustar00rootroot00000000000000{ "devDependencies": { "@babel/cli": "^7.7.7", "@babel/core": "^7.7.7", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4", "@babel/plugin-proposal-optional-catch-binding": "^7.7.4", "@babel/plugin-proposal-optional-chaining": "^7.7.5", "@babel/plugin-transform-arrow-functions": "^7.7.4", "@babel/plugin-transform-block-scoped-functions": "^7.7.4", "@babel/plugin-transform-block-scoping": "^7.7.4", "@babel/plugin-transform-classes": "^7.7.4", "@babel/plugin-transform-computed-properties": "^7.7.4", "@babel/plugin-transform-destructuring": "^7.7.4", "@babel/plugin-transform-exponentiation-operator": "^7.7.4", "@babel/plugin-transform-literals": "^7.7.4", "@babel/plugin-transform-member-expression-literals": "^7.7.4", "@babel/plugin-transform-parameters": "^7.7.7", "@babel/plugin-transform-property-literals": "^7.7.4", "@babel/plugin-transform-shorthand-properties": "^7.7.4", "@babel/plugin-transform-spread": "^7.7.4", "@babel/plugin-transform-template-literals": "^7.7.4", "babel-loader": "^8.0.6", "babel-plugin-transform-es2015-modules-simple-commonjs": "~0.3.0", "babel-plugin-transform-for-of-as-array": "^1.1.1", "es-observable": "git+https://github.com/tc39/proposal-observable.git#bf4d87144b6189e793593868e3c022eb51a7d292", "eslint": "^6.8.0", "eslint-import-resolver-webpack": "^0.12.0", "eslint-plugin-import": "^2.19.1", "eslint-plugin-node": "^10.0.0", "eslint-plugin-optimize-regex": "^1.1.7", "eslint-plugin-qunit": "^4.0.0", "eslint-plugin-sonarjs": "^0.5.0", "eslint-plugin-unicorn": "^15.0.1", "grunt": "^1.0.4", "grunt-cli": "^1.3.2", "grunt-contrib-clean": "^2.0.0", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-uglify": "^4.0.1", "grunt-karma": "^3.0.2", "grunt-webpack": "^3.1.3", "karma": "^4.4.1", "karma-chrome-launcher": "^3.1.0", "karma-phantomjs-launcher": "~1.0.4", "karma-qunit": "^4.0.0", "lerna": "^3.19.0", "moon-unit": "^0.2.2", "phantomjs-prebuilt": "~2.1.16", "promises-aplus-tests": "^2.1.2", "puppeteer": "~2.0.0", "qunit": "~2.9.3", "webpack": "^4.41.4" }, "license": "MIT", "repository": { "type": "git", "url": "https://github.com/zloirock/core-js.git" }, "scripts": { "bootstrap": "lerna bootstrap --no-ci", "build": "grunt clean copy && npm run bootstrap && npm run build-compat && grunt bundle uglify", "build-compat": "npm run build-compat-data && npm run build-compat-entries && npm run build-compat-modules-by-versions", "build-compat-data": "node packages/core-js-compat/src/build-data", "build-compat-entries": "node packages/core-js-compat/src/build-entries", "build-compat-modules-by-versions": "node packages/core-js-compat/src/build-modules-by-versions", "lint": "grunt clean copy && npm run bootstrap && npm run build-compat && eslint ./", "unit-tests": "grunt clean copy && npm run bootstrap && npm run build-compat && grunt bundle webpack:helpers webpack:tests karma:tests", "unit-tests-pure": "grunt clean copy && npm run build-compat && grunt webpack:helpers webpack:pure karma:pure", "bundle-promises-tests": "grunt webpack:promises-aplus-tests", "promises-tests": "promises-aplus-tests tests/promises-aplus/adapter --timeout 1000", "observables-tests": "babel node_modules/es-observable/test/ -d tests/bundles/observables-tests/ && node tests/observables/adapter && node tests/observables/adapter-pure", "commonjs-tests": "node tests/commonjs", "commonjs-entries-content": "node tests/commonjs-entries-content", "targets-parser-tests": "node tests/targets-parser", "test": "grunt clean copy && npm run bootstrap && npm run build-compat && eslint ./ && grunt webpack:helpers webpack:tests bundle uglify karma:tests webpack:helpers webpack:pure karma:pure && npm run promises-tests && npm run observables-tests && npm run commonjs-tests && npm run commonjs-entries-content && npm run targets-parser-tests" }, "engines": { "node": ">=8.9.0" } } core-js-3.6.1/packages/000077500000000000000000000000001360057567700146615ustar00rootroot00000000000000core-js-3.6.1/packages/core-js-builder/000077500000000000000000000000001360057567700176475ustar00rootroot00000000000000core-js-3.6.1/packages/core-js-builder/.npmignore000066400000000000000000000000271360057567700216450ustar00rootroot00000000000000node_modules/ *.log .* core-js-3.6.1/packages/core-js-builder/.npmrc000066400000000000000000000000231360057567700207620ustar00rootroot00000000000000package-lock=false core-js-3.6.1/packages/core-js-builder/README.md000066400000000000000000000016571360057567700211370ustar00rootroot00000000000000For some cases could be useful adding a blacklist of features or generation a polyfill for target engines. This API helps conditionally include or exclude certain parts of [`core-js`](https://github.com/zloirock/core-js), use `browserslist` queries from [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) package. ```js require('core-js-builder')({ modules: ['es', 'esnext.reflect', 'web'], // modules / namespaces, by default - all `core-js` modules blacklist: ['es.math', 'es.number.constructor'], // blacklist of modules / namespaces, by default - empty list targets: '> 0.5%', // optional browserslist query filename: './my-core-js-bundle.js', // optional target filename, if it's missed a file will not be created }).then(code => { // code of result polyfill // ... }).catch(error => { // ... }); ``` core-js-3.6.1/packages/core-js-builder/config.js000066400000000000000000000006601360057567700214540ustar00rootroot00000000000000'use strict'; const { version } = require('./package'); module.exports = { /* eslint-disable prefer-template */ banner: '/**\n' + ' * core-js ' + version + '\n' + ' * https://github.com/zloirock/core-js\n' + ' * License: http://rock.mit-license.org\n' + ' * © ' + new Date().getFullYear() + ' Denis Pushkarev (zloirock.ru)\n' + ' */', /* eslint-enable prefer-template */ }; core-js-3.6.1/packages/core-js-builder/index.js000066400000000000000000000035671360057567700213270ustar00rootroot00000000000000'use strict'; const { promisify } = require('util'); const fs = require('fs'); // TODO: replace by `fs.promises` after dropping NodeJS < 10 support const readFile = promisify(fs.readFile); const unlink = promisify(fs.unlink); const writeFile = promisify(fs.writeFile); const { dirname, join } = require('path'); const tmpdir = require('os').tmpdir(); // TODO: replace by `mkdir` with `recursive: true` after dropping NodeJS < 10.12 support const mkdirp = promisify(require('mkdirp')); const webpack = promisify(require('webpack')); const compat = require('core-js-compat/compat'); const modulesList = require('core-js-compat/modules'); const { banner } = require('./config'); module.exports = async function ({ blacklist = [], modules = modulesList.slice(), targets, filename } = {}) { const set = new Set(); function filter(method, list) { for (const ns of list) { for (const name of modulesList) { if (name === ns || name.startsWith(`${ ns }.`)) { set[method](name); } } } } filter('add', modules); filter('delete', blacklist); modules = modulesList.filter(it => set.has(it)); if (targets) modules = compat({ targets, filter: modules }).list; const tempFileName = `core-js-${ Math.random().toString(36).slice(2) }.js`; const tempFile = join(tmpdir, tempFileName); await webpack({ mode: 'none', node: { global: false, process: false, setImmediate: false, }, entry: modules.map(it => require.resolve(`core-js/modules/${ it }`)), output: { path: tmpdir, filename: tempFileName, }, }); const file = await readFile(tempFile); await unlink(tempFile); const script = `${ banner }\n!function (undefined) { 'use strict'; ${ file } }();`; if (typeof filename != 'undefined') { await mkdirp(dirname(filename)); await writeFile(filename, script); } return script; }; core-js-3.6.1/packages/core-js-builder/package.json000066400000000000000000000007601360057567700221400ustar00rootroot00000000000000{ "name": "core-js-builder", "description": "core-js builder", "version": "3.6.1", "repository": { "type": "git", "url": "https://github.com/zloirock/core-js.git" }, "main": "index.js", "dependencies": { "core-js": "3.6.1", "core-js-compat": "3.6.1", "mkdirp": "^0.5.1", "webpack": "^4.41.4" }, "engines": { "node": ">=8.9.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/core-js" }, "license": "MIT" } core-js-3.6.1/packages/core-js-bundle/000077500000000000000000000000001360057567700174725ustar00rootroot00000000000000core-js-3.6.1/packages/core-js-bundle/.npmignore000066400000000000000000000000111360057567700214610ustar00rootroot00000000000000*.log .* core-js-3.6.1/packages/core-js-bundle/README.md000066400000000000000000000126131360057567700207540ustar00rootroot00000000000000# core-js-bundle [![Sponsors on Open Collective](https://opencollective.com/core-js/sponsors/badge.svg)](#sponsors) [![Backers on Open Collective](https://opencollective.com/core-js/backers/badge.svg)](#backers) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/zloirock/core-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![version](https://img.shields.io/npm/v/core-js-pure.svg)](https://www.npmjs.com/package/core-js-pure) [![npm downloads](https://img.shields.io/npm/dm/core-js-pure.svg)](http://npm-stat.com/charts.html?package=core-js-pure&author=&from=2019-03-18) [![Build Status](https://travis-ci.org/zloirock/core-js.svg)](https://travis-ci.org/zloirock/core-js) [![devDependency status](https://david-dm.org/zloirock/core-js/dev-status.svg)](https://david-dm.org/zloirock/core-js?type=dev) > Modular standard library for JavaScript. Includes polyfills for [ECMAScript up to 2019](https://github.com/zloirock/core-js#ecmascript): [promises](https://github.com/zloirock/core-js#ecmascript-promise), [symbols](https://github.com/zloirock/core-js#ecmascript-symbol), [collections](https://github.com/zloirock/core-js#ecmascript-collections), iterators, [typed arrays](https://github.com/zloirock/core-js#ecmascript-typed-arrays), many other features, [ECMAScript proposals](https://github.com/zloirock/core-js#ecmascript-proposals), [some cross-platform WHATWG / W3C features and proposals](#web-standards) like [`URL`](https://github.com/zloirock/core-js#url-and-urlsearchparams). You can load only required features or use it without global namespace pollution. ## As advertising: the author is looking for a good job -) ## [core-js@3, babel and a look into the future](https://github.com/zloirock/core-js/tree/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md) ## Raising funds `core-js` isn't backed by a company, so the future of this project depends on you. Become a sponsor or a backer [**on Open Collective**](https://opencollective.com/core-js) or [**on Patreon**](https://www.patreon.com/zloirock) if you are interested in `core-js`. --- --- --- [*Example*](http://goo.gl/a2xexl): ```js import 'core-js'; // <- at the top of your entry point Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] [1, [2, 3], [4, [5]]].flat(2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` *You can load only required features*: ```js import 'core-js/features/array/from'; // <- at the top of your entry point import 'core-js/features/array/flat'; // <- at the top of your entry point import 'core-js/features/set'; // <- at the top of your entry point import 'core-js/features/promise'; // <- at the top of your entry point Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] [1, [2, 3], [4, [5]]].flat(2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` *Or use it without global namespace pollution*: ```js import from from 'core-js-pure/features/array/from'; import flat from 'core-js-pure/features/array/flat'; import Set from 'core-js-pure/features/set'; import Promise from 'core-js-pure/features/promise'; from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] flat([1, [2, 3], [4, [5]]], 2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` **It's a bundled global version, for more info see [`core-js` documentation](https://github.com/zloirock/core-js/blob/master/README.md).** core-js-3.6.1/packages/core-js-bundle/package.json000066400000000000000000000020341360057567700217570ustar00rootroot00000000000000{ "name": "core-js-bundle", "description": "Standard library", "version": "3.6.1", "repository": { "type": "git", "url": "https://github.com/zloirock/core-js.git" }, "main": "index.js", "funding": { "type": "opencollective", "url": "https://opencollective.com/core-js" }, "license": "MIT", "keywords": [ "ES3", "ES5", "ES6", "ES7", "ES2015", "ES2016", "ES2017", "ES2018", "ES2019", "ES2020", "ECMAScript 3", "ECMAScript 5", "ECMAScript 6", "ECMAScript 7", "ECMAScript 2015", "ECMAScript 2016", "ECMAScript 2017", "ECMAScript 2018", "ECMAScript 2019", "ECMAScript 2020", "Harmony", "Strawman", "Map", "Set", "WeakMap", "WeakSet", "Promise", "Observable", "Symbol", "TypedArray", "URL", "URLSearchParams", "queueMicrotask", "setImmediate", "polyfill", "ponyfill", "shim" ], "scripts": { "postinstall": "node -e \"try{require('./postinstall')}catch(e){}\"" } } core-js-3.6.1/packages/core-js-compat/000077500000000000000000000000001360057567700175045ustar00rootroot00000000000000core-js-3.6.1/packages/core-js-compat/.npmignore000066400000000000000000000000351360057567700215010ustar00rootroot00000000000000node_modules/ /src/ *.log .* core-js-3.6.1/packages/core-js-compat/.npmrc000066400000000000000000000000231360057567700206170ustar00rootroot00000000000000package-lock=false core-js-3.6.1/packages/core-js-compat/README.md000066400000000000000000000065761360057567700210010ustar00rootroot00000000000000[`core-js-compat` package](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) contains data about the necessity of [`core-js`](https://github.com/zloirock/core-js) modules and API for getting a list of required core-js modules by browserslist query. ```js const { list, // array of required modules targets, // object with targets for each module } = require('core-js-compat')({ targets: '> 2.5%', // browserslist query or object of minimum environment versions to support filter: /^(es|web)\./, // optional filter - string-prefix, regexp or list of modules version: '3.4', // used `core-js` version, by default - the latest }); console.log(targets); /* => { 'es.symbol.match-all': { ios: '12.2-12.4' }, 'es.array.unscopables.flat': { ios: '12.2-12.4' }, 'es.array.unscopables.flat-map': { ios: '12.2-12.4' }, 'es.math.hypot': { chrome: '77' }, 'es.promise.all-settled': { firefox: '69', ios: '12.2-12.4' }, 'es.promise.finally': { ios: '12.2-12.4' }, 'es.string.match-all': { chrome: '77', firefox: '69', ios: '12.2-12.4' }, 'es.string.replace': { firefox: '69', ios: '12.2-12.4' }, 'es.typed-array.float32-array': { ios: '12.2-12.4' }, 'es.typed-array.float64-array': { ios: '12.2-12.4' }, 'es.typed-array.int8-array': { ios: '12.2-12.4' }, 'es.typed-array.int16-array': { ios: '12.2-12.4' }, 'es.typed-array.int32-array': { ios: '12.2-12.4' }, 'es.typed-array.uint8-array': { ios: '12.2-12.4' }, 'es.typed-array.uint8-clamped-array': { ios: '12.2-12.4' }, 'es.typed-array.uint16-array': { ios: '12.2-12.4' }, 'es.typed-array.uint32-array': { ios: '12.2-12.4' }, 'es.typed-array.from': { ios: '12.2-12.4' }, 'es.typed-array.of': { ios: '12.2-12.4' }, 'web.dom-collections.iterator': { ios: '12.2-12.4' }, 'web.immediate': { chrome: '77', firefox: '69', ios: '12.2-12.4' }, 'web.url': { ios: '12.2-12.4' }, 'web.url.to-json': { ios: '12.2-12.4' }, 'web.url-search-params': { ios: '12.2-12.4' } } */ ``` Additional API: ```js // equals of of the method from the example above require('core-js-compat/compat')({ targets, filter, version }); // => { list: Array, targets: { [ModuleName]: { [EngineName]: EngineVersion } } } // or require('core-js-compat').compat({ targets, filter, version }); // => { list: Array, targets: { [ModuleName]: { [EngineName]: EngineVersion } } } // full compat data: require('core-js-compat/data'); // => { [ModuleName]: { [EngineName]: EngineVersion } } // or require('core-js-compat').data; // => { [ModuleName]: { [EngineName]: EngineVersion } } // map of modules by `core-js` entry points: require('core-js-compat/entries'); // => { [EntryPoint]: Array } // or require('core-js-compat').entries; // => { [EntryPoint]: Array } // full list of modules: require('core-js-compat/modules'); // => Array // or require('core-js-compat').modules; // => Array // the subset of modules which available in the passed `core-js` version: require('core-js-compat/get-modules-list-for-target-version')('3.3'); // => Array // or require('core-js-compat').getModulesListForTargetVersion('3.3'); // => Array ``` If you want to add new / update data about modules required for target engines, [follow this instruction](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md#updating-core-js-compat-data). core-js-3.6.1/packages/core-js-compat/compat.js000066400000000000000000000026711360057567700213330ustar00rootroot00000000000000'use strict'; const { compare, has, intersection } = require('./helpers'); const data = require('./data'); const getModulesListForTargetVersion = require('./get-modules-list-for-target-version'); const modules = require('./modules'); const targetsParser = require('./targets-parser'); function checkModule(name, targets) { if (!has(data, name)) throw new TypeError(`Incorrect module: ${ name }`); const requirements = data[name]; const result = { required: false, targets: {}, }; for (const [engine, version] of targets) { if (!has(requirements, engine) || compare(version, '<', requirements[engine])) { result.required = true; result.targets[engine] = version; } } return result; } module.exports = function ({ targets, filter, version }) { const parsedTargets = targetsParser(targets); const result = { list: [], targets: {}, }; let $modules = Array.isArray(filter) ? filter : modules; if (filter instanceof RegExp) { $modules = $modules.filter(it => filter.test(it)); } else if (typeof filter == 'string') { $modules = $modules.filter(it => it.startsWith(filter)); } if (version) { $modules = intersection($modules, getModulesListForTargetVersion(version)); } for (const key of $modules) { const check = checkModule(key, parsedTargets); if (check.required) { result.list.push(key); result.targets[key] = check.targets; } } return result; }; core-js-3.6.1/packages/core-js-compat/get-modules-list-for-target-version.js000066400000000000000000000011101360057567700267640ustar00rootroot00000000000000'use strict'; const { compare, intersection, semver } = require('./helpers'); const modulesByVersions = require('./modules-by-versions'); const modules = require('./modules'); module.exports = function (raw) { const corejs = semver(raw); if (corejs.major !== 3) { throw RangeError('This version of `core-js-compat` works only with `core-js@3`.'); } const result = []; for (const version of Object.keys(modulesByVersions)) { if (compare(version, '<=', corejs)) { result.push(...modulesByVersions[version]); } } return intersection(result, modules); }; core-js-3.6.1/packages/core-js-compat/helpers.js000066400000000000000000000011741360057567700215070ustar00rootroot00000000000000'use strict'; const cmp = require('semver/functions/cmp'); const semver = require('semver/functions/coerce'); const has = Function.call.bind({}.hasOwnProperty); function compare(a, operator, b) { return cmp(semver(a), operator, semver(b)); } function intersection(list, order) { const set = list instanceof Set ? list : new Set(list); return order.filter(name => set.has(name)); } function sortObjectByKey(object, fn) { return Object.keys(object).sort(fn).reduce((memo, key) => { memo[key] = object[key]; return memo; }, {}); } module.exports = { compare, has, intersection, semver, sortObjectByKey, }; core-js-3.6.1/packages/core-js-compat/index.js000066400000000000000000000005571360057567700211600ustar00rootroot00000000000000'use strict'; const compat = require('./compat'); const data = require('./data'); const entries = require('./entries'); const getModulesListForTargetVersion = require('./get-modules-list-for-target-version'); const modules = require('./modules'); module.exports = Object.assign(compat, { compat, data, entries, getModulesListForTargetVersion, modules, }); core-js-3.6.1/packages/core-js-compat/package.json000066400000000000000000000010041360057567700217650ustar00rootroot00000000000000{ "name": "core-js-compat", "description": "core-js compat", "version": "3.6.1", "repository": { "type": "git", "url": "https://github.com/zloirock/core-js.git" }, "main": "index.js", "dependencies": { "browserslist": "^4.8.2", "semver": "7.0.0" }, "devDependencies": { "detective": "^5.2.0", "electron-to-chromium": "^1.3.322", "glob": "^7.1.6" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/core-js" }, "license": "MIT" } core-js-3.6.1/packages/core-js-compat/src/000077500000000000000000000000001360057567700202735ustar00rootroot00000000000000core-js-3.6.1/packages/core-js-compat/src/build-data.js000066400000000000000000000040421360057567700226370ustar00rootroot00000000000000'use strict'; const { writeFileSync } = require('fs'); const { resolve } = require('path'); const { compare, sortObjectByKey, semver } = require('../helpers'); const data = require('./data'); const external = require('./external'); const { ChromeToNode, ChromeToSamsung, ChromeToOperaMobile, ChromeToAndroid, ChromeToElectron, SafariToIOS, SafariToPhantomJS, } = require('./mapping'); for (const scope of [data, external]) { for (const [key, module] of Object.entries(scope)) { const { chrome, ie, safari } = module; const map = function (mapping, version, targetKey) { if (module[targetKey]) return; const source = semver(version); for (const [from, to] of mapping) { if (compare(source, '<=', from)) { module[targetKey] = String(to); return; } } }; if (!module.edge && ie && key !== 'web.immediate') { module.edge = '12'; } if (chrome) { if (!module.edge) { module.edge = String(Math.max(chrome, 74)); } if (!module.opera) { module.opera = String(chrome <= 23 ? 15 : chrome <= 29 ? 16 : chrome - 13); } if (!module.opera_mobile && module.opera && module.opera <= 42) { module.opera_mobile = module.opera; } else { map(ChromeToOperaMobile, chrome, 'opera_mobile'); } if (key.startsWith('es')) { map(ChromeToNode, chrome, 'node'); } map(ChromeToSamsung, chrome, 'samsung'); map(ChromeToAndroid, chrome, 'android'); if (/^(es|esnext|web)\./.test(key)) { map(ChromeToElectron, chrome, 'electron'); } } if (safari) { map(SafariToIOS, safari, 'ios'); map(SafariToPhantomJS, safari, 'phantom'); } scope[key] = sortObjectByKey(module); } } writeFileSync(resolve(__dirname, '../data.json'), JSON.stringify(data, null, ' ')); writeFileSync(resolve(__dirname, '../modules.json'), JSON.stringify(Object.keys(data), null, ' ')); writeFileSync(resolve(__dirname, '../external.json'), JSON.stringify(external, null, ' ')); core-js-3.6.1/packages/core-js-compat/src/build-entries.js000066400000000000000000000030271360057567700234010ustar00rootroot00000000000000'use strict'; const { readFileSync, writeFileSync } = require('fs'); const { dirname, resolve } = require('path'); const detective = require('detective'); const { sync: glob } = require('glob'); const { intersection, sortObjectByKey } = require('../helpers'); const modules = require('../modules'); function getModulesForEntryPoint(entry) { const match = entry.match(/[/\\]modules[/\\]([^/\\]+)$/); if (match) return [match[1]]; const name = require.resolve(entry); const result = []; const dir = dirname(name); const file = readFileSync(name); const dependencies = detective(file); for (const dependency of dependencies) { const relative = resolve(dir, dependency); result.push(...getModulesForEntryPoint(relative)); } return intersection(result, modules); } const entries = [ 'packages/core-js/index.js', ...glob('packages/core-js/es/**/*.js'), ...glob('packages/core-js/features/**/*.js'), ...glob('packages/core-js/modules/*.js'), ...glob('packages/core-js/proposals/**/*.js'), ...glob('packages/core-js/stable/**/*.js'), ...glob('packages/core-js/stage/**/*.js'), ...glob('packages/core-js/web/**/*.js'), ].reduce((memo, file) => { // TODO: store entries without the package name in `core-js@4` const entry = file.replace(/^packages\/(core-js.+)\.js$/, '$1').replace(/^(.+)\/index$/, '$1'); memo[entry] = getModulesForEntryPoint(resolve(__dirname, `../../${ entry }`)); return memo; }, {}); writeFileSync(resolve(__dirname, '../entries.json'), JSON.stringify(sortObjectByKey(entries), null, ' ')); core-js-3.6.1/packages/core-js-compat/src/build-modules-by-versions.js000066400000000000000000000007551360057567700256630ustar00rootroot00000000000000'use strict'; const { writeFileSync } = require('fs'); const { resolve } = require('path'); const modules = require('../modules'); const modulesByVersions = require('./modules-by-versions'); const defaults = new Set(modules); for (const version of Object.values(modulesByVersions)) { for (const module of version) defaults.delete(module); } writeFileSync(resolve(__dirname, '../modules-by-versions.json'), JSON.stringify({ '3.0': [...defaults], ...modulesByVersions, }, null, ' ')); core-js-3.6.1/packages/core-js-compat/src/data.js000066400000000000000000000651011360057567700215450ustar00rootroot00000000000000'use strict'; const data = { 'es.symbol': { chrome: '49', edge: '15', firefox: '51', safari: '10.0', }, 'es.symbol.description': { chrome: '70', firefox: '63', safari: '12.1', }, 'es.symbol.async-iterator': { chrome: '63', firefox: '55', safari: '12.0', }, 'es.symbol.has-instance': { chrome: '50', edge: '15', firefox: '49', safari: '10.0', }, 'es.symbol.is-concat-spreadable': { chrome: '48', edge: '15', firefox: '48', safari: '10.0', }, 'es.symbol.iterator': { chrome: '39', edge: '13', firefox: '36', safari: '9.0', }, 'es.symbol.match': { chrome: '50', firefox: '40', safari: '10.0', }, 'es.symbol.match-all': { chrome: '73', firefox: '67', safari: '13', }, 'es.symbol.replace': { chrome: '50', firefox: '49', safari: '10.0', }, 'es.symbol.search': { chrome: '50', firefox: '49', safari: '10.0', }, 'es.symbol.species': { chrome: '51', edge: '13', firefox: '41', safari: '10.0', }, 'es.symbol.split': { chrome: '50', firefox: '49', safari: '10.0', }, 'es.symbol.to-primitive': { chrome: '47', edge: '15', firefox: '44', safari: '10.0', }, 'es.symbol.to-string-tag': { chrome: '49', edge: '15', firefox: '51', safari: '10.0', }, 'es.symbol.unscopables': { chrome: '39', edge: '13', firefox: '48', safari: '9.0', }, 'es.array.concat': { chrome: '51', edge: '15', firefox: '48', safari: '10.0', }, 'es.array.copy-within': { chrome: '45', edge: '13', firefox: '48', safari: '9.0', }, 'es.array.every': { chrome: '26', firefox: '4', ie: '9', safari: '8.0', }, 'es.array.fill': { chrome: '45', edge: '13', firefox: '4', safari: '9.0', }, 'es.array.filter': { chrome: '51', edge: '15', firefox: '48', safari: '10.0', }, 'es.array.find': { chrome: '45', edge: '13', firefox: '48', safari: '9.0', }, 'es.array.find-index': { chrome: '45', edge: '13', firefox: '48', safari: '9.0', }, 'es.array.flat': { chrome: '69', firefox: '62', safari: '12.0', }, 'es.array.flat-map': { chrome: '69', firefox: '62', safari: '12.0', }, 'es.array.for-each': { chrome: '26', firefox: '4', ie: '9', safari: '8.0', }, 'es.array.from': { chrome: '51', edge: '15', firefox: '53', safari: '9.0', }, 'es.array.includes': { chrome: '53', edge: '14', firefox: '48', safari: '10.0', }, 'es.array.index-of': { chrome: '51', firefox: '4', ie: '9', safari: '8.0', }, 'es.array.is-array': { chrome: '5', firefox: '4', ie: '9', opera: '10.50', safari: '4.0', }, 'es.array.iterator': { chrome: '66', edge: '15', firefox: '60', safari: '10.0', }, 'es.array.join': { chrome: '26', edge: '13', firefox: '4', safari: '8.0', }, 'es.array.last-index-of': { chrome: '51', firefox: '4', ie: '9', safari: '8.0', }, 'es.array.map': { chrome: '51', edge: '13', firefox: '50', safari: '10.0', }, 'es.array.of': { chrome: '45', edge: '13', firefox: '25', safari: '9.0', }, 'es.array.reduce': { chrome: '26', firefox: '4', ie: '9', safari: '8.0', }, 'es.array.reduce-right': { chrome: '26', firefox: '4', ie: '9', safari: '8.0', }, 'es.array.reverse': { chrome: '26', firefox: '4', ie: '8', // safari 12.0 has a serious bug safari: '12.0.2', }, 'es.array.slice': { chrome: '51', edge: '13', firefox: '48', safari: '10.0', }, 'es.array.some': { chrome: '26', firefox: '4', ie: '9', safari: '8.0', }, 'es.array.sort': { chrome: '63', firefox: '4', ie: '9', safari: '12.0', }, 'es.array.species': { chrome: '51', edge: '13', firefox: '48', safari: '10.0', }, 'es.array.splice': { chrome: '51', edge: '13', firefox: '49', safari: '10.0', }, 'es.array.unscopables.flat': { chrome: '73', firefox: '67', safari: '13', }, 'es.array.unscopables.flat-map': { chrome: '73', firefox: '67', safari: '13', }, 'es.array-buffer.constructor': { chrome: '26', edge: '14', firefox: '44', safari: '12.0', }, 'es.array-buffer.is-view': { chrome: '32', firefox: '29', ie: '11', safari: '8.0', }, 'es.array-buffer.slice': { chrome: '31', firefox: '46', ie: '11', safari: '12.1', }, 'es.data-view': { chrome: '26', firefox: '15', ie: '10', safari: '8.0', }, 'es.date.now': { chrome: '5', firefox: '2', ie: '9', opera: '10.50', safari: '4.0', }, 'es.date.to-iso-string': { chrome: '26', firefox: '7', ie: '9', safari: '8.0', }, 'es.date.to-json': { chrome: '26', firefox: '4', ie: '9', safari: '10.0', }, 'es.date.to-primitive': { chrome: '47', edge: '15', firefox: '44', safari: '10.0', }, 'es.date.to-string': { chrome: '26', firefox: '4', ie: '9', safari: '8.0', }, 'es.function.bind': { chrome: '7', firefox: '4', ie: '9', opera: '12', safari: '5.1', }, 'es.function.has-instance': { chrome: '51', edge: '15', firefox: '50', safari: '10.0', }, 'es.function.name': { chrome: '26', edge: '14', firefox: '4', safari: '8.0', }, 'es.global-this': { chrome: '71', firefox: '65', safari: '12.1', }, 'es.json.stringify': { chrome: '72', firefox: '64', safari: '12.1', }, 'es.json.to-string-tag': { chrome: '50', edge: '15', firefox: '51', safari: '10.0', }, 'es.map': { chrome: '51', edge: '15', firefox: '53', safari: '10.0', }, 'es.math.acosh': { chrome: '54', edge: '13', firefox: '25', safari: '8.0', }, 'es.math.asinh': { chrome: '38', edge: '13', firefox: '25', safari: '8.0', }, 'es.math.atanh': { chrome: '38', edge: '13', firefox: '25', safari: '8.0', }, 'es.math.cbrt': { chrome: '38', edge: '12', firefox: '25', safari: '7.1', }, 'es.math.clz32': { chrome: '38', edge: '12', firefox: '31', safari: '9.0', }, 'es.math.cosh': { chrome: '39', edge: '13', firefox: '25', safari: '8.0', }, 'es.math.expm1': { chrome: '39', edge: '13', firefox: '46', safari: '8.0', }, 'es.math.fround': { chrome: '38', edge: '12', firefox: '26', safari: '7.1', }, 'es.math.hypot': { // https://bugs.chromium.org/p/v8/issues/detail?id=9546 chrome: '78', // '38', edge: '12', firefox: '27', safari: '7.1', }, 'es.math.imul': { chrome: '28', edge: '13', firefox: '20', safari: '9.0', }, 'es.math.log10': { chrome: '38', edge: '12', firefox: '25', safari: '7.1', }, 'es.math.log1p': { chrome: '38', edge: '12', firefox: '25', safari: '7.1', }, 'es.math.log2': { chrome: '38', edge: '12', firefox: '25', safari: '7.1', }, 'es.math.sign': { chrome: '38', edge: '12', firefox: '25', safari: '9.0', }, 'es.math.sinh': { chrome: '39', edge: '13', firefox: '25', safari: '8.0', }, 'es.math.tanh': { chrome: '38', edge: '12', firefox: '25', safari: '7.1', }, 'es.math.to-string-tag': { chrome: '50', edge: '15', firefox: '51', safari: '10.0', }, 'es.math.trunc': { chrome: '38', edge: '12', firefox: '25', safari: '7.1', }, 'es.number.constructor': { chrome: '41', edge: '13', firefox: '46', safari: '9.0', }, 'es.number.epsilon': { chrome: '34', edge: '12', firefox: '25', safari: '9.0', }, 'es.number.is-finite': { android: '4.1', chrome: '19', edge: '12', firefox: '16', safari: '9.0', }, 'es.number.is-integer': { chrome: '34', edge: '12', firefox: '16', safari: '9.0', }, 'es.number.is-nan': { android: '4.1', chrome: '19', edge: '12', firefox: '15', safari: '9.0', }, 'es.number.is-safe-integer': { chrome: '34', edge: '12', firefox: '32', safari: '9.0', }, 'es.number.max-safe-integer': { chrome: '34', edge: '12', firefox: '31', safari: '9.0', }, 'es.number.min-safe-integer': { chrome: '34', edge: '12', firefox: '31', safari: '9.0', }, 'es.number.parse-float': { chrome: '35', edge: '13', firefox: '39', safari: '11.0', }, 'es.number.parse-int': { chrome: '35', edge: '13', firefox: '39', safari: '9.0', }, 'es.number.to-fixed': { chrome: '26', firefox: '4', safari: '8.0', }, 'es.number.to-precision': { chrome: '26', firefox: '4', ie: '8', safari: '8.0', }, 'es.object.assign': { chrome: '49', // order of operations bug // edge: '13', firefox: '36', safari: '9.0', }, 'es.object.create': { chrome: '5', firefox: '4', ie: '9', opera: '12', safari: '4.0', }, 'es.object.define-getter': { chrome: '62', edge: '16', firefox: '48', safari: '8.0', }, 'es.object.define-properties': { chrome: '5', firefox: '4', ie: '9', opera: '12', safari: '8.0', }, 'es.object.define-property': { chrome: '5', firefox: '4', ie: '9', opera: '12', safari: '8.0', }, 'es.object.define-setter': { chrome: '62', edge: '16', firefox: '48', safari: '8.0', }, 'es.object.entries': { chrome: '54', edge: '14', firefox: '47', safari: '10.1', }, 'es.object.freeze': { chrome: '44', edge: '13', firefox: '35', safari: '9.0', }, 'es.object.from-entries': { chrome: '73', firefox: '63', safari: '12.1', }, 'es.object.get-own-property-descriptor': { chrome: '44', edge: '13', firefox: '35', safari: '9.0', }, 'es.object.get-own-property-descriptors': { chrome: '54', edge: '15', firefox: '50', safari: '10.0', }, 'es.object.get-own-property-names': { chrome: '40', edge: '13', firefox: '34', safari: '9.0', }, 'es.object.get-prototype-of': { chrome: '44', edge: '13', firefox: '35', safari: '9.0', }, 'es.object.is': { android: '4.1', chrome: '19', edge: '12', firefox: '22', safari: '9.0', }, 'es.object.is-extensible': { chrome: '44', edge: '13', firefox: '35', safari: '9.0', }, 'es.object.is-frozen': { chrome: '44', edge: '13', firefox: '35', safari: '9.0', }, 'es.object.is-sealed': { chrome: '44', edge: '13', firefox: '35', safari: '9.0', }, 'es.object.keys': { chrome: '40', edge: '13', firefox: '35', safari: '9.0', }, 'es.object.lookup-getter': { chrome: '62', edge: '16', firefox: '48', safari: '8.0', }, 'es.object.lookup-setter': { chrome: '62', edge: '16', firefox: '48', safari: '8.0', }, 'es.object.prevent-extensions': { chrome: '44', edge: '13', firefox: '35', safari: '9.0', }, 'es.object.seal': { chrome: '44', edge: '13', firefox: '35', safari: '9.0', }, 'es.object.set-prototype-of': { chrome: '34', firefox: '31', ie: '11', safari: '9.0', }, 'es.object.to-string': { chrome: '49', edge: '15', firefox: '51', safari: '10.0', }, 'es.object.values': { chrome: '54', edge: '14', firefox: '47', safari: '10.1', }, 'es.parse-float': { chrome: '35', firefox: '8', ie: '8', safari: '8.0', }, 'es.parse-int': { chrome: '35', firefox: '21', ie: '9', safari: '8.0', }, 'es.promise': { // V8 6.6 has a serious bug chrome: '67', // '51', firefox: '69', safari: '11.0', }, 'es.promise.all-settled': { chrome: '76', firefox: '71', safari: '13', }, 'es.promise.finally': { // V8 6.6 has a serious bug chrome: '67', // '63', firefox: '69', // Previous versions are non-generic // https://bugs.webkit.org/show_bug.cgi?id=200788 ios: '13.2.3', // need to clarify the patch release, >13.0.0 && <= 13.2.3 safari: '13.0.3', // need to clarify the patch release, >13.0.0 && <= 13.0.3 }, 'es.reflect.apply': { chrome: '49', edge: '15', firefox: '42', safari: '10.0', }, 'es.reflect.construct': { chrome: '49', edge: '15', firefox: '44', safari: '10.0', }, 'es.reflect.define-property': { chrome: '49', edge: '13', firefox: '42', safari: '10.0', }, 'es.reflect.delete-property': { chrome: '49', edge: '12', firefox: '42', safari: '10.0', }, 'es.reflect.get': { chrome: '49', edge: '12', firefox: '42', safari: '10.0', }, 'es.reflect.get-own-property-descriptor': { chrome: '49', edge: '12', firefox: '42', safari: '10.0', }, 'es.reflect.get-prototype-of': { chrome: '49', edge: '12', firefox: '42', safari: '10.0', }, 'es.reflect.has': { chrome: '49', edge: '12', firefox: '42', safari: '10.0', }, 'es.reflect.is-extensible': { chrome: '49', edge: '12', firefox: '42', safari: '10.0', }, 'es.reflect.own-keys': { chrome: '49', edge: '12', firefox: '42', safari: '10.0', }, 'es.reflect.prevent-extensions': { chrome: '49', edge: '12', firefox: '42', safari: '10.0', }, 'es.reflect.set': { // MS Edge 17-18 Reflect.set allows setting the property to object // with non-writable property on the prototype // edge: '12', chrome: '49', firefox: '42', safari: '10.0', }, 'es.reflect.set-prototype-of': { chrome: '49', edge: '12', firefox: '42', safari: '10.0', }, 'es.regexp.constructor': { chrome: '51', firefox: '49', safari: '10.0', }, 'es.regexp.exec': { chrome: '26', edge: '13', firefox: '44', safari: '10.0', }, 'es.regexp.flags': { chrome: '49', firefox: '37', safari: '9.0', }, 'es.regexp.sticky': { chrome: '49', edge: '13', firefox: '3', safari: '10.0', }, 'es.regexp.test': { chrome: '51', firefox: '46', safari: '10.0', }, 'es.regexp.to-string': { chrome: '50', firefox: '46', safari: '10.0', }, 'es.set': { chrome: '51', edge: '15', firefox: '53', safari: '10.0', }, 'es.string.code-point-at': { chrome: '41', edge: '13', firefox: '29', safari: '9.0', }, 'es.string.ends-with': { chrome: '51', firefox: '40', safari: '10.0', }, 'es.string.from-code-point': { chrome: '41', edge: '13', firefox: '29', safari: '9.0', }, 'es.string.includes': { chrome: '51', firefox: '40', safari: '10.0', }, 'es.string.iterator': { chrome: '39', edge: '13', firefox: '36', safari: '9.0', }, 'es.string.match': { chrome: '51', firefox: '49', safari: '10.0', }, 'es.string.match-all': { // Early implementations does not throw an error on non-global regex chrome: '80', // 73 firefox: '73', // 67 safari: '13.1', // 13 }, 'es.string.pad-end': { chrome: '57', edge: '15', firefox: '48', safari: '11.0', }, 'es.string.pad-start': { chrome: '57', edge: '15', firefox: '48', safari: '11.0', }, 'es.string.raw': { chrome: '41', edge: '13', firefox: '34', safari: '9.0', }, 'es.string.repeat': { chrome: '41', edge: '13', firefox: '24', safari: '9.0', }, 'es.string.replace': { chrome: '64', }, 'es.string.search': { chrome: '51', firefox: '49', safari: '10.0', }, 'es.string.split': { chrome: '54', firefox: '49', safari: '10.0', }, 'es.string.starts-with': { chrome: '51', firefox: '40', safari: '10.0', }, 'es.string.trim': { chrome: '59', edge: '15', firefox: '52', safari: '12.1', }, 'es.string.trim-end': { chrome: '66', firefox: '61', safari: '12.1', }, 'es.string.trim-start': { chrome: '66', firefox: '61', safari: '12.0', }, 'es.string.anchor': { chrome: '26', edge: '13', firefox: '17', safari: '8.0', }, 'es.string.big': { chrome: '26', edge: '13', firefox: '4', safari: '8.0', }, 'es.string.blink': { chrome: '26', edge: '13', firefox: '4', safari: '8.0', }, 'es.string.bold': { chrome: '26', edge: '13', firefox: '4', safari: '8.0', }, 'es.string.fixed': { chrome: '26', edge: '13', firefox: '4', safari: '8.0', }, 'es.string.fontcolor': { chrome: '26', edge: '13', firefox: '17', safari: '8.0', }, 'es.string.fontsize': { chrome: '26', edge: '13', firefox: '17', safari: '8.0', }, 'es.string.italics': { chrome: '26', edge: '13', firefox: '4', safari: '8.0', }, 'es.string.link': { chrome: '26', edge: '13', firefox: '17', safari: '8.0', }, 'es.string.small': { chrome: '26', edge: '13', firefox: '4', safari: '8.0', }, 'es.string.strike': { chrome: '26', edge: '13', firefox: '4', safari: '8.0', }, 'es.string.sub': { chrome: '26', edge: '13', firefox: '4', safari: '8.0', }, 'es.string.sup': { chrome: '26', edge: '13', firefox: '4', safari: '8.0', }, 'es.typed-array.float32-array': { chrome: '54', edge: '15', firefox: '55', }, 'es.typed-array.float64-array': { chrome: '54', edge: '15', firefox: '55', }, 'es.typed-array.int8-array': { chrome: '54', edge: '15', firefox: '55', }, 'es.typed-array.int16-array': { chrome: '54', edge: '15', firefox: '55', }, 'es.typed-array.int32-array': { chrome: '54', edge: '15', firefox: '55', }, 'es.typed-array.uint8-array': { chrome: '54', edge: '15', firefox: '55', }, 'es.typed-array.uint8-clamped-array': { chrome: '54', edge: '15', firefox: '55', }, 'es.typed-array.uint16-array': { chrome: '54', edge: '15', firefox: '55', }, 'es.typed-array.uint32-array': { chrome: '54', edge: '15', firefox: '55', }, 'es.typed-array.copy-within': { chrome: '45', edge: '13', firefox: '34', safari: '10.0', }, 'es.typed-array.every': { chrome: '45', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.fill': { chrome: '45', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.filter': { chrome: '45', edge: '13', firefox: '38', safari: '10.0', }, 'es.typed-array.find': { chrome: '45', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.find-index': { chrome: '45', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.for-each': { chrome: '45', edge: '13', firefox: '38', safari: '10.0', }, 'es.typed-array.from': { chrome: '54', edge: '15', firefox: '55', }, 'es.typed-array.includes': { chrome: '49', edge: '14', firefox: '43', safari: '10.0', }, 'es.typed-array.index-of': { chrome: '45', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.iterator': { chrome: '47', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.join': { chrome: '45', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.last-index-of': { chrome: '45', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.map': { chrome: '45', edge: '13', firefox: '38', safari: '10.0', }, 'es.typed-array.of': { chrome: '54', edge: '15', firefox: '55', }, 'es.typed-array.reduce': { chrome: '45', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.reduce-right': { chrome: '45', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.reverse': { chrome: '45', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.set': { chrome: '26', edge: '13', firefox: '15', safari: '8.0', }, 'es.typed-array.slice': { chrome: '45', edge: '13', firefox: '38', safari: '10.0', }, 'es.typed-array.some': { chrome: '45', edge: '13', firefox: '37', safari: '10.0', }, 'es.typed-array.sort': { chrome: '45', edge: '13', firefox: '46', safari: '10.0', }, 'es.typed-array.subarray': { chrome: '26', edge: '13', firefox: '15', safari: '8.0', }, 'es.typed-array.to-locale-string': { chrome: '45', firefox: '51', safari: '10.0', }, 'es.typed-array.to-string': { chrome: '51', edge: '13', firefox: '51', safari: '10.0', }, 'es.weak-map': { chrome: '51', edge: '15', firefox: '53', safari: '10.0', }, 'es.weak-set': { chrome: '51', edge: '15', firefox: '53', safari: '10.0', }, 'esnext.aggregate-error': { }, 'esnext.array.is-template-object': { }, 'esnext.array.last-index': { }, 'esnext.array.last-item': { }, 'esnext.async-iterator.constructor': { }, 'esnext.async-iterator.as-indexed-pairs': { }, 'esnext.async-iterator.drop': { }, 'esnext.async-iterator.every': { }, 'esnext.async-iterator.filter': { }, 'esnext.async-iterator.find': { }, 'esnext.async-iterator.flat-map': { }, 'esnext.async-iterator.for-each': { }, 'esnext.async-iterator.from': { }, 'esnext.async-iterator.map': { }, 'esnext.async-iterator.reduce': { }, 'esnext.async-iterator.some': { }, 'esnext.async-iterator.take': { }, 'esnext.async-iterator.to-array': { }, 'esnext.composite-key': { }, 'esnext.composite-symbol': { }, // TODO: Remove from `core-js@4` 'esnext.global-this': null, 'esnext.iterator.constructor': { }, 'esnext.iterator.as-indexed-pairs': { }, 'esnext.iterator.drop': { }, 'esnext.iterator.every': { }, 'esnext.iterator.filter': { }, 'esnext.iterator.find': { }, 'esnext.iterator.flat-map': { }, 'esnext.iterator.for-each': { }, 'esnext.iterator.from': { }, 'esnext.iterator.map': { }, 'esnext.iterator.reduce': { }, 'esnext.iterator.some': { }, 'esnext.iterator.take': { }, 'esnext.iterator.to-array': { }, 'esnext.map.delete-all': { }, 'esnext.map.every': { }, 'esnext.map.filter': { }, 'esnext.map.find': { }, 'esnext.map.find-key': { }, 'esnext.map.from': { }, 'esnext.map.group-by': { }, 'esnext.map.includes': { }, 'esnext.map.key-by': { }, 'esnext.map.key-of': { }, 'esnext.map.map-keys': { }, 'esnext.map.map-values': { }, 'esnext.map.merge': { }, 'esnext.map.of': { }, 'esnext.map.reduce': { }, 'esnext.map.some': { }, 'esnext.map.update': { }, // TODO: Remove from `core-js@4` 'esnext.map.update-or-insert': { }, 'esnext.map.upsert': { }, 'esnext.math.clamp': { }, 'esnext.math.deg-per-rad': { }, 'esnext.math.degrees': { }, 'esnext.math.fscale': { }, // TODO: Remove from `core-js@4` 'esnext.math.iaddh': { }, // TODO: Remove from `core-js@4` 'esnext.math.imulh': { }, // TODO: Remove from `core-js@4` 'esnext.math.isubh': { }, 'esnext.math.rad-per-deg': { }, 'esnext.math.radians': { }, 'esnext.math.scale': { }, 'esnext.math.seeded-prng': { }, 'esnext.math.signbit': { }, // TODO: Remove from `core-js@4` 'esnext.math.umulh': { }, 'esnext.number.from-string': { }, 'esnext.object.iterate-entries': { }, 'esnext.object.iterate-keys': { }, 'esnext.object.iterate-values': { }, 'esnext.observable': { }, // TODO: Remove from `core-js@4` 'esnext.promise.all-settled': null, 'esnext.promise.any': { }, 'esnext.promise.try': { }, 'esnext.reflect.define-metadata': { }, 'esnext.reflect.delete-metadata': { }, 'esnext.reflect.get-metadata': { }, 'esnext.reflect.get-metadata-keys': { }, 'esnext.reflect.get-own-metadata': { }, 'esnext.reflect.get-own-metadata-keys': { }, 'esnext.reflect.has-metadata': { }, 'esnext.reflect.has-own-metadata': { }, 'esnext.reflect.metadata': { }, 'esnext.set.add-all': { }, 'esnext.set.delete-all': { }, 'esnext.set.difference': { }, 'esnext.set.every': { }, 'esnext.set.filter': { }, 'esnext.set.find': { }, 'esnext.set.from': { }, 'esnext.set.intersection': { }, 'esnext.set.is-disjoint-from': { }, 'esnext.set.is-subset-of': { }, 'esnext.set.is-superset-of': { }, 'esnext.set.join': { }, 'esnext.set.map': { }, 'esnext.set.of': { }, 'esnext.set.reduce': { }, 'esnext.set.some': { }, 'esnext.set.symmetric-difference': { }, 'esnext.set.union': { }, 'esnext.string.at': { }, 'esnext.string.code-points': { }, // TODO: Remove from `core-js@4` 'esnext.string.match-all': null, 'esnext.string.replace-all': { }, 'esnext.symbol.async-dispose': { }, 'esnext.symbol.dispose': { }, 'esnext.symbol.observable': { }, 'esnext.symbol.pattern-match': { }, // TODO: Remove from `core-js@4` 'esnext.symbol.replace-all': { }, 'esnext.weak-map.delete-all': { }, 'esnext.weak-map.from': { }, 'esnext.weak-map.of': { }, 'esnext.weak-map.upsert': { }, 'esnext.weak-set.add-all': { }, 'esnext.weak-set.delete-all': { }, 'esnext.weak-set.from': { }, 'esnext.weak-set.of': { }, 'web.dom-collections.for-each': { chrome: '58', edge: '16', firefox: '50', node: '0.0.1', safari: '10.0', }, 'web.dom-collections.iterator': { chrome: '66', firefox: '60', node: '0.0.1', safari: '13.1', }, 'web.immediate': { ie: '10', node: '0.9.1', }, 'web.queue-microtask': { chrome: '71', firefox: '69', // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` node: '12.0', // '11.0', safari: '12.1', }, 'web.timers': { android: '1.5', chrome: '1', firefox: '1', ie: '10', node: '0.0.1', opera: '7', safari: '1.0', }, 'web.url': { chrome: '67', firefox: '57', node: '10.0', }, 'web.url.to-json': { chrome: '71', firefox: '57', node: '10.0', }, 'web.url-search-params': { chrome: '67', firefox: '57', node: '10.0', }, }; // TODO: Remove from `core-js@4` data['esnext.global-this'] = data['es.global-this']; data['esnext.promise.all-settled'] = data['es.promise.all-settled']; data['esnext.string.match-all'] = data['es.string.match-all']; module.exports = data; core-js-3.6.1/packages/core-js-compat/src/external.js000066400000000000000000000001771360057567700224600ustar00rootroot00000000000000'use strict'; module.exports = { modules: { chrome: '61', edge: '16', firefox: '60', safari: '10.1', }, }; core-js-3.6.1/packages/core-js-compat/src/mapping.js000066400000000000000000000046531360057567700222740ustar00rootroot00000000000000'use strict'; const ChromeToElectronModule = require('electron-to-chromium/chromium-versions'); const ChromeToElectron = Object.entries(ChromeToElectronModule); module.exports = { // https://nodejs.org/dist/index.json ChromeToNode: [ [3, '0.0.3'], [4, '0.1.19'], [5, '0.1.27'], [6, '0.1.90'], [7, '0.1.101'], [9, '0.3.0'], [10, '0.3.2'], [11, '0.3.8'], [14, '0.5.1'], [15, '0.5.4'], [16, '0.5.6'], [18, '0.7.0'], [19, '0.7.3'], [21, '0.7.11'], [23, '0.9.3'], [24, '0.9.6'], [27, '0.11.0'], [28, '0.11.1'], [29, '0.11.2'], [30, '0.11.4'], [31, '0.11.8'], [32, '0.11.9'], [35, '0.11.13'], [36, '0.11.14'], [38, '0.11.15'], [41, '1.0'], // io.js [42, '2.0'], // io.js [44, '3.0'], // io.js [45, '4.0'], [46, '5.0'], [50, '6.0'], [51, '6.5'], [54, '7.0'], [55, '7.6'], [58, '8.0'], [60, '8.3'], [61, '8.7'], [62, '8.10'], [66, '10.0'], [67, '10.4'], [68, '10.9'], [70, '11.0'], [74, '12.0'], [75, '12.5'], [76, '12.9'], [77, '12.11'], [78, '13.0'], [79, '13.2'], ], // https://github.com/mdn/browser-compat-data/blob/master/browsers/samsunginternet_android.json ChromeToSamsung: [ [18, '1.0'], [28, '1.5'], [34, '2.0'], [38, '3.0'], [42, '3.4'], [44, '4.0'], [51, '5.0'], [56, '6.0'], [59, '7.0'], [63, '8.0'], [67, '9.0'], [71, '10.0'], [75, '11.0'], ], // https://github.com/mdn/browser-compat-data/blob/master/browsers/opera_android.json ChromeToOperaMobile: [ [59, 43], [60, 44], [61, 45], [63, 46], [66, 47], [69, 48], [70, 49], [71, 50], [72, 51], [73, 52], [74, 53], [76, 54], [77, 55], ], ChromeToAndroid: [ [9, '3.0'], [12, '4.0'], [30, '4.4'], [33, '4.4.3'], ], ChromeToElectron, // https://github.com/mdn/browser-compat-data/blob/master/browsers/safari_ios.json SafariToIOS: [ ['3.0', '1.0'], ['3.1', '2.0'], ['3.2', '3.0'], ['4.0', '3.2'], ['4.1', '4.2'], ['5.1', '5.1'], ['6.0', '6.0'], ['6.1', '7.0'], ['7.1', '8.0'], ['9.0', '9.0'], ['9.1', '9.3'], ['10.0', '10.0'], ['10.1', '10.3'], ['11.0', '11.0'], ['11.1', '11.3'], ['12.0', '12.0'], ['12.1', '12.2'], ['13.0', '13.0'], ], SafariToPhantomJS: [ ['4.1', '1.9'], ['6.0', '2.0'], ], }; core-js-3.6.1/packages/core-js-compat/src/modules-by-versions.js000066400000000000000000000030031360057567700245530ustar00rootroot00000000000000'use strict'; module.exports = { 3.1: [ 'es.string.match-all', 'es.symbol.match-all', 'esnext.symbol.replace-all', ], 3.2: [ 'es.promise.all-settled', 'esnext.array.is-template-object', 'esnext.map.update-or-insert', 'esnext.symbol.async-dispose', ], 3.3: [ 'es.global-this', 'esnext.async-iterator.constructor', 'esnext.async-iterator.as-indexed-pairs', 'esnext.async-iterator.drop', 'esnext.async-iterator.every', 'esnext.async-iterator.filter', 'esnext.async-iterator.find', 'esnext.async-iterator.flat-map', 'esnext.async-iterator.for-each', 'esnext.async-iterator.from', 'esnext.async-iterator.map', 'esnext.async-iterator.reduce', 'esnext.async-iterator.some', 'esnext.async-iterator.take', 'esnext.async-iterator.to-array', 'esnext.iterator.constructor', 'esnext.iterator.as-indexed-pairs', 'esnext.iterator.drop', 'esnext.iterator.every', 'esnext.iterator.filter', 'esnext.iterator.find', 'esnext.iterator.flat-map', 'esnext.iterator.for-each', 'esnext.iterator.from', 'esnext.iterator.map', 'esnext.iterator.reduce', 'esnext.iterator.some', 'esnext.iterator.take', 'esnext.iterator.to-array', 'esnext.map.upsert', 'esnext.weak-map.upsert', ], 3.4: [ 'es.json.stringify', ], 3.5: [ 'esnext.object.iterate-entries', 'esnext.object.iterate-keys', 'esnext.object.iterate-values', ], 3.6: [ 'es.regexp.sticky', 'es.regexp.test', ], }; core-js-3.6.1/packages/core-js-compat/targets-parser.js000066400000000000000000000033541360057567700230120ustar00rootroot00000000000000'use strict'; const browserslist = require('browserslist'); const { compare, has } = require('./helpers'); const external = require('./external'); const aliases = new Map([ ['and_chr', 'chrome'], ['and_ff', 'firefox'], ['ie_mob', 'ie'], ['ios_saf', 'ios'], ['op_mob', 'opera_mobile'], ]); const validTargets = new Set([ 'android', 'chrome', 'edge', 'electron', 'firefox', 'ie', 'ios', 'node', 'opera', 'opera_mobile', 'phantom', 'safari', 'samsung', ]); module.exports = function (targets) { if (typeof targets !== 'object' || Array.isArray(targets)) { targets = { browsers: targets }; } const { browsers, esmodules, node, ...rest } = targets; const list = Object.entries(rest); if (browsers) { list.push(...browserslist(browsers).map(it => it.split(' '))); } if (esmodules) { list.push(...Object.entries(external.modules)); } if (node) { list.push(['node', node === 'current' ? process.versions.node : node]); } const normalized = list.map(([engine, version]) => { if (has(browserslist.aliases, engine)) { engine = browserslist.aliases[engine]; } if (aliases.has(engine)) { engine = aliases.get(engine); } else if (engine === 'android' && compare(version, '>', '4.4.4')) { engine = 'chrome'; } return [engine, String(version)]; }).filter(([engine]) => { return validTargets.has(engine); }).sort(([a], [b]) => { return a < b ? -1 : a > b ? 1 : 0; }); const reducedByMinVersion = new Map(); for (const [engine, version] of normalized) { if (!reducedByMinVersion.has(engine) || compare(version, '<=', reducedByMinVersion.get(engine))) { reducedByMinVersion.set(engine, version); } } return reducedByMinVersion; }; core-js-3.6.1/packages/core-js-pure/000077500000000000000000000000001360057567700171745ustar00rootroot00000000000000core-js-3.6.1/packages/core-js-pure/.npmignore000066400000000000000000000000431360057567700211700ustar00rootroot00000000000000node_modules/ *.log .* /override/ core-js-3.6.1/packages/core-js-pure/README.md000066400000000000000000000126611360057567700204610ustar00rootroot00000000000000# core-js-pure [![Sponsors on Open Collective](https://opencollective.com/core-js/sponsors/badge.svg)](#sponsors) [![Backers on Open Collective](https://opencollective.com/core-js/backers/badge.svg)](#backers) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/zloirock/core-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![version](https://img.shields.io/npm/v/core-js-pure.svg)](https://www.npmjs.com/package/core-js-pure) [![npm downloads](https://img.shields.io/npm/dm/core-js-pure.svg)](http://npm-stat.com/charts.html?package=core-js-pure&author=&from=2019-03-18) [![Build Status](https://travis-ci.org/zloirock/core-js.svg)](https://travis-ci.org/zloirock/core-js) [![devDependency status](https://david-dm.org/zloirock/core-js/dev-status.svg)](https://david-dm.org/zloirock/core-js?type=dev) > Modular standard library for JavaScript. Includes polyfills for [ECMAScript up to 2019](https://github.com/zloirock/core-js#ecmascript): [promises](https://github.com/zloirock/core-js#ecmascript-promise), [symbols](https://github.com/zloirock/core-js#ecmascript-symbol), [collections](https://github.com/zloirock/core-js#ecmascript-collections), iterators, [typed arrays](https://github.com/zloirock/core-js#ecmascript-typed-arrays), many other features, [ECMAScript proposals](https://github.com/zloirock/core-js#ecmascript-proposals), [some cross-platform WHATWG / W3C features and proposals](#web-standards) like [`URL`](https://github.com/zloirock/core-js#url-and-urlsearchparams). You can load only required features or use it without global namespace pollution. ## As advertising: the author is looking for a good job -) ## [core-js@3, babel and a look into the future](https://github.com/zloirock/core-js/tree/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md) ## Raising funds `core-js` isn't backed by a company, so the future of this project depends on you. Become a sponsor or a backer [**on Open Collective**](https://opencollective.com/core-js) or [**on Patreon**](https://www.patreon.com/zloirock) if you are interested in `core-js`. --- --- --- [*Example*](http://goo.gl/a2xexl): ```js import 'core-js'; // <- at the top of your entry point Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] [1, [2, 3], [4, [5]]].flat(2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` *You can load only required features*: ```js import 'core-js/features/array/from'; // <- at the top of your entry point import 'core-js/features/array/flat'; // <- at the top of your entry point import 'core-js/features/set'; // <- at the top of your entry point import 'core-js/features/promise'; // <- at the top of your entry point Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] [1, [2, 3], [4, [5]]].flat(2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` *Or use it without global namespace pollution*: ```js import from from 'core-js-pure/features/array/from'; import flat from 'core-js-pure/features/array/flat'; import Set from 'core-js-pure/features/set'; import Promise from 'core-js-pure/features/promise'; from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] flat([1, [2, 3], [4, [5]]], 2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` **It's a version without global namespace pollution (the third example), for more info see [`core-js` documentation](https://github.com/zloirock/core-js/blob/master/README.md)**. core-js-3.6.1/packages/core-js-pure/override/000077500000000000000000000000001360057567700210135ustar00rootroot00000000000000core-js-3.6.1/packages/core-js-pure/override/internals/000077500000000000000000000000001360057567700230125ustar00rootroot00000000000000core-js-3.6.1/packages/core-js-pure/override/internals/add-to-unscopables.js000066400000000000000000000000561360057567700270350ustar00rootroot00000000000000module.exports = function () { /* empty */ }; core-js-3.6.1/packages/core-js-pure/override/internals/array-buffer-view-core.js000066400000000000000000000000111360057567700276230ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/internals/array-buffer.js000066400000000000000000000000111360057567700257250ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/internals/collection.js000066400000000000000000000057401360057567700255110ustar00rootroot00000000000000'use strict'; var $ = require('./export'); var global = require('../internals/global'); var InternalMetadataModule = require('../internals/internal-metadata'); var fails = require('../internals/fails'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var iterate = require('../internals/iterate'); var anInstance = require('../internals/an-instance'); var isObject = require('../internals/is-object'); var setToStringTag = require('../internals/set-to-string-tag'); var defineProperty = require('../internals/object-define-property').f; var forEach = require('../internals/array-iteration').forEach; var DESCRIPTORS = require('../internals/descriptors'); var InternalStateModule = require('../internals/internal-state'); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; var ADDER = IS_MAP ? 'set' : 'add'; var NativeConstructor = global[CONSTRUCTOR_NAME]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; var exported = {}; var Constructor; if (!DESCRIPTORS || typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); })) ) { // create collection constructor Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); InternalMetadataModule.REQUIRED = true; } else { Constructor = wrapper(function (target, iterable) { setInternalState(anInstance(target, Constructor, CONSTRUCTOR_NAME), { type: CONSTRUCTOR_NAME, collection: new NativeConstructor() }); if (iterable != undefined) iterate(iterable, target[ADDER], target, IS_MAP); }); var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) { var IS_ADDER = KEY == 'add' || KEY == 'set'; if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) { createNonEnumerableProperty(Constructor.prototype, KEY, function (a, b) { var collection = getInternalState(this).collection; if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false; var result = collection[KEY](a === 0 ? 0 : a, b); return IS_ADDER ? this : result; }); } }); IS_WEAK || defineProperty(Constructor.prototype, 'size', { configurable: true, get: function () { return getInternalState(this).collection.size; } }); } setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true); exported[CONSTRUCTOR_NAME] = Constructor; $({ global: true, forced: true }, exported); if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); return Constructor; }; core-js-3.6.1/packages/core-js-pure/override/internals/entry-unbind.js000066400000000000000000000001251360057567700257640ustar00rootroot00000000000000var getBuiltIn = require('../internals/get-built-in'); module.exports = getBuiltIn; core-js-3.6.1/packages/core-js-pure/override/internals/entry-virtual.js000066400000000000000000000002011360057567700261660ustar00rootroot00000000000000var path = require('../internals/path'); module.exports = function (CONSTRUCTOR) { return path[CONSTRUCTOR + 'Prototype']; }; core-js-3.6.1/packages/core-js-pure/override/internals/export.js000066400000000000000000000101601360057567700246670ustar00rootroot00000000000000'use strict'; var global = require('../internals/global'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var isForced = require('../internals/is-forced'); var path = require('../internals/path'); var bind = require('../internals/bind-context'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var has = require('../internals/has'); var wrapConstructor = function (NativeConstructor) { var Wrapper = function (a, b, c) { if (this instanceof NativeConstructor) { switch (arguments.length) { case 0: return new NativeConstructor(); case 1: return new NativeConstructor(a); case 2: return new NativeConstructor(a, b); } return new NativeConstructor(a, b, c); } return NativeConstructor.apply(this, arguments); }; Wrapper.prototype = NativeConstructor.prototype; return Wrapper; }; /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.noTargetGet - prevent calling a getter on target */ module.exports = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var PROTO = options.proto; var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype; var target = GLOBAL ? path : path[TARGET] || (path[TARGET] = {}); var targetPrototype = target.prototype; var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE; var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor; for (key in source) { FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contains in native USE_NATIVE = !FORCED && nativeSource && has(nativeSource, key); targetProperty = target[key]; if (USE_NATIVE) if (options.noTargetGet) { descriptor = getOwnPropertyDescriptor(nativeSource, key); nativeProperty = descriptor && descriptor.value; } else nativeProperty = nativeSource[key]; // export native or implementation sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key]; if (USE_NATIVE && typeof targetProperty === typeof sourceProperty) continue; // bind timers to global for call from export context if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global); // wrap global constructors for prevent changs in this version else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty); // make static versions for prototype methods else if (PROTO && typeof sourceProperty == 'function') resultProperty = bind(Function.call, sourceProperty); // default case else resultProperty = sourceProperty; // add a flag to not completely full polyfills if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(resultProperty, 'sham', true); } target[key] = resultProperty; if (PROTO) { VIRTUAL_PROTOTYPE = TARGET + 'Prototype'; if (!has(path, VIRTUAL_PROTOTYPE)) { createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {}); } // export virtual prototype methods path[VIRTUAL_PROTOTYPE][key] = sourceProperty; // export real prototype methods if (options.real && targetPrototype && !targetPrototype[key]) { createNonEnumerableProperty(targetPrototype, key, sourceProperty); } } } }; core-js-3.6.1/packages/core-js-pure/override/internals/fix-regexp-well-known-symbol-logic.js000066400000000000000000000000111360057567700321070ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/internals/is-pure.js000066400000000000000000000000271360057567700247330ustar00rootroot00000000000000module.exports = true; core-js-3.6.1/packages/core-js-pure/override/internals/path.js000066400000000000000000000000251360057567700243010ustar00rootroot00000000000000module.exports = {}; core-js-3.6.1/packages/core-js-pure/override/internals/redefine-all.js000066400000000000000000000004211360057567700256740ustar00rootroot00000000000000var redefine = require('../internals/redefine'); module.exports = function (target, src, options) { for (var key in src) { if (options && options.unsafe && target[key]) target[key] = src[key]; else redefine(target, key, src[key], options); } return target; }; core-js-3.6.1/packages/core-js-pure/override/internals/redefine.js000066400000000000000000000004121360057567700251260ustar00rootroot00000000000000var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); module.exports = function (target, key, value, options) { if (options && options.enumerable) target[key] = value; else createNonEnumerableProperty(target, key, value); }; core-js-3.6.1/packages/core-js-pure/override/internals/regexp-exec-abstract.js000066400000000000000000000000111360057567700273550ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/internals/regexp-exec.js000066400000000000000000000000111360057567700255540ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/internals/regexp-sticky-helpers.js000066400000000000000000000000111360057567700275760ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/internals/set-to-string-tag.js000066400000000000000000000014621360057567700266430ustar00rootroot00000000000000var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support'); var defineProperty = require('../internals/object-define-property').f; var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var has = require('../internals/has'); var toString = require('../internals/object-to-string'); var wellKnownSymbol = require('../internals/well-known-symbol'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); module.exports = function (it, TAG, STATIC, SET_METHOD) { if (it) { var target = STATIC ? it : it.prototype; if (!has(target, TO_STRING_TAG)) { defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG }); } if (SET_METHOD && !TO_STRING_TAG_SUPPORT) { createNonEnumerableProperty(target, 'toString', toString); } } }; core-js-3.6.1/packages/core-js-pure/override/internals/to-offset.js000066400000000000000000000000111360057567700252460ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/internals/typed-array-constructor.js000066400000000000000000000000111360057567700301640ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/internals/typed-array-from.js000066400000000000000000000000111360057567700265420ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/000077500000000000000000000000001360057567700224635ustar00rootroot00000000000000core-js-3.6.1/packages/core-js-pure/override/modules/es.array-buffer.constructor.js000066400000000000000000000000111360057567700303700ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.array-buffer.is-view.js000066400000000000000000000000111360057567700273660ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.array-buffer.slice.js000066400000000000000000000000111360057567700271020ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.data-view.js000066400000000000000000000000111360057567700253000ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.date.to-json.js000066400000000000000000000014771360057567700257450ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var toObject = require('../internals/to-object'); var toPrimitive = require('../internals/to-primitive'); var toISOString = require('../internals/date-to-iso-string'); var classof = require('../internals/classof-raw'); var fails = require('../internals/fails'); var FORCED = fails(function () { return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; }); $({ target: 'Date', proto: true, forced: FORCED }, { // eslint-disable-next-line no-unused-vars toJSON: function toJSON(key) { var O = toObject(this); var pv = toPrimitive(O); return typeof pv == 'number' && !isFinite(pv) ? null : (!('toISOString' in O) && classof(O) == 'Date') ? toISOString.call(O) : O.toISOString(); } }); core-js-3.6.1/packages/core-js-pure/override/modules/es.date.to-primitive.js000066400000000000000000000000111360057567700267630ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.date.to-string.js000066400000000000000000000000111360057567700262610ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.function.name.js000066400000000000000000000000111360057567700261630ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.number.constructor.js000066400000000000000000000000111360057567700272730ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.object.to-string.js000066400000000000000000000000111360057567700266120ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.regexp.constructor.js000066400000000000000000000001151360057567700273020ustar00rootroot00000000000000var setSpecies = require('../internals/set-species'); setSpecies('RegExp'); core-js-3.6.1/packages/core-js-pure/override/modules/es.regexp.exec.js000066400000000000000000000000111360057567700256340ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.regexp.flags.js000066400000000000000000000000111360057567700260040ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.regexp.sticky.js000066400000000000000000000000111360057567700262160ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.regexp.test.js000066400000000000000000000000111360057567700256670ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.regexp.to-string.js000066400000000000000000000000111360057567700266360ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.string.match.js000066400000000000000000000000111360057567700260200ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.string.replace.js000066400000000000000000000000111360057567700263370ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.string.search.js000066400000000000000000000000111360057567700261710ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.string.split.js000066400000000000000000000000111360057567700260570ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.symbol.description.js000066400000000000000000000000111360057567700272460ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.copy-within.js000066400000000000000000000000111360057567700301310ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.every.js000066400000000000000000000000111360057567700270110ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.fill.js000066400000000000000000000000111360057567700266050ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.filter.js000066400000000000000000000000111360057567700271440ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.find-index.js000066400000000000000000000000111360057567700277040ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.find.js000066400000000000000000000000111360057567700265770ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.float32-array.js000066400000000000000000000000111360057567700302450ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.float64-array.js000066400000000000000000000000111360057567700302520ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.for-each.js000066400000000000000000000000111360057567700273430ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.from.js000066400000000000000000000000111360057567700266220ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.includes.js000066400000000000000000000000111360057567700274650ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.index-of.js000066400000000000000000000000111360057567700273700ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.int16-array.js000066400000000000000000000000111360057567700277340ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.int32-array.js000066400000000000000000000000111360057567700277320ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.int8-array.js000066400000000000000000000000111360057567700276550ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.iterator.js000066400000000000000000000000111360057567700275100ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.join.js000066400000000000000000000000111360057567700266160ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.last-index-of.js000066400000000000000000000000111360057567700303310ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.map.js000066400000000000000000000000111360057567700264340ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.of.js000066400000000000000000000000111360057567700262630ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.reduce-right.js000066400000000000000000000000111360057567700302410ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.reduce.js000066400000000000000000000000111360057567700271260ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.reverse.js000066400000000000000000000000111360057567700273320ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.set.js000066400000000000000000000000111360057567700264520ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.slice.js000066400000000000000000000000111360057567700267560ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.some.js000066400000000000000000000000111360057567700266220ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.sort.js000066400000000000000000000000111360057567700266460ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.subarray.js000066400000000000000000000000111360057567700275070ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.to-locale-string.js000066400000000000000000000000111360057567700310420ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.to-string.js000066400000000000000000000000111360057567700276050ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.uint16-array.js000066400000000000000000000000111360057567700301210ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.uint32-array.js000066400000000000000000000000111360057567700301170ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.uint8-array.js000066400000000000000000000000111360057567700300420ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/es.typed-array.uint8-clamped-array.js000066400000000000000000000000111360057567700314450ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/esnext.array.last-index.js000066400000000000000000000000111360057567700275030ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/esnext.array.last-item.js000066400000000000000000000000111360057567700273320ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/web.dom-collections.for-each.js000066400000000000000000000000111360057567700303430ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/override/modules/web.dom-collections.iterator.js000066400000000000000000000014551360057567700305250ustar00rootroot00000000000000require('./es.array.iterator'); var DOMIterables = require('../internals/dom-iterables'); var global = require('../internals/global'); var classof = require('../internals/classof'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var Iterators = require('../internals/iterators'); var wellKnownSymbol = require('../internals/well-known-symbol'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); for (var COLLECTION_NAME in DOMIterables) { var Collection = global[COLLECTION_NAME]; var CollectionPrototype = Collection && Collection.prototype; if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) { createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME); } Iterators[COLLECTION_NAME] = Iterators.Array; } core-js-3.6.1/packages/core-js-pure/override/modules/web.url.to-json.js000066400000000000000000000000111360057567700257570ustar00rootroot00000000000000// empty core-js-3.6.1/packages/core-js-pure/package.json000066400000000000000000000020321360057567700214570ustar00rootroot00000000000000{ "name": "core-js-pure", "description": "Standard library", "version": "3.6.1", "repository": { "type": "git", "url": "https://github.com/zloirock/core-js.git" }, "main": "index.js", "funding": { "type": "opencollective", "url": "https://opencollective.com/core-js" }, "license": "MIT", "keywords": [ "ES3", "ES5", "ES6", "ES7", "ES2015", "ES2016", "ES2017", "ES2018", "ES2019", "ES2020", "ECMAScript 3", "ECMAScript 5", "ECMAScript 6", "ECMAScript 7", "ECMAScript 2015", "ECMAScript 2016", "ECMAScript 2017", "ECMAScript 2018", "ECMAScript 2019", "ECMAScript 2020", "Harmony", "Strawman", "Map", "Set", "WeakMap", "WeakSet", "Promise", "Observable", "Symbol", "TypedArray", "URL", "URLSearchParams", "queueMicrotask", "setImmediate", "polyfill", "ponyfill", "shim" ], "scripts": { "postinstall": "node -e \"try{require('./postinstall')}catch(e){}\"" } } core-js-3.6.1/packages/core-js/000077500000000000000000000000001360057567700162235ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/.npmignore000066400000000000000000000000271360057567700202210ustar00rootroot00000000000000node_modules/ *.log .* core-js-3.6.1/packages/core-js/README.md000066400000000000000000000125731360057567700175120ustar00rootroot00000000000000# core-js [![Sponsors on Open Collective](https://opencollective.com/core-js/sponsors/badge.svg)](#sponsors) [![Backers on Open Collective](https://opencollective.com/core-js/backers/badge.svg)](#backers) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/zloirock/core-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![version](https://img.shields.io/npm/v/core-js.svg)](https://www.npmjs.com/package/core-js) [![npm downloads](https://img.shields.io/npm/dm/core-js.svg)](http://npm-stat.com/charts.html?package=core-js&author=&from=2014-11-18) [![Build Status](https://travis-ci.org/zloirock/core-js.svg)](https://travis-ci.org/zloirock/core-js) [![devDependency status](https://david-dm.org/zloirock/core-js/dev-status.svg)](https://david-dm.org/zloirock/core-js?type=dev) > Modular standard library for JavaScript. Includes polyfills for [ECMAScript up to 2019](https://github.com/zloirock/core-js#ecmascript): [promises](https://github.com/zloirock/core-js#ecmascript-promise), [symbols](https://github.com/zloirock/core-js#ecmascript-symbol), [collections](https://github.com/zloirock/core-js#ecmascript-collections), iterators, [typed arrays](https://github.com/zloirock/core-js#ecmascript-typed-arrays), many other features, [ECMAScript proposals](https://github.com/zloirock/core-js#ecmascript-proposals), [some cross-platform WHATWG / W3C features and proposals](#web-standards) like [`URL`](https://github.com/zloirock/core-js#url-and-urlsearchparams). You can load only required features or use it without global namespace pollution. ## As advertising: the author is looking for a good job -) ## [core-js@3, babel and a look into the future](https://github.com/zloirock/core-js/tree/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md) ## Raising funds `core-js` isn't backed by a company, so the future of this project depends on you. Become a sponsor or a backer [**on Open Collective**](https://opencollective.com/core-js) or [**on Patreon**](https://www.patreon.com/zloirock) if you are interested in `core-js`. --- --- --- [*Example*](http://goo.gl/a2xexl): ```js import 'core-js'; // <- at the top of your entry point Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] [1, [2, 3], [4, [5]]].flat(2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` *You can load only required features*: ```js import 'core-js/features/array/from'; // <- at the top of your entry point import 'core-js/features/array/flat'; // <- at the top of your entry point import 'core-js/features/set'; // <- at the top of your entry point import 'core-js/features/promise'; // <- at the top of your entry point Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] [1, [2, 3], [4, [5]]].flat(2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` *Or use it without global namespace pollution*: ```js import from from 'core-js-pure/features/array/from'; import flat from 'core-js-pure/features/array/flat'; import Set from 'core-js-pure/features/set'; import Promise from 'core-js-pure/features/promise'; from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3] flat([1, [2, 3], [4, [5]]], 2); // => [1, 2, 3, 4, 5] Promise.resolve(32).then(x => console.log(x)); // => 32 ``` **It's a global version (first 2 examples), for more info see [`core-js` documentation](https://github.com/zloirock/core-js/blob/master/README.md).** core-js-3.6.1/packages/core-js/configurator.js000066400000000000000000000020231360057567700212600ustar00rootroot00000000000000var has = require('./internals/has'); var isArray = require('./internals/is-array'); var isForced = require('./internals/is-forced'); var shared = require('./internals/shared-store'); var data = isForced.data; var normalize = isForced.normalize; var USE_FUNCTION_CONSTRUCTOR = 'USE_FUNCTION_CONSTRUCTOR'; var ASYNC_ITERATOR_PROTOTYPE = 'AsyncIteratorPrototype'; var setAggressivenessLevel = function (object, constant) { if (isArray(object)) for (var i = 0; i < object.length; i++) data[normalize(object[i])] = constant; }; module.exports = function (options) { if (typeof options == 'object') { setAggressivenessLevel(options.useNative, isForced.NATIVE); setAggressivenessLevel(options.usePolyfill, isForced.POLYFILL); setAggressivenessLevel(options.useFeatureDetection, null); if (has(options, USE_FUNCTION_CONSTRUCTOR)) shared[USE_FUNCTION_CONSTRUCTOR] = !!options[USE_FUNCTION_CONSTRUCTOR]; if (has(options, ASYNC_ITERATOR_PROTOTYPE)) shared[USE_FUNCTION_CONSTRUCTOR] = options[ASYNC_ITERATOR_PROTOTYPE]; } }; core-js-3.6.1/packages/core-js/es/000077500000000000000000000000001360057567700166325ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/README.md000066400000000000000000000002161360057567700201100ustar00rootroot00000000000000This folder contains entry points for [stable ECMAScript features](https://github.com/zloirock/core-js/tree/v3#ecmascript) with dependencies. core-js-3.6.1/packages/core-js/es/array-buffer/000077500000000000000000000000001360057567700212175ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/array-buffer/constructor.js000066400000000000000000000002641360057567700241440ustar00rootroot00000000000000require('../../modules/es.array-buffer.constructor'); require('../../modules/es.object.to-string'); var path = require('../../internals/path'); module.exports = path.ArrayBuffer; core-js-3.6.1/packages/core-js/es/array-buffer/index.js000066400000000000000000000004261360057567700226660ustar00rootroot00000000000000require('../../modules/es.array-buffer.constructor'); require('../../modules/es.array-buffer.is-view'); require('../../modules/es.array-buffer.slice'); require('../../modules/es.object.to-string'); var path = require('../../internals/path'); module.exports = path.ArrayBuffer; core-js-3.6.1/packages/core-js/es/array-buffer/is-view.js000066400000000000000000000002111360057567700231320ustar00rootroot00000000000000require('../../modules/es.array-buffer.is-view'); var path = require('../../internals/path'); module.exports = path.ArrayBuffer.isView; core-js-3.6.1/packages/core-js/es/array-buffer/slice.js000066400000000000000000000000601360057567700226500ustar00rootroot00000000000000require('../../modules/es.array-buffer.slice'); core-js-3.6.1/packages/core-js/es/array/000077500000000000000000000000001360057567700177505ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/array/concat.js000066400000000000000000000002271360057567700215560ustar00rootroot00000000000000require('../../modules/es.array.concat'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'concat'); core-js-3.6.1/packages/core-js/es/array/copy-within.js000066400000000000000000000002401360057567700225540ustar00rootroot00000000000000require('../../modules/es.array.copy-within'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'copyWithin'); core-js-3.6.1/packages/core-js/es/array/entries.js000066400000000000000000000002321360057567700217540ustar00rootroot00000000000000require('../../modules/es.array.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'entries'); core-js-3.6.1/packages/core-js/es/array/every.js000066400000000000000000000002251360057567700214370ustar00rootroot00000000000000require('../../modules/es.array.every'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'every'); core-js-3.6.1/packages/core-js/es/array/fill.js000066400000000000000000000002231360057567700212310ustar00rootroot00000000000000require('../../modules/es.array.fill'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'fill'); core-js-3.6.1/packages/core-js/es/array/filter.js000066400000000000000000000002271360057567700215740ustar00rootroot00000000000000require('../../modules/es.array.filter'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'filter'); core-js-3.6.1/packages/core-js/es/array/find-index.js000066400000000000000000000002361360057567700223340ustar00rootroot00000000000000require('../../modules/es.array.find-index'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'findIndex'); core-js-3.6.1/packages/core-js/es/array/find.js000066400000000000000000000002231360057567700212230ustar00rootroot00000000000000require('../../modules/es.array.find'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'find'); core-js-3.6.1/packages/core-js/es/array/flat-map.js000066400000000000000000000003221360057567700220040ustar00rootroot00000000000000require('../../modules/es.array.flat-map'); require('../../modules/es.array.unscopables.flat-map'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'flatMap'); core-js-3.6.1/packages/core-js/es/array/flat.js000066400000000000000000000003071360057567700212340ustar00rootroot00000000000000require('../../modules/es.array.flat'); require('../../modules/es.array.unscopables.flat'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'flat'); core-js-3.6.1/packages/core-js/es/array/for-each.js000066400000000000000000000002321360057567700217670ustar00rootroot00000000000000require('../../modules/es.array.for-each'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'forEach'); core-js-3.6.1/packages/core-js/es/array/from.js000066400000000000000000000002441360057567700212510ustar00rootroot00000000000000require('../../modules/es.string.iterator'); require('../../modules/es.array.from'); var path = require('../../internals/path'); module.exports = path.Array.from; core-js-3.6.1/packages/core-js/es/array/includes.js000066400000000000000000000002331360057567700221120ustar00rootroot00000000000000require('../../modules/es.array.includes'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'includes'); core-js-3.6.1/packages/core-js/es/array/index-of.js000066400000000000000000000002321360057567700220140ustar00rootroot00000000000000require('../../modules/es.array.index-of'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'indexOf'); core-js-3.6.1/packages/core-js/es/array/index.js000066400000000000000000000025361360057567700214230ustar00rootroot00000000000000require('../../modules/es.string.iterator'); require('../../modules/es.array.from'); require('../../modules/es.array.is-array'); require('../../modules/es.array.of'); require('../../modules/es.array.concat'); require('../../modules/es.array.copy-within'); require('../../modules/es.array.every'); require('../../modules/es.array.fill'); require('../../modules/es.array.filter'); require('../../modules/es.array.find'); require('../../modules/es.array.find-index'); require('../../modules/es.array.flat'); require('../../modules/es.array.flat-map'); require('../../modules/es.array.for-each'); require('../../modules/es.array.includes'); require('../../modules/es.array.index-of'); require('../../modules/es.array.iterator'); require('../../modules/es.array.join'); require('../../modules/es.array.last-index-of'); require('../../modules/es.array.map'); require('../../modules/es.array.reduce'); require('../../modules/es.array.reduce-right'); require('../../modules/es.array.reverse'); require('../../modules/es.array.slice'); require('../../modules/es.array.some'); require('../../modules/es.array.sort'); require('../../modules/es.array.species'); require('../../modules/es.array.splice'); require('../../modules/es.array.unscopables.flat'); require('../../modules/es.array.unscopables.flat-map'); var path = require('../../internals/path'); module.exports = path.Array; core-js-3.6.1/packages/core-js/es/array/is-array.js000066400000000000000000000001761360057567700220410ustar00rootroot00000000000000require('../../modules/es.array.is-array'); var path = require('../../internals/path'); module.exports = path.Array.isArray; core-js-3.6.1/packages/core-js/es/array/iterator.js000066400000000000000000000002311360057567700221330ustar00rootroot00000000000000require('../../modules/es.array.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'values'); core-js-3.6.1/packages/core-js/es/array/join.js000066400000000000000000000002231360057567700212420ustar00rootroot00000000000000require('../../modules/es.array.join'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'join'); core-js-3.6.1/packages/core-js/es/array/keys.js000066400000000000000000000002271360057567700212620ustar00rootroot00000000000000require('../../modules/es.array.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'keys'); core-js-3.6.1/packages/core-js/es/array/last-index-of.js000066400000000000000000000002431360057567700227570ustar00rootroot00000000000000require('../../modules/es.array.last-index-of'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'lastIndexOf'); core-js-3.6.1/packages/core-js/es/array/map.js000066400000000000000000000002211360057567700210560ustar00rootroot00000000000000require('../../modules/es.array.map'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'map'); core-js-3.6.1/packages/core-js/es/array/of.js000066400000000000000000000001631360057567700207120ustar00rootroot00000000000000require('../../modules/es.array.of'); var path = require('../../internals/path'); module.exports = path.Array.of; core-js-3.6.1/packages/core-js/es/array/reduce-right.js000066400000000000000000000002421360057567700226660ustar00rootroot00000000000000require('../../modules/es.array.reduce-right'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'reduceRight'); core-js-3.6.1/packages/core-js/es/array/reduce.js000066400000000000000000000002271360057567700215560ustar00rootroot00000000000000require('../../modules/es.array.reduce'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'reduce'); core-js-3.6.1/packages/core-js/es/array/reverse.js000066400000000000000000000002311360057567700217550ustar00rootroot00000000000000require('../../modules/es.array.reverse'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'reverse'); core-js-3.6.1/packages/core-js/es/array/slice.js000066400000000000000000000002251360057567700214040ustar00rootroot00000000000000require('../../modules/es.array.slice'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'slice'); core-js-3.6.1/packages/core-js/es/array/some.js000066400000000000000000000002231360057567700212460ustar00rootroot00000000000000require('../../modules/es.array.some'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'some'); core-js-3.6.1/packages/core-js/es/array/sort.js000066400000000000000000000002231360057567700212720ustar00rootroot00000000000000require('../../modules/es.array.sort'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'sort'); core-js-3.6.1/packages/core-js/es/array/splice.js000066400000000000000000000002271360057567700215660ustar00rootroot00000000000000require('../../modules/es.array.splice'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'splice'); core-js-3.6.1/packages/core-js/es/array/values.js000066400000000000000000000002311360057567700216010ustar00rootroot00000000000000require('../../modules/es.array.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'values'); core-js-3.6.1/packages/core-js/es/array/virtual/000077500000000000000000000000001360057567700214365ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/array/virtual/concat.js000066400000000000000000000002351360057567700232430ustar00rootroot00000000000000require('../../../modules/es.array.concat'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').concat; core-js-3.6.1/packages/core-js/es/array/virtual/copy-within.js000066400000000000000000000002461360057567700242500ustar00rootroot00000000000000require('../../../modules/es.array.copy-within'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').copyWithin; core-js-3.6.1/packages/core-js/es/array/virtual/entries.js000066400000000000000000000002401360057567700234410ustar00rootroot00000000000000require('../../../modules/es.array.iterator'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').entries; core-js-3.6.1/packages/core-js/es/array/virtual/every.js000066400000000000000000000002331360057567700231240ustar00rootroot00000000000000require('../../../modules/es.array.every'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').every; core-js-3.6.1/packages/core-js/es/array/virtual/fill.js000066400000000000000000000002311360057567700227160ustar00rootroot00000000000000require('../../../modules/es.array.fill'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').fill; core-js-3.6.1/packages/core-js/es/array/virtual/filter.js000066400000000000000000000002351360057567700232610ustar00rootroot00000000000000require('../../../modules/es.array.filter'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').filter; core-js-3.6.1/packages/core-js/es/array/virtual/find-index.js000066400000000000000000000002441360057567700240210ustar00rootroot00000000000000require('../../../modules/es.array.find-index'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').findIndex; core-js-3.6.1/packages/core-js/es/array/virtual/find.js000066400000000000000000000002311360057567700227100ustar00rootroot00000000000000require('../../../modules/es.array.find'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').find; core-js-3.6.1/packages/core-js/es/array/virtual/flat-map.js000066400000000000000000000003331360057567700234740ustar00rootroot00000000000000require('../../../modules/es.array.flat-map'); require('../../../modules/es.array.unscopables.flat-map'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').flatMap; core-js-3.6.1/packages/core-js/es/array/virtual/flat.js000066400000000000000000000003201360057567700227150ustar00rootroot00000000000000require('../../../modules/es.array.flat'); require('../../../modules/es.array.unscopables.flat'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').flat; core-js-3.6.1/packages/core-js/es/array/virtual/for-each.js000066400000000000000000000002401360057567700234540ustar00rootroot00000000000000require('../../../modules/es.array.for-each'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').forEach; core-js-3.6.1/packages/core-js/es/array/virtual/includes.js000066400000000000000000000002411360057567700235770ustar00rootroot00000000000000require('../../../modules/es.array.includes'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').includes; core-js-3.6.1/packages/core-js/es/array/virtual/index-of.js000066400000000000000000000002401360057567700235010ustar00rootroot00000000000000require('../../../modules/es.array.index-of'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').indexOf; core-js-3.6.1/packages/core-js/es/array/virtual/index.js000066400000000000000000000024441360057567700231070ustar00rootroot00000000000000require('../../../modules/es.array.concat'); require('../../../modules/es.array.copy-within'); require('../../../modules/es.array.every'); require('../../../modules/es.array.fill'); require('../../../modules/es.array.filter'); require('../../../modules/es.array.find'); require('../../../modules/es.array.find-index'); require('../../../modules/es.array.flat'); require('../../../modules/es.array.flat-map'); require('../../../modules/es.array.for-each'); require('../../../modules/es.array.includes'); require('../../../modules/es.array.index-of'); require('../../../modules/es.array.iterator'); require('../../../modules/es.array.join'); require('../../../modules/es.array.last-index-of'); require('../../../modules/es.array.map'); require('../../../modules/es.array.reduce'); require('../../../modules/es.array.reduce-right'); require('../../../modules/es.array.reverse'); require('../../../modules/es.array.slice'); require('../../../modules/es.array.some'); require('../../../modules/es.array.sort'); require('../../../modules/es.array.species'); require('../../../modules/es.array.splice'); require('../../../modules/es.array.unscopables.flat'); require('../../../modules/es.array.unscopables.flat-map'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array'); core-js-3.6.1/packages/core-js/es/array/virtual/iterator.js000066400000000000000000000002371360057567700236270ustar00rootroot00000000000000require('../../../modules/es.array.iterator'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').values; core-js-3.6.1/packages/core-js/es/array/virtual/join.js000066400000000000000000000002311360057567700227270ustar00rootroot00000000000000require('../../../modules/es.array.join'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').join; core-js-3.6.1/packages/core-js/es/array/virtual/keys.js000066400000000000000000000002351360057567700227470ustar00rootroot00000000000000require('../../../modules/es.array.iterator'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').keys; core-js-3.6.1/packages/core-js/es/array/virtual/last-index-of.js000066400000000000000000000002511360057567700244440ustar00rootroot00000000000000require('../../../modules/es.array.last-index-of'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').lastIndexOf; core-js-3.6.1/packages/core-js/es/array/virtual/map.js000066400000000000000000000002271360057567700225520ustar00rootroot00000000000000require('../../../modules/es.array.map'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').map; core-js-3.6.1/packages/core-js/es/array/virtual/reduce-right.js000066400000000000000000000002501360057567700243530ustar00rootroot00000000000000require('../../../modules/es.array.reduce-right'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').reduceRight; core-js-3.6.1/packages/core-js/es/array/virtual/reduce.js000066400000000000000000000002351360057567700232430ustar00rootroot00000000000000require('../../../modules/es.array.reduce'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').reduce; core-js-3.6.1/packages/core-js/es/array/virtual/reverse.js000066400000000000000000000002371360057567700234510ustar00rootroot00000000000000require('../../../modules/es.array.reverse'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').reverse; core-js-3.6.1/packages/core-js/es/array/virtual/slice.js000066400000000000000000000002331360057567700230710ustar00rootroot00000000000000require('../../../modules/es.array.slice'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').slice; core-js-3.6.1/packages/core-js/es/array/virtual/some.js000066400000000000000000000002311360057567700227330ustar00rootroot00000000000000require('../../../modules/es.array.some'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').some; core-js-3.6.1/packages/core-js/es/array/virtual/sort.js000066400000000000000000000002311360057567700227570ustar00rootroot00000000000000require('../../../modules/es.array.sort'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').sort; core-js-3.6.1/packages/core-js/es/array/virtual/splice.js000066400000000000000000000002351360057567700232530ustar00rootroot00000000000000require('../../../modules/es.array.splice'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').splice; core-js-3.6.1/packages/core-js/es/array/virtual/values.js000066400000000000000000000002371360057567700232750ustar00rootroot00000000000000require('../../../modules/es.array.iterator'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Array').values; core-js-3.6.1/packages/core-js/es/data-view/000077500000000000000000000000001360057567700205135ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/data-view/index.js000066400000000000000000000002421360057567700221560ustar00rootroot00000000000000require('../../modules/es.data-view'); require('../../modules/es.object.to-string'); var path = require('../../internals/path'); module.exports = path.DataView; core-js-3.6.1/packages/core-js/es/date/000077500000000000000000000000001360057567700175475ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/date/index.js000066400000000000000000000004441360057567700212160ustar00rootroot00000000000000require('../../modules/es.date.now'); require('../../modules/es.date.to-json'); require('../../modules/es.date.to-iso-string'); require('../../modules/es.date.to-string'); require('../../modules/es.date.to-primitive'); var path = require('../../internals/path'); module.exports = path.Date; core-js-3.6.1/packages/core-js/es/date/now.js000066400000000000000000000001631360057567700207100ustar00rootroot00000000000000require('../../modules/es.date.now'); var path = require('../../internals/path'); module.exports = path.Date.now; core-js-3.6.1/packages/core-js/es/date/to-iso-string.js000066400000000000000000000003131360057567700226200ustar00rootroot00000000000000require('../../modules/es.date.to-iso-string'); require('../../modules/es.date.to-json'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Date', 'toISOString'); core-js-3.6.1/packages/core-js/es/date/to-json.js000066400000000000000000000002261360057567700214760ustar00rootroot00000000000000require('../../modules/es.date.to-json'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Date', 'toJSON'); core-js-3.6.1/packages/core-js/es/date/to-primitive.js000066400000000000000000000002771360057567700225430ustar00rootroot00000000000000require('../../modules/es.date.to-primitive'); var toPrimitive = require('../../internals/date-to-primitive'); module.exports = function (it, hint) { return toPrimitive.call(it, hint); }; core-js-3.6.1/packages/core-js/es/date/to-string.js000066400000000000000000000002451360057567700220340ustar00rootroot00000000000000require('../../modules/es.date.to-string'); var dateToString = Date.prototype.toString; module.exports = function toString(it) { return dateToString.call(it); }; core-js-3.6.1/packages/core-js/es/function/000077500000000000000000000000001360057567700204575ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/function/bind.js000066400000000000000000000002311360057567700217250ustar00rootroot00000000000000require('../../modules/es.function.bind'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Function', 'bind'); core-js-3.6.1/packages/core-js/es/function/has-instance.js000066400000000000000000000002631360057567700233730ustar00rootroot00000000000000require('../../modules/es.function.has-instance'); var wellKnownSymbol = require('../../internals/well-known-symbol'); module.exports = Function[wellKnownSymbol('hasInstance')]; core-js-3.6.1/packages/core-js/es/function/index.js000066400000000000000000000003261360057567700221250ustar00rootroot00000000000000require('../../modules/es.function.bind'); require('../../modules/es.function.name'); require('../../modules/es.function.has-instance'); var path = require('../../internals/path'); module.exports = path.Function; core-js-3.6.1/packages/core-js/es/function/name.js000066400000000000000000000000531360057567700217330ustar00rootroot00000000000000require('../../modules/es.function.name'); core-js-3.6.1/packages/core-js/es/function/virtual/000077500000000000000000000000001360057567700221455ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/function/virtual/bind.js000066400000000000000000000002371360057567700234210ustar00rootroot00000000000000require('../../../modules/es.function.bind'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Function').bind; core-js-3.6.1/packages/core-js/es/function/virtual/index.js000066400000000000000000000002321360057567700236070ustar00rootroot00000000000000require('../../../modules/es.function.bind'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Function'); core-js-3.6.1/packages/core-js/es/global-this.js000066400000000000000000000001301360057567700213670ustar00rootroot00000000000000require('../modules/es.global-this'); module.exports = require('../internals/global'); core-js-3.6.1/packages/core-js/es/index.js000066400000000000000000000213371360057567700203050ustar00rootroot00000000000000require('../modules/es.symbol'); require('../modules/es.symbol.async-iterator'); require('../modules/es.symbol.description'); require('../modules/es.symbol.has-instance'); require('../modules/es.symbol.is-concat-spreadable'); require('../modules/es.symbol.iterator'); require('../modules/es.symbol.match'); require('../modules/es.symbol.match-all'); require('../modules/es.symbol.replace'); require('../modules/es.symbol.search'); require('../modules/es.symbol.species'); require('../modules/es.symbol.split'); require('../modules/es.symbol.to-primitive'); require('../modules/es.symbol.to-string-tag'); require('../modules/es.symbol.unscopables'); require('../modules/es.object.assign'); require('../modules/es.object.create'); require('../modules/es.object.define-property'); require('../modules/es.object.define-properties'); require('../modules/es.object.entries'); require('../modules/es.object.freeze'); require('../modules/es.object.from-entries'); require('../modules/es.object.get-own-property-descriptor'); require('../modules/es.object.get-own-property-descriptors'); require('../modules/es.object.get-own-property-names'); require('../modules/es.object.get-prototype-of'); require('../modules/es.object.is'); require('../modules/es.object.is-extensible'); require('../modules/es.object.is-frozen'); require('../modules/es.object.is-sealed'); require('../modules/es.object.keys'); require('../modules/es.object.prevent-extensions'); require('../modules/es.object.seal'); require('../modules/es.object.set-prototype-of'); require('../modules/es.object.values'); require('../modules/es.object.to-string'); require('../modules/es.object.define-getter'); require('../modules/es.object.define-setter'); require('../modules/es.object.lookup-getter'); require('../modules/es.object.lookup-setter'); require('../modules/es.function.bind'); require('../modules/es.function.name'); require('../modules/es.function.has-instance'); require('../modules/es.global-this'); require('../modules/es.array.from'); require('../modules/es.array.is-array'); require('../modules/es.array.of'); require('../modules/es.array.concat'); require('../modules/es.array.copy-within'); require('../modules/es.array.every'); require('../modules/es.array.fill'); require('../modules/es.array.filter'); require('../modules/es.array.find'); require('../modules/es.array.find-index'); require('../modules/es.array.flat'); require('../modules/es.array.flat-map'); require('../modules/es.array.for-each'); require('../modules/es.array.includes'); require('../modules/es.array.index-of'); require('../modules/es.array.join'); require('../modules/es.array.last-index-of'); require('../modules/es.array.map'); require('../modules/es.array.reduce'); require('../modules/es.array.reduce-right'); require('../modules/es.array.reverse'); require('../modules/es.array.slice'); require('../modules/es.array.some'); require('../modules/es.array.sort'); require('../modules/es.array.splice'); require('../modules/es.array.species'); require('../modules/es.array.unscopables.flat'); require('../modules/es.array.unscopables.flat-map'); require('../modules/es.array.iterator'); require('../modules/es.string.from-code-point'); require('../modules/es.string.raw'); require('../modules/es.string.code-point-at'); require('../modules/es.string.ends-with'); require('../modules/es.string.includes'); require('../modules/es.string.match'); require('../modules/es.string.match-all'); require('../modules/es.string.pad-end'); require('../modules/es.string.pad-start'); require('../modules/es.string.repeat'); require('../modules/es.string.replace'); require('../modules/es.string.search'); require('../modules/es.string.split'); require('../modules/es.string.starts-with'); require('../modules/es.string.trim'); require('../modules/es.string.trim-start'); require('../modules/es.string.trim-end'); require('../modules/es.string.iterator'); require('../modules/es.string.anchor'); require('../modules/es.string.big'); require('../modules/es.string.blink'); require('../modules/es.string.bold'); require('../modules/es.string.fixed'); require('../modules/es.string.fontcolor'); require('../modules/es.string.fontsize'); require('../modules/es.string.italics'); require('../modules/es.string.link'); require('../modules/es.string.small'); require('../modules/es.string.strike'); require('../modules/es.string.sub'); require('../modules/es.string.sup'); require('../modules/es.regexp.constructor'); require('../modules/es.regexp.exec'); require('../modules/es.regexp.flags'); require('../modules/es.regexp.sticky'); require('../modules/es.regexp.test'); require('../modules/es.regexp.to-string'); require('../modules/es.parse-int'); require('../modules/es.parse-float'); require('../modules/es.number.constructor'); require('../modules/es.number.epsilon'); require('../modules/es.number.is-finite'); require('../modules/es.number.is-integer'); require('../modules/es.number.is-nan'); require('../modules/es.number.is-safe-integer'); require('../modules/es.number.max-safe-integer'); require('../modules/es.number.min-safe-integer'); require('../modules/es.number.parse-float'); require('../modules/es.number.parse-int'); require('../modules/es.number.to-fixed'); require('../modules/es.number.to-precision'); require('../modules/es.math.acosh'); require('../modules/es.math.asinh'); require('../modules/es.math.atanh'); require('../modules/es.math.cbrt'); require('../modules/es.math.clz32'); require('../modules/es.math.cosh'); require('../modules/es.math.expm1'); require('../modules/es.math.fround'); require('../modules/es.math.hypot'); require('../modules/es.math.imul'); require('../modules/es.math.log10'); require('../modules/es.math.log1p'); require('../modules/es.math.log2'); require('../modules/es.math.sign'); require('../modules/es.math.sinh'); require('../modules/es.math.tanh'); require('../modules/es.math.to-string-tag'); require('../modules/es.math.trunc'); require('../modules/es.date.now'); require('../modules/es.date.to-json'); require('../modules/es.date.to-iso-string'); require('../modules/es.date.to-string'); require('../modules/es.date.to-primitive'); require('../modules/es.json.stringify'); require('../modules/es.json.to-string-tag'); require('../modules/es.promise'); require('../modules/es.promise.all-settled'); require('../modules/es.promise.finally'); require('../modules/es.map'); require('../modules/es.set'); require('../modules/es.weak-map'); require('../modules/es.weak-set'); require('../modules/es.array-buffer.constructor'); require('../modules/es.array-buffer.is-view'); require('../modules/es.array-buffer.slice'); require('../modules/es.data-view'); require('../modules/es.typed-array.int8-array'); require('../modules/es.typed-array.uint8-array'); require('../modules/es.typed-array.uint8-clamped-array'); require('../modules/es.typed-array.int16-array'); require('../modules/es.typed-array.uint16-array'); require('../modules/es.typed-array.int32-array'); require('../modules/es.typed-array.uint32-array'); require('../modules/es.typed-array.float32-array'); require('../modules/es.typed-array.float64-array'); require('../modules/es.typed-array.from'); require('../modules/es.typed-array.of'); require('../modules/es.typed-array.copy-within'); require('../modules/es.typed-array.every'); require('../modules/es.typed-array.fill'); require('../modules/es.typed-array.filter'); require('../modules/es.typed-array.find'); require('../modules/es.typed-array.find-index'); require('../modules/es.typed-array.for-each'); require('../modules/es.typed-array.includes'); require('../modules/es.typed-array.index-of'); require('../modules/es.typed-array.iterator'); require('../modules/es.typed-array.join'); require('../modules/es.typed-array.last-index-of'); require('../modules/es.typed-array.map'); require('../modules/es.typed-array.reduce'); require('../modules/es.typed-array.reduce-right'); require('../modules/es.typed-array.reverse'); require('../modules/es.typed-array.set'); require('../modules/es.typed-array.slice'); require('../modules/es.typed-array.some'); require('../modules/es.typed-array.sort'); require('../modules/es.typed-array.subarray'); require('../modules/es.typed-array.to-locale-string'); require('../modules/es.typed-array.to-string'); require('../modules/es.reflect.apply'); require('../modules/es.reflect.construct'); require('../modules/es.reflect.define-property'); require('../modules/es.reflect.delete-property'); require('../modules/es.reflect.get'); require('../modules/es.reflect.get-own-property-descriptor'); require('../modules/es.reflect.get-prototype-of'); require('../modules/es.reflect.has'); require('../modules/es.reflect.is-extensible'); require('../modules/es.reflect.own-keys'); require('../modules/es.reflect.prevent-extensions'); require('../modules/es.reflect.set'); require('../modules/es.reflect.set-prototype-of'); var path = require('../internals/path'); module.exports = path; core-js-3.6.1/packages/core-js/es/instance/000077500000000000000000000000001360057567700204365ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/instance/bind.js000066400000000000000000000004051360057567700217070ustar00rootroot00000000000000var bind = require('../function/virtual/bind'); var FunctionPrototype = Function.prototype; module.exports = function (it) { var own = it.bind; return it === FunctionPrototype || (it instanceof Function && own === FunctionPrototype.bind) ? bind : own; }; core-js-3.6.1/packages/core-js/es/instance/code-point-at.js000066400000000000000000000004741360057567700234440ustar00rootroot00000000000000var codePointAt = require('../string/virtual/code-point-at'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.codePointAt; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.codePointAt) ? codePointAt : own; }; core-js-3.6.1/packages/core-js/es/instance/concat.js000066400000000000000000000003751360057567700222500ustar00rootroot00000000000000var concat = require('../array/virtual/concat'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.concat; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.concat) ? concat : own; }; core-js-3.6.1/packages/core-js/es/instance/copy-within.js000066400000000000000000000004221360057567700232440ustar00rootroot00000000000000var copyWithin = require('../array/virtual/copy-within'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.copyWithin; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.copyWithin) ? copyWithin : own; }; core-js-3.6.1/packages/core-js/es/instance/ends-with.js000066400000000000000000000004541360057567700227010ustar00rootroot00000000000000var endsWith = require('../string/virtual/ends-with'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.endsWith; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.endsWith) ? endsWith : own; }; core-js-3.6.1/packages/core-js/es/instance/entries.js000066400000000000000000000004021360057567700224410ustar00rootroot00000000000000var entries = require('../array/virtual/entries'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.entries; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.entries) ? entries : own; }; core-js-3.6.1/packages/core-js/es/instance/every.js000066400000000000000000000003701360057567700221260ustar00rootroot00000000000000var every = require('../array/virtual/every'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.every; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.every) ? every : own; }; core-js-3.6.1/packages/core-js/es/instance/fill.js000066400000000000000000000003631360057567700217240ustar00rootroot00000000000000var fill = require('../array/virtual/fill'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.fill; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.fill) ? fill : own; }; core-js-3.6.1/packages/core-js/es/instance/filter.js000066400000000000000000000003751360057567700222660ustar00rootroot00000000000000var filter = require('../array/virtual/filter'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.filter; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.filter) ? filter : own; }; core-js-3.6.1/packages/core-js/es/instance/find-index.js000066400000000000000000000004151360057567700230210ustar00rootroot00000000000000var findIndex = require('../array/virtual/find-index'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.findIndex; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.findIndex) ? findIndex : own; }; core-js-3.6.1/packages/core-js/es/instance/find.js000066400000000000000000000003631360057567700217160ustar00rootroot00000000000000var find = require('../array/virtual/find'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.find; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.find) ? find : own; }; core-js-3.6.1/packages/core-js/es/instance/flags.js000066400000000000000000000003341360057567700220700ustar00rootroot00000000000000var flags = require('../regexp/flags'); var RegExpPrototype = RegExp.prototype; module.exports = function (it) { return (it === RegExpPrototype || it instanceof RegExp) && !('flags' in it) ? flags(it) : it.flags; }; core-js-3.6.1/packages/core-js/es/instance/flat-map.js000066400000000000000000000004031360057567700224720ustar00rootroot00000000000000var flatMap = require('../array/virtual/flat-map'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.flatMap; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.flatMap) ? flatMap : own; }; core-js-3.6.1/packages/core-js/es/instance/flat.js000066400000000000000000000003631360057567700217240ustar00rootroot00000000000000var flat = require('../array/virtual/flat'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.flat; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.flat) ? flat : own; }; core-js-3.6.1/packages/core-js/es/instance/for-each.js000066400000000000000000000004031360057567700224550ustar00rootroot00000000000000var forEach = require('../array/virtual/for-each'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.forEach; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.forEach) ? forEach : own; }; core-js-3.6.1/packages/core-js/es/instance/includes.js000066400000000000000000000010251360057567700226000ustar00rootroot00000000000000var arrayIncludes = require('../array/virtual/includes'); var stringIncludes = require('../string/virtual/includes'); var ArrayPrototype = Array.prototype; var StringPrototype = String.prototype; module.exports = function (it) { var own = it.includes; if (it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.includes)) return arrayIncludes; if (typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.includes)) { return stringIncludes; } return own; }; core-js-3.6.1/packages/core-js/es/instance/index-of.js000066400000000000000000000004031360057567700225020ustar00rootroot00000000000000var indexOf = require('../array/virtual/index-of'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.indexOf; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.indexOf) ? indexOf : own; }; core-js-3.6.1/packages/core-js/es/instance/keys.js000066400000000000000000000003631360057567700217510ustar00rootroot00000000000000var keys = require('../array/virtual/keys'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.keys; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.keys) ? keys : own; }; core-js-3.6.1/packages/core-js/es/instance/last-index-of.js000066400000000000000000000004301360057567700234430ustar00rootroot00000000000000var lastIndexOf = require('../array/virtual/last-index-of'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.lastIndexOf; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.lastIndexOf) ? lastIndexOf : own; }; core-js-3.6.1/packages/core-js/es/instance/map.js000066400000000000000000000003561360057567700215550ustar00rootroot00000000000000var map = require('../array/virtual/map'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.map; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.map) ? map : own; }; core-js-3.6.1/packages/core-js/es/instance/match-all.js000066400000000000000000000004541360057567700226410ustar00rootroot00000000000000var matchAll = require('../string/virtual/match-all'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.matchAll; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.matchAll) ? matchAll : own; }; core-js-3.6.1/packages/core-js/es/instance/pad-end.js000066400000000000000000000004421360057567700223040ustar00rootroot00000000000000var padEnd = require('../string/virtual/pad-end'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.padEnd; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.padEnd) ? padEnd : own; }; core-js-3.6.1/packages/core-js/es/instance/pad-start.js000066400000000000000000000004541360057567700226760ustar00rootroot00000000000000var padStart = require('../string/virtual/pad-start'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.padStart; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.padStart) ? padStart : own; }; core-js-3.6.1/packages/core-js/es/instance/reduce-right.js000066400000000000000000000004271360057567700233610ustar00rootroot00000000000000var reduceRight = require('../array/virtual/reduce-right'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.reduceRight; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.reduceRight) ? reduceRight : own; }; core-js-3.6.1/packages/core-js/es/instance/reduce.js000066400000000000000000000003751360057567700222500ustar00rootroot00000000000000var reduce = require('../array/virtual/reduce'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.reduce; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.reduce) ? reduce : own; }; core-js-3.6.1/packages/core-js/es/instance/repeat.js000066400000000000000000000004411360057567700222530ustar00rootroot00000000000000var repeat = require('../string/virtual/repeat'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.repeat; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.repeat) ? repeat : own; }; core-js-3.6.1/packages/core-js/es/instance/reverse.js000066400000000000000000000004021360057567700224430ustar00rootroot00000000000000var reverse = require('../array/virtual/reverse'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.reverse; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.reverse) ? reverse : own; }; core-js-3.6.1/packages/core-js/es/instance/slice.js000066400000000000000000000003701360057567700220730ustar00rootroot00000000000000var slice = require('../array/virtual/slice'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.slice; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.slice) ? slice : own; }; core-js-3.6.1/packages/core-js/es/instance/some.js000066400000000000000000000003631360057567700217410ustar00rootroot00000000000000var some = require('../array/virtual/some'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.some; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.some) ? some : own; }; core-js-3.6.1/packages/core-js/es/instance/sort.js000066400000000000000000000003631360057567700217650ustar00rootroot00000000000000var sort = require('../array/virtual/sort'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.sort; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.sort) ? sort : own; }; core-js-3.6.1/packages/core-js/es/instance/splice.js000066400000000000000000000003751360057567700222600ustar00rootroot00000000000000var splice = require('../array/virtual/splice'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.splice; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.splice) ? splice : own; }; core-js-3.6.1/packages/core-js/es/instance/starts-with.js000066400000000000000000000004661360057567700232730ustar00rootroot00000000000000var startsWith = require('../string/virtual/starts-with'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.startsWith; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.startsWith) ? startsWith : own; }; core-js-3.6.1/packages/core-js/es/instance/trim-end.js000066400000000000000000000004471360057567700225200ustar00rootroot00000000000000var trimEnd = require('../string/virtual/trim-end'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.trimEnd; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.trimEnd) ? trimEnd : own; }; core-js-3.6.1/packages/core-js/es/instance/trim-left.js000066400000000000000000000004541360057567700227020ustar00rootroot00000000000000var trimLeft = require('../string/virtual/trim-left'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.trimLeft; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.trimLeft) ? trimLeft : own; }; core-js-3.6.1/packages/core-js/es/instance/trim-right.js000066400000000000000000000004611360057567700230630ustar00rootroot00000000000000var trimRight = require('../string/virtual/trim-right'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.trimRight; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.trimRight) ? trimRight : own; }; core-js-3.6.1/packages/core-js/es/instance/trim-start.js000066400000000000000000000004611360057567700231030ustar00rootroot00000000000000var trimStart = require('../string/virtual/trim-start'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.trimStart; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.trimStart) ? trimStart : own; }; core-js-3.6.1/packages/core-js/es/instance/trim.js000066400000000000000000000004271360057567700217520ustar00rootroot00000000000000var trim = require('../string/virtual/trim'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.trim; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.trim) ? trim : own; }; core-js-3.6.1/packages/core-js/es/instance/values.js000066400000000000000000000003751360057567700223000ustar00rootroot00000000000000var values = require('../array/virtual/values'); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.values; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.values) ? values : own; }; core-js-3.6.1/packages/core-js/es/json/000077500000000000000000000000001360057567700176035ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/json/index.js000066400000000000000000000003241360057567700212470ustar00rootroot00000000000000require('../../modules/es.json.stringify'); require('../../modules/es.json.to-string-tag'); var path = require('../../internals/path'); module.exports = path.JSON || (path.JSON = { stringify: JSON.stringify }); core-js-3.6.1/packages/core-js/es/json/stringify.js000066400000000000000000000004631360057567700221620ustar00rootroot00000000000000require('../../modules/es.json.stringify'); var core = require('../../internals/path'); if (!core.JSON) core.JSON = { stringify: JSON.stringify }; // eslint-disable-next-line no-unused-vars module.exports = function stringify(it, replacer, space) { return core.JSON.stringify.apply(null, arguments); }; core-js-3.6.1/packages/core-js/es/json/to-string-tag.js000066400000000000000000000001121360057567700226320ustar00rootroot00000000000000require('../../modules/es.json.to-string-tag'); module.exports = 'JSON'; core-js-3.6.1/packages/core-js/es/map/000077500000000000000000000000001360057567700174075ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/map/index.js000066400000000000000000000003731360057567700210570ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); module.exports = path.Map; core-js-3.6.1/packages/core-js/es/math/000077500000000000000000000000001360057567700175635ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/math/acosh.js000066400000000000000000000001671360057567700212220ustar00rootroot00000000000000require('../../modules/es.math.acosh'); var path = require('../../internals/path'); module.exports = path.Math.acosh; core-js-3.6.1/packages/core-js/es/math/asinh.js000066400000000000000000000001671360057567700212270ustar00rootroot00000000000000require('../../modules/es.math.asinh'); var path = require('../../internals/path'); module.exports = path.Math.asinh; core-js-3.6.1/packages/core-js/es/math/atanh.js000066400000000000000000000001671360057567700212200ustar00rootroot00000000000000require('../../modules/es.math.atanh'); var path = require('../../internals/path'); module.exports = path.Math.atanh; core-js-3.6.1/packages/core-js/es/math/cbrt.js000066400000000000000000000001651360057567700210550ustar00rootroot00000000000000require('../../modules/es.math.cbrt'); var path = require('../../internals/path'); module.exports = path.Math.cbrt; core-js-3.6.1/packages/core-js/es/math/clz32.js000066400000000000000000000001671360057567700210620ustar00rootroot00000000000000require('../../modules/es.math.clz32'); var path = require('../../internals/path'); module.exports = path.Math.clz32; core-js-3.6.1/packages/core-js/es/math/cosh.js000066400000000000000000000001651360057567700210570ustar00rootroot00000000000000require('../../modules/es.math.cosh'); var path = require('../../internals/path'); module.exports = path.Math.cosh; core-js-3.6.1/packages/core-js/es/math/expm1.js000066400000000000000000000001671360057567700211570ustar00rootroot00000000000000require('../../modules/es.math.expm1'); var path = require('../../internals/path'); module.exports = path.Math.expm1; core-js-3.6.1/packages/core-js/es/math/fround.js000066400000000000000000000001711360057567700214150ustar00rootroot00000000000000require('../../modules/es.math.fround'); var path = require('../../internals/path'); module.exports = path.Math.fround; core-js-3.6.1/packages/core-js/es/math/hypot.js000066400000000000000000000001671360057567700212700ustar00rootroot00000000000000require('../../modules/es.math.hypot'); var path = require('../../internals/path'); module.exports = path.Math.hypot; core-js-3.6.1/packages/core-js/es/math/imul.js000066400000000000000000000001651360057567700210710ustar00rootroot00000000000000require('../../modules/es.math.imul'); var path = require('../../internals/path'); module.exports = path.Math.imul; core-js-3.6.1/packages/core-js/es/math/index.js000066400000000000000000000014331360057567700212310ustar00rootroot00000000000000require('../../modules/es.math.acosh'); require('../../modules/es.math.asinh'); require('../../modules/es.math.atanh'); require('../../modules/es.math.cbrt'); require('../../modules/es.math.clz32'); require('../../modules/es.math.cosh'); require('../../modules/es.math.expm1'); require('../../modules/es.math.fround'); require('../../modules/es.math.hypot'); require('../../modules/es.math.imul'); require('../../modules/es.math.log10'); require('../../modules/es.math.log1p'); require('../../modules/es.math.log2'); require('../../modules/es.math.sign'); require('../../modules/es.math.sinh'); require('../../modules/es.math.tanh'); require('../../modules/es.math.to-string-tag'); require('../../modules/es.math.trunc'); var path = require('../../internals/path'); module.exports = path.Math; core-js-3.6.1/packages/core-js/es/math/log10.js000066400000000000000000000001671360057567700210470ustar00rootroot00000000000000require('../../modules/es.math.log10'); var path = require('../../internals/path'); module.exports = path.Math.log10; core-js-3.6.1/packages/core-js/es/math/log1p.js000066400000000000000000000001671360057567700211470ustar00rootroot00000000000000require('../../modules/es.math.log1p'); var path = require('../../internals/path'); module.exports = path.Math.log1p; core-js-3.6.1/packages/core-js/es/math/log2.js000066400000000000000000000001651360057567700207660ustar00rootroot00000000000000require('../../modules/es.math.log2'); var path = require('../../internals/path'); module.exports = path.Math.log2; core-js-3.6.1/packages/core-js/es/math/sign.js000066400000000000000000000001651360057567700210630ustar00rootroot00000000000000require('../../modules/es.math.sign'); var path = require('../../internals/path'); module.exports = path.Math.sign; core-js-3.6.1/packages/core-js/es/math/sinh.js000066400000000000000000000001651360057567700210640ustar00rootroot00000000000000require('../../modules/es.math.sinh'); var path = require('../../internals/path'); module.exports = path.Math.sinh; core-js-3.6.1/packages/core-js/es/math/tanh.js000066400000000000000000000001651360057567700210550ustar00rootroot00000000000000require('../../modules/es.math.tanh'); var path = require('../../internals/path'); module.exports = path.Math.tanh; core-js-3.6.1/packages/core-js/es/math/to-string-tag.js000066400000000000000000000001121360057567700226120ustar00rootroot00000000000000require('../../modules/es.math.to-string-tag'); module.exports = 'Math'; core-js-3.6.1/packages/core-js/es/math/trunc.js000066400000000000000000000001671360057567700212600ustar00rootroot00000000000000require('../../modules/es.math.trunc'); var path = require('../../internals/path'); module.exports = path.Math.trunc; core-js-3.6.1/packages/core-js/es/number/000077500000000000000000000000001360057567700201225ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/number/constructor.js000066400000000000000000000001121360057567700230370ustar00rootroot00000000000000require('../../modules/es.number.constructor'); module.exports = Number; core-js-3.6.1/packages/core-js/es/number/epsilon.js000066400000000000000000000001201360057567700221220ustar00rootroot00000000000000require('../../modules/es.number.epsilon'); module.exports = Math.pow(2, -52); core-js-3.6.1/packages/core-js/es/number/index.js000066400000000000000000000012111360057567700215620ustar00rootroot00000000000000require('../../modules/es.number.constructor'); require('../../modules/es.number.epsilon'); require('../../modules/es.number.is-finite'); require('../../modules/es.number.is-integer'); require('../../modules/es.number.is-nan'); require('../../modules/es.number.is-safe-integer'); require('../../modules/es.number.max-safe-integer'); require('../../modules/es.number.min-safe-integer'); require('../../modules/es.number.parse-float'); require('../../modules/es.number.parse-int'); require('../../modules/es.number.to-fixed'); require('../../modules/es.number.to-precision'); var path = require('../../internals/path'); module.exports = path.Number; core-js-3.6.1/packages/core-js/es/number/is-finite.js000066400000000000000000000002021360057567700223410ustar00rootroot00000000000000require('../../modules/es.number.is-finite'); var path = require('../../internals/path'); module.exports = path.Number.isFinite; core-js-3.6.1/packages/core-js/es/number/is-integer.js000066400000000000000000000002041360057567700225220ustar00rootroot00000000000000require('../../modules/es.number.is-integer'); var path = require('../../internals/path'); module.exports = path.Number.isInteger; core-js-3.6.1/packages/core-js/es/number/is-nan.js000066400000000000000000000001741360057567700216470ustar00rootroot00000000000000require('../../modules/es.number.is-nan'); var path = require('../../internals/path'); module.exports = path.Number.isNaN; core-js-3.6.1/packages/core-js/es/number/is-safe-integer.js000066400000000000000000000002151360057567700234400ustar00rootroot00000000000000require('../../modules/es.number.is-safe-integer'); var path = require('../../internals/path'); module.exports = path.Number.isSafeInteger; core-js-3.6.1/packages/core-js/es/number/max-safe-integer.js000066400000000000000000000001311360057567700236070ustar00rootroot00000000000000require('../../modules/es.number.max-safe-integer'); module.exports = 0x1FFFFFFFFFFFFF; core-js-3.6.1/packages/core-js/es/number/min-safe-integer.js000066400000000000000000000001321360057567700236060ustar00rootroot00000000000000require('../../modules/es.number.min-safe-integer'); module.exports = -0x1FFFFFFFFFFFFF; core-js-3.6.1/packages/core-js/es/number/parse-float.js000066400000000000000000000002061360057567700226730ustar00rootroot00000000000000require('../../modules/es.number.parse-float'); var path = require('../../internals/path'); module.exports = path.Number.parseFloat; core-js-3.6.1/packages/core-js/es/number/parse-int.js000066400000000000000000000002021360057567700223540ustar00rootroot00000000000000require('../../modules/es.number.parse-int'); var path = require('../../internals/path'); module.exports = path.Number.parseInt; core-js-3.6.1/packages/core-js/es/number/to-fixed.js000066400000000000000000000002341360057567700221760ustar00rootroot00000000000000require('../../modules/es.number.to-fixed'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Number', 'toFixed'); core-js-3.6.1/packages/core-js/es/number/to-precision.js000066400000000000000000000002441360057567700230730ustar00rootroot00000000000000require('../../modules/es.number.to-precision'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Number', 'toPrecision'); core-js-3.6.1/packages/core-js/es/number/virtual/000077500000000000000000000000001360057567700216105ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/number/virtual/index.js000066400000000000000000000003161360057567700232550ustar00rootroot00000000000000require('../../../modules/es.number.to-fixed'); require('../../../modules/es.number.to-precision'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Number'); core-js-3.6.1/packages/core-js/es/number/virtual/to-fixed.js000066400000000000000000000002421360057567700236630ustar00rootroot00000000000000require('../../../modules/es.number.to-fixed'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Number').toFixed; core-js-3.6.1/packages/core-js/es/number/virtual/to-precision.js000066400000000000000000000002521360057567700245600ustar00rootroot00000000000000require('../../../modules/es.number.to-precision'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('Number').toPrecision; core-js-3.6.1/packages/core-js/es/object/000077500000000000000000000000001360057567700201005ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/object/assign.js000066400000000000000000000001751360057567700217250ustar00rootroot00000000000000require('../../modules/es.object.assign'); var path = require('../../internals/path'); module.exports = path.Object.assign; core-js-3.6.1/packages/core-js/es/object/create.js000066400000000000000000000002751360057567700217050ustar00rootroot00000000000000require('../../modules/es.object.create'); var path = require('../../internals/path'); var Object = path.Object; module.exports = function create(P, D) { return Object.create(P, D); }; core-js-3.6.1/packages/core-js/es/object/define-getter.js000066400000000000000000000002521360057567700231570ustar00rootroot00000000000000require('../../modules/es.object.define-getter'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Object', '__defineGetter__'); core-js-3.6.1/packages/core-js/es/object/define-properties.js000066400000000000000000000004641360057567700240660ustar00rootroot00000000000000require('../../modules/es.object.define-properties'); var path = require('../../internals/path'); var Object = path.Object; var defineProperties = module.exports = function defineProperties(T, D) { return Object.defineProperties(T, D); }; if (Object.defineProperties.sham) defineProperties.sham = true; core-js-3.6.1/packages/core-js/es/object/define-property.js000066400000000000000000000004721360057567700235550ustar00rootroot00000000000000require('../../modules/es.object.define-property'); var path = require('../../internals/path'); var Object = path.Object; var defineProperty = module.exports = function defineProperty(it, key, desc) { return Object.defineProperty(it, key, desc); }; if (Object.defineProperty.sham) defineProperty.sham = true; core-js-3.6.1/packages/core-js/es/object/define-setter.js000066400000000000000000000002521360057567700231730ustar00rootroot00000000000000require('../../modules/es.object.define-setter'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Object', '__defineSetter__'); core-js-3.6.1/packages/core-js/es/object/entries.js000066400000000000000000000001771360057567700221140ustar00rootroot00000000000000require('../../modules/es.object.entries'); var path = require('../../internals/path'); module.exports = path.Object.entries; core-js-3.6.1/packages/core-js/es/object/freeze.js000066400000000000000000000001751360057567700217210ustar00rootroot00000000000000require('../../modules/es.object.freeze'); var path = require('../../internals/path'); module.exports = path.Object.freeze; core-js-3.6.1/packages/core-js/es/object/from-entries.js000066400000000000000000000002641360057567700230520ustar00rootroot00000000000000require('../../modules/es.array.iterator'); require('../../modules/es.object.from-entries'); var path = require('../../internals/path'); module.exports = path.Object.fromEntries; core-js-3.6.1/packages/core-js/es/object/get-own-property-descriptor.js000066400000000000000000000005541360057567700260600ustar00rootroot00000000000000require('../../modules/es.object.get-own-property-descriptor'); var path = require('../../internals/path'); var Object = path.Object; var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) { return Object.getOwnPropertyDescriptor(it, key); }; if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true; core-js-3.6.1/packages/core-js/es/object/get-own-property-descriptors.js000066400000000000000000000002461360057567700262410ustar00rootroot00000000000000require('../../modules/es.object.get-own-property-descriptors'); var path = require('../../internals/path'); module.exports = path.Object.getOwnPropertyDescriptors; core-js-3.6.1/packages/core-js/es/object/get-own-property-names.js000066400000000000000000000003431360057567700250010ustar00rootroot00000000000000require('../../modules/es.object.get-own-property-names'); var path = require('../../internals/path'); var Object = path.Object; module.exports = function getOwnPropertyNames(it) { return Object.getOwnPropertyNames(it); }; core-js-3.6.1/packages/core-js/es/object/get-own-property-symbols.js000066400000000000000000000002051360057567700253630ustar00rootroot00000000000000require('../../modules/es.symbol'); var path = require('../../internals/path'); module.exports = path.Object.getOwnPropertySymbols; core-js-3.6.1/packages/core-js/es/object/get-prototype-of.js000066400000000000000000000002171360057567700236620ustar00rootroot00000000000000require('../../modules/es.object.get-prototype-of'); var path = require('../../internals/path'); module.exports = path.Object.getPrototypeOf; core-js-3.6.1/packages/core-js/es/object/index.js000066400000000000000000000026341360057567700215520ustar00rootroot00000000000000require('../../modules/es.symbol'); require('../../modules/es.object.assign'); require('../../modules/es.object.create'); require('../../modules/es.object.define-property'); require('../../modules/es.object.define-properties'); require('../../modules/es.object.entries'); require('../../modules/es.object.freeze'); require('../../modules/es.object.from-entries'); require('../../modules/es.object.get-own-property-descriptor'); require('../../modules/es.object.get-own-property-descriptors'); require('../../modules/es.object.get-own-property-names'); require('../../modules/es.object.get-prototype-of'); require('../../modules/es.object.is'); require('../../modules/es.object.is-extensible'); require('../../modules/es.object.is-frozen'); require('../../modules/es.object.is-sealed'); require('../../modules/es.object.keys'); require('../../modules/es.object.prevent-extensions'); require('../../modules/es.object.seal'); require('../../modules/es.object.set-prototype-of'); require('../../modules/es.object.values'); require('../../modules/es.object.to-string'); require('../../modules/es.object.define-getter'); require('../../modules/es.object.define-setter'); require('../../modules/es.object.lookup-getter'); require('../../modules/es.object.lookup-setter'); require('../../modules/es.math.to-string-tag'); require('../../modules/es.json.to-string-tag'); var path = require('../../internals/path'); module.exports = path.Object; core-js-3.6.1/packages/core-js/es/object/is-extensible.js000066400000000000000000000002121360057567700232040ustar00rootroot00000000000000require('../../modules/es.object.is-extensible'); var path = require('../../internals/path'); module.exports = path.Object.isExtensible; core-js-3.6.1/packages/core-js/es/object/is-frozen.js000066400000000000000000000002021360057567700223440ustar00rootroot00000000000000require('../../modules/es.object.is-frozen'); var path = require('../../internals/path'); module.exports = path.Object.isFrozen; core-js-3.6.1/packages/core-js/es/object/is-sealed.js000066400000000000000000000002021360057567700222760ustar00rootroot00000000000000require('../../modules/es.object.is-sealed'); var path = require('../../internals/path'); module.exports = path.Object.isSealed; core-js-3.6.1/packages/core-js/es/object/is.js000066400000000000000000000001651360057567700210530ustar00rootroot00000000000000require('../../modules/es.object.is'); var path = require('../../internals/path'); module.exports = path.Object.is; core-js-3.6.1/packages/core-js/es/object/keys.js000066400000000000000000000001711360057567700214100ustar00rootroot00000000000000require('../../modules/es.object.keys'); var path = require('../../internals/path'); module.exports = path.Object.keys; core-js-3.6.1/packages/core-js/es/object/lookup-getter.js000066400000000000000000000002521360057567700232360ustar00rootroot00000000000000require('../../modules/es.object.lookup-setter'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Object', '__lookupGetter__'); core-js-3.6.1/packages/core-js/es/object/lookup-setter.js000066400000000000000000000002521360057567700232520ustar00rootroot00000000000000require('../../modules/es.object.lookup-setter'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Object', '__lookupSetter__'); core-js-3.6.1/packages/core-js/es/object/prevent-extensions.js000066400000000000000000000002241360057567700243140ustar00rootroot00000000000000require('../../modules/es.object.prevent-extensions'); var path = require('../../internals/path'); module.exports = path.Object.preventExtensions; core-js-3.6.1/packages/core-js/es/object/seal.js000066400000000000000000000001711360057567700213610ustar00rootroot00000000000000require('../../modules/es.object.seal'); var path = require('../../internals/path'); module.exports = path.Object.seal; core-js-3.6.1/packages/core-js/es/object/set-prototype-of.js000066400000000000000000000002171360057567700236760ustar00rootroot00000000000000require('../../modules/es.object.set-prototype-of'); var path = require('../../internals/path'); module.exports = path.Object.setPrototypeOf; core-js-3.6.1/packages/core-js/es/object/to-string.js000066400000000000000000000004161360057567700223650ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.math.to-string-tag'); require('../../modules/es.json.to-string-tag'); var classof = require('../../internals/classof'); module.exports = function (it) { return '[object ' + classof(it) + ']'; }; core-js-3.6.1/packages/core-js/es/object/values.js000066400000000000000000000001751360057567700217400ustar00rootroot00000000000000require('../../modules/es.object.values'); var path = require('../../internals/path'); module.exports = path.Object.values; core-js-3.6.1/packages/core-js/es/parse-float.js000066400000000000000000000001621360057567700214040ustar00rootroot00000000000000require('../modules/es.parse-float'); var path = require('../internals/path'); module.exports = path.parseFloat; core-js-3.6.1/packages/core-js/es/parse-int.js000066400000000000000000000001561360057567700210740ustar00rootroot00000000000000require('../modules/es.parse-int'); var path = require('../internals/path'); module.exports = path.parseInt; core-js-3.6.1/packages/core-js/es/promise/000077500000000000000000000000001360057567700203105ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/promise/all-settled.js000066400000000000000000000005321360057567700230600ustar00rootroot00000000000000'use strict'; require('../../modules/es.promise'); require('../../modules/es.promise.all-settled'); var path = require('../../internals/path'); var Promise = path.Promise; var $allSettled = Promise.allSettled; module.exports = function allSettled(iterable) { return $allSettled.call(typeof this === 'function' ? this : Promise, iterable); }; core-js-3.6.1/packages/core-js/es/promise/finally.js000066400000000000000000000003021360057567700222770ustar00rootroot00000000000000require('../../modules/es.promise'); require('../../modules/es.promise.finally'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Promise', 'finally'); core-js-3.6.1/packages/core-js/es/promise/index.js000066400000000000000000000005411360057567700217550ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/web.dom-collections.iterator'); require('../../modules/es.promise'); require('../../modules/es.promise.all-settled'); require('../../modules/es.promise.finally'); var path = require('../../internals/path'); module.exports = path.Promise; core-js-3.6.1/packages/core-js/es/reflect/000077500000000000000000000000001360057567700202565ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/reflect/apply.js000066400000000000000000000001751360057567700217440ustar00rootroot00000000000000require('../../modules/es.reflect.apply'); var path = require('../../internals/path'); module.exports = path.Reflect.apply; core-js-3.6.1/packages/core-js/es/reflect/construct.js000066400000000000000000000002051360057567700226350ustar00rootroot00000000000000require('../../modules/es.reflect.construct'); var path = require('../../internals/path'); module.exports = path.Reflect.construct; core-js-3.6.1/packages/core-js/es/reflect/define-property.js000066400000000000000000000002201360057567700237220ustar00rootroot00000000000000require('../../modules/es.reflect.define-property'); var path = require('../../internals/path'); module.exports = path.Reflect.defineProperty; core-js-3.6.1/packages/core-js/es/reflect/delete-property.js000066400000000000000000000002201360057567700237320ustar00rootroot00000000000000require('../../modules/es.reflect.delete-property'); var path = require('../../internals/path'); module.exports = path.Reflect.deleteProperty; core-js-3.6.1/packages/core-js/es/reflect/get-own-property-descriptor.js000066400000000000000000000002461360057567700262340ustar00rootroot00000000000000require('../../modules/es.reflect.get-own-property-descriptor'); var path = require('../../internals/path'); module.exports = path.Reflect.getOwnPropertyDescriptor; core-js-3.6.1/packages/core-js/es/reflect/get-prototype-of.js000066400000000000000000000002211360057567700240330ustar00rootroot00000000000000require('../../modules/es.reflect.get-prototype-of'); var path = require('../../internals/path'); module.exports = path.Reflect.getPrototypeOf; core-js-3.6.1/packages/core-js/es/reflect/get.js000066400000000000000000000001711360057567700213720ustar00rootroot00000000000000require('../../modules/es.reflect.get'); var path = require('../../internals/path'); module.exports = path.Reflect.get; core-js-3.6.1/packages/core-js/es/reflect/has.js000066400000000000000000000001711360057567700213660ustar00rootroot00000000000000require('../../modules/es.reflect.has'); var path = require('../../internals/path'); module.exports = path.Reflect.has; core-js-3.6.1/packages/core-js/es/reflect/index.js000066400000000000000000000013211360057567700217200ustar00rootroot00000000000000require('../../modules/es.reflect.apply'); require('../../modules/es.reflect.construct'); require('../../modules/es.reflect.define-property'); require('../../modules/es.reflect.delete-property'); require('../../modules/es.reflect.get'); require('../../modules/es.reflect.get-own-property-descriptor'); require('../../modules/es.reflect.get-prototype-of'); require('../../modules/es.reflect.has'); require('../../modules/es.reflect.is-extensible'); require('../../modules/es.reflect.own-keys'); require('../../modules/es.reflect.prevent-extensions'); require('../../modules/es.reflect.set'); require('../../modules/es.reflect.set-prototype-of'); var path = require('../../internals/path'); module.exports = path.Reflect; core-js-3.6.1/packages/core-js/es/reflect/is-extensible.js000066400000000000000000000002141360057567700233640ustar00rootroot00000000000000require('../../modules/es.reflect.is-extensible'); var path = require('../../internals/path'); module.exports = path.Reflect.isExtensible; core-js-3.6.1/packages/core-js/es/reflect/own-keys.js000066400000000000000000000002021360057567700223620ustar00rootroot00000000000000require('../../modules/es.reflect.own-keys'); var path = require('../../internals/path'); module.exports = path.Reflect.ownKeys; core-js-3.6.1/packages/core-js/es/reflect/prevent-extensions.js000066400000000000000000000002261360057567700244740ustar00rootroot00000000000000require('../../modules/es.reflect.prevent-extensions'); var path = require('../../internals/path'); module.exports = path.Reflect.preventExtensions; core-js-3.6.1/packages/core-js/es/reflect/set-prototype-of.js000066400000000000000000000002211360057567700240470ustar00rootroot00000000000000require('../../modules/es.reflect.set-prototype-of'); var path = require('../../internals/path'); module.exports = path.Reflect.setPrototypeOf; core-js-3.6.1/packages/core-js/es/reflect/set.js000066400000000000000000000001711360057567700214060ustar00rootroot00000000000000require('../../modules/es.reflect.set'); var path = require('../../internals/path'); module.exports = path.Reflect.set; core-js-3.6.1/packages/core-js/es/regexp/000077500000000000000000000000001360057567700201245ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/regexp/constructor.js000066400000000000000000000001121360057567700230410ustar00rootroot00000000000000require('../../modules/es.regexp.constructor'); module.exports = RegExp; core-js-3.6.1/packages/core-js/es/regexp/flags.js000066400000000000000000000002351360057567700215560ustar00rootroot00000000000000require('../../modules/es.regexp.flags'); var flags = require('../../internals/regexp-flags'); module.exports = function (it) { return flags.call(it); }; core-js-3.6.1/packages/core-js/es/regexp/index.js000066400000000000000000000006601360057567700215730ustar00rootroot00000000000000require('../../modules/es.regexp.constructor'); require('../../modules/es.regexp.to-string'); require('../../modules/es.regexp.exec'); require('../../modules/es.regexp.flags'); require('../../modules/es.regexp.sticky'); require('../../modules/es.regexp.test'); require('../../modules/es.string.match'); require('../../modules/es.string.replace'); require('../../modules/es.string.search'); require('../../modules/es.string.split'); core-js-3.6.1/packages/core-js/es/regexp/match.js000066400000000000000000000003571360057567700215630ustar00rootroot00000000000000require('../../modules/es.string.match'); var wellKnownSymbol = require('../../internals/well-known-symbol'); var MATCH = wellKnownSymbol('match'); module.exports = function (it, str) { return RegExp.prototype[MATCH].call(it, str); }; core-js-3.6.1/packages/core-js/es/regexp/replace.js000066400000000000000000000004131360057567700220730ustar00rootroot00000000000000require('../../modules/es.string.replace'); var wellKnownSymbol = require('../../internals/well-known-symbol'); var REPLACE = wellKnownSymbol('replace'); module.exports = function (it, str, replacer) { return RegExp.prototype[REPLACE].call(it, str, replacer); }; core-js-3.6.1/packages/core-js/es/regexp/search.js000066400000000000000000000003631360057567700217310ustar00rootroot00000000000000require('../../modules/es.string.search'); var wellKnownSymbol = require('../../internals/well-known-symbol'); var SEARCH = wellKnownSymbol('search'); module.exports = function (it, str) { return RegExp.prototype[SEARCH].call(it, str); }; core-js-3.6.1/packages/core-js/es/regexp/split.js000066400000000000000000000003751360057567700216220ustar00rootroot00000000000000require('../../modules/es.string.split'); var wellKnownSymbol = require('../../internals/well-known-symbol'); var SPLIT = wellKnownSymbol('split'); module.exports = function (it, str, limit) { return RegExp.prototype[SPLIT].call(it, str, limit); }; core-js-3.6.1/packages/core-js/es/regexp/sticky.js000066400000000000000000000001441360057567700217670ustar00rootroot00000000000000require('../../modules/es.regexp.sticky'); module.exports = function (it) { return it.sticky; }; core-js-3.6.1/packages/core-js/es/regexp/test.js000066400000000000000000000002071360057567700214400ustar00rootroot00000000000000require('../../modules/es.regexp.test'); module.exports = function (re, string) { return RegExp.prototype.test.call(re, string); }; core-js-3.6.1/packages/core-js/es/regexp/to-string.js000066400000000000000000000002101360057567700224010ustar00rootroot00000000000000require('../../modules/es.regexp.to-string'); module.exports = function toString(it) { return RegExp.prototype.toString.call(it); }; core-js-3.6.1/packages/core-js/es/set/000077500000000000000000000000001360057567700174255ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/set/index.js000066400000000000000000000003731360057567700210750ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); module.exports = path.Set; core-js-3.6.1/packages/core-js/es/string/000077500000000000000000000000001360057567700201405ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/string/anchor.js000066400000000000000000000002311360057567700217440ustar00rootroot00000000000000require('../../modules/es.string.anchor'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'anchor'); core-js-3.6.1/packages/core-js/es/string/big.js000066400000000000000000000002231360057567700212340ustar00rootroot00000000000000require('../../modules/es.string.big'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'big'); core-js-3.6.1/packages/core-js/es/string/blink.js000066400000000000000000000002271360057567700215760ustar00rootroot00000000000000require('../../modules/es.string.blink'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'blink'); core-js-3.6.1/packages/core-js/es/string/bold.js000066400000000000000000000002251360057567700214150ustar00rootroot00000000000000require('../../modules/es.string.bold'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'bold'); core-js-3.6.1/packages/core-js/es/string/code-point-at.js000066400000000000000000000002451360057567700231420ustar00rootroot00000000000000require('../../modules/es.string.code-point-at'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'codePointAt'); core-js-3.6.1/packages/core-js/es/string/ends-with.js000066400000000000000000000002361360057567700224010ustar00rootroot00000000000000require('../../modules/es.string.ends-with'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'endsWith'); core-js-3.6.1/packages/core-js/es/string/fixed.js000066400000000000000000000002271360057567700215760ustar00rootroot00000000000000require('../../modules/es.string.fixed'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'fixed'); core-js-3.6.1/packages/core-js/es/string/fontcolor.js000066400000000000000000000002371360057567700225050ustar00rootroot00000000000000require('../../modules/es.string.fontcolor'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'fontcolor'); core-js-3.6.1/packages/core-js/es/string/fontsize.js000066400000000000000000000002351360057567700223370ustar00rootroot00000000000000require('../../modules/es.string.fontsize'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'fontsize'); core-js-3.6.1/packages/core-js/es/string/from-code-point.js000066400000000000000000000002151360057567700234760ustar00rootroot00000000000000require('../../modules/es.string.from-code-point'); var path = require('../../internals/path'); module.exports = path.String.fromCodePoint; core-js-3.6.1/packages/core-js/es/string/includes.js000066400000000000000000000002351360057567700223040ustar00rootroot00000000000000require('../../modules/es.string.includes'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'includes'); core-js-3.6.1/packages/core-js/es/string/index.js000066400000000000000000000026311360057567700216070ustar00rootroot00000000000000require('../../modules/es.string.from-code-point'); require('../../modules/es.string.raw'); require('../../modules/es.string.code-point-at'); require('../../modules/es.string.ends-with'); require('../../modules/es.string.includes'); require('../../modules/es.string.match'); require('../../modules/es.string.match-all'); require('../../modules/es.string.pad-end'); require('../../modules/es.string.pad-start'); require('../../modules/es.string.repeat'); require('../../modules/es.string.replace'); require('../../modules/es.string.search'); require('../../modules/es.string.split'); require('../../modules/es.string.starts-with'); require('../../modules/es.string.trim'); require('../../modules/es.string.trim-start'); require('../../modules/es.string.trim-end'); require('../../modules/es.string.iterator'); require('../../modules/es.string.anchor'); require('../../modules/es.string.big'); require('../../modules/es.string.blink'); require('../../modules/es.string.bold'); require('../../modules/es.string.fixed'); require('../../modules/es.string.fontcolor'); require('../../modules/es.string.fontsize'); require('../../modules/es.string.italics'); require('../../modules/es.string.link'); require('../../modules/es.string.small'); require('../../modules/es.string.strike'); require('../../modules/es.string.sub'); require('../../modules/es.string.sup'); var path = require('../../internals/path'); module.exports = path.String; core-js-3.6.1/packages/core-js/es/string/italics.js000066400000000000000000000002331360057567700221240ustar00rootroot00000000000000require('../../modules/es.string.italics'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'italics'); core-js-3.6.1/packages/core-js/es/string/iterator.js000066400000000000000000000003301360057567700223230ustar00rootroot00000000000000require('../../modules/es.string.iterator'); var Iterators = require('../../internals/iterators'); var getStringIterator = Iterators.String; module.exports = function (it) { return getStringIterator.call(it); }; core-js-3.6.1/packages/core-js/es/string/link.js000066400000000000000000000002251360057567700214320ustar00rootroot00000000000000require('../../modules/es.string.link'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'link'); core-js-3.6.1/packages/core-js/es/string/match-all.js000066400000000000000000000002361360057567700223410ustar00rootroot00000000000000require('../../modules/es.string.match-all'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'matchAll'); core-js-3.6.1/packages/core-js/es/string/match.js000066400000000000000000000002271360057567700215730ustar00rootroot00000000000000require('../../modules/es.string.match'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'match'); core-js-3.6.1/packages/core-js/es/string/pad-end.js000066400000000000000000000002321360057567700220030ustar00rootroot00000000000000require('../../modules/es.string.pad-end'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'padEnd'); core-js-3.6.1/packages/core-js/es/string/pad-start.js000066400000000000000000000002361360057567700223760ustar00rootroot00000000000000require('../../modules/es.string.pad-start'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'padStart'); core-js-3.6.1/packages/core-js/es/string/raw.js000066400000000000000000000001671360057567700212730ustar00rootroot00000000000000require('../../modules/es.string.raw'); var path = require('../../internals/path'); module.exports = path.String.raw; core-js-3.6.1/packages/core-js/es/string/repeat.js000066400000000000000000000002311360057567700217520ustar00rootroot00000000000000require('../../modules/es.string.repeat'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'repeat'); core-js-3.6.1/packages/core-js/es/string/replace.js000066400000000000000000000002331360057567700221070ustar00rootroot00000000000000require('../../modules/es.string.replace'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'replace'); core-js-3.6.1/packages/core-js/es/string/search.js000066400000000000000000000002311360057567700217370ustar00rootroot00000000000000require('../../modules/es.string.search'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'search'); core-js-3.6.1/packages/core-js/es/string/small.js000066400000000000000000000002271360057567700216070ustar00rootroot00000000000000require('../../modules/es.string.small'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'small'); core-js-3.6.1/packages/core-js/es/string/split.js000066400000000000000000000002271360057567700216320ustar00rootroot00000000000000require('../../modules/es.string.split'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'split'); core-js-3.6.1/packages/core-js/es/string/starts-with.js000066400000000000000000000002421360057567700227650ustar00rootroot00000000000000require('../../modules/es.string.starts-with'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'startsWith'); core-js-3.6.1/packages/core-js/es/string/strike.js000066400000000000000000000002311360057567700217730ustar00rootroot00000000000000require('../../modules/es.string.strike'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'strike'); core-js-3.6.1/packages/core-js/es/string/sub.js000066400000000000000000000002231360057567700212640ustar00rootroot00000000000000require('../../modules/es.string.sub'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'sub'); core-js-3.6.1/packages/core-js/es/string/sup.js000066400000000000000000000002231360057567700213020ustar00rootroot00000000000000require('../../modules/es.string.sup'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'sup'); core-js-3.6.1/packages/core-js/es/string/trim-end.js000066400000000000000000000002361360057567700222160ustar00rootroot00000000000000require('../../modules/es.string.trim-end'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'trimRight'); core-js-3.6.1/packages/core-js/es/string/trim-left.js000066400000000000000000000002371360057567700224030ustar00rootroot00000000000000require('../../modules/es.string.trim-start'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'trimLeft'); core-js-3.6.1/packages/core-js/es/string/trim-right.js000066400000000000000000000002361360057567700225650ustar00rootroot00000000000000require('../../modules/es.string.trim-end'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'trimRight'); core-js-3.6.1/packages/core-js/es/string/trim-start.js000066400000000000000000000002371360057567700226060ustar00rootroot00000000000000require('../../modules/es.string.trim-start'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'trimLeft'); core-js-3.6.1/packages/core-js/es/string/trim.js000066400000000000000000000002251360057567700214500ustar00rootroot00000000000000require('../../modules/es.string.trim'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'trim'); core-js-3.6.1/packages/core-js/es/string/virtual/000077500000000000000000000000001360057567700216265ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/string/virtual/anchor.js000066400000000000000000000002371360057567700234400ustar00rootroot00000000000000require('../../../modules/es.string.anchor'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').anchor; core-js-3.6.1/packages/core-js/es/string/virtual/big.js000066400000000000000000000002311360057567700227210ustar00rootroot00000000000000require('../../../modules/es.string.big'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').big; core-js-3.6.1/packages/core-js/es/string/virtual/blink.js000066400000000000000000000002351360057567700232630ustar00rootroot00000000000000require('../../../modules/es.string.blink'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').blink; core-js-3.6.1/packages/core-js/es/string/virtual/bold.js000066400000000000000000000002331360057567700231020ustar00rootroot00000000000000require('../../../modules/es.string.bold'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').bold; core-js-3.6.1/packages/core-js/es/string/virtual/code-point-at.js000066400000000000000000000002531360057567700246270ustar00rootroot00000000000000require('../../../modules/es.string.code-point-at'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').codePointAt; core-js-3.6.1/packages/core-js/es/string/virtual/ends-with.js000066400000000000000000000002441360057567700240660ustar00rootroot00000000000000require('../../../modules/es.string.ends-with'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').endsWith; core-js-3.6.1/packages/core-js/es/string/virtual/fixed.js000066400000000000000000000002351360057567700232630ustar00rootroot00000000000000require('../../../modules/es.string.fixed'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').fixed; core-js-3.6.1/packages/core-js/es/string/virtual/fontcolor.js000066400000000000000000000002451360057567700241720ustar00rootroot00000000000000require('../../../modules/es.string.fontcolor'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').fontcolor; core-js-3.6.1/packages/core-js/es/string/virtual/fontsize.js000066400000000000000000000002431360057567700240240ustar00rootroot00000000000000require('../../../modules/es.string.fontsize'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').fontsize; core-js-3.6.1/packages/core-js/es/string/virtual/includes.js000066400000000000000000000002431360057567700237710ustar00rootroot00000000000000require('../../../modules/es.string.includes'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').includes; core-js-3.6.1/packages/core-js/es/string/virtual/index.js000066400000000000000000000026631360057567700233020ustar00rootroot00000000000000require('../../../modules/es.string.code-point-at'); require('../../../modules/es.string.ends-with'); require('../../../modules/es.string.includes'); require('../../../modules/es.string.match'); require('../../../modules/es.string.match-all'); require('../../../modules/es.string.pad-end'); require('../../../modules/es.string.pad-start'); require('../../../modules/es.string.repeat'); require('../../../modules/es.string.replace'); require('../../../modules/es.string.search'); require('../../../modules/es.string.split'); require('../../../modules/es.string.starts-with'); require('../../../modules/es.string.trim'); require('../../../modules/es.string.trim-start'); require('../../../modules/es.string.trim-end'); require('../../../modules/es.string.iterator'); require('../../../modules/es.string.anchor'); require('../../../modules/es.string.big'); require('../../../modules/es.string.blink'); require('../../../modules/es.string.bold'); require('../../../modules/es.string.fixed'); require('../../../modules/es.string.fontcolor'); require('../../../modules/es.string.fontsize'); require('../../../modules/es.string.italics'); require('../../../modules/es.string.link'); require('../../../modules/es.string.small'); require('../../../modules/es.string.strike'); require('../../../modules/es.string.sub'); require('../../../modules/es.string.sup'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String'); core-js-3.6.1/packages/core-js/es/string/virtual/italics.js000066400000000000000000000002411360057567700236110ustar00rootroot00000000000000require('../../../modules/es.string.italics'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').italics; core-js-3.6.1/packages/core-js/es/string/virtual/iterator.js000066400000000000000000000002151360057567700240130ustar00rootroot00000000000000require('../../../modules/es.string.iterator'); var Iterators = require('../../../internals/iterators'); module.exports = Iterators.String; core-js-3.6.1/packages/core-js/es/string/virtual/link.js000066400000000000000000000002331360057567700231170ustar00rootroot00000000000000require('../../../modules/es.string.link'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').link; core-js-3.6.1/packages/core-js/es/string/virtual/match-all.js000066400000000000000000000002441360057567700240260ustar00rootroot00000000000000require('../../../modules/es.string.match-all'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').matchAll; core-js-3.6.1/packages/core-js/es/string/virtual/pad-end.js000066400000000000000000000002401360057567700234700ustar00rootroot00000000000000require('../../../modules/es.string.pad-end'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').padEnd; core-js-3.6.1/packages/core-js/es/string/virtual/pad-start.js000066400000000000000000000002441360057567700240630ustar00rootroot00000000000000require('../../../modules/es.string.pad-start'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').padStart; core-js-3.6.1/packages/core-js/es/string/virtual/repeat.js000066400000000000000000000002371360057567700234460ustar00rootroot00000000000000require('../../../modules/es.string.repeat'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').repeat; core-js-3.6.1/packages/core-js/es/string/virtual/small.js000066400000000000000000000002351360057567700232740ustar00rootroot00000000000000require('../../../modules/es.string.small'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').small; core-js-3.6.1/packages/core-js/es/string/virtual/starts-with.js000066400000000000000000000002501360057567700244520ustar00rootroot00000000000000require('../../../modules/es.string.starts-with'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').startsWith; core-js-3.6.1/packages/core-js/es/string/virtual/strike.js000066400000000000000000000002371360057567700234670ustar00rootroot00000000000000require('../../../modules/es.string.strike'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').strike; core-js-3.6.1/packages/core-js/es/string/virtual/sub.js000066400000000000000000000002311360057567700227510ustar00rootroot00000000000000require('../../../modules/es.string.sub'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').sub; core-js-3.6.1/packages/core-js/es/string/virtual/sup.js000066400000000000000000000002311360057567700227670ustar00rootroot00000000000000require('../../../modules/es.string.sup'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').sup; core-js-3.6.1/packages/core-js/es/string/virtual/trim-end.js000066400000000000000000000002441360057567700237030ustar00rootroot00000000000000require('../../../modules/es.string.trim-end'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').trimRight; core-js-3.6.1/packages/core-js/es/string/virtual/trim-left.js000066400000000000000000000002451360057567700240700ustar00rootroot00000000000000require('../../../modules/es.string.trim-start'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').trimLeft; core-js-3.6.1/packages/core-js/es/string/virtual/trim-right.js000066400000000000000000000002441360057567700242520ustar00rootroot00000000000000require('../../../modules/es.string.trim-end'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').trimRight; core-js-3.6.1/packages/core-js/es/string/virtual/trim-start.js000066400000000000000000000002451360057567700242730ustar00rootroot00000000000000require('../../../modules/es.string.trim-start'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').trimLeft; core-js-3.6.1/packages/core-js/es/string/virtual/trim.js000066400000000000000000000002331360057567700231350ustar00rootroot00000000000000require('../../../modules/es.string.trim'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').trim; core-js-3.6.1/packages/core-js/es/symbol/000077500000000000000000000000001360057567700201375ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/symbol/async-iterator.js000066400000000000000000000003171360057567700234420ustar00rootroot00000000000000require('../../modules/es.symbol.async-iterator'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('asyncIterator'); core-js-3.6.1/packages/core-js/es/symbol/description.js000066400000000000000000000000601360057567700230140ustar00rootroot00000000000000require('../../modules/es.symbol.description'); core-js-3.6.1/packages/core-js/es/symbol/for.js000066400000000000000000000001661360057567700212660ustar00rootroot00000000000000require('../../modules/es.symbol'); var path = require('../../internals/path'); module.exports = path.Symbol['for']; core-js-3.6.1/packages/core-js/es/symbol/has-instance.js000066400000000000000000000003761360057567700230600ustar00rootroot00000000000000require('../../modules/es.symbol.has-instance'); require('../../modules/es.function.has-instance'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('hasInstance'); core-js-3.6.1/packages/core-js/es/symbol/index.js000066400000000000000000000016711360057567700216110ustar00rootroot00000000000000require('../../modules/es.array.concat'); require('../../modules/es.object.to-string'); require('../../modules/es.symbol'); require('../../modules/es.symbol.async-iterator'); require('../../modules/es.symbol.description'); require('../../modules/es.symbol.has-instance'); require('../../modules/es.symbol.is-concat-spreadable'); require('../../modules/es.symbol.iterator'); require('../../modules/es.symbol.match'); require('../../modules/es.symbol.match-all'); require('../../modules/es.symbol.replace'); require('../../modules/es.symbol.search'); require('../../modules/es.symbol.species'); require('../../modules/es.symbol.split'); require('../../modules/es.symbol.to-primitive'); require('../../modules/es.symbol.to-string-tag'); require('../../modules/es.symbol.unscopables'); require('../../modules/es.math.to-string-tag'); require('../../modules/es.json.to-string-tag'); var path = require('../../internals/path'); module.exports = path.Symbol; core-js-3.6.1/packages/core-js/es/symbol/is-concat-spreadable.js000066400000000000000000000004041360057567700244530ustar00rootroot00000000000000require('../../modules/es.symbol.is-concat-spreadable'); require('../../modules/es.array.concat'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('isConcatSpreadable'); core-js-3.6.1/packages/core-js/es/symbol/iterator.js000066400000000000000000000004501360057567700223250ustar00rootroot00000000000000require('../../modules/es.symbol.iterator'); require('../../modules/es.string.iterator'); require('../../modules/web.dom-collections.iterator'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('iterator'); core-js-3.6.1/packages/core-js/es/symbol/key-for.js000066400000000000000000000001661360057567700220540ustar00rootroot00000000000000require('../../modules/es.symbol'); var path = require('../../internals/path'); module.exports = path.Symbol.keyFor; core-js-3.6.1/packages/core-js/es/symbol/match-all.js000066400000000000000000000003631360057567700223410ustar00rootroot00000000000000require('../../modules/es.symbol.match-all'); require('../../modules/es.string.match-all'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('matchAll'); core-js-3.6.1/packages/core-js/es/symbol/match.js000066400000000000000000000003501360057567700215670ustar00rootroot00000000000000require('../../modules/es.symbol.match'); require('../../modules/es.string.match'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('match'); core-js-3.6.1/packages/core-js/es/symbol/replace.js000066400000000000000000000003561360057567700221140ustar00rootroot00000000000000require('../../modules/es.symbol.replace'); require('../../modules/es.string.replace'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('replace'); core-js-3.6.1/packages/core-js/es/symbol/search.js000066400000000000000000000003531360057567700217430ustar00rootroot00000000000000require('../../modules/es.symbol.search'); require('../../modules/es.string.search'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('search'); core-js-3.6.1/packages/core-js/es/symbol/species.js000066400000000000000000000003021360057567700221230ustar00rootroot00000000000000require('../../modules/es.symbol.species'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('species'); core-js-3.6.1/packages/core-js/es/symbol/split.js000066400000000000000000000003501360057567700216260ustar00rootroot00000000000000require('../../modules/es.symbol.split'); require('../../modules/es.string.split'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('split'); core-js-3.6.1/packages/core-js/es/symbol/to-primitive.js000066400000000000000000000003131360057567700231220ustar00rootroot00000000000000require('../../modules/es.symbol.to-primitive'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('toPrimitive'); core-js-3.6.1/packages/core-js/es/symbol/to-string-tag.js000066400000000000000000000005321360057567700231740ustar00rootroot00000000000000require('../../modules/es.symbol.to-string-tag'); require('../../modules/es.object.to-string'); require('../../modules/es.math.to-string-tag'); require('../../modules/es.json.to-string-tag'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('toStringTag'); core-js-3.6.1/packages/core-js/es/symbol/unscopables.js000066400000000000000000000003121360057567700230070ustar00rootroot00000000000000require('../../modules/es.symbol.unscopables'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('unscopables'); core-js-3.6.1/packages/core-js/es/typed-array/000077500000000000000000000000001360057567700210735ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/typed-array/copy-within.js000066400000000000000000000000651360057567700237040ustar00rootroot00000000000000require('../../modules/es.typed-array.copy-within'); core-js-3.6.1/packages/core-js/es/typed-array/entries.js000066400000000000000000000000621360057567700231000ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/es/typed-array/every.js000066400000000000000000000000571360057567700225650ustar00rootroot00000000000000require('../../modules/es.typed-array.every'); core-js-3.6.1/packages/core-js/es/typed-array/fill.js000066400000000000000000000000561360057567700223600ustar00rootroot00000000000000require('../../modules/es.typed-array.fill'); core-js-3.6.1/packages/core-js/es/typed-array/filter.js000066400000000000000000000000601360057567700227120ustar00rootroot00000000000000require('../../modules/es.typed-array.filter'); core-js-3.6.1/packages/core-js/es/typed-array/find-index.js000066400000000000000000000000641360057567700234560ustar00rootroot00000000000000require('../../modules/es.typed-array.find-index'); core-js-3.6.1/packages/core-js/es/typed-array/find.js000066400000000000000000000000561360057567700223520ustar00rootroot00000000000000require('../../modules/es.typed-array.find'); core-js-3.6.1/packages/core-js/es/typed-array/float32-array.js000066400000000000000000000002441360057567700240170ustar00rootroot00000000000000require('../../modules/es.typed-array.float32-array'); require('./methods'); var global = require('../../internals/global'); module.exports = global.Float32Array; core-js-3.6.1/packages/core-js/es/typed-array/float64-array.js000066400000000000000000000002441360057567700240240ustar00rootroot00000000000000require('../../modules/es.typed-array.float64-array'); require('./methods'); var global = require('../../internals/global'); module.exports = global.Float64Array; core-js-3.6.1/packages/core-js/es/typed-array/for-each.js000066400000000000000000000000621360057567700231130ustar00rootroot00000000000000require('../../modules/es.typed-array.for-each'); core-js-3.6.1/packages/core-js/es/typed-array/from.js000066400000000000000000000000561360057567700223750ustar00rootroot00000000000000require('../../modules/es.typed-array.from'); core-js-3.6.1/packages/core-js/es/typed-array/includes.js000066400000000000000000000000621360057567700232350ustar00rootroot00000000000000require('../../modules/es.typed-array.includes'); core-js-3.6.1/packages/core-js/es/typed-array/index-of.js000066400000000000000000000000621360057567700231400ustar00rootroot00000000000000require('../../modules/es.typed-array.index-of'); core-js-3.6.1/packages/core-js/es/typed-array/index.js000066400000000000000000000010651360057567700225420ustar00rootroot00000000000000require('../../modules/es.typed-array.int8-array'); require('../../modules/es.typed-array.uint8-array'); require('../../modules/es.typed-array.uint8-clamped-array'); require('../../modules/es.typed-array.int16-array'); require('../../modules/es.typed-array.uint16-array'); require('../../modules/es.typed-array.int32-array'); require('../../modules/es.typed-array.uint32-array'); require('../../modules/es.typed-array.float32-array'); require('../../modules/es.typed-array.float64-array'); require('./methods'); module.exports = require('../../internals/global'); core-js-3.6.1/packages/core-js/es/typed-array/int16-array.js000066400000000000000000000002401360057567700235020ustar00rootroot00000000000000require('../../modules/es.typed-array.int16-array'); require('./methods'); var global = require('../../internals/global'); module.exports = global.Int16Array; core-js-3.6.1/packages/core-js/es/typed-array/int32-array.js000066400000000000000000000002401360057567700235000ustar00rootroot00000000000000require('../../modules/es.typed-array.int32-array'); require('./methods'); var global = require('../../internals/global'); module.exports = global.Int32Array; core-js-3.6.1/packages/core-js/es/typed-array/int8-array.js000066400000000000000000000002361360057567700234300ustar00rootroot00000000000000require('../../modules/es.typed-array.int8-array'); require('./methods'); var global = require('../../internals/global'); module.exports = global.Int8Array; core-js-3.6.1/packages/core-js/es/typed-array/iterator.js000066400000000000000000000000621360057567700232600ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/es/typed-array/join.js000066400000000000000000000000561360057567700223710ustar00rootroot00000000000000require('../../modules/es.typed-array.join'); core-js-3.6.1/packages/core-js/es/typed-array/keys.js000066400000000000000000000000621360057567700224020ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/es/typed-array/last-index-of.js000066400000000000000000000000671360057567700241060ustar00rootroot00000000000000require('../../modules/es.typed-array.last-index-of'); core-js-3.6.1/packages/core-js/es/typed-array/map.js000066400000000000000000000000551360057567700222060ustar00rootroot00000000000000require('../../modules/es.typed-array.map'); core-js-3.6.1/packages/core-js/es/typed-array/methods.js000066400000000000000000000023641360057567700231010ustar00rootroot00000000000000require('../../modules/es.typed-array.from'); require('../../modules/es.typed-array.of'); require('../../modules/es.typed-array.copy-within'); require('../../modules/es.typed-array.every'); require('../../modules/es.typed-array.fill'); require('../../modules/es.typed-array.filter'); require('../../modules/es.typed-array.find'); require('../../modules/es.typed-array.find-index'); require('../../modules/es.typed-array.for-each'); require('../../modules/es.typed-array.includes'); require('../../modules/es.typed-array.index-of'); require('../../modules/es.typed-array.join'); require('../../modules/es.typed-array.last-index-of'); require('../../modules/es.typed-array.map'); require('../../modules/es.typed-array.reduce'); require('../../modules/es.typed-array.reduce-right'); require('../../modules/es.typed-array.reverse'); require('../../modules/es.typed-array.set'); require('../../modules/es.typed-array.slice'); require('../../modules/es.typed-array.some'); require('../../modules/es.typed-array.sort'); require('../../modules/es.typed-array.subarray'); require('../../modules/es.typed-array.to-locale-string'); require('../../modules/es.typed-array.to-string'); require('../../modules/es.typed-array.iterator'); require('../../modules/es.object.to-string'); core-js-3.6.1/packages/core-js/es/typed-array/of.js000066400000000000000000000000541360057567700220340ustar00rootroot00000000000000require('../../modules/es.typed-array.of'); core-js-3.6.1/packages/core-js/es/typed-array/reduce-right.js000066400000000000000000000000661360057567700240150ustar00rootroot00000000000000require('../../modules/es.typed-array.reduce-right'); core-js-3.6.1/packages/core-js/es/typed-array/reduce.js000066400000000000000000000000601360057567700226740ustar00rootroot00000000000000require('../../modules/es.typed-array.reduce'); core-js-3.6.1/packages/core-js/es/typed-array/reverse.js000066400000000000000000000000611360057567700231010ustar00rootroot00000000000000require('../../modules/es.typed-array.reverse'); core-js-3.6.1/packages/core-js/es/typed-array/set.js000066400000000000000000000000551360057567700222240ustar00rootroot00000000000000require('../../modules/es.typed-array.set'); core-js-3.6.1/packages/core-js/es/typed-array/slice.js000066400000000000000000000000571360057567700225320ustar00rootroot00000000000000require('../../modules/es.typed-array.slice'); core-js-3.6.1/packages/core-js/es/typed-array/some.js000066400000000000000000000000561360057567700223750ustar00rootroot00000000000000require('../../modules/es.typed-array.some'); core-js-3.6.1/packages/core-js/es/typed-array/sort.js000066400000000000000000000000561360057567700224210ustar00rootroot00000000000000require('../../modules/es.typed-array.sort'); core-js-3.6.1/packages/core-js/es/typed-array/subarray.js000066400000000000000000000000621360057567700232570ustar00rootroot00000000000000require('../../modules/es.typed-array.subarray'); core-js-3.6.1/packages/core-js/es/typed-array/to-locale-string.js000066400000000000000000000000721360057567700246130ustar00rootroot00000000000000require('../../modules/es.typed-array.to-locale-string'); core-js-3.6.1/packages/core-js/es/typed-array/to-string.js000066400000000000000000000000631360057567700233560ustar00rootroot00000000000000require('../../modules/es.typed-array.to-string'); core-js-3.6.1/packages/core-js/es/typed-array/uint16-array.js000066400000000000000000000002421360057567700236710ustar00rootroot00000000000000require('../../modules/es.typed-array.uint16-array'); require('./methods'); var global = require('../../internals/global'); module.exports = global.Uint16Array; core-js-3.6.1/packages/core-js/es/typed-array/uint32-array.js000066400000000000000000000002421360057567700236670ustar00rootroot00000000000000require('../../modules/es.typed-array.uint32-array'); require('./methods'); var global = require('../../internals/global'); module.exports = global.Uint32Array; core-js-3.6.1/packages/core-js/es/typed-array/uint8-array.js000066400000000000000000000002401360057567700236100ustar00rootroot00000000000000require('../../modules/es.typed-array.uint8-array'); require('./methods'); var global = require('../../internals/global'); module.exports = global.Uint8Array; core-js-3.6.1/packages/core-js/es/typed-array/uint8-clamped-array.js000066400000000000000000000002571360057567700252230ustar00rootroot00000000000000require('../../modules/es.typed-array.uint8-clamped-array'); require('./methods'); var global = require('../../internals/global'); module.exports = global.Uint8ClampedArray; core-js-3.6.1/packages/core-js/es/typed-array/values.js000066400000000000000000000000621360057567700227260ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/es/weak-map/000077500000000000000000000000001360057567700203345ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/weak-map/index.js000066400000000000000000000003271360057567700220030ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.weak-map'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); module.exports = path.WeakMap; core-js-3.6.1/packages/core-js/es/weak-set/000077500000000000000000000000001360057567700203525ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/es/weak-set/index.js000066400000000000000000000003271360057567700220210ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.weak-set'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); module.exports = path.WeakSet; core-js-3.6.1/packages/core-js/features/000077500000000000000000000000001360057567700200415ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/README.md000066400000000000000000000002131360057567700213140ustar00rootroot00000000000000This folder contains entry points for all `core-js` features with dependencies. It's the recommended way for usage only required features. core-js-3.6.1/packages/core-js/features/aggregate-error.js000066400000000000000000000003341360057567700234540ustar00rootroot00000000000000require('../modules/web.dom-collections.iterator'); require('../modules/es.string.iterator'); require('../modules/esnext.aggregate-error'); var path = require('../internals/path'); module.exports = path.AggregateError; core-js-3.6.1/packages/core-js/features/array-buffer/000077500000000000000000000000001360057567700224265ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/array-buffer/constructor.js000066400000000000000000000001251360057567700253470ustar00rootroot00000000000000var parent = require('../../es/array-buffer/constructor'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array-buffer/index.js000066400000000000000000000001111360057567700240640ustar00rootroot00000000000000var parent = require('../../es/array-buffer'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array-buffer/is-view.js000066400000000000000000000001211360057567700243410ustar00rootroot00000000000000var parent = require('../../es/array-buffer/is-view'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array-buffer/slice.js000066400000000000000000000001171360057567700240620ustar00rootroot00000000000000var parent = require('../../es/array-buffer/slice'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/000077500000000000000000000000001360057567700211575ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/array/concat.js000066400000000000000000000001111360057567700227550ustar00rootroot00000000000000var parent = require('../../es/array/concat'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/copy-within.js000066400000000000000000000001161360057567700237650ustar00rootroot00000000000000var parent = require('../../es/array/copy-within'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/entries.js000066400000000000000000000001121360057567700231600ustar00rootroot00000000000000var parent = require('../../es/array/entries'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/every.js000066400000000000000000000001101360057567700226370ustar00rootroot00000000000000var parent = require('../../es/array/every'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/fill.js000066400000000000000000000001071360057567700224410ustar00rootroot00000000000000var parent = require('../../es/array/fill'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/filter.js000066400000000000000000000001111360057567700227730ustar00rootroot00000000000000var parent = require('../../es/array/filter'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/find-index.js000066400000000000000000000001151360057567700235370ustar00rootroot00000000000000var parent = require('../../es/array/find-index'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/find.js000066400000000000000000000001071360057567700224330ustar00rootroot00000000000000var parent = require('../../es/array/find'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/flat-map.js000066400000000000000000000001131360057567700232110ustar00rootroot00000000000000var parent = require('../../es/array/flat-map'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/flat.js000066400000000000000000000001071360057567700224410ustar00rootroot00000000000000var parent = require('../../es/array/flat'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/for-each.js000066400000000000000000000001131360057567700231740ustar00rootroot00000000000000var parent = require('../../es/array/for-each'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/from.js000066400000000000000000000001071360057567700224560ustar00rootroot00000000000000var parent = require('../../es/array/from'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/includes.js000066400000000000000000000001131360057567700233160ustar00rootroot00000000000000var parent = require('../../es/array/includes'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/index-of.js000066400000000000000000000001131360057567700232210ustar00rootroot00000000000000var parent = require('../../es/array/index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/index.js000066400000000000000000000003371360057567700226270ustar00rootroot00000000000000var parent = require('../../es/array'); require('../../modules/esnext.array.is-template-object'); require('../../modules/esnext.array.last-item'); require('../../modules/esnext.array.last-index'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/is-array.js000066400000000000000000000001131360057567700232370ustar00rootroot00000000000000var parent = require('../../es/array/is-array'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/is-template-object.js000066400000000000000000000002251360057567700252040ustar00rootroot00000000000000require('../../modules/esnext.array.is-template-object'); var path = require('../../internals/path'); module.exports = path.Array.isTemplateObject; core-js-3.6.1/packages/core-js/features/array/iterator.js000066400000000000000000000001131360057567700233410ustar00rootroot00000000000000var parent = require('../../es/array/iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/join.js000066400000000000000000000001071360057567700224520ustar00rootroot00000000000000var parent = require('../../es/array/join'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/keys.js000066400000000000000000000001071360057567700224660ustar00rootroot00000000000000var parent = require('../../es/array/keys'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/last-index-of.js000066400000000000000000000001201360057567700241600ustar00rootroot00000000000000var parent = require('../../es/array/last-index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/last-index.js000066400000000000000000000000621360057567700235630ustar00rootroot00000000000000require('../../modules/esnext.array.last-index'); core-js-3.6.1/packages/core-js/features/array/last-item.js000066400000000000000000000000611360057567700234110ustar00rootroot00000000000000require('../../modules/esnext.array.last-item'); core-js-3.6.1/packages/core-js/features/array/map.js000066400000000000000000000001061360057567700222670ustar00rootroot00000000000000var parent = require('../../es/array/map'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/of.js000066400000000000000000000001051360057567700221150ustar00rootroot00000000000000var parent = require('../../es/array/of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/reduce-right.js000066400000000000000000000001171360057567700240760ustar00rootroot00000000000000var parent = require('../../es/array/reduce-right'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/reduce.js000066400000000000000000000001111360057567700227550ustar00rootroot00000000000000var parent = require('../../es/array/reduce'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/reverse.js000066400000000000000000000001121360057567700231620ustar00rootroot00000000000000var parent = require('../../es/array/reverse'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/slice.js000066400000000000000000000001101360057567700226040ustar00rootroot00000000000000var parent = require('../../es/array/slice'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/some.js000066400000000000000000000001071360057567700224560ustar00rootroot00000000000000var parent = require('../../es/array/some'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/sort.js000066400000000000000000000001071360057567700225020ustar00rootroot00000000000000var parent = require('../../es/array/sort'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/splice.js000066400000000000000000000001111360057567700227650ustar00rootroot00000000000000var parent = require('../../es/array/splice'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/values.js000066400000000000000000000001111360057567700230050ustar00rootroot00000000000000var parent = require('../../es/array/values'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/000077500000000000000000000000001360057567700226455ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/array/virtual/concat.js000066400000000000000000000001241360057567700244470ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/concat'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/copy-within.js000066400000000000000000000001311360057567700254500ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/copy-within'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/entries.js000066400000000000000000000001251360057567700246520ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/entries'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/every.js000066400000000000000000000001231360057567700243310ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/every'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/fill.js000066400000000000000000000001221360057567700241240ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/fill'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/filter.js000066400000000000000000000001241360057567700244650ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/filter'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/find-index.js000066400000000000000000000001301360057567700252220ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/find-index'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/find.js000066400000000000000000000001221360057567700241160ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/find'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/flat-map.js000066400000000000000000000001261360057567700247030ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/flat-map'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/flat.js000066400000000000000000000001221360057567700241240ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/flat'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/for-each.js000066400000000000000000000001261360057567700246660ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/for-each'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/includes.js000066400000000000000000000001261360057567700250100ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/includes'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/index-of.js000066400000000000000000000001261360057567700247130ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/index.js000066400000000000000000000001151360057567700243070ustar00rootroot00000000000000var parent = require('../../../es/array/virtual'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/iterator.js000066400000000000000000000001261360057567700250330ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/join.js000066400000000000000000000001221360057567700241350ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/join'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/keys.js000066400000000000000000000001221360057567700241510ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/keys'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/last-index-of.js000066400000000000000000000001331360057567700256520ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/last-index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/map.js000066400000000000000000000001211360057567700237520ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/map'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/reduce-right.js000066400000000000000000000001321360057567700255610ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/reduce-right'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/reduce.js000066400000000000000000000001241360057567700244470ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/reduce'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/reverse.js000066400000000000000000000001251360057567700246540ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/reverse'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/slice.js000066400000000000000000000001231360057567700242760ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/slice'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/some.js000066400000000000000000000001221360057567700241410ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/some'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/sort.js000066400000000000000000000001221360057567700241650ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/sort'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/splice.js000066400000000000000000000001241360057567700244570ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/splice'); module.exports = parent; core-js-3.6.1/packages/core-js/features/array/virtual/values.js000066400000000000000000000001241360057567700244770ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/values'); module.exports = parent; core-js-3.6.1/packages/core-js/features/async-iterator/000077500000000000000000000000001360057567700230055ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/async-iterator/as-indexed-pairs.js000066400000000000000000000006621360057567700265040ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.as-indexed-pairs'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'asIndexedPairs'); core-js-3.6.1/packages/core-js/features/async-iterator/drop.js000066400000000000000000000006341360057567700243120ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.drop'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'drop'); core-js-3.6.1/packages/core-js/features/async-iterator/every.js000066400000000000000000000006361360057567700245020ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.every'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'every'); core-js-3.6.1/packages/core-js/features/async-iterator/filter.js000066400000000000000000000006401360057567700246300ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.filter'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'filter'); core-js-3.6.1/packages/core-js/features/async-iterator/find.js000066400000000000000000000006341360057567700242660ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.find'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'find'); core-js-3.6.1/packages/core-js/features/async-iterator/flat-map.js000066400000000000000000000006431360057567700250470ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.flat-map'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'flatMap'); core-js-3.6.1/packages/core-js/features/async-iterator/for-each.js000066400000000000000000000006431360057567700250320ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.for-each'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'forEach'); core-js-3.6.1/packages/core-js/features/async-iterator/from.js000066400000000000000000000006001360057567700243020ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.from'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); module.exports = path.AsyncIterator.from; core-js-3.6.1/packages/core-js/features/async-iterator/index.js000066400000000000000000000020231360057567700244470ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.as-indexed-pairs'); require('../../modules/esnext.async-iterator.drop'); require('../../modules/esnext.async-iterator.every'); require('../../modules/esnext.async-iterator.filter'); require('../../modules/esnext.async-iterator.find'); require('../../modules/esnext.async-iterator.flat-map'); require('../../modules/esnext.async-iterator.for-each'); require('../../modules/esnext.async-iterator.from'); require('../../modules/esnext.async-iterator.map'); require('../../modules/esnext.async-iterator.reduce'); require('../../modules/esnext.async-iterator.some'); require('../../modules/esnext.async-iterator.take'); require('../../modules/esnext.async-iterator.to-array'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); module.exports = path.AsyncIterator; core-js-3.6.1/packages/core-js/features/async-iterator/map.js000066400000000000000000000006321360057567700241210ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.map'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'map'); core-js-3.6.1/packages/core-js/features/async-iterator/reduce.js000066400000000000000000000006401360057567700246120ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.reduce'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'reduce'); core-js-3.6.1/packages/core-js/features/async-iterator/some.js000066400000000000000000000006341360057567700243110ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.some'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'some'); core-js-3.6.1/packages/core-js/features/async-iterator/take.js000066400000000000000000000006341360057567700242720ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.take'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'take'); core-js-3.6.1/packages/core-js/features/async-iterator/to-array.js000066400000000000000000000006431360057567700251040ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.promise'); require('../../modules/es.string.iterator'); require('../../modules/esnext.async-iterator.constructor'); require('../../modules/esnext.async-iterator.to-array'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('AsyncIterator', 'toArray'); core-js-3.6.1/packages/core-js/features/clear-immediate.js000066400000000000000000000001151360057567700234160ustar00rootroot00000000000000var parent = require('../stable/clear-immediate'); module.exports = parent; core-js-3.6.1/packages/core-js/features/composite-key.js000066400000000000000000000001721360057567700231670ustar00rootroot00000000000000require('../modules/esnext.composite-key'); var path = require('../internals/path'); module.exports = path.compositeKey; core-js-3.6.1/packages/core-js/features/composite-symbol.js000066400000000000000000000002411360057567700237010ustar00rootroot00000000000000require('../modules/es.symbol'); require('../modules/esnext.composite-symbol'); var path = require('../internals/path'); module.exports = path.compositeSymbol; core-js-3.6.1/packages/core-js/features/data-view/000077500000000000000000000000001360057567700217225ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/data-view/index.js000066400000000000000000000001061360057567700233640ustar00rootroot00000000000000var parent = require('../../es/data-view'); module.exports = parent; core-js-3.6.1/packages/core-js/features/date/000077500000000000000000000000001360057567700207565ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/date/index.js000066400000000000000000000001011360057567700224130ustar00rootroot00000000000000var parent = require('../../es/date'); module.exports = parent; core-js-3.6.1/packages/core-js/features/date/now.js000066400000000000000000000001051360057567700221130ustar00rootroot00000000000000var parent = require('../../es/date/now'); module.exports = parent; core-js-3.6.1/packages/core-js/features/date/to-iso-string.js000066400000000000000000000001171360057567700240310ustar00rootroot00000000000000var parent = require('../../es/date/to-iso-string'); module.exports = parent; core-js-3.6.1/packages/core-js/features/date/to-json.js000066400000000000000000000001111360057567700226760ustar00rootroot00000000000000var parent = require('../../es/date/to-json'); module.exports = parent; core-js-3.6.1/packages/core-js/features/date/to-primitive.js000066400000000000000000000001161360057567700237420ustar00rootroot00000000000000var parent = require('../../es/date/to-primitive'); module.exports = parent; core-js-3.6.1/packages/core-js/features/date/to-string.js000066400000000000000000000001131360057567700232350ustar00rootroot00000000000000var parent = require('../../es/date/to-string'); module.exports = parent; core-js-3.6.1/packages/core-js/features/dom-collections/000077500000000000000000000000001360057567700231345ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/dom-collections/for-each.js000066400000000000000000000001311360057567700251510ustar00rootroot00000000000000var parent = require('../../stable/dom-collections/for-each'); module.exports = parent; core-js-3.6.1/packages/core-js/features/dom-collections/index.js000066400000000000000000000001201360057567700245720ustar00rootroot00000000000000var parent = require('../../stable/dom-collections'); module.exports = parent; core-js-3.6.1/packages/core-js/features/dom-collections/iterator.js000066400000000000000000000001311360057567700253160ustar00rootroot00000000000000var parent = require('../../stable/dom-collections/iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/features/function/000077500000000000000000000000001360057567700216665ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/function/bind.js000066400000000000000000000001121360057567700231320ustar00rootroot00000000000000var parent = require('../../es/function/bind'); module.exports = parent; core-js-3.6.1/packages/core-js/features/function/has-instance.js000066400000000000000000000001221360057567700245740ustar00rootroot00000000000000var parent = require('../../es/function/has-instance'); module.exports = parent; core-js-3.6.1/packages/core-js/features/function/index.js000066400000000000000000000001051360057567700233270ustar00rootroot00000000000000var parent = require('../../es/function'); module.exports = parent; core-js-3.6.1/packages/core-js/features/function/name.js000066400000000000000000000001121360057567700231360ustar00rootroot00000000000000var parent = require('../../es/function/name'); module.exports = parent; core-js-3.6.1/packages/core-js/features/function/virtual/000077500000000000000000000000001360057567700233545ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/function/virtual/bind.js000066400000000000000000000001251360057567700246240ustar00rootroot00000000000000var parent = require('../../../es/function/virtual/bind'); module.exports = parent; core-js-3.6.1/packages/core-js/features/function/virtual/index.js000066400000000000000000000001201360057567700250120ustar00rootroot00000000000000var parent = require('../../../es/function/virtual'); module.exports = parent; core-js-3.6.1/packages/core-js/features/get-iterator-method.js000066400000000000000000000003101360057567700242550ustar00rootroot00000000000000require('../modules/web.dom-collections.iterator'); require('../modules/es.string.iterator'); var getIteratorMethod = require('../internals/get-iterator-method'); module.exports = getIteratorMethod; core-js-3.6.1/packages/core-js/features/get-iterator.js000066400000000000000000000002651360057567700230100ustar00rootroot00000000000000require('../modules/web.dom-collections.iterator'); require('../modules/es.string.iterator'); var getIterator = require('../internals/get-iterator'); module.exports = getIterator; core-js-3.6.1/packages/core-js/features/global-this.js000066400000000000000000000002211360057567700225770ustar00rootroot00000000000000// TODO: remove from `core-js@4` require('../modules/esnext.global-this'); var parent = require('../es/global-this'); module.exports = parent; core-js-3.6.1/packages/core-js/features/index.js000066400000000000000000000000661360057567700215100ustar00rootroot00000000000000var parent = require('..'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/000077500000000000000000000000001360057567700216455ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/instance/at.js000066400000000000000000000004151360057567700226070ustar00rootroot00000000000000var at = require('../string/virtual/at'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.at; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.at) ? at : own; }; core-js-3.6.1/packages/core-js/features/instance/bind.js000066400000000000000000000001121360057567700231110ustar00rootroot00000000000000var parent = require('../../es/instance/bind'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/code-point-at.js000066400000000000000000000001231360057567700246420ustar00rootroot00000000000000var parent = require('../../es/instance/code-point-at'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/code-points.js000066400000000000000000000004661360057567700244350ustar00rootroot00000000000000var codePoints = require('../string/virtual/code-points'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.codePoints; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.codePoints) ? codePoints : own; }; core-js-3.6.1/packages/core-js/features/instance/concat.js000066400000000000000000000001141360057567700234460ustar00rootroot00000000000000var parent = require('../../es/instance/concat'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/copy-within.js000066400000000000000000000001211360057567700244470ustar00rootroot00000000000000var parent = require('../../es/instance/copy-within'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/ends-with.js000066400000000000000000000001171360057567700241040ustar00rootroot00000000000000var parent = require('../../es/instance/ends-with'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/entries.js000066400000000000000000000001211360057567700236460ustar00rootroot00000000000000var parent = require('../../stable/instance/entries'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/every.js000066400000000000000000000001131360057567700233300ustar00rootroot00000000000000var parent = require('../../es/instance/every'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/fill.js000066400000000000000000000001121360057567700231230ustar00rootroot00000000000000var parent = require('../../es/instance/fill'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/filter.js000066400000000000000000000001141360057567700234640ustar00rootroot00000000000000var parent = require('../../es/instance/filter'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/find-index.js000066400000000000000000000001201360057567700242210ustar00rootroot00000000000000var parent = require('../../es/instance/find-index'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/find.js000066400000000000000000000001121360057567700231150ustar00rootroot00000000000000var parent = require('../../es/instance/find'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/flags.js000066400000000000000000000001131360057567700232720ustar00rootroot00000000000000var parent = require('../../es/instance/flags'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/flat-map.js000066400000000000000000000001161360057567700237020ustar00rootroot00000000000000var parent = require('../../es/instance/flat-map'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/flat.js000066400000000000000000000001121360057567700231230ustar00rootroot00000000000000var parent = require('../../es/instance/flat'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/for-each.js000066400000000000000000000001221360057567700236620ustar00rootroot00000000000000var parent = require('../../stable/instance/for-each'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/includes.js000066400000000000000000000001161360057567700240070ustar00rootroot00000000000000var parent = require('../../es/instance/includes'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/index-of.js000066400000000000000000000001161360057567700237120ustar00rootroot00000000000000var parent = require('../../es/instance/index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/keys.js000066400000000000000000000001161360057567700231540ustar00rootroot00000000000000var parent = require('../../stable/instance/keys'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/last-index-of.js000066400000000000000000000001231360057567700246510ustar00rootroot00000000000000var parent = require('../../es/instance/last-index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/map.js000066400000000000000000000001111360057567700227510ustar00rootroot00000000000000var parent = require('../../es/instance/map'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/match-all.js000066400000000000000000000002431360057567700240440ustar00rootroot00000000000000// TODO: remove from `core-js@4` require('../../modules/esnext.string.match-all'); var parent = require('../../es/instance/match-all'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/pad-end.js000066400000000000000000000001151360057567700235100ustar00rootroot00000000000000var parent = require('../../es/instance/pad-end'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/pad-start.js000066400000000000000000000001171360057567700241010ustar00rootroot00000000000000var parent = require('../../es/instance/pad-start'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/reduce-right.js000066400000000000000000000001221360057567700245600ustar00rootroot00000000000000var parent = require('../../es/instance/reduce-right'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/reduce.js000066400000000000000000000001141360057567700234460ustar00rootroot00000000000000var parent = require('../../es/instance/reduce'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/repeat.js000066400000000000000000000001141360057567700234570ustar00rootroot00000000000000var parent = require('../../es/instance/repeat'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/replace-all.js000066400000000000000000000004661360057567700243720ustar00rootroot00000000000000var replaceAll = require('../string/virtual/replace-all'); var StringPrototype = String.prototype; module.exports = function (it) { var own = it.replaceAll; return typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.replaceAll) ? replaceAll : own; }; core-js-3.6.1/packages/core-js/features/instance/reverse.js000066400000000000000000000001151360057567700236530ustar00rootroot00000000000000var parent = require('../../es/instance/reverse'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/slice.js000066400000000000000000000001131360057567700232750ustar00rootroot00000000000000var parent = require('../../es/instance/slice'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/some.js000066400000000000000000000001121360057567700231400ustar00rootroot00000000000000var parent = require('../../es/instance/some'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/sort.js000066400000000000000000000001121360057567700231640ustar00rootroot00000000000000var parent = require('../../es/instance/sort'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/splice.js000066400000000000000000000001141360057567700234560ustar00rootroot00000000000000var parent = require('../../es/instance/splice'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/starts-with.js000066400000000000000000000001211360057567700244660ustar00rootroot00000000000000var parent = require('../../es/instance/starts-with'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/trim-end.js000066400000000000000000000001161360057567700237200ustar00rootroot00000000000000var parent = require('../../es/instance/trim-end'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/trim-left.js000066400000000000000000000001171360057567700241050ustar00rootroot00000000000000var parent = require('../../es/instance/trim-left'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/trim-right.js000066400000000000000000000001201360057567700242620ustar00rootroot00000000000000var parent = require('../../es/instance/trim-right'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/trim-start.js000066400000000000000000000001201360057567700243020ustar00rootroot00000000000000var parent = require('../../es/instance/trim-start'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/trim.js000066400000000000000000000001121360057567700231500ustar00rootroot00000000000000var parent = require('../../es/instance/trim'); module.exports = parent; core-js-3.6.1/packages/core-js/features/instance/values.js000066400000000000000000000001201360057567700234730ustar00rootroot00000000000000var parent = require('../../stable/instance/values'); module.exports = parent; core-js-3.6.1/packages/core-js/features/is-iterable.js000066400000000000000000000002621360057567700225770ustar00rootroot00000000000000require('../modules/web.dom-collections.iterator'); require('../modules/es.string.iterator'); var isIterable = require('../internals/is-iterable'); module.exports = isIterable; core-js-3.6.1/packages/core-js/features/iterator/000077500000000000000000000000001360057567700216725ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/iterator/as-indexed-pairs.js000066400000000000000000000005751360057567700253740ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.as-indexed-pairs'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'asIndexedPairs'); core-js-3.6.1/packages/core-js/features/iterator/drop.js000066400000000000000000000005461360057567700232010ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.drop'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'drop'); core-js-3.6.1/packages/core-js/features/iterator/every.js000066400000000000000000000005501360057567700233620ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.every'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'every'); core-js-3.6.1/packages/core-js/features/iterator/filter.js000066400000000000000000000005521360057567700235170ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.filter'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'filter'); core-js-3.6.1/packages/core-js/features/iterator/find.js000066400000000000000000000005461360057567700231550ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.find'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'find'); core-js-3.6.1/packages/core-js/features/iterator/flat-map.js000066400000000000000000000005551360057567700237360ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.flat-map'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'flatMap'); core-js-3.6.1/packages/core-js/features/iterator/for-each.js000066400000000000000000000005551360057567700237210ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.for-each'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'forEach'); core-js-3.6.1/packages/core-js/features/iterator/from.js000066400000000000000000000005121360057567700231710ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.from'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); module.exports = path.Iterator.from; core-js-3.6.1/packages/core-js/features/iterator/index.js000066400000000000000000000016251360057567700233430ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.as-indexed-pairs'); require('../../modules/esnext.iterator.drop'); require('../../modules/esnext.iterator.every'); require('../../modules/esnext.iterator.filter'); require('../../modules/esnext.iterator.find'); require('../../modules/esnext.iterator.flat-map'); require('../../modules/esnext.iterator.for-each'); require('../../modules/esnext.iterator.from'); require('../../modules/esnext.iterator.map'); require('../../modules/esnext.iterator.reduce'); require('../../modules/esnext.iterator.some'); require('../../modules/esnext.iterator.take'); require('../../modules/esnext.iterator.to-array'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); module.exports = path.Iterator; core-js-3.6.1/packages/core-js/features/iterator/map.js000066400000000000000000000005441360057567700230100ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.map'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'map'); core-js-3.6.1/packages/core-js/features/iterator/reduce.js000066400000000000000000000005521360057567700235010ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.reduce'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'reduce'); core-js-3.6.1/packages/core-js/features/iterator/some.js000066400000000000000000000005461360057567700232000ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.some'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'some'); core-js-3.6.1/packages/core-js/features/iterator/take.js000066400000000000000000000005461360057567700231610ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.take'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'take'); core-js-3.6.1/packages/core-js/features/iterator/to-array.js000066400000000000000000000005551360057567700237730ustar00rootroot00000000000000require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/esnext.iterator.constructor'); require('../../modules/esnext.iterator.to-array'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Iterator', 'toArray'); core-js-3.6.1/packages/core-js/features/json/000077500000000000000000000000001360057567700210125ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/json/index.js000066400000000000000000000001011360057567700224470ustar00rootroot00000000000000var parent = require('../../es/json'); module.exports = parent; core-js-3.6.1/packages/core-js/features/json/stringify.js000066400000000000000000000001131360057567700233610ustar00rootroot00000000000000var parent = require('../../es/json/stringify'); module.exports = parent; core-js-3.6.1/packages/core-js/features/json/to-string-tag.js000066400000000000000000000001171360057567700240460ustar00rootroot00000000000000var parent = require('../../es/json/to-string-tag'); module.exports = parent; core-js-3.6.1/packages/core-js/features/map/000077500000000000000000000000001360057567700206165ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/map/delete-all.js000066400000000000000000000002771360057567700231720ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.delete-all'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'deleteAll'); core-js-3.6.1/packages/core-js/features/map/every.js000066400000000000000000000002661360057567700223120ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.every'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'every'); core-js-3.6.1/packages/core-js/features/map/filter.js000066400000000000000000000002701360057567700224400ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.filter'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'filter'); core-js-3.6.1/packages/core-js/features/map/find-key.js000066400000000000000000000002731360057567700226640ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.find-key'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'findKey'); core-js-3.6.1/packages/core-js/features/map/find.js000066400000000000000000000002641360057567700220760ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.find'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'find'); core-js-3.6.1/packages/core-js/features/map/from.js000066400000000000000000000006531360057567700221230ustar00rootroot00000000000000'use strict'; require('../../modules/es.map'); require('../../modules/es.string.iterator'); require('../../modules/esnext.map.from'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); var Map = path.Map; var mapFrom = Map.from; module.exports = function from(source, mapFn, thisArg) { return mapFrom.call(typeof this === 'function' ? this : Map, source, mapFn, thisArg); }; core-js-3.6.1/packages/core-js/features/map/group-by.js000066400000000000000000000005511360057567700227210ustar00rootroot00000000000000'use strict'; require('../../modules/es.map'); require('../../modules/esnext.map.group-by'); var path = require('../../internals/path'); var Map = path.Map; var mapGroupBy = Map.groupBy; module.exports = function groupBy(source, iterable, keyDerivative) { return mapGroupBy.call(typeof this === 'function' ? this : Map, source, iterable, keyDerivative); }; core-js-3.6.1/packages/core-js/features/map/includes.js000066400000000000000000000002741360057567700227650ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.includes'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'includes'); core-js-3.6.1/packages/core-js/features/map/index.js000066400000000000000000000016631360057567700222710ustar00rootroot00000000000000var parent = require('../../es/map'); require('../../modules/esnext.map.from'); require('../../modules/esnext.map.of'); require('../../modules/esnext.map.delete-all'); require('../../modules/esnext.map.every'); require('../../modules/esnext.map.filter'); require('../../modules/esnext.map.find'); require('../../modules/esnext.map.find-key'); require('../../modules/esnext.map.group-by'); require('../../modules/esnext.map.includes'); require('../../modules/esnext.map.key-by'); require('../../modules/esnext.map.key-of'); require('../../modules/esnext.map.map-keys'); require('../../modules/esnext.map.map-values'); require('../../modules/esnext.map.merge'); require('../../modules/esnext.map.reduce'); require('../../modules/esnext.map.some'); require('../../modules/esnext.map.update'); require('../../modules/esnext.map.upsert'); // TODO: remove from `core-js@4` require('../../modules/esnext.map.update-or-insert'); module.exports = parent; core-js-3.6.1/packages/core-js/features/map/key-by.js000066400000000000000000000005371360057567700223610ustar00rootroot00000000000000'use strict'; require('../../modules/es.map'); require('../../modules/esnext.map.key-by'); var path = require('../../internals/path'); var Map = path.Map; var mapKeyBy = Map.keyBy; module.exports = function keyBy(source, iterable, keyDerivative) { return mapKeyBy.call(typeof this === 'function' ? this : Map, source, iterable, keyDerivative); }; core-js-3.6.1/packages/core-js/features/map/key-of.js000066400000000000000000000002671360057567700223530ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.key-of'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'keyOf'); core-js-3.6.1/packages/core-js/features/map/map-keys.js000066400000000000000000000002731360057567700227040ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.map-keys'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'mapKeys'); core-js-3.6.1/packages/core-js/features/map/map-values.js000066400000000000000000000002771360057567700232340ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.map-values'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'mapValues'); core-js-3.6.1/packages/core-js/features/map/merge.js000066400000000000000000000002661360057567700222570ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.merge'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'merge'); core-js-3.6.1/packages/core-js/features/map/of.js000066400000000000000000000005771360057567700215710ustar00rootroot00000000000000'use strict'; require('../../modules/es.map'); require('../../modules/es.string.iterator'); require('../../modules/esnext.map.of'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); var Map = path.Map; var mapOf = Map.of; module.exports = function of() { return mapOf.apply(typeof this === 'function' ? this : Map, arguments); }; core-js-3.6.1/packages/core-js/features/map/reduce.js000066400000000000000000000002701360057567700224220ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.reduce'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'reduce'); core-js-3.6.1/packages/core-js/features/map/some.js000066400000000000000000000002641360057567700221210ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.some'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'some'); core-js-3.6.1/packages/core-js/features/map/update-or-insert.js000066400000000000000000000003531360057567700243570ustar00rootroot00000000000000// TODO: remove from `core-js@4` require('../../modules/es.map'); require('../../modules/esnext.map.update-or-insert'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'updateOrInsert'); core-js-3.6.1/packages/core-js/features/map/update.js000066400000000000000000000002701360057567700224350ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.update'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'update'); core-js-3.6.1/packages/core-js/features/map/upsert.js000066400000000000000000000002701360057567700224750ustar00rootroot00000000000000require('../../modules/es.map'); require('../../modules/esnext.map.upsert'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Map', 'upsert'); core-js-3.6.1/packages/core-js/features/math/000077500000000000000000000000001360057567700207725ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/math/acosh.js000066400000000000000000000001071360057567700224230ustar00rootroot00000000000000var parent = require('../../es/math/acosh'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/asinh.js000066400000000000000000000001071360057567700224300ustar00rootroot00000000000000var parent = require('../../es/math/asinh'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/atanh.js000066400000000000000000000001071360057567700224210ustar00rootroot00000000000000var parent = require('../../es/math/atanh'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/cbrt.js000066400000000000000000000001061360057567700222570ustar00rootroot00000000000000var parent = require('../../es/math/cbrt'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/clamp.js000066400000000000000000000001731360057567700224250ustar00rootroot00000000000000require('../../modules/esnext.math.clamp'); var path = require('../../internals/path'); module.exports = path.Math.clamp; core-js-3.6.1/packages/core-js/features/math/clz32.js000066400000000000000000000001071360057567700222630ustar00rootroot00000000000000var parent = require('../../es/math/clz32'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/cosh.js000066400000000000000000000001061360057567700222610ustar00rootroot00000000000000var parent = require('../../es/math/cosh'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/deg-per-rad.js000066400000000000000000000001231360057567700234130ustar00rootroot00000000000000require('../../modules/esnext.math.deg-per-rad'); module.exports = Math.PI / 180; core-js-3.6.1/packages/core-js/features/math/degrees.js000066400000000000000000000001771360057567700227530ustar00rootroot00000000000000require('../../modules/esnext.math.degrees'); var path = require('../../internals/path'); module.exports = path.Math.degrees; core-js-3.6.1/packages/core-js/features/math/expm1.js000066400000000000000000000001071360057567700223600ustar00rootroot00000000000000var parent = require('../../es/math/expm1'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/fround.js000066400000000000000000000001101360057567700226150ustar00rootroot00000000000000var parent = require('../../es/math/fround'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/fscale.js000066400000000000000000000001751360057567700225700ustar00rootroot00000000000000require('../../modules/esnext.math.fscale'); var path = require('../../internals/path'); module.exports = path.Math.fscale; core-js-3.6.1/packages/core-js/features/math/hypot.js000066400000000000000000000001071360057567700224710ustar00rootroot00000000000000var parent = require('../../es/math/hypot'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/iaddh.js000066400000000000000000000001731360057567700224020ustar00rootroot00000000000000require('../../modules/esnext.math.iaddh'); var path = require('../../internals/path'); module.exports = path.Math.iaddh; core-js-3.6.1/packages/core-js/features/math/imul.js000066400000000000000000000001061360057567700222730ustar00rootroot00000000000000var parent = require('../../es/math/imul'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/imulh.js000066400000000000000000000001731360057567700224470ustar00rootroot00000000000000require('../../modules/esnext.math.imulh'); var path = require('../../internals/path'); module.exports = path.Math.imulh; core-js-3.6.1/packages/core-js/features/math/index.js000066400000000000000000000012671360057567700224450ustar00rootroot00000000000000var parent = require('../../es/math'); require('../../modules/esnext.math.clamp'); require('../../modules/esnext.math.deg-per-rad'); require('../../modules/esnext.math.degrees'); require('../../modules/esnext.math.fscale'); require('../../modules/esnext.math.rad-per-deg'); require('../../modules/esnext.math.radians'); require('../../modules/esnext.math.scale'); require('../../modules/esnext.math.seeded-prng'); require('../../modules/esnext.math.signbit'); // TODO: Remove from `core-js@4` require('../../modules/esnext.math.iaddh'); require('../../modules/esnext.math.isubh'); require('../../modules/esnext.math.imulh'); require('../../modules/esnext.math.umulh'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/isubh.js000066400000000000000000000001731360057567700224430ustar00rootroot00000000000000require('../../modules/esnext.math.isubh'); var path = require('../../internals/path'); module.exports = path.Math.isubh; core-js-3.6.1/packages/core-js/features/math/log10.js000066400000000000000000000001071360057567700222500ustar00rootroot00000000000000var parent = require('../../es/math/log10'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/log1p.js000066400000000000000000000001071360057567700223500ustar00rootroot00000000000000var parent = require('../../es/math/log1p'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/log2.js000066400000000000000000000001061360057567700221700ustar00rootroot00000000000000var parent = require('../../es/math/log2'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/rad-per-deg.js000066400000000000000000000001231360057567700234130ustar00rootroot00000000000000require('../../modules/esnext.math.rad-per-deg'); module.exports = 180 / Math.PI; core-js-3.6.1/packages/core-js/features/math/radians.js000066400000000000000000000001771360057567700227560ustar00rootroot00000000000000require('../../modules/esnext.math.radians'); var path = require('../../internals/path'); module.exports = path.Math.radians; core-js-3.6.1/packages/core-js/features/math/scale.js000066400000000000000000000001731360057567700224200ustar00rootroot00000000000000require('../../modules/esnext.math.scale'); var path = require('../../internals/path'); module.exports = path.Math.scale; core-js-3.6.1/packages/core-js/features/math/seeded-prng.js000066400000000000000000000002061360057567700235230ustar00rootroot00000000000000require('../../modules/esnext.math.seeded-prng'); var path = require('../../internals/path'); module.exports = path.Math.seededPRNG; core-js-3.6.1/packages/core-js/features/math/sign.js000066400000000000000000000001061360057567700222650ustar00rootroot00000000000000var parent = require('../../es/math/sign'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/signbit.js000066400000000000000000000001771360057567700227740ustar00rootroot00000000000000require('../../modules/esnext.math.signbit'); var path = require('../../internals/path'); module.exports = path.Math.signbit; core-js-3.6.1/packages/core-js/features/math/sinh.js000066400000000000000000000001061360057567700222660ustar00rootroot00000000000000var parent = require('../../es/math/sinh'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/tanh.js000066400000000000000000000001061360057567700222570ustar00rootroot00000000000000var parent = require('../../es/math/tanh'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/to-string-tag.js000066400000000000000000000001171360057567700240260ustar00rootroot00000000000000var parent = require('../../es/math/to-string-tag'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/trunc.js000066400000000000000000000001071360057567700224610ustar00rootroot00000000000000var parent = require('../../es/math/trunc'); module.exports = parent; core-js-3.6.1/packages/core-js/features/math/umulh.js000066400000000000000000000001731360057567700224630ustar00rootroot00000000000000require('../../modules/esnext.math.umulh'); var path = require('../../internals/path'); module.exports = path.Math.umulh; core-js-3.6.1/packages/core-js/features/number/000077500000000000000000000000001360057567700213315ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/number/constructor.js000066400000000000000000000001171360057567700242530ustar00rootroot00000000000000var parent = require('../../es/number/constructor'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/epsilon.js000066400000000000000000000001131360057567700233330ustar00rootroot00000000000000var parent = require('../../es/number/epsilon'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/from-string.js000066400000000000000000000002121360057567700241310ustar00rootroot00000000000000require('../../modules/esnext.number.from-string'); var path = require('../../internals/path'); module.exports = path.Number.fromString; core-js-3.6.1/packages/core-js/features/number/index.js000066400000000000000000000001701360057567700227740ustar00rootroot00000000000000var parent = require('../../es/number'); module.exports = parent; require('../../modules/esnext.number.from-string'); core-js-3.6.1/packages/core-js/features/number/is-finite.js000066400000000000000000000001151360057567700235530ustar00rootroot00000000000000var parent = require('../../es/number/is-finite'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/is-integer.js000066400000000000000000000001161360057567700237330ustar00rootroot00000000000000var parent = require('../../es/number/is-integer'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/is-nan.js000066400000000000000000000001121360057567700230460ustar00rootroot00000000000000var parent = require('../../es/number/is-nan'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/is-safe-integer.js000066400000000000000000000001231360057567700246450ustar00rootroot00000000000000var parent = require('../../es/number/is-safe-integer'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/max-safe-integer.js000066400000000000000000000001241360057567700250200ustar00rootroot00000000000000var parent = require('../../es/number/max-safe-integer'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/min-safe-integer.js000066400000000000000000000001241360057567700250160ustar00rootroot00000000000000var parent = require('../../es/number/min-safe-integer'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/parse-float.js000066400000000000000000000001171360057567700241030ustar00rootroot00000000000000var parent = require('../../es/number/parse-float'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/parse-int.js000066400000000000000000000001151360057567700235660ustar00rootroot00000000000000var parent = require('../../es/number/parse-int'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/to-fixed.js000066400000000000000000000001141360057567700234020ustar00rootroot00000000000000var parent = require('../../es/number/to-fixed'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/to-precision.js000066400000000000000000000001201360057567700242730ustar00rootroot00000000000000var parent = require('../../es/number/to-precision'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/virtual/000077500000000000000000000000001360057567700230175ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/number/virtual/index.js000066400000000000000000000001161360057567700244620ustar00rootroot00000000000000var parent = require('../../../es/number/virtual'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/virtual/to-fixed.js000066400000000000000000000001271360057567700250740ustar00rootroot00000000000000var parent = require('../../../es/number/virtual/to-fixed'); module.exports = parent; core-js-3.6.1/packages/core-js/features/number/virtual/to-precision.js000066400000000000000000000001331360057567700257650ustar00rootroot00000000000000var parent = require('../../../es/number/virtual/to-precision'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/000077500000000000000000000000001360057567700213075ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/object/assign.js000066400000000000000000000001121360057567700231230ustar00rootroot00000000000000var parent = require('../../es/object/assign'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/create.js000066400000000000000000000001121360057567700231020ustar00rootroot00000000000000var parent = require('../../es/object/create'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/define-getter.js000066400000000000000000000001211360057567700243610ustar00rootroot00000000000000var parent = require('../../es/object/define-getter'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/define-properties.js000066400000000000000000000001251360057567700252670ustar00rootroot00000000000000var parent = require('../../es/object/define-properties'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/define-property.js000066400000000000000000000001231360057567700247550ustar00rootroot00000000000000var parent = require('../../es/object/define-property'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/define-setter.js000066400000000000000000000001211360057567700243750ustar00rootroot00000000000000var parent = require('../../es/object/define-setter'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/entries.js000066400000000000000000000001131360057567700233110ustar00rootroot00000000000000var parent = require('../../es/object/entries'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/freeze.js000066400000000000000000000001121360057567700231170ustar00rootroot00000000000000var parent = require('../../es/object/freeze'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/from-entries.js000066400000000000000000000001201360057567700242500ustar00rootroot00000000000000var parent = require('../../es/object/from-entries'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/get-own-property-descriptor.js000066400000000000000000000001371360057567700272640ustar00rootroot00000000000000var parent = require('../../es/object/get-own-property-descriptor'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/get-own-property-descriptors.js000066400000000000000000000001401360057567700274410ustar00rootroot00000000000000var parent = require('../../es/object/get-own-property-descriptors'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/get-own-property-names.js000066400000000000000000000001321360057567700262040ustar00rootroot00000000000000var parent = require('../../es/object/get-own-property-names'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/get-own-property-symbols.js000066400000000000000000000001341360057567700265730ustar00rootroot00000000000000var parent = require('../../es/object/get-own-property-symbols'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/get-prototype-of.js000066400000000000000000000001241360057567700250660ustar00rootroot00000000000000var parent = require('../../es/object/get-prototype-of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/index.js000066400000000000000000000003471360057567700227600ustar00rootroot00000000000000var parent = require('../../es/object'); require('../../modules/esnext.object.iterate-entries'); require('../../modules/esnext.object.iterate-keys'); require('../../modules/esnext.object.iterate-values'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/is-extensible.js000066400000000000000000000001211360057567700244120ustar00rootroot00000000000000var parent = require('../../es/object/is-extensible'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/is-frozen.js000066400000000000000000000001151360057567700235560ustar00rootroot00000000000000var parent = require('../../es/object/is-frozen'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/is-sealed.js000066400000000000000000000001151360057567700235100ustar00rootroot00000000000000var parent = require('../../es/object/is-sealed'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/is.js000066400000000000000000000001061360057567700222550ustar00rootroot00000000000000var parent = require('../../es/object/is'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/iterate-entries.js000066400000000000000000000002221360057567700247450ustar00rootroot00000000000000require('../../modules/esnext.object.iterate-entries'); var path = require('../../internals/path'); module.exports = path.Object.iterateEntries; core-js-3.6.1/packages/core-js/features/object/iterate-keys.js000066400000000000000000000002141360057567700242500ustar00rootroot00000000000000require('../../modules/esnext.object.iterate-keys'); var path = require('../../internals/path'); module.exports = path.Object.iterateKeys; core-js-3.6.1/packages/core-js/features/object/iterate-values.js000066400000000000000000000002201360057567700245710ustar00rootroot00000000000000require('../../modules/esnext.object.iterate-values'); var path = require('../../internals/path'); module.exports = path.Object.iterateValues; core-js-3.6.1/packages/core-js/features/object/keys.js000066400000000000000000000001101360057567700226100ustar00rootroot00000000000000var parent = require('../../es/object/keys'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/lookup-getter.js000066400000000000000000000001211360057567700244400ustar00rootroot00000000000000var parent = require('../../es/object/lookup-getter'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/lookup-setter.js000066400000000000000000000001211360057567700244540ustar00rootroot00000000000000var parent = require('../../es/object/lookup-setter'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/prevent-extensions.js000066400000000000000000000001261360057567700255240ustar00rootroot00000000000000var parent = require('../../es/object/prevent-extensions'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/seal.js000066400000000000000000000001101360057567700225610ustar00rootroot00000000000000var parent = require('../../es/object/seal'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/set-prototype-of.js000066400000000000000000000001241360057567700251020ustar00rootroot00000000000000var parent = require('../../es/object/set-prototype-of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/to-string.js000066400000000000000000000001151360057567700235700ustar00rootroot00000000000000var parent = require('../../es/object/to-string'); module.exports = parent; core-js-3.6.1/packages/core-js/features/object/values.js000066400000000000000000000001121360057567700231360ustar00rootroot00000000000000var parent = require('../../es/object/values'); module.exports = parent; core-js-3.6.1/packages/core-js/features/observable/000077500000000000000000000000001360057567700221655ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/observable/index.js000066400000000000000000000005001360057567700236250ustar00rootroot00000000000000require('../../modules/esnext.observable'); require('../../modules/esnext.symbol.observable'); require('../../modules/es.object.to-string'); require('../../modules/es.string.iterator'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); module.exports = path.Observable; core-js-3.6.1/packages/core-js/features/parse-float.js000066400000000000000000000001051360057567700226100ustar00rootroot00000000000000var parent = require('../es/parse-float'); module.exports = parent; core-js-3.6.1/packages/core-js/features/parse-int.js000066400000000000000000000001031360057567700222730ustar00rootroot00000000000000var parent = require('../es/parse-int'); module.exports = parent; core-js-3.6.1/packages/core-js/features/promise/000077500000000000000000000000001360057567700215175ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/promise/all-settled.js000066400000000000000000000002471360057567700242720ustar00rootroot00000000000000// TODO: Remove from `core-js@4` require('../../modules/esnext.promise.all-settled'); var parent = require('../../es/promise/all-settled'); module.exports = parent; core-js-3.6.1/packages/core-js/features/promise/any.js000066400000000000000000000005531360057567700226470ustar00rootroot00000000000000'use strict'; require('../../modules/es.promise'); require('../../modules/esnext.aggregate-error'); require('../../modules/esnext.promise.any'); var path = require('../../internals/path'); var Promise = path.Promise; var $any = Promise.any; module.exports = function any(iterable) { return $any.call(typeof this === 'function' ? this : Promise, iterable); }; core-js-3.6.1/packages/core-js/features/promise/finally.js000066400000000000000000000001141360057567700235070ustar00rootroot00000000000000var parent = require('../../es/promise/finally'); module.exports = parent; core-js-3.6.1/packages/core-js/features/promise/index.js000066400000000000000000000004451360057567700231670ustar00rootroot00000000000000var parent = require('../../es/promise'); require('../../modules/esnext.aggregate-error'); // TODO: Remove from `core-js@4` require('../../modules/esnext.promise.all-settled'); require('../../modules/esnext.promise.try'); require('../../modules/esnext.promise.any'); module.exports = parent; core-js-3.6.1/packages/core-js/features/promise/try.js000066400000000000000000000005341360057567700226750ustar00rootroot00000000000000'use strict'; require('../../modules/es.promise'); require('../../modules/esnext.promise.try'); var path = require('../../internals/path'); var Promise = path.Promise; var promiseTry = Promise['try']; module.exports = { 'try': function (callbackfn) { return promiseTry.call(typeof this === 'function' ? this : Promise, callbackfn); } }['try']; core-js-3.6.1/packages/core-js/features/queue-microtask.js000066400000000000000000000001151360057567700235120ustar00rootroot00000000000000var parent = require('../stable/queue-microtask'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/000077500000000000000000000000001360057567700214655ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/reflect/apply.js000066400000000000000000000001121360057567700231420ustar00rootroot00000000000000var parent = require('../../es/reflect/apply'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/construct.js000066400000000000000000000001161360057567700240450ustar00rootroot00000000000000var parent = require('../../es/reflect/construct'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/define-metadata.js000066400000000000000000000002241360057567700250310ustar00rootroot00000000000000require('../../modules/esnext.reflect.define-metadata'); var path = require('../../internals/path'); module.exports = path.Reflect.defineMetadata; core-js-3.6.1/packages/core-js/features/reflect/define-property.js000066400000000000000000000001241360057567700251340ustar00rootroot00000000000000var parent = require('../../es/reflect/define-property'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/delete-metadata.js000066400000000000000000000002241360057567700250410ustar00rootroot00000000000000require('../../modules/esnext.reflect.delete-metadata'); var path = require('../../internals/path'); module.exports = path.Reflect.deleteMetadata; core-js-3.6.1/packages/core-js/features/reflect/delete-property.js000066400000000000000000000001241360057567700251440ustar00rootroot00000000000000var parent = require('../../es/reflect/delete-property'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/get-metadata-keys.js000066400000000000000000000002271360057567700253320ustar00rootroot00000000000000require('../../modules/esnext.reflect.get-metadata-keys'); var path = require('../../internals/path'); module.exports = path.Reflect.getMetadataKeys; core-js-3.6.1/packages/core-js/features/reflect/get-metadata.js000066400000000000000000000002161360057567700243570ustar00rootroot00000000000000require('../../modules/esnext.reflect.get-metadata'); var path = require('../../internals/path'); module.exports = path.Reflect.getMetadata; core-js-3.6.1/packages/core-js/features/reflect/get-own-metadata-keys.js000066400000000000000000000002361360057567700261330ustar00rootroot00000000000000require('../../modules/esnext.reflect.get-own-metadata-keys'); var path = require('../../internals/path'); module.exports = path.Reflect.getOwnMetadataKeys; core-js-3.6.1/packages/core-js/features/reflect/get-own-metadata.js000066400000000000000000000002251360057567700251600ustar00rootroot00000000000000require('../../modules/esnext.reflect.get-own-metadata'); var path = require('../../internals/path'); module.exports = path.Reflect.getOwnMetadata; core-js-3.6.1/packages/core-js/features/reflect/get-own-property-descriptor.js000066400000000000000000000001401360057567700274340ustar00rootroot00000000000000var parent = require('../../es/reflect/get-own-property-descriptor'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/get-prototype-of.js000066400000000000000000000001251360057567700252450ustar00rootroot00000000000000var parent = require('../../es/reflect/get-prototype-of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/get.js000066400000000000000000000001101360057567700225720ustar00rootroot00000000000000var parent = require('../../es/reflect/get'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/has-metadata.js000066400000000000000000000002161360057567700243530ustar00rootroot00000000000000require('../../modules/esnext.reflect.has-metadata'); var path = require('../../internals/path'); module.exports = path.Reflect.hasMetadata; core-js-3.6.1/packages/core-js/features/reflect/has-own-metadata.js000066400000000000000000000002251360057567700251540ustar00rootroot00000000000000require('../../modules/esnext.reflect.has-own-metadata'); var path = require('../../internals/path'); module.exports = path.Reflect.hasOwnMetadata; core-js-3.6.1/packages/core-js/features/reflect/has.js000066400000000000000000000001101360057567700225660ustar00rootroot00000000000000var parent = require('../../es/reflect/has'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/index.js000066400000000000000000000011021360057567700231240ustar00rootroot00000000000000var parent = require('../../es/reflect'); require('../../modules/esnext.reflect.define-metadata'); require('../../modules/esnext.reflect.delete-metadata'); require('../../modules/esnext.reflect.get-metadata'); require('../../modules/esnext.reflect.get-metadata-keys'); require('../../modules/esnext.reflect.get-own-metadata'); require('../../modules/esnext.reflect.get-own-metadata-keys'); require('../../modules/esnext.reflect.has-metadata'); require('../../modules/esnext.reflect.has-own-metadata'); require('../../modules/esnext.reflect.metadata'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/is-extensible.js000066400000000000000000000001221360057567700245710ustar00rootroot00000000000000var parent = require('../../es/reflect/is-extensible'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/metadata.js000066400000000000000000000002071360057567700236020ustar00rootroot00000000000000require('../../modules/esnext.reflect.metadata'); var path = require('../../internals/path'); module.exports = path.Reflect.metadata; core-js-3.6.1/packages/core-js/features/reflect/own-keys.js000066400000000000000000000001151360057567700235740ustar00rootroot00000000000000var parent = require('../../es/reflect/own-keys'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/prevent-extensions.js000066400000000000000000000001271360057567700257030ustar00rootroot00000000000000var parent = require('../../es/reflect/prevent-extensions'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/set-prototype-of.js000066400000000000000000000001251360057567700252610ustar00rootroot00000000000000var parent = require('../../es/reflect/set-prototype-of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/reflect/set.js000066400000000000000000000001101360057567700226060ustar00rootroot00000000000000var parent = require('../../es/reflect/set'); module.exports = parent; core-js-3.6.1/packages/core-js/features/regexp/000077500000000000000000000000001360057567700213335ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/regexp/constructor.js000066400000000000000000000001171360057567700242550ustar00rootroot00000000000000var parent = require('../../es/regexp/constructor'); module.exports = parent; core-js-3.6.1/packages/core-js/features/regexp/flags.js000066400000000000000000000001111360057567700227560ustar00rootroot00000000000000var parent = require('../../es/regexp/flags'); module.exports = parent; core-js-3.6.1/packages/core-js/features/regexp/index.js000066400000000000000000000001031360057567700227720ustar00rootroot00000000000000var parent = require('../../es/regexp'); module.exports = parent; core-js-3.6.1/packages/core-js/features/regexp/match.js000066400000000000000000000001111360057567700227560ustar00rootroot00000000000000var parent = require('../../es/regexp/match'); module.exports = parent; core-js-3.6.1/packages/core-js/features/regexp/replace.js000066400000000000000000000001131360057567700232770ustar00rootroot00000000000000var parent = require('../../es/regexp/replace'); module.exports = parent; core-js-3.6.1/packages/core-js/features/regexp/search.js000066400000000000000000000001121360057567700231300ustar00rootroot00000000000000var parent = require('../../es/regexp/search'); module.exports = parent; core-js-3.6.1/packages/core-js/features/regexp/split.js000066400000000000000000000001111360057567700230150ustar00rootroot00000000000000var parent = require('../../es/regexp/split'); module.exports = parent; core-js-3.6.1/packages/core-js/features/regexp/sticky.js000066400000000000000000000001121360057567700231710ustar00rootroot00000000000000var parent = require('../../es/regexp/sticky'); module.exports = parent; core-js-3.6.1/packages/core-js/features/regexp/test.js000066400000000000000000000001101360057567700226400ustar00rootroot00000000000000var parent = require('../../es/regexp/test'); module.exports = parent; core-js-3.6.1/packages/core-js/features/regexp/to-string.js000066400000000000000000000001151360057567700236140ustar00rootroot00000000000000var parent = require('../../es/regexp/to-string'); module.exports = parent; core-js-3.6.1/packages/core-js/features/set-immediate.js000066400000000000000000000001131360057567700231210ustar00rootroot00000000000000var parent = require('../stable/set-immediate'); module.exports = parent; core-js-3.6.1/packages/core-js/features/set-interval.js000066400000000000000000000001121360057567700230060ustar00rootroot00000000000000var parent = require('../stable/set-interval'); module.exports = parent; core-js-3.6.1/packages/core-js/features/set-timeout.js000066400000000000000000000001111360057567700226470ustar00rootroot00000000000000var parent = require('../stable/set-timeout'); module.exports = parent; core-js-3.6.1/packages/core-js/features/set/000077500000000000000000000000001360057567700206345ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/set/add-all.js000066400000000000000000000002711360057567700224700ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.add-all'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'addAll'); core-js-3.6.1/packages/core-js/features/set/delete-all.js000066400000000000000000000002771360057567700232100ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.delete-all'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'deleteAll'); core-js-3.6.1/packages/core-js/features/set/difference.js000066400000000000000000000004441360057567700232660ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/es.string.iterator'); require('../../modules/esnext.set.difference'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'difference'); core-js-3.6.1/packages/core-js/features/set/every.js000066400000000000000000000002661360057567700223300ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.every'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'every'); core-js-3.6.1/packages/core-js/features/set/filter.js000066400000000000000000000002701360057567700224560ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.filter'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'filter'); core-js-3.6.1/packages/core-js/features/set/find.js000066400000000000000000000002641360057567700221140ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.find'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'find'); core-js-3.6.1/packages/core-js/features/set/from.js000066400000000000000000000006531360057567700221410ustar00rootroot00000000000000'use strict'; require('../../modules/es.set'); require('../../modules/es.string.iterator'); require('../../modules/esnext.set.from'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); var Set = path.Set; var setFrom = Set.from; module.exports = function from(source, mapFn, thisArg) { return setFrom.call(typeof this === 'function' ? this : Set, source, mapFn, thisArg); }; core-js-3.6.1/packages/core-js/features/set/index.js000066400000000000000000000015741360057567700223100ustar00rootroot00000000000000var parent = require('../../es/set'); require('../../modules/esnext.set.from'); require('../../modules/esnext.set.of'); require('../../modules/esnext.set.add-all'); require('../../modules/esnext.set.delete-all'); require('../../modules/esnext.set.every'); require('../../modules/esnext.set.difference'); require('../../modules/esnext.set.filter'); require('../../modules/esnext.set.find'); require('../../modules/esnext.set.intersection'); require('../../modules/esnext.set.is-disjoint-from'); require('../../modules/esnext.set.is-subset-of'); require('../../modules/esnext.set.is-superset-of'); require('../../modules/esnext.set.join'); require('../../modules/esnext.set.map'); require('../../modules/esnext.set.reduce'); require('../../modules/esnext.set.some'); require('../../modules/esnext.set.symmetric-difference'); require('../../modules/esnext.set.union'); module.exports = parent; core-js-3.6.1/packages/core-js/features/set/intersection.js000066400000000000000000000003041360057567700236750ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.intersection'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'intersection'); core-js-3.6.1/packages/core-js/features/set/is-disjoint-from.js000066400000000000000000000003121360057567700243630ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.is-disjoint-from'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'isDisjointFrom'); core-js-3.6.1/packages/core-js/features/set/is-subset-of.js000066400000000000000000000004461360057567700235160ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/es.string.iterator'); require('../../modules/esnext.set.is-subset-of'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'isSubsetOf'); core-js-3.6.1/packages/core-js/features/set/is-superset-of.js000066400000000000000000000003061360057567700240560ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.is-superset-of'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'isSupersetOf'); core-js-3.6.1/packages/core-js/features/set/join.js000066400000000000000000000002641360057567700221330ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.join'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'join'); core-js-3.6.1/packages/core-js/features/set/map.js000066400000000000000000000002621360057567700217470ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.map'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'map'); core-js-3.6.1/packages/core-js/features/set/of.js000066400000000000000000000005771360057567700216070ustar00rootroot00000000000000'use strict'; require('../../modules/es.set'); require('../../modules/es.string.iterator'); require('../../modules/esnext.set.of'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); var Set = path.Set; var setOf = Set.of; module.exports = function of() { return setOf.apply(typeof this === 'function' ? this : Set, arguments); }; core-js-3.6.1/packages/core-js/features/set/reduce.js000066400000000000000000000002701360057567700224400ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.reduce'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'reduce'); core-js-3.6.1/packages/core-js/features/set/some.js000066400000000000000000000002641360057567700221370ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/esnext.set.some'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'some'); core-js-3.6.1/packages/core-js/features/set/symmetric-difference.js000066400000000000000000000004671360057567700253050ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/es.string.iterator'); require('../../modules/esnext.set.symmetric-difference'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'symmetricDifference'); core-js-3.6.1/packages/core-js/features/set/union.js000066400000000000000000000004321360057567700223210ustar00rootroot00000000000000require('../../modules/es.set'); require('../../modules/es.string.iterator'); require('../../modules/esnext.set.union'); require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Set', 'union'); core-js-3.6.1/packages/core-js/features/string/000077500000000000000000000000001360057567700213475ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/string/anchor.js000066400000000000000000000001121360057567700231510ustar00rootroot00000000000000var parent = require('../../es/string/anchor'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/at.js000066400000000000000000000002251360057567700223100ustar00rootroot00000000000000require('../../modules/esnext.string.at'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'at'); core-js-3.6.1/packages/core-js/features/string/big.js000066400000000000000000000001071360057567700224440ustar00rootroot00000000000000var parent = require('../../es/string/big'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/blink.js000066400000000000000000000001111360057567700227750ustar00rootroot00000000000000var parent = require('../../es/string/blink'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/bold.js000066400000000000000000000001101360057567700226150ustar00rootroot00000000000000var parent = require('../../es/string/bold'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/code-point-at.js000066400000000000000000000001211360057567700243420ustar00rootroot00000000000000var parent = require('../../es/string/code-point-at'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/code-points.js000066400000000000000000000002071360057567700241300ustar00rootroot00000000000000require('../../modules/esnext.string.code-points'); module.exports = require('../../internals/entry-unbind')('String', 'codePoints'); core-js-3.6.1/packages/core-js/features/string/ends-with.js000066400000000000000000000001151360057567700236040ustar00rootroot00000000000000var parent = require('../../es/string/ends-with'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/fixed.js000066400000000000000000000001111360057567700227750ustar00rootroot00000000000000var parent = require('../../es/string/fixed'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/fontcolor.js000066400000000000000000000001151360057567700237070ustar00rootroot00000000000000var parent = require('../../es/string/fontcolor'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/fontsize.js000066400000000000000000000001141360057567700235420ustar00rootroot00000000000000var parent = require('../../es/string/fontsize'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/from-code-point.js000066400000000000000000000001231360057567700247030ustar00rootroot00000000000000var parent = require('../../es/string/from-code-point'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/includes.js000066400000000000000000000001141360057567700235070ustar00rootroot00000000000000var parent = require('../../es/string/includes'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/index.js000066400000000000000000000004511360057567700230140ustar00rootroot00000000000000var parent = require('../../es/string'); require('../../modules/esnext.string.at'); require('../../modules/esnext.string.code-points'); // TODO: remove from `core-js@4` require('../../modules/esnext.string.match-all'); require('../../modules/esnext.string.replace-all'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/italics.js000066400000000000000000000001131360057567700233300ustar00rootroot00000000000000var parent = require('../../es/string/italics'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/iterator.js000066400000000000000000000001141360057567700235320ustar00rootroot00000000000000var parent = require('../../es/string/iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/link.js000066400000000000000000000001101360057567700226320ustar00rootroot00000000000000var parent = require('../../es/string/link'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/match-all.js000066400000000000000000000002411360057567700235440ustar00rootroot00000000000000// TODO: remove from `core-js@4` require('../../modules/esnext.string.match-all'); var parent = require('../../es/string/match-all'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/match.js000066400000000000000000000001111360057567700227720ustar00rootroot00000000000000var parent = require('../../es/string/match'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/pad-end.js000066400000000000000000000001131360057567700232100ustar00rootroot00000000000000var parent = require('../../es/string/pad-end'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/pad-start.js000066400000000000000000000001151360057567700236010ustar00rootroot00000000000000var parent = require('../../es/string/pad-start'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/raw.js000066400000000000000000000001071360057567700224740ustar00rootroot00000000000000var parent = require('../../es/string/raw'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/repeat.js000066400000000000000000000001121360057567700231570ustar00rootroot00000000000000var parent = require('../../es/string/repeat'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/replace-all.js000066400000000000000000000002461360057567700240700ustar00rootroot00000000000000require('../../modules/esnext.string.replace-all'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('String', 'replaceAll'); core-js-3.6.1/packages/core-js/features/string/replace.js000066400000000000000000000001131360057567700233130ustar00rootroot00000000000000var parent = require('../../es/string/replace'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/search.js000066400000000000000000000001121360057567700231440ustar00rootroot00000000000000var parent = require('../../es/string/search'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/small.js000066400000000000000000000001111360057567700230060ustar00rootroot00000000000000var parent = require('../../es/string/small'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/split.js000066400000000000000000000001111360057567700230310ustar00rootroot00000000000000var parent = require('../../es/string/split'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/starts-with.js000066400000000000000000000001171360057567700241750ustar00rootroot00000000000000var parent = require('../../es/string/starts-with'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/strike.js000066400000000000000000000001121360057567700232000ustar00rootroot00000000000000var parent = require('../../es/string/strike'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/sub.js000066400000000000000000000001071360057567700224740ustar00rootroot00000000000000var parent = require('../../es/string/sub'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/sup.js000066400000000000000000000001071360057567700225120ustar00rootroot00000000000000var parent = require('../../es/string/sup'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/trim-end.js000066400000000000000000000001141360057567700234200ustar00rootroot00000000000000var parent = require('../../es/string/trim-end'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/trim-left.js000066400000000000000000000001151360057567700236050ustar00rootroot00000000000000var parent = require('../../es/string/trim-left'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/trim-right.js000066400000000000000000000001161360057567700237710ustar00rootroot00000000000000var parent = require('../../es/string/trim-right'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/trim-start.js000066400000000000000000000001161360057567700240110ustar00rootroot00000000000000var parent = require('../../es/string/trim-start'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/trim.js000066400000000000000000000001101360057567700226500ustar00rootroot00000000000000var parent = require('../../es/string/trim'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/000077500000000000000000000000001360057567700230355ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/string/virtual/anchor.js000066400000000000000000000001251360057567700246430ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/anchor'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/at.js000066400000000000000000000002331360057567700237750ustar00rootroot00000000000000require('../../../modules/esnext.string.at'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').at; core-js-3.6.1/packages/core-js/features/string/virtual/big.js000066400000000000000000000001221360057567700241270ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/big'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/blink.js000066400000000000000000000001241360057567700244670ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/blink'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/bold.js000066400000000000000000000001231360057567700243070ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/bold'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/code-point-at.js000066400000000000000000000001341360057567700260340ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/code-point-at'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/code-points.js000066400000000000000000000002131360057567700256130ustar00rootroot00000000000000require('../../../modules/esnext.string.code-points'); module.exports = require('../../../internals/entry-virtual')('String').codePoints; core-js-3.6.1/packages/core-js/features/string/virtual/ends-with.js000066400000000000000000000001301360057567700252670ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/ends-with'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/fixed.js000066400000000000000000000001241360057567700244670ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/fixed'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/fontcolor.js000066400000000000000000000001301360057567700253720ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/fontcolor'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/fontsize.js000066400000000000000000000001271360057567700252340ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/fontsize'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/includes.js000066400000000000000000000001271360057567700252010ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/includes'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/index.js000066400000000000000000000005001360057567700244750ustar00rootroot00000000000000var parent = require('../../../es/string/virtual'); require('../../../modules/esnext.string.at'); require('../../../modules/esnext.string.code-points'); // TODO: remove from `core-js@4` require('../../../modules/esnext.string.match-all'); require('../../../modules/esnext.string.replace-all'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/italics.js000066400000000000000000000001261360057567700250220ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/italics'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/iterator.js000066400000000000000000000001271360057567700252240ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/link.js000066400000000000000000000001231360057567700243240ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/link'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/match-all.js000066400000000000000000000002571360057567700252410ustar00rootroot00000000000000// TODO: remove from `core-js@4` require('../../../modules/esnext.string.match-all'); var parent = require('../../../es/string/virtual/match-all'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/pad-end.js000066400000000000000000000001261360057567700247020ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/pad-end'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/pad-start.js000066400000000000000000000001301360057567700252640ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/pad-start'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/repeat.js000066400000000000000000000001251360057567700246510ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/repeat'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/replace-all.js000066400000000000000000000002541360057567700255550ustar00rootroot00000000000000require('../../../modules/esnext.string.replace-all'); var entryVirtual = require('../../../internals/entry-virtual'); module.exports = entryVirtual('String').replaceAll; core-js-3.6.1/packages/core-js/features/string/virtual/small.js000066400000000000000000000001241360057567700245000ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/small'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/starts-with.js000066400000000000000000000001321360057567700256600ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/starts-with'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/strike.js000066400000000000000000000001251360057567700246720ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/strike'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/sub.js000066400000000000000000000001221360057567700241570ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/sub'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/sup.js000066400000000000000000000001221360057567700241750ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/sup'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/trim-end.js000066400000000000000000000001271360057567700251120ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/trim-end'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/trim-left.js000066400000000000000000000001301360057567700252700ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/trim-left'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/trim-right.js000066400000000000000000000001311360057567700254540ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/trim-right'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/trim-start.js000066400000000000000000000001311360057567700254740ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/trim-start'); module.exports = parent; core-js-3.6.1/packages/core-js/features/string/virtual/trim.js000066400000000000000000000001231360057567700243420ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/trim'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/000077500000000000000000000000001360057567700213465ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/symbol/async-dispose.js000066400000000000000000000003211360057567700244610ustar00rootroot00000000000000require('../../modules/esnext.symbol.async-dispose'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('asyncDispose'); core-js-3.6.1/packages/core-js/features/symbol/async-iterator.js000066400000000000000000000001221360057567700246430ustar00rootroot00000000000000var parent = require('../../es/symbol/async-iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/description.js000066400000000000000000000000601360057567700242230ustar00rootroot00000000000000require('../../modules/es.symbol.description'); core-js-3.6.1/packages/core-js/features/symbol/dispose.js000066400000000000000000000003061360057567700233510ustar00rootroot00000000000000require('../../modules/esnext.symbol.dispose'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('dispose'); core-js-3.6.1/packages/core-js/features/symbol/for.js000066400000000000000000000001071360057567700224700ustar00rootroot00000000000000var parent = require('../../es/symbol/for'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/has-instance.js000066400000000000000000000001201360057567700242520ustar00rootroot00000000000000var parent = require('../../es/symbol/has-instance'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/index.js000066400000000000000000000005471360057567700230210ustar00rootroot00000000000000var parent = require('../../es/symbol'); require('../../modules/esnext.symbol.async-dispose'); require('../../modules/esnext.symbol.dispose'); require('../../modules/esnext.symbol.observable'); require('../../modules/esnext.symbol.pattern-match'); // TODO: Remove from `core-js@4` require('../../modules/esnext.symbol.replace-all'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/is-concat-spreadable.js000066400000000000000000000001301360057567700256560ustar00rootroot00000000000000var parent = require('../../es/symbol/is-concat-spreadable'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/iterator.js000066400000000000000000000001141360057567700235310ustar00rootroot00000000000000var parent = require('../../es/symbol/iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/key-for.js000066400000000000000000000001131360057567700232530ustar00rootroot00000000000000var parent = require('../../es/symbol/key-for'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/match-all.js000066400000000000000000000001151360057567700235430ustar00rootroot00000000000000var parent = require('../../es/symbol/match-all'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/match.js000066400000000000000000000001111360057567700227710ustar00rootroot00000000000000var parent = require('../../es/symbol/match'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/observable.js000066400000000000000000000003141360057567700240260ustar00rootroot00000000000000require('../../modules/esnext.symbol.observable'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('observable'); core-js-3.6.1/packages/core-js/features/symbol/pattern-match.js000066400000000000000000000003211360057567700244470ustar00rootroot00000000000000require('../../modules/esnext.symbol.pattern-match'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('patternMatch'); core-js-3.6.1/packages/core-js/features/symbol/replace-all.js000066400000000000000000000003561360057567700240710ustar00rootroot00000000000000// TODO: Remove from `core-js@4` require('../../modules/esnext.symbol.replace-all'); var WrappedWellKnownSymbolModule = require('../../internals/wrapped-well-known-symbol'); module.exports = WrappedWellKnownSymbolModule.f('replaceAll'); core-js-3.6.1/packages/core-js/features/symbol/replace.js000066400000000000000000000001131360057567700233120ustar00rootroot00000000000000var parent = require('../../es/symbol/replace'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/search.js000066400000000000000000000001121360057567700231430ustar00rootroot00000000000000var parent = require('../../es/symbol/search'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/species.js000066400000000000000000000001131360057567700233320ustar00rootroot00000000000000var parent = require('../../es/symbol/species'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/split.js000066400000000000000000000001111360057567700230300ustar00rootroot00000000000000var parent = require('../../es/symbol/split'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/to-primitive.js000066400000000000000000000001201360057567700243250ustar00rootroot00000000000000var parent = require('../../es/symbol/to-primitive'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/to-string-tag.js000066400000000000000000000001211360057567700243750ustar00rootroot00000000000000var parent = require('../../es/symbol/to-string-tag'); module.exports = parent; core-js-3.6.1/packages/core-js/features/symbol/unscopables.js000066400000000000000000000001171360057567700242210ustar00rootroot00000000000000var parent = require('../../es/symbol/unscopables'); module.exports = parent; core-js-3.6.1/packages/core-js/features/typed-array/000077500000000000000000000000001360057567700223025ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/typed-array/copy-within.js000066400000000000000000000000651360057567700251130ustar00rootroot00000000000000require('../../modules/es.typed-array.copy-within'); core-js-3.6.1/packages/core-js/features/typed-array/entries.js000066400000000000000000000000621360057567700243070ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/features/typed-array/every.js000066400000000000000000000000571360057567700237740ustar00rootroot00000000000000require('../../modules/es.typed-array.every'); core-js-3.6.1/packages/core-js/features/typed-array/fill.js000066400000000000000000000000561360057567700235670ustar00rootroot00000000000000require('../../modules/es.typed-array.fill'); core-js-3.6.1/packages/core-js/features/typed-array/filter.js000066400000000000000000000000601360057567700241210ustar00rootroot00000000000000require('../../modules/es.typed-array.filter'); core-js-3.6.1/packages/core-js/features/typed-array/find-index.js000066400000000000000000000000641360057567700246650ustar00rootroot00000000000000require('../../modules/es.typed-array.find-index'); core-js-3.6.1/packages/core-js/features/typed-array/find.js000066400000000000000000000000561360057567700235610ustar00rootroot00000000000000require('../../modules/es.typed-array.find'); core-js-3.6.1/packages/core-js/features/typed-array/float32-array.js000066400000000000000000000001261360057567700252250ustar00rootroot00000000000000var parent = require('../../es/typed-array/float32-array'); module.exports = parent; core-js-3.6.1/packages/core-js/features/typed-array/float64-array.js000066400000000000000000000001261360057567700252320ustar00rootroot00000000000000var parent = require('../../es/typed-array/float64-array'); module.exports = parent; core-js-3.6.1/packages/core-js/features/typed-array/for-each.js000066400000000000000000000000621360057567700243220ustar00rootroot00000000000000require('../../modules/es.typed-array.for-each'); core-js-3.6.1/packages/core-js/features/typed-array/from.js000066400000000000000000000000561360057567700236040ustar00rootroot00000000000000require('../../modules/es.typed-array.from'); core-js-3.6.1/packages/core-js/features/typed-array/includes.js000066400000000000000000000000621360057567700244440ustar00rootroot00000000000000require('../../modules/es.typed-array.includes'); core-js-3.6.1/packages/core-js/features/typed-array/index-of.js000066400000000000000000000000621360057567700243470ustar00rootroot00000000000000require('../../modules/es.typed-array.index-of'); core-js-3.6.1/packages/core-js/features/typed-array/index.js000066400000000000000000000001101360057567700237370ustar00rootroot00000000000000var parent = require('../../es/typed-array'); module.exports = parent; core-js-3.6.1/packages/core-js/features/typed-array/int16-array.js000066400000000000000000000001241360057567700247120ustar00rootroot00000000000000var parent = require('../../es/typed-array/int16-array'); module.exports = parent; core-js-3.6.1/packages/core-js/features/typed-array/int32-array.js000066400000000000000000000001241360057567700247100ustar00rootroot00000000000000var parent = require('../../es/typed-array/int32-array'); module.exports = parent; core-js-3.6.1/packages/core-js/features/typed-array/int8-array.js000066400000000000000000000001231360057567700246320ustar00rootroot00000000000000var parent = require('../../es/typed-array/int8-array'); module.exports = parent; core-js-3.6.1/packages/core-js/features/typed-array/iterator.js000066400000000000000000000000621360057567700244670ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/features/typed-array/join.js000066400000000000000000000000561360057567700236000ustar00rootroot00000000000000require('../../modules/es.typed-array.join'); core-js-3.6.1/packages/core-js/features/typed-array/keys.js000066400000000000000000000000621360057567700236110ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/features/typed-array/last-index-of.js000066400000000000000000000000671360057567700253150ustar00rootroot00000000000000require('../../modules/es.typed-array.last-index-of'); core-js-3.6.1/packages/core-js/features/typed-array/map.js000066400000000000000000000000551360057567700234150ustar00rootroot00000000000000require('../../modules/es.typed-array.map'); core-js-3.6.1/packages/core-js/features/typed-array/of.js000066400000000000000000000000541360057567700232430ustar00rootroot00000000000000require('../../modules/es.typed-array.of'); core-js-3.6.1/packages/core-js/features/typed-array/reduce-right.js000066400000000000000000000000661360057567700252240ustar00rootroot00000000000000require('../../modules/es.typed-array.reduce-right'); core-js-3.6.1/packages/core-js/features/typed-array/reduce.js000066400000000000000000000000601360057567700241030ustar00rootroot00000000000000require('../../modules/es.typed-array.reduce'); core-js-3.6.1/packages/core-js/features/typed-array/reverse.js000066400000000000000000000000611360057567700243100ustar00rootroot00000000000000require('../../modules/es.typed-array.reverse'); core-js-3.6.1/packages/core-js/features/typed-array/set.js000066400000000000000000000000551360057567700234330ustar00rootroot00000000000000require('../../modules/es.typed-array.set'); core-js-3.6.1/packages/core-js/features/typed-array/slice.js000066400000000000000000000000571360057567700237410ustar00rootroot00000000000000require('../../modules/es.typed-array.slice'); core-js-3.6.1/packages/core-js/features/typed-array/some.js000066400000000000000000000000561360057567700236040ustar00rootroot00000000000000require('../../modules/es.typed-array.some'); core-js-3.6.1/packages/core-js/features/typed-array/sort.js000066400000000000000000000000561360057567700236300ustar00rootroot00000000000000require('../../modules/es.typed-array.sort'); core-js-3.6.1/packages/core-js/features/typed-array/subarray.js000066400000000000000000000000621360057567700244660ustar00rootroot00000000000000require('../../modules/es.typed-array.subarray'); core-js-3.6.1/packages/core-js/features/typed-array/to-locale-string.js000066400000000000000000000000721360057567700260220ustar00rootroot00000000000000require('../../modules/es.typed-array.to-locale-string'); core-js-3.6.1/packages/core-js/features/typed-array/to-string.js000066400000000000000000000000631360057567700245650ustar00rootroot00000000000000require('../../modules/es.typed-array.to-string'); core-js-3.6.1/packages/core-js/features/typed-array/uint16-array.js000066400000000000000000000001251360057567700251000ustar00rootroot00000000000000var parent = require('../../es/typed-array/uint16-array'); module.exports = parent; core-js-3.6.1/packages/core-js/features/typed-array/uint32-array.js000066400000000000000000000001251360057567700250760ustar00rootroot00000000000000var parent = require('../../es/typed-array/uint32-array'); module.exports = parent; core-js-3.6.1/packages/core-js/features/typed-array/uint8-array.js000066400000000000000000000001241360057567700250200ustar00rootroot00000000000000var parent = require('../../es/typed-array/uint8-array'); module.exports = parent; core-js-3.6.1/packages/core-js/features/typed-array/uint8-clamped-array.js000066400000000000000000000001341360057567700264240ustar00rootroot00000000000000var parent = require('../../es/typed-array/uint8-clamped-array'); module.exports = parent; core-js-3.6.1/packages/core-js/features/typed-array/values.js000066400000000000000000000000621360057567700241350ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/features/url-search-params/000077500000000000000000000000001360057567700233675ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/url-search-params/index.js000066400000000000000000000001221360057567700250270ustar00rootroot00000000000000var parent = require('../../stable/url-search-params'); module.exports = parent; core-js-3.6.1/packages/core-js/features/url/000077500000000000000000000000001360057567700206435ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/url/index.js000066400000000000000000000001041360057567700223030ustar00rootroot00000000000000var parent = require('../../stable/url'); module.exports = parent; core-js-3.6.1/packages/core-js/features/url/to-json.js000066400000000000000000000001141360057567700225660ustar00rootroot00000000000000var parent = require('../../stable/url/to-json'); module.exports = parent; core-js-3.6.1/packages/core-js/features/weak-map/000077500000000000000000000000001360057567700215435ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/weak-map/delete-all.js000066400000000000000000000003151360057567700241100ustar00rootroot00000000000000require('../../modules/es.weak-map'); require('../../modules/esnext.weak-map.delete-all'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('WeakMap', 'deleteAll'); core-js-3.6.1/packages/core-js/features/weak-map/from.js000066400000000000000000000007151360057567700230470ustar00rootroot00000000000000'use strict'; require('../../modules/es.string.iterator'); require('../../modules/es.weak-map'); require('../../modules/esnext.weak-map.from'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); var WeakMap = path.WeakMap; var weakMapFrom = WeakMap.from; module.exports = function from(source, mapFn, thisArg) { return weakMapFrom.call(typeof this === 'function' ? this : WeakMap, source, mapFn, thisArg); }; core-js-3.6.1/packages/core-js/features/weak-map/index.js000066400000000000000000000004071360057567700232110ustar00rootroot00000000000000var parent = require('../../es/weak-map'); require('../../modules/esnext.weak-map.from'); require('../../modules/esnext.weak-map.of'); require('../../modules/esnext.weak-map.delete-all'); require('../../modules/esnext.weak-map.upsert'); module.exports = parent; core-js-3.6.1/packages/core-js/features/weak-map/of.js000066400000000000000000000006411360057567700225060ustar00rootroot00000000000000'use strict'; require('../../modules/es.string.iterator'); require('../../modules/es.weak-map'); require('../../modules/esnext.weak-map.of'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); var WeakMap = path.WeakMap; var weakMapOf = WeakMap.of; module.exports = function of() { return weakMapOf.apply(typeof this === 'function' ? this : WeakMap, arguments); }; core-js-3.6.1/packages/core-js/features/weak-map/upsert.js000066400000000000000000000003061360057567700234220ustar00rootroot00000000000000require('../../modules/es.weak-map'); require('../../modules/esnext.weak-map.upsert'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('WeakMap', 'upsert'); core-js-3.6.1/packages/core-js/features/weak-set/000077500000000000000000000000001360057567700215615ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/features/weak-set/add-all.js000066400000000000000000000003071360057567700234150ustar00rootroot00000000000000require('../../modules/es.weak-set'); require('../../modules/esnext.weak-set.add-all'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('WeakSet', 'addAll'); core-js-3.6.1/packages/core-js/features/weak-set/delete-all.js000066400000000000000000000003151360057567700241260ustar00rootroot00000000000000require('../../modules/es.weak-set'); require('../../modules/esnext.weak-set.delete-all'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('WeakSet', 'deleteAll'); core-js-3.6.1/packages/core-js/features/weak-set/from.js000066400000000000000000000007151360057567700230650ustar00rootroot00000000000000'use strict'; require('../../modules/es.string.iterator'); require('../../modules/es.weak-set'); require('../../modules/esnext.weak-set.from'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); var WeakSet = path.WeakSet; var weakSetfrom = WeakSet.from; module.exports = function from(source, mapFn, thisArg) { return weakSetfrom.call(typeof this === 'function' ? this : WeakSet, source, mapFn, thisArg); }; core-js-3.6.1/packages/core-js/features/weak-set/index.js000066400000000000000000000004101360057567700232210ustar00rootroot00000000000000var parent = require('../../es/weak-set'); require('../../modules/esnext.weak-set.add-all'); require('../../modules/esnext.weak-set.delete-all'); require('../../modules/esnext.weak-set.from'); require('../../modules/esnext.weak-set.of'); module.exports = parent; core-js-3.6.1/packages/core-js/features/weak-set/of.js000066400000000000000000000006411360057567700225240ustar00rootroot00000000000000'use strict'; require('../../modules/es.string.iterator'); require('../../modules/es.weak-set'); require('../../modules/esnext.weak-set.of'); require('../../modules/web.dom-collections.iterator'); var path = require('../../internals/path'); var WeakSet = path.WeakSet; var weakSetOf = WeakSet.of; module.exports = function of() { return weakSetOf.apply(typeof this === 'function' ? this : WeakSet, arguments); }; core-js-3.6.1/packages/core-js/index.js000066400000000000000000000001731360057567700176710ustar00rootroot00000000000000require('./es'); require('./proposals'); require('./web'); var path = require('./internals/path'); module.exports = path; core-js-3.6.1/packages/core-js/internals/000077500000000000000000000000001360057567700202225ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/internals/README.md000066400000000000000000000000771360057567700215050ustar00rootroot00000000000000This folder contains internal parts of `core-js` like helpers. core-js-3.6.1/packages/core-js/internals/a-function.js000066400000000000000000000002141360057567700226200ustar00rootroot00000000000000module.exports = function (it) { if (typeof it != 'function') { throw TypeError(String(it) + ' is not a function'); } return it; }; core-js-3.6.1/packages/core-js/internals/a-possible-prototype.js000066400000000000000000000003201360057567700246540ustar00rootroot00000000000000var isObject = require('../internals/is-object'); module.exports = function (it) { if (!isObject(it) && it !== null) { throw TypeError("Can't set " + String(it) + ' as a prototype'); } return it; }; core-js-3.6.1/packages/core-js/internals/add-to-unscopables.js000066400000000000000000000012411360057567700242420ustar00rootroot00000000000000var wellKnownSymbol = require('../internals/well-known-symbol'); var create = require('../internals/object-create'); var definePropertyModule = require('../internals/object-define-property'); var UNSCOPABLES = wellKnownSymbol('unscopables'); var ArrayPrototype = Array.prototype; // Array.prototype[@@unscopables] // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables if (ArrayPrototype[UNSCOPABLES] == undefined) { definePropertyModule.f(ArrayPrototype, UNSCOPABLES, { configurable: true, value: create(null) }); } // add a key to Array.prototype[@@unscopables] module.exports = function (key) { ArrayPrototype[UNSCOPABLES][key] = true; }; core-js-3.6.1/packages/core-js/internals/advance-string-index.js000066400000000000000000000004371360057567700245760ustar00rootroot00000000000000'use strict'; var charAt = require('../internals/string-multibyte').charAt; // `AdvanceStringIndex` abstract operation // https://tc39.github.io/ecma262/#sec-advancestringindex module.exports = function (S, index, unicode) { return index + (unicode ? charAt(S, index).length : 1); }; core-js-3.6.1/packages/core-js/internals/an-instance.js000066400000000000000000000002711360057567700227600ustar00rootroot00000000000000module.exports = function (it, Constructor, name) { if (!(it instanceof Constructor)) { throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation'); } return it; }; core-js-3.6.1/packages/core-js/internals/an-object.js000066400000000000000000000002641360057567700224240ustar00rootroot00000000000000var isObject = require('../internals/is-object'); module.exports = function (it) { if (!isObject(it)) { throw TypeError(String(it) + ' is not an object'); } return it; }; core-js-3.6.1/packages/core-js/internals/array-buffer-view-core.js000066400000000000000000000143441360057567700250510ustar00rootroot00000000000000'use strict'; var DESCRIPTORS = require('../internals/descriptors'); var global = require('../internals/global'); var isObject = require('../internals/is-object'); var has = require('../internals/has'); var classof = require('../internals/classof'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var redefine = require('../internals/redefine'); var defineProperty = require('../internals/object-define-property').f; var getPrototypeOf = require('../internals/object-get-prototype-of'); var setPrototypeOf = require('../internals/object-set-prototype-of'); var wellKnownSymbol = require('../internals/well-known-symbol'); var uid = require('../internals/uid'); var DataView = global.DataView; var DataViewPrototype = DataView && DataView.prototype; var Int8Array = global.Int8Array; var Int8ArrayPrototype = Int8Array && Int8Array.prototype; var Uint8ClampedArray = global.Uint8ClampedArray; var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype; var TypedArray = Int8Array && getPrototypeOf(Int8Array); var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype); var ObjectPrototype = Object.prototype; var isPrototypeOf = ObjectPrototype.isPrototypeOf; var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG'); var NATIVE_ARRAY_BUFFER = !!(global.ArrayBuffer && DataView); // Fixing native typed arrays in Opera Presto crashes the browser, see #595 var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera'; var TYPED_ARRAY_TAG_REQIRED = false; var NAME; var TypedArrayConstructorsList = { Int8Array: 1, Uint8Array: 1, Uint8ClampedArray: 1, Int16Array: 2, Uint16Array: 2, Int32Array: 4, Uint32Array: 4, Float32Array: 4, Float64Array: 8 }; var isView = function isView(it) { var klass = classof(it); return klass === 'DataView' || has(TypedArrayConstructorsList, klass); }; var isTypedArray = function (it) { return isObject(it) && has(TypedArrayConstructorsList, classof(it)); }; var aTypedArray = function (it) { if (isTypedArray(it)) return it; throw TypeError('Target is not a typed array'); }; var aTypedArrayConstructor = function (C) { if (setPrototypeOf) { if (isPrototypeOf.call(TypedArray, C)) return C; } else for (var ARRAY in TypedArrayConstructorsList) if (has(TypedArrayConstructorsList, NAME)) { var TypedArrayConstructor = global[ARRAY]; if (TypedArrayConstructor && (C === TypedArrayConstructor || isPrototypeOf.call(TypedArrayConstructor, C))) { return C; } } throw TypeError('Target is not a typed array constructor'); }; var exportTypedArrayMethod = function (KEY, property, forced) { if (!DESCRIPTORS) return; if (forced) for (var ARRAY in TypedArrayConstructorsList) { var TypedArrayConstructor = global[ARRAY]; if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) { delete TypedArrayConstructor.prototype[KEY]; } } if (!TypedArrayPrototype[KEY] || forced) { redefine(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property); } }; var exportTypedArrayStaticMethod = function (KEY, property, forced) { var ARRAY, TypedArrayConstructor; if (!DESCRIPTORS) return; if (setPrototypeOf) { if (forced) for (ARRAY in TypedArrayConstructorsList) { TypedArrayConstructor = global[ARRAY]; if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) { delete TypedArrayConstructor[KEY]; } } if (!TypedArray[KEY] || forced) { // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable try { return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8Array[KEY] || property); } catch (error) { /* empty */ } } else return; } for (ARRAY in TypedArrayConstructorsList) { TypedArrayConstructor = global[ARRAY]; if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) { redefine(TypedArrayConstructor, KEY, property); } } }; for (NAME in TypedArrayConstructorsList) { if (!global[NAME]) NATIVE_ARRAY_BUFFER_VIEWS = false; } // WebKit bug - typed arrays constructors prototype is Object.prototype if (!NATIVE_ARRAY_BUFFER_VIEWS || typeof TypedArray != 'function' || TypedArray === Function.prototype) { // eslint-disable-next-line no-shadow TypedArray = function TypedArray() { throw TypeError('Incorrect invocation'); }; if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { if (global[NAME]) setPrototypeOf(global[NAME], TypedArray); } } if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) { TypedArrayPrototype = TypedArray.prototype; if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { if (global[NAME]) setPrototypeOf(global[NAME].prototype, TypedArrayPrototype); } } // WebKit bug - one more object in Uint8ClampedArray prototype chain if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) { setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype); } if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) { TYPED_ARRAY_TAG_REQIRED = true; defineProperty(TypedArrayPrototype, TO_STRING_TAG, { get: function () { return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined; } }); for (NAME in TypedArrayConstructorsList) if (global[NAME]) { createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME); } } // WebKit bug - the same parent prototype for typed arrays and data view if (NATIVE_ARRAY_BUFFER && setPrototypeOf && getPrototypeOf(DataViewPrototype) !== ObjectPrototype) { setPrototypeOf(DataViewPrototype, ObjectPrototype); } module.exports = { NATIVE_ARRAY_BUFFER: NATIVE_ARRAY_BUFFER, NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS, TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG, aTypedArray: aTypedArray, aTypedArrayConstructor: aTypedArrayConstructor, exportTypedArrayMethod: exportTypedArrayMethod, exportTypedArrayStaticMethod: exportTypedArrayStaticMethod, isView: isView, isTypedArray: isTypedArray, TypedArray: TypedArray, TypedArrayPrototype: TypedArrayPrototype }; core-js-3.6.1/packages/core-js/internals/array-buffer.js000066400000000000000000000207431360057567700231530ustar00rootroot00000000000000'use strict'; var global = require('../internals/global'); var DESCRIPTORS = require('../internals/descriptors'); var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER; var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var redefineAll = require('../internals/redefine-all'); var fails = require('../internals/fails'); var anInstance = require('../internals/an-instance'); var toInteger = require('../internals/to-integer'); var toLength = require('../internals/to-length'); var toIndex = require('../internals/to-index'); var IEEE754 = require('../internals/ieee754'); var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; var defineProperty = require('../internals/object-define-property').f; var arrayFill = require('../internals/array-fill'); var setToStringTag = require('../internals/set-to-string-tag'); var InternalStateModule = require('../internals/internal-state'); var getInternalState = InternalStateModule.get; var setInternalState = InternalStateModule.set; var ARRAY_BUFFER = 'ArrayBuffer'; var DATA_VIEW = 'DataView'; var PROTOTYPE = 'prototype'; var WRONG_LENGTH = 'Wrong length'; var WRONG_INDEX = 'Wrong index'; var NativeArrayBuffer = global[ARRAY_BUFFER]; var $ArrayBuffer = NativeArrayBuffer; var $DataView = global[DATA_VIEW]; var RangeError = global.RangeError; var packIEEE754 = IEEE754.pack; var unpackIEEE754 = IEEE754.unpack; var packInt8 = function (number) { return [number & 0xFF]; }; var packInt16 = function (number) { return [number & 0xFF, number >> 8 & 0xFF]; }; var packInt32 = function (number) { return [number & 0xFF, number >> 8 & 0xFF, number >> 16 & 0xFF, number >> 24 & 0xFF]; }; var unpackInt32 = function (buffer) { return buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0]; }; var packFloat32 = function (number) { return packIEEE754(number, 23, 4); }; var packFloat64 = function (number) { return packIEEE754(number, 52, 8); }; var addGetter = function (Constructor, key) { defineProperty(Constructor[PROTOTYPE], key, { get: function () { return getInternalState(this)[key]; } }); }; var get = function (view, count, index, isLittleEndian) { var intIndex = toIndex(index); var store = getInternalState(view); if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX); var bytes = getInternalState(store.buffer).bytes; var start = intIndex + store.byteOffset; var pack = bytes.slice(start, start + count); return isLittleEndian ? pack : pack.reverse(); }; var set = function (view, count, index, conversion, value, isLittleEndian) { var intIndex = toIndex(index); var store = getInternalState(view); if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX); var bytes = getInternalState(store.buffer).bytes; var start = intIndex + store.byteOffset; var pack = conversion(+value); for (var i = 0; i < count; i++) bytes[start + i] = pack[isLittleEndian ? i : count - i - 1]; }; if (!NATIVE_ARRAY_BUFFER) { $ArrayBuffer = function ArrayBuffer(length) { anInstance(this, $ArrayBuffer, ARRAY_BUFFER); var byteLength = toIndex(length); setInternalState(this, { bytes: arrayFill.call(new Array(byteLength), 0), byteLength: byteLength }); if (!DESCRIPTORS) this.byteLength = byteLength; }; $DataView = function DataView(buffer, byteOffset, byteLength) { anInstance(this, $DataView, DATA_VIEW); anInstance(buffer, $ArrayBuffer, DATA_VIEW); var bufferLength = getInternalState(buffer).byteLength; var offset = toInteger(byteOffset); if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset'); byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength); if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH); setInternalState(this, { buffer: buffer, byteLength: byteLength, byteOffset: offset }); if (!DESCRIPTORS) { this.buffer = buffer; this.byteLength = byteLength; this.byteOffset = offset; } }; if (DESCRIPTORS) { addGetter($ArrayBuffer, 'byteLength'); addGetter($DataView, 'buffer'); addGetter($DataView, 'byteLength'); addGetter($DataView, 'byteOffset'); } redefineAll($DataView[PROTOTYPE], { getInt8: function getInt8(byteOffset) { return get(this, 1, byteOffset)[0] << 24 >> 24; }, getUint8: function getUint8(byteOffset) { return get(this, 1, byteOffset)[0]; }, getInt16: function getInt16(byteOffset /* , littleEndian */) { var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined); return (bytes[1] << 8 | bytes[0]) << 16 >> 16; }, getUint16: function getUint16(byteOffset /* , littleEndian */) { var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined); return bytes[1] << 8 | bytes[0]; }, getInt32: function getInt32(byteOffset /* , littleEndian */) { return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)); }, getUint32: function getUint32(byteOffset /* , littleEndian */) { return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)) >>> 0; }, getFloat32: function getFloat32(byteOffset /* , littleEndian */) { return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 23); }, getFloat64: function getFloat64(byteOffset /* , littleEndian */) { return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 52); }, setInt8: function setInt8(byteOffset, value) { set(this, 1, byteOffset, packInt8, value); }, setUint8: function setUint8(byteOffset, value) { set(this, 1, byteOffset, packInt8, value); }, setInt16: function setInt16(byteOffset, value /* , littleEndian */) { set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined); }, setUint16: function setUint16(byteOffset, value /* , littleEndian */) { set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined); }, setInt32: function setInt32(byteOffset, value /* , littleEndian */) { set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined); }, setUint32: function setUint32(byteOffset, value /* , littleEndian */) { set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined); }, setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) { set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : undefined); }, setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) { set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : undefined); } }); } else { if (!fails(function () { NativeArrayBuffer(1); }) || !fails(function () { new NativeArrayBuffer(-1); // eslint-disable-line no-new }) || fails(function () { new NativeArrayBuffer(); // eslint-disable-line no-new new NativeArrayBuffer(1.5); // eslint-disable-line no-new new NativeArrayBuffer(NaN); // eslint-disable-line no-new return NativeArrayBuffer.name != ARRAY_BUFFER; })) { $ArrayBuffer = function ArrayBuffer(length) { anInstance(this, $ArrayBuffer); return new NativeArrayBuffer(toIndex(length)); }; var ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE] = NativeArrayBuffer[PROTOTYPE]; for (var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key; keys.length > j;) { if (!((key = keys[j++]) in $ArrayBuffer)) { createNonEnumerableProperty($ArrayBuffer, key, NativeArrayBuffer[key]); } } ArrayBufferPrototype.constructor = $ArrayBuffer; } // iOS Safari 7.x bug var testView = new $DataView(new $ArrayBuffer(2)); var nativeSetInt8 = $DataView[PROTOTYPE].setInt8; testView.setInt8(0, 2147483648); testView.setInt8(1, 2147483649); if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll($DataView[PROTOTYPE], { setInt8: function setInt8(byteOffset, value) { nativeSetInt8.call(this, byteOffset, value << 24 >> 24); }, setUint8: function setUint8(byteOffset, value) { nativeSetInt8.call(this, byteOffset, value << 24 >> 24); } }, { unsafe: true }); } setToStringTag($ArrayBuffer, ARRAY_BUFFER); setToStringTag($DataView, DATA_VIEW); module.exports = { ArrayBuffer: $ArrayBuffer, DataView: $DataView }; core-js-3.6.1/packages/core-js/internals/array-copy-within.js000066400000000000000000000017111360057567700241460ustar00rootroot00000000000000'use strict'; var toObject = require('../internals/to-object'); var toAbsoluteIndex = require('../internals/to-absolute-index'); var toLength = require('../internals/to-length'); var min = Math.min; // `Array.prototype.copyWithin` method implementation // https://tc39.github.io/ecma262/#sec-array.prototype.copywithin module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { var O = toObject(this); var len = toLength(O.length); var to = toAbsoluteIndex(target, len); var from = toAbsoluteIndex(start, len); var end = arguments.length > 2 ? arguments[2] : undefined; var count = min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to); var inc = 1; if (from < to && to < from + count) { inc = -1; from += count - 1; to += count - 1; } while (count-- > 0) { if (from in O) O[to] = O[from]; else delete O[to]; to += inc; from += inc; } return O; }; core-js-3.6.1/packages/core-js/internals/array-fill.js000066400000000000000000000013511360057567700226220ustar00rootroot00000000000000'use strict'; var toObject = require('../internals/to-object'); var toAbsoluteIndex = require('../internals/to-absolute-index'); var toLength = require('../internals/to-length'); // `Array.prototype.fill` method implementation // https://tc39.github.io/ecma262/#sec-array.prototype.fill module.exports = function fill(value /* , start = 0, end = @length */) { var O = toObject(this); var length = toLength(O.length); var argumentsLength = arguments.length; var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length); var end = argumentsLength > 2 ? arguments[2] : undefined; var endPos = end === undefined ? length : toAbsoluteIndex(end, length); while (endPos > index) O[index++] = value; return O; }; core-js-3.6.1/packages/core-js/internals/array-for-each.js000066400000000000000000000007131360057567700233610ustar00rootroot00000000000000'use strict'; var $forEach = require('../internals/array-iteration').forEach; var sloppyArrayMethod = require('../internals/sloppy-array-method'); // `Array.prototype.forEach` method implementation // https://tc39.github.io/ecma262/#sec-array.prototype.foreach module.exports = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) { return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } : [].forEach; core-js-3.6.1/packages/core-js/internals/array-from.js000066400000000000000000000034201360057567700226360ustar00rootroot00000000000000'use strict'; var bind = require('../internals/bind-context'); var toObject = require('../internals/to-object'); var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); var toLength = require('../internals/to-length'); var createProperty = require('../internals/create-property'); var getIteratorMethod = require('../internals/get-iterator-method'); // `Array.from` method implementation // https://tc39.github.io/ecma262/#sec-array.from module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { var O = toObject(arrayLike); var C = typeof this == 'function' ? this : Array; var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; var index = 0; var iteratorMethod = getIteratorMethod(O); var length, result, step, iterator, next; if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); // if the target is not iterable or it's an array with the default iterator - use a simple case if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) { iterator = iteratorMethod.call(O); next = iterator.next; result = new C(); for (;!(step = next.call(iterator)).done; index++) { createProperty(result, index, mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value ); } } else { length = toLength(O.length); result = new C(length); for (;length > index; index++) { createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); } } result.length = index; return result; }; core-js-3.6.1/packages/core-js/internals/array-includes.js000066400000000000000000000024031360057567700235010ustar00rootroot00000000000000var toIndexedObject = require('../internals/to-indexed-object'); var toLength = require('../internals/to-length'); var toAbsoluteIndex = require('../internals/to-absolute-index'); // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject($this); var length = toLength(O.length); var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) { if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; module.exports = { // `Array.prototype.includes` method // https://tc39.github.io/ecma262/#sec-array.prototype.includes includes: createMethod(true), // `Array.prototype.indexOf` method // https://tc39.github.io/ecma262/#sec-array.prototype.indexof indexOf: createMethod(false) }; core-js-3.6.1/packages/core-js/internals/array-iteration.js000066400000000000000000000047671360057567700237100ustar00rootroot00000000000000var bind = require('../internals/bind-context'); var IndexedObject = require('../internals/indexed-object'); var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); var arraySpeciesCreate = require('../internals/array-species-create'); var push = [].push; // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation var createMethod = function (TYPE) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; var IS_EVERY = TYPE == 4; var IS_FIND_INDEX = TYPE == 6; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; return function ($this, callbackfn, that, specificCreate) { var O = toObject($this); var self = IndexedObject(O); var boundFunction = bind(callbackfn, that, 3); var length = toLength(self.length); var index = 0; var create = specificCreate || arraySpeciesCreate; var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; var value, result; for (;length > index; index++) if (NO_HOLES || index in self) { value = self[index]; result = boundFunction(value, index, O); if (TYPE) { if (IS_MAP) target[index] = result; // map else if (result) switch (TYPE) { case 3: return true; // some case 5: return value; // find case 6: return index; // findIndex case 2: push.call(target, value); // filter } else if (IS_EVERY) return false; // every } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; }; }; module.exports = { // `Array.prototype.forEach` method // https://tc39.github.io/ecma262/#sec-array.prototype.foreach forEach: createMethod(0), // `Array.prototype.map` method // https://tc39.github.io/ecma262/#sec-array.prototype.map map: createMethod(1), // `Array.prototype.filter` method // https://tc39.github.io/ecma262/#sec-array.prototype.filter filter: createMethod(2), // `Array.prototype.some` method // https://tc39.github.io/ecma262/#sec-array.prototype.some some: createMethod(3), // `Array.prototype.every` method // https://tc39.github.io/ecma262/#sec-array.prototype.every every: createMethod(4), // `Array.prototype.find` method // https://tc39.github.io/ecma262/#sec-array.prototype.find find: createMethod(5), // `Array.prototype.findIndex` method // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex findIndex: createMethod(6) }; core-js-3.6.1/packages/core-js/internals/array-last-index-of.js000066400000000000000000000021331360057567700243450ustar00rootroot00000000000000'use strict'; var toIndexedObject = require('../internals/to-indexed-object'); var toInteger = require('../internals/to-integer'); var toLength = require('../internals/to-length'); var sloppyArrayMethod = require('../internals/sloppy-array-method'); var min = Math.min; var nativeLastIndexOf = [].lastIndexOf; var NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0; var SLOPPY_METHOD = sloppyArrayMethod('lastIndexOf'); // `Array.prototype.lastIndexOf` method implementation // https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof module.exports = (NEGATIVE_ZERO || SLOPPY_METHOD) ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { // convert -0 to +0 if (NEGATIVE_ZERO) return nativeLastIndexOf.apply(this, arguments) || 0; var O = toIndexedObject(this); var length = toLength(O.length); var index = length - 1; if (arguments.length > 1) index = min(index, toInteger(arguments[1])); if (index < 0) index = length + index; for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0; return -1; } : nativeLastIndexOf; core-js-3.6.1/packages/core-js/internals/array-method-has-species-support.js000066400000000000000000000012321360057567700270660ustar00rootroot00000000000000var fails = require('../internals/fails'); var wellKnownSymbol = require('../internals/well-known-symbol'); var V8_VERSION = require('../internals/v8-version'); var SPECIES = wellKnownSymbol('species'); module.exports = function (METHOD_NAME) { // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/677 return V8_VERSION >= 51 || !fails(function () { var array = []; var constructor = array.constructor = {}; constructor[SPECIES] = function () { return { foo: 1 }; }; return array[METHOD_NAME](Boolean).foo !== 1; }); }; core-js-3.6.1/packages/core-js/internals/array-reduce.js000066400000000000000000000024751360057567700231530ustar00rootroot00000000000000var aFunction = require('../internals/a-function'); var toObject = require('../internals/to-object'); var IndexedObject = require('../internals/indexed-object'); var toLength = require('../internals/to-length'); // `Array.prototype.{ reduce, reduceRight }` methods implementation var createMethod = function (IS_RIGHT) { return function (that, callbackfn, argumentsLength, memo) { aFunction(callbackfn); var O = toObject(that); var self = IndexedObject(O); var length = toLength(O.length); var index = IS_RIGHT ? length - 1 : 0; var i = IS_RIGHT ? -1 : 1; if (argumentsLength < 2) while (true) { if (index in self) { memo = self[index]; index += i; break; } index += i; if (IS_RIGHT ? index < 0 : length <= index) { throw TypeError('Reduce of empty array with no initial value'); } } for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) { memo = callbackfn(memo, self[index], index, O); } return memo; }; }; module.exports = { // `Array.prototype.reduce` method // https://tc39.github.io/ecma262/#sec-array.prototype.reduce left: createMethod(false), // `Array.prototype.reduceRight` method // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright right: createMethod(true) }; core-js-3.6.1/packages/core-js/internals/array-species-create.js000066400000000000000000000013211360057567700245650ustar00rootroot00000000000000var isObject = require('../internals/is-object'); var isArray = require('../internals/is-array'); var wellKnownSymbol = require('../internals/well-known-symbol'); var SPECIES = wellKnownSymbol('species'); // `ArraySpeciesCreate` abstract operation // https://tc39.github.io/ecma262/#sec-arrayspeciescreate module.exports = function (originalArray, length) { var C; if (isArray(originalArray)) { C = originalArray.constructor; // cross-realm fallback if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; else if (isObject(C)) { C = C[SPECIES]; if (C === null) C = undefined; } } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); }; core-js-3.6.1/packages/core-js/internals/async-iterator-iteration.js000066400000000000000000000035031360057567700255210ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var getBuiltIn = require('../internals/get-built-in'); var Promise = getBuiltIn('Promise'); var push = [].push; var createMethod = function (TYPE) { var IS_TO_ARRAY = TYPE == 0; var IS_FOR_EACH = TYPE == 1; var IS_EVERY = TYPE == 2; var IS_SOME = TYPE == 3; return function (iterator, fn) { anObject(iterator); var next = aFunction(iterator.next); var array = IS_TO_ARRAY ? [] : undefined; if (!IS_TO_ARRAY) aFunction(fn); return new Promise(function (resolve, reject) { var loop = function () { try { Promise.resolve(anObject(next.call(iterator))).then(function (step) { try { if (anObject(step).done) { resolve(IS_TO_ARRAY ? array : IS_SOME ? false : IS_EVERY || undefined); } else { var value = step.value; if (IS_TO_ARRAY) { push.call(array, value); loop(); } else { Promise.resolve(fn(value)).then(function (result) { if (IS_FOR_EACH) { loop(); } else if (IS_EVERY) { result ? loop() : resolve(false); } else { result ? resolve(IS_SOME || value) : loop(); } }, reject); } } } catch (err) { reject(err); } }, reject); } catch (error) { reject(error); } }; loop(); }); }; }; module.exports = { toArray: createMethod(0), forEach: createMethod(1), every: createMethod(2), some: createMethod(3), find: createMethod(4) }; core-js-3.6.1/packages/core-js/internals/async-iterator-prototype.js000066400000000000000000000030021360057567700255620ustar00rootroot00000000000000var global = require('../internals/global'); var shared = require('../internals/shared-store'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var has = require('../internals/has'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var wellKnownSymbol = require('../internals/well-known-symbol'); var IS_PURE = require('../internals/is-pure'); var USE_FUNCTION_CONSTRUCTOR = 'USE_FUNCTION_CONSTRUCTOR'; var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator'); var AsyncIterator = global.AsyncIterator; var PassedAsyncIteratorPrototype = shared.AsyncIteratorPrototype; var AsyncIteratorPrototype, prototype; if (!IS_PURE) { if (PassedAsyncIteratorPrototype) { AsyncIteratorPrototype = PassedAsyncIteratorPrototype; } else if (typeof AsyncIterator == 'function') { AsyncIteratorPrototype = AsyncIterator.prototype; } else if (shared[USE_FUNCTION_CONSTRUCTOR] || global[USE_FUNCTION_CONSTRUCTOR]) { try { // eslint-disable-next-line no-new-func prototype = getPrototypeOf(getPrototypeOf(getPrototypeOf(Function('return async function*(){}()')()))); if (getPrototypeOf(prototype) === Object.prototype) AsyncIteratorPrototype = prototype; } catch (error) { /* empty */ } } } if (!AsyncIteratorPrototype) AsyncIteratorPrototype = {}; if (!has(AsyncIteratorPrototype, ASYNC_ITERATOR)) { createNonEnumerableProperty(AsyncIteratorPrototype, ASYNC_ITERATOR, function () { return this; }); } module.exports = AsyncIteratorPrototype; core-js-3.6.1/packages/core-js/internals/bind-context.js000066400000000000000000000011271360057567700231570ustar00rootroot00000000000000var aFunction = require('../internals/a-function'); // optional / simple context binding module.exports = function (fn, that, length) { aFunction(fn); if (that === undefined) return fn; switch (length) { case 0: return function () { return fn.call(that); }; case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; core-js-3.6.1/packages/core-js/internals/call-with-safe-iteration-closing.js000066400000000000000000000007101360057567700270060ustar00rootroot00000000000000var anObject = require('../internals/an-object'); // call something on iterator step with safe closing on error module.exports = function (iterator, fn, value, ENTRIES) { try { return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion) } catch (error) { var returnMethod = iterator['return']; if (returnMethod !== undefined) anObject(returnMethod.call(iterator)); throw error; } }; core-js-3.6.1/packages/core-js/internals/check-correctness-of-iteration.js000066400000000000000000000016501360057567700265650ustar00rootroot00000000000000var wellKnownSymbol = require('../internals/well-known-symbol'); var ITERATOR = wellKnownSymbol('iterator'); var SAFE_CLOSING = false; try { var called = 0; var iteratorWithReturn = { next: function () { return { done: !!called++ }; }, 'return': function () { SAFE_CLOSING = true; } }; iteratorWithReturn[ITERATOR] = function () { return this; }; // eslint-disable-next-line no-throw-literal Array.from(iteratorWithReturn, function () { throw 2; }); } catch (error) { /* empty */ } module.exports = function (exec, SKIP_CLOSING) { if (!SKIP_CLOSING && !SAFE_CLOSING) return false; var ITERATION_SUPPORT = false; try { var object = {}; object[ITERATOR] = function () { return { next: function () { return { done: ITERATION_SUPPORT = true }; } }; }; exec(object); } catch (error) { /* empty */ } return ITERATION_SUPPORT; }; core-js-3.6.1/packages/core-js/internals/classof-raw.js000066400000000000000000000001521360057567700227770ustar00rootroot00000000000000var toString = {}.toString; module.exports = function (it) { return toString.call(it).slice(8, -1); }; core-js-3.6.1/packages/core-js/internals/classof.js000066400000000000000000000017611360057567700222170ustar00rootroot00000000000000var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support'); var classofRaw = require('../internals/classof-raw'); var wellKnownSymbol = require('../internals/well-known-symbol'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (error) { /* empty */ } }; // getting tag from ES6+ `Object.prototype.toString` module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { var O, tag, result; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result; }; core-js-3.6.1/packages/core-js/internals/collection-add-all.js000066400000000000000000000006031360057567700242060ustar00rootroot00000000000000'use strict'; var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); // https://github.com/tc39/collection-methods module.exports = function (/* ...elements */) { var set = anObject(this); var adder = aFunction(set.add); for (var k = 0, len = arguments.length; k < len; k++) { adder.call(set, arguments[k]); } return set; }; core-js-3.6.1/packages/core-js/internals/collection-delete-all.js000066400000000000000000000010161360057567700247170ustar00rootroot00000000000000'use strict'; var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); // https://github.com/tc39/collection-methods module.exports = function (/* ...elements */) { var collection = anObject(this); var remover = aFunction(collection['delete']); var allDeleted = true; var wasDeleted; for (var k = 0, len = arguments.length; k < len; k++) { wasDeleted = remover.call(collection, arguments[k]); allDeleted = allDeleted && wasDeleted; } return !!allDeleted; }; core-js-3.6.1/packages/core-js/internals/collection-from.js000066400000000000000000000014511360057567700236550ustar00rootroot00000000000000'use strict'; // https://tc39.github.io/proposal-setmap-offrom/ var aFunction = require('../internals/a-function'); var bind = require('../internals/bind-context'); var iterate = require('../internals/iterate'); module.exports = function from(source /* , mapFn, thisArg */) { var length = arguments.length; var mapFn = length > 1 ? arguments[1] : undefined; var mapping, A, n, boundFunction; aFunction(this); mapping = mapFn !== undefined; if (mapping) aFunction(mapFn); if (source == undefined) return new this(); A = []; if (mapping) { n = 0; boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined, 2); iterate(source, function (nextItem) { A.push(boundFunction(nextItem, n++)); }); } else { iterate(source, A.push, A); } return new this(A); }; core-js-3.6.1/packages/core-js/internals/collection-of.js000066400000000000000000000003521360057567700233150ustar00rootroot00000000000000'use strict'; // https://tc39.github.io/proposal-setmap-offrom/ module.exports = function of() { var length = arguments.length; var A = new Array(length); while (length--) A[length] = arguments[length]; return new this(A); }; core-js-3.6.1/packages/core-js/internals/collection-strong.js000066400000000000000000000150771360057567700242370ustar00rootroot00000000000000'use strict'; var defineProperty = require('../internals/object-define-property').f; var create = require('../internals/object-create'); var redefineAll = require('../internals/redefine-all'); var bind = require('../internals/bind-context'); var anInstance = require('../internals/an-instance'); var iterate = require('../internals/iterate'); var defineIterator = require('../internals/define-iterator'); var setSpecies = require('../internals/set-species'); var DESCRIPTORS = require('../internals/descriptors'); var fastKey = require('../internals/internal-metadata').fastKey; var InternalStateModule = require('../internals/internal-state'); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; module.exports = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var C = wrapper(function (that, iterable) { anInstance(that, C, CONSTRUCTOR_NAME); setInternalState(that, { type: CONSTRUCTOR_NAME, index: create(null), first: undefined, last: undefined, size: 0 }); if (!DESCRIPTORS) that.size = 0; if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP); }); var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function (that, key, value) { var state = getInternalState(that); var entry = getEntry(that, key); var previous, index; // change existing entry if (entry) { entry.value = value; // create new entry } else { state.last = entry = { index: index = fastKey(key, true), key: key, value: value, previous: previous = state.last, next: undefined, removed: false }; if (!state.first) state.first = entry; if (previous) previous.next = entry; if (DESCRIPTORS) state.size++; else that.size++; // add to index if (index !== 'F') state.index[index] = entry; } return that; }; var getEntry = function (that, key) { var state = getInternalState(that); // fast case var index = fastKey(key); var entry; if (index !== 'F') return state.index[index]; // frozen object case for (entry = state.first; entry; entry = entry.next) { if (entry.key == key) return entry; } }; redefineAll(C.prototype, { // 23.1.3.1 Map.prototype.clear() // 23.2.3.2 Set.prototype.clear() clear: function clear() { var that = this; var state = getInternalState(that); var data = state.index; var entry = state.first; while (entry) { entry.removed = true; if (entry.previous) entry.previous = entry.previous.next = undefined; delete data[entry.index]; entry = entry.next; } state.first = state.last = undefined; if (DESCRIPTORS) state.size = 0; else that.size = 0; }, // 23.1.3.3 Map.prototype.delete(key) // 23.2.3.4 Set.prototype.delete(value) 'delete': function (key) { var that = this; var state = getInternalState(that); var entry = getEntry(that, key); if (entry) { var next = entry.next; var prev = entry.previous; delete state.index[entry.index]; entry.removed = true; if (prev) prev.next = next; if (next) next.previous = prev; if (state.first == entry) state.first = next; if (state.last == entry) state.last = prev; if (DESCRIPTORS) state.size--; else that.size--; } return !!entry; }, // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) forEach: function forEach(callbackfn /* , that = undefined */) { var state = getInternalState(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); var entry; while (entry = entry ? entry.next : state.first) { boundFunction(entry.value, entry.key, this); // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; } }, // 23.1.3.7 Map.prototype.has(key) // 23.2.3.7 Set.prototype.has(value) has: function has(key) { return !!getEntry(this, key); } }); redefineAll(C.prototype, IS_MAP ? { // 23.1.3.6 Map.prototype.get(key) get: function get(key) { var entry = getEntry(this, key); return entry && entry.value; }, // 23.1.3.9 Map.prototype.set(key, value) set: function set(key, value) { return define(this, key === 0 ? 0 : key, value); } } : { // 23.2.3.1 Set.prototype.add(value) add: function add(value) { return define(this, value = value === 0 ? 0 : value, value); } }); if (DESCRIPTORS) defineProperty(C.prototype, 'size', { get: function () { return getInternalState(this).size; } }); return C; }, setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) { var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME); var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME); // add .keys, .values, .entries, [@@iterator] // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) { setInternalState(this, { type: ITERATOR_NAME, target: iterated, state: getInternalCollectionState(iterated), kind: kind, last: undefined }); }, function () { var state = getInternalIteratorState(this); var kind = state.kind; var entry = state.last; // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; // get next entry if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { // or finish the iteration state.target = undefined; return { value: undefined, done: true }; } // return step by kind if (kind == 'keys') return { value: entry.key, done: false }; if (kind == 'values') return { value: entry.value, done: false }; return { value: [entry.key, entry.value], done: false }; }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); // add [@@species], 23.1.2.2, 23.2.2.2 setSpecies(CONSTRUCTOR_NAME); } }; core-js-3.6.1/packages/core-js/internals/collection-weak.js000066400000000000000000000074451360057567700236520ustar00rootroot00000000000000'use strict'; var redefineAll = require('../internals/redefine-all'); var getWeakData = require('../internals/internal-metadata').getWeakData; var anObject = require('../internals/an-object'); var isObject = require('../internals/is-object'); var anInstance = require('../internals/an-instance'); var iterate = require('../internals/iterate'); var ArrayIterationModule = require('../internals/array-iteration'); var $has = require('../internals/has'); var InternalStateModule = require('../internals/internal-state'); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; var find = ArrayIterationModule.find; var findIndex = ArrayIterationModule.findIndex; var id = 0; // fallback for uncaught frozen keys var uncaughtFrozenStore = function (store) { return store.frozen || (store.frozen = new UncaughtFrozenStore()); }; var UncaughtFrozenStore = function () { this.entries = []; }; var findUncaughtFrozen = function (store, key) { return find(store.entries, function (it) { return it[0] === key; }); }; UncaughtFrozenStore.prototype = { get: function (key) { var entry = findUncaughtFrozen(this, key); if (entry) return entry[1]; }, has: function (key) { return !!findUncaughtFrozen(this, key); }, set: function (key, value) { var entry = findUncaughtFrozen(this, key); if (entry) entry[1] = value; else this.entries.push([key, value]); }, 'delete': function (key) { var index = findIndex(this.entries, function (it) { return it[0] === key; }); if (~index) this.entries.splice(index, 1); return !!~index; } }; module.exports = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var C = wrapper(function (that, iterable) { anInstance(that, C, CONSTRUCTOR_NAME); setInternalState(that, { type: CONSTRUCTOR_NAME, id: id++, frozen: undefined }); if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP); }); var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function (that, key, value) { var state = getInternalState(that); var data = getWeakData(anObject(key), true); if (data === true) uncaughtFrozenStore(state).set(key, value); else data[state.id] = value; return that; }; redefineAll(C.prototype, { // 23.3.3.2 WeakMap.prototype.delete(key) // 23.4.3.3 WeakSet.prototype.delete(value) 'delete': function (key) { var state = getInternalState(this); if (!isObject(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state)['delete'](key); return data && $has(data, state.id) && delete data[state.id]; }, // 23.3.3.4 WeakMap.prototype.has(key) // 23.4.3.4 WeakSet.prototype.has(value) has: function has(key) { var state = getInternalState(this); if (!isObject(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).has(key); return data && $has(data, state.id); } }); redefineAll(C.prototype, IS_MAP ? { // 23.3.3.3 WeakMap.prototype.get(key) get: function get(key) { var state = getInternalState(this); if (isObject(key)) { var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).get(key); return data ? data[state.id] : undefined; } }, // 23.3.3.5 WeakMap.prototype.set(key, value) set: function set(key, value) { return define(this, key, value); } } : { // 23.4.3.1 WeakSet.prototype.add(value) add: function add(value) { return define(this, value, true); } }); return C; } }; core-js-3.6.1/packages/core-js/internals/collection.js000066400000000000000000000102751360057567700227200ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var global = require('../internals/global'); var isForced = require('../internals/is-forced'); var redefine = require('../internals/redefine'); var InternalMetadataModule = require('../internals/internal-metadata'); var iterate = require('../internals/iterate'); var anInstance = require('../internals/an-instance'); var isObject = require('../internals/is-object'); var fails = require('../internals/fails'); var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); var setToStringTag = require('../internals/set-to-string-tag'); var inheritIfRequired = require('../internals/inherit-if-required'); module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; var ADDER = IS_MAP ? 'set' : 'add'; var NativeConstructor = global[CONSTRUCTOR_NAME]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; var Constructor = NativeConstructor; var exported = {}; var fixMethod = function (KEY) { var nativeMethod = NativePrototype[KEY]; redefine(NativePrototype, KEY, KEY == 'add' ? function add(value) { nativeMethod.call(this, value === 0 ? 0 : value); return this; } : KEY == 'delete' ? function (key) { return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); } : KEY == 'get' ? function get(key) { return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key); } : KEY == 'has' ? function has(key) { return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); } : function set(key, value) { nativeMethod.call(this, key === 0 ? 0 : key, value); return this; } ); }; // eslint-disable-next-line max-len if (isForced(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); })))) { // create collection constructor Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); InternalMetadataModule.REQUIRED = true; } else if (isForced(CONSTRUCTOR_NAME, true)) { var instance = new Constructor(); // early implementations not supports chaining var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); }); // most early implementations doesn't supports iterables, most modern - not close it correctly // eslint-disable-next-line no-new var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); }); // for early implementations -0 and +0 not the same var BUGGY_ZERO = !IS_WEAK && fails(function () { // V8 ~ Chromium 42- fails only with 5+ elements var $instance = new NativeConstructor(); var index = 5; while (index--) $instance[ADDER](index, index); return !$instance.has(-0); }); if (!ACCEPT_ITERABLES) { Constructor = wrapper(function (dummy, iterable) { anInstance(dummy, Constructor, CONSTRUCTOR_NAME); var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); if (iterable != undefined) iterate(iterable, that[ADDER], that, IS_MAP); return that; }); Constructor.prototype = NativePrototype; NativePrototype.constructor = Constructor; } if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { fixMethod('delete'); fixMethod('has'); IS_MAP && fixMethod('get'); } if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); // weak collections should not contains .clear method if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear; } exported[CONSTRUCTOR_NAME] = Constructor; $({ global: true, forced: Constructor != NativeConstructor }, exported); setToStringTag(Constructor, CONSTRUCTOR_NAME); if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); return Constructor; }; core-js-3.6.1/packages/core-js/internals/composite-key.js000066400000000000000000000025761360057567700233620ustar00rootroot00000000000000// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` var Map = require('../modules/es.map'); var WeakMap = require('../modules/es.weak-map'); var create = require('../internals/object-create'); var isObject = require('../internals/is-object'); var Node = function () { // keys this.object = null; this.symbol = null; // child nodes this.primitives = null; this.objectsByIndex = create(null); }; Node.prototype.get = function (key, initializer) { return this[key] || (this[key] = initializer()); }; Node.prototype.next = function (i, it, IS_OBJECT) { var store = IS_OBJECT ? this.objectsByIndex[i] || (this.objectsByIndex[i] = new WeakMap()) : this.primitives || (this.primitives = new Map()); var entry = store.get(it); if (!entry) store.set(it, entry = new Node()); return entry; }; var root = new Node(); module.exports = function () { var active = root; var length = arguments.length; var i, it; // for prevent leaking, start from objects for (i = 0; i < length; i++) { if (isObject(it = arguments[i])) active = active.next(i, it, true); } if (this === Object && active === root) throw TypeError('Composite keys must contain a non-primitive component'); for (i = 0; i < length; i++) { if (!isObject(it = arguments[i])) active = active.next(i, it, false); } return active; }; core-js-3.6.1/packages/core-js/internals/copy-constructor-properties.js000066400000000000000000000011501360057567700263040ustar00rootroot00000000000000var has = require('../internals/has'); var ownKeys = require('../internals/own-keys'); var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); var definePropertyModule = require('../internals/object-define-property'); module.exports = function (target, source) { var keys = ownKeys(source); var defineProperty = definePropertyModule.f; var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } }; core-js-3.6.1/packages/core-js/internals/correct-is-regexp-logic.js000066400000000000000000000005441360057567700252200ustar00rootroot00000000000000var wellKnownSymbol = require('../internals/well-known-symbol'); var MATCH = wellKnownSymbol('match'); module.exports = function (METHOD_NAME) { var regexp = /./; try { '/./'[METHOD_NAME](regexp); } catch (e) { try { regexp[MATCH] = false; return '/./'[METHOD_NAME](regexp); } catch (f) { /* empty */ } } return false; }; core-js-3.6.1/packages/core-js/internals/correct-prototype-getter.js000066400000000000000000000003201360057567700255470ustar00rootroot00000000000000var fails = require('../internals/fails'); module.exports = !fails(function () { function F() { /* empty */ } F.prototype.constructor = null; return Object.getPrototypeOf(new F()) !== F.prototype; }); core-js-3.6.1/packages/core-js/internals/create-async-iterator-proxy.js000066400000000000000000000037671360057567700261610ustar00rootroot00000000000000'use strict'; var path = require('../internals/path'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var create = require('../internals/object-create'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var redefineAll = require('../internals/redefine-all'); var wellKnownSymbol = require('../internals/well-known-symbol'); var InternalStateModule = require('../internals/internal-state'); var getBuiltIn = require('../internals/get-built-in'); var Promise = getBuiltIn('Promise'); var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.get; var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var $return = function (value) { var iterator = getInternalState(this).iterator; var $$return = iterator['return']; return $$return === undefined ? Promise.resolve({ done: true, value: value }) : anObject($$return.call(iterator, value)); }; var $throw = function (value) { var iterator = getInternalState(this).iterator; var $$throw = iterator['throw']; return $$throw === undefined ? Promise.reject(value) : $$throw.call(iterator, value); }; module.exports = function (nextHandler, IS_ITERATOR) { var AsyncIteratorProxy = function AsyncIterator(state) { state.next = aFunction(state.iterator.next); state.done = false; setInternalState(this, state); }; AsyncIteratorProxy.prototype = redefineAll(create(path.AsyncIterator.prototype), { next: function next(arg) { var state = getInternalState(this); if (state.done) return Promise.resolve({ done: true, value: undefined }); try { return Promise.resolve(anObject(nextHandler.call(state, arg, Promise))); } catch (error) { return Promise.reject(error); } }, 'return': $return, 'throw': $throw }); if (!IS_ITERATOR) { createNonEnumerableProperty(AsyncIteratorProxy.prototype, TO_STRING_TAG, 'Generator'); } return AsyncIteratorProxy; }; core-js-3.6.1/packages/core-js/internals/create-html.js000066400000000000000000000007401360057567700227660ustar00rootroot00000000000000var requireObjectCoercible = require('../internals/require-object-coercible'); var quot = /"/g; // B.2.3.2.1 CreateHTML(string, tag, attribute, value) // https://tc39.github.io/ecma262/#sec-createhtml module.exports = function (string, tag, attribute, value) { var S = String(requireObjectCoercible(string)); var p1 = '<' + tag; if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; return p1 + '>' + S + ''; }; core-js-3.6.1/packages/core-js/internals/create-iterator-constructor.js000066400000000000000000000013521360057567700262360ustar00rootroot00000000000000'use strict'; var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype; var create = require('../internals/object-create'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); var setToStringTag = require('../internals/set-to-string-tag'); var Iterators = require('../internals/iterators'); var returnThis = function () { return this; }; module.exports = function (IteratorConstructor, NAME, next) { var TO_STRING_TAG = NAME + ' Iterator'; IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) }); setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true); Iterators[TO_STRING_TAG] = returnThis; return IteratorConstructor; }; core-js-3.6.1/packages/core-js/internals/create-iterator-proxy.js000066400000000000000000000033421360057567700250330ustar00rootroot00000000000000'use strict'; var path = require('../internals/path'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var create = require('../internals/object-create'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var redefineAll = require('../internals/redefine-all'); var wellKnownSymbol = require('../internals/well-known-symbol'); var InternalStateModule = require('../internals/internal-state'); var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.get; var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var $return = function (value) { var iterator = getInternalState(this).iterator; var $$return = iterator['return']; return $$return === undefined ? { done: true, value: value } : anObject($$return.call(iterator, value)); }; var $throw = function (value) { var iterator = getInternalState(this).iterator; var $$throw = iterator['throw']; if ($$throw === undefined) throw value; return $$throw.call(iterator, value); }; module.exports = function (nextHandler, IS_ITERATOR) { var IteratorProxy = function Iterator(state) { state.next = aFunction(state.iterator.next); state.done = false; setInternalState(this, state); }; IteratorProxy.prototype = redefineAll(create(path.Iterator.prototype), { next: function next() { var state = getInternalState(this); var result = state.done ? undefined : nextHandler.apply(state, arguments); return { done: state.done, value: result }; }, 'return': $return, 'throw': $throw }); if (!IS_ITERATOR) { createNonEnumerableProperty(IteratorProxy.prototype, TO_STRING_TAG, 'Generator'); } return IteratorProxy; }; core-js-3.6.1/packages/core-js/internals/create-non-enumerable-property.js000066400000000000000000000006661360057567700266220ustar00rootroot00000000000000var DESCRIPTORS = require('../internals/descriptors'); var definePropertyModule = require('../internals/object-define-property'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); module.exports = DESCRIPTORS ? function (object, key, value) { return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); } : function (object, key, value) { object[key] = value; return object; }; core-js-3.6.1/packages/core-js/internals/create-property-descriptor.js000066400000000000000000000002551360057567700260630ustar00rootroot00000000000000module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; core-js-3.6.1/packages/core-js/internals/create-property.js000066400000000000000000000007211360057567700237050ustar00rootroot00000000000000'use strict'; var toPrimitive = require('../internals/to-primitive'); var definePropertyModule = require('../internals/object-define-property'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); module.exports = function (object, key, value) { var propertyKey = toPrimitive(key); if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value)); else object[propertyKey] = value; }; core-js-3.6.1/packages/core-js/internals/date-to-iso-string.js000066400000000000000000000023531360057567700242140ustar00rootroot00000000000000'use strict'; var fails = require('../internals/fails'); var padStart = require('../internals/string-pad').start; var abs = Math.abs; var DatePrototype = Date.prototype; var getTime = DatePrototype.getTime; var nativeDateToISOString = DatePrototype.toISOString; // `Date.prototype.toISOString` method implementation // https://tc39.github.io/ecma262/#sec-date.prototype.toisostring // PhantomJS / old WebKit fails here: module.exports = (fails(function () { return nativeDateToISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; }) || !fails(function () { nativeDateToISOString.call(new Date(NaN)); })) ? function toISOString() { if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value'); var date = this; var year = date.getUTCFullYear(); var milliseconds = date.getUTCMilliseconds(); var sign = year < 0 ? '-' : year > 9999 ? '+' : ''; return sign + padStart(abs(year), sign ? 6 : 4, 0) + '-' + padStart(date.getUTCMonth() + 1, 2, 0) + '-' + padStart(date.getUTCDate(), 2, 0) + 'T' + padStart(date.getUTCHours(), 2, 0) + ':' + padStart(date.getUTCMinutes(), 2, 0) + ':' + padStart(date.getUTCSeconds(), 2, 0) + '.' + padStart(milliseconds, 3, 0) + 'Z'; } : nativeDateToISOString; core-js-3.6.1/packages/core-js/internals/date-to-primitive.js000066400000000000000000000005071360057567700241250ustar00rootroot00000000000000'use strict'; var anObject = require('../internals/an-object'); var toPrimitive = require('../internals/to-primitive'); module.exports = function (hint) { if (hint !== 'string' && hint !== 'number' && hint !== 'default') { throw TypeError('Incorrect hint'); } return toPrimitive(anObject(this), hint !== 'number'); }; core-js-3.6.1/packages/core-js/internals/define-iterator.js000066400000000000000000000077121360057567700236500ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createIteratorConstructor = require('../internals/create-iterator-constructor'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var setPrototypeOf = require('../internals/object-set-prototype-of'); var setToStringTag = require('../internals/set-to-string-tag'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var redefine = require('../internals/redefine'); var wellKnownSymbol = require('../internals/well-known-symbol'); var IS_PURE = require('../internals/is-pure'); var Iterators = require('../internals/iterators'); var IteratorsCore = require('../internals/iterators-core'); var IteratorPrototype = IteratorsCore.IteratorPrototype; var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; var ITERATOR = wellKnownSymbol('iterator'); var KEYS = 'keys'; var VALUES = 'values'; var ENTRIES = 'entries'; var returnThis = function () { return this; }; module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { createIteratorConstructor(IteratorConstructor, NAME, next); var getIterationMethod = function (KIND) { if (KIND === DEFAULT && defaultIterator) return defaultIterator; if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND]; switch (KIND) { case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; } return function () { return new IteratorConstructor(this); }; }; var TO_STRING_TAG = NAME + ' Iterator'; var INCORRECT_VALUES_NAME = false; var IterablePrototype = Iterable.prototype; var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT]; var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; var CurrentIteratorPrototype, methods, KEY; // fix native if (anyNativeIterator) { CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { if (setPrototypeOf) { setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') { createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis); } } // Set @@toStringTag to native iterators setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis; } } // fix Array#{values, @@iterator}.name in V8 / FF if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { INCORRECT_VALUES_NAME = true; defaultIterator = function values() { return nativeIterator.call(this); }; } // define iterator if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator); } Iterators[NAME] = defaultIterator; // export additional methods if (DEFAULT) { methods = { values: getIterationMethod(VALUES), keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), entries: getIterationMethod(ENTRIES) }; if (FORCED) for (KEY in methods) { if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { redefine(IterablePrototype, KEY, methods[KEY]); } } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); } return methods; }; core-js-3.6.1/packages/core-js/internals/define-well-known-symbol.js000066400000000000000000000006651360057567700254170ustar00rootroot00000000000000var path = require('../internals/path'); var has = require('../internals/has'); var wrappedWellKnownSymbolModule = require('../internals/wrapped-well-known-symbol'); var defineProperty = require('../internals/object-define-property').f; module.exports = function (NAME) { var Symbol = path.Symbol || (path.Symbol = {}); if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, { value: wrappedWellKnownSymbolModule.f(NAME) }); }; core-js-3.6.1/packages/core-js/internals/descriptors.js000066400000000000000000000003261360057567700231220ustar00rootroot00000000000000var fails = require('../internals/fails'); // Thank's IE8 for his funny defineProperty module.exports = !fails(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); core-js-3.6.1/packages/core-js/internals/document-create-element.js000066400000000000000000000005241360057567700252670ustar00rootroot00000000000000var global = require('../internals/global'); var isObject = require('../internals/is-object'); var document = global.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document) && isObject(document.createElement); module.exports = function (it) { return EXISTS ? document.createElement(it) : {}; }; core-js-3.6.1/packages/core-js/internals/dom-iterables.js000066400000000000000000000013611360057567700233100ustar00rootroot00000000000000// iterable DOM collections // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods module.exports = { CSSRuleList: 0, CSSStyleDeclaration: 0, CSSValueList: 0, ClientRectList: 0, DOMRectList: 0, DOMStringList: 0, DOMTokenList: 1, DataTransferItemList: 0, FileList: 0, HTMLAllCollection: 0, HTMLCollection: 0, HTMLFormElement: 0, HTMLSelectElement: 0, MediaList: 0, MimeTypeArray: 0, NamedNodeMap: 0, NodeList: 1, PaintRequestList: 0, Plugin: 0, PluginArray: 0, SVGLengthList: 0, SVGNumberList: 0, SVGPathSegList: 0, SVGPointList: 0, SVGStringList: 0, SVGTransformList: 0, SourceBufferList: 0, StyleSheetList: 0, TextTrackCueList: 0, TextTrackList: 0, TouchList: 0 }; core-js-3.6.1/packages/core-js/internals/entry-unbind.js000066400000000000000000000003731360057567700232010ustar00rootroot00000000000000var global = require('../internals/global'); var bind = require('../internals/bind-context'); var call = Function.call; module.exports = function (CONSTRUCTOR, METHOD, length) { return bind(call, global[CONSTRUCTOR].prototype[METHOD], length); }; core-js-3.6.1/packages/core-js/internals/entry-virtual.js000066400000000000000000000002031360057567700234000ustar00rootroot00000000000000var global = require('../internals/global'); module.exports = function (CONSTRUCTOR) { return global[CONSTRUCTOR].prototype; }; core-js-3.6.1/packages/core-js/internals/enum-bug-keys.js000066400000000000000000000002621360057567700232500ustar00rootroot00000000000000// IE8- don't enum bug keys module.exports = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; core-js-3.6.1/packages/core-js/internals/export.js000066400000000000000000000047271360057567700221130ustar00rootroot00000000000000var global = require('../internals/global'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var redefine = require('../internals/redefine'); var setGlobal = require('../internals/set-global'); var copyConstructorProperties = require('../internals/copy-constructor-properties'); var isForced = require('../internals/is-forced'); /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.noTargetGet - prevent calling a getter on target */ module.exports = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { target = global; } else if (STATIC) { target = global[TARGET] || setGlobal(TARGET, {}); } else { target = (global[TARGET] || {}).prototype; } if (target) for (key in source) { sourceProperty = source[key]; if (options.noTargetGet) { descriptor = getOwnPropertyDescriptor(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target if (!FORCED && targetProperty !== undefined) { if (typeof sourceProperty === typeof targetProperty) continue; copyConstructorProperties(sourceProperty, targetProperty); } // add a flag to not completely full polyfills if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(sourceProperty, 'sham', true); } // extend global redefine(target, key, sourceProperty, options); } }; core-js-3.6.1/packages/core-js/internals/fails.js000066400000000000000000000001541360057567700216560ustar00rootroot00000000000000module.exports = function (exec) { try { return !!exec(); } catch (error) { return true; } }; core-js-3.6.1/packages/core-js/internals/fix-regexp-well-known-symbol-logic.js000066400000000000000000000100041360057567700273220ustar00rootroot00000000000000'use strict'; var redefine = require('../internals/redefine'); var fails = require('../internals/fails'); var wellKnownSymbol = require('../internals/well-known-symbol'); var regexpExec = require('../internals/regexp-exec'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var SPECIES = wellKnownSymbol('species'); var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { // #replace needs built-in support for named groups. // #match works fine because it just return the exec results, even if it has // a "grops" property. var re = /./; re.exec = function () { var result = []; result.groups = { a: '7' }; return result; }; return ''.replace(re, '$') !== '7'; }); // IE <= 11 replaces $0 with the whole match, as if it was $& // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 var REPLACE_KEEPS_$0 = (function () { return 'a'.replace(/./, '$0') === '$0'; })(); // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec // Weex JS has frozen built-in prototypes, so use try / catch wrapper var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { var re = /(?:)/; var originalExec = re.exec; re.exec = function () { return originalExec.apply(this, arguments); }; var result = 'ab'.split(re); return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b'; }); module.exports = function (KEY, length, exec, sham) { var SYMBOL = wellKnownSymbol(KEY); var DELEGATES_TO_SYMBOL = !fails(function () { // String methods call symbol-named RegEp methods var O = {}; O[SYMBOL] = function () { return 7; }; return ''[KEY](O) != 7; }); var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () { // Symbol-named RegExp methods call .exec var execCalled = false; var re = /a/; if (KEY === 'split') { // We can't use real regex here since it causes deoptimization // and serious performance degradation in V8 // https://github.com/zloirock/core-js/issues/306 re = {}; // RegExp[@@split] doesn't call the regex's exec method, but first creates // a new one. We need to return the patched regex when creating the new one. re.constructor = {}; re.constructor[SPECIES] = function () { return re; }; re.flags = ''; re[SYMBOL] = /./[SYMBOL]; } re.exec = function () { execCalled = true; return null; }; re[SYMBOL](''); return !execCalled; }); if ( !DELEGATES_TO_SYMBOL || !DELEGATES_TO_EXEC || (KEY === 'replace' && !(REPLACE_SUPPORTS_NAMED_GROUPS && REPLACE_KEEPS_$0)) || (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) ) { var nativeRegExpMethod = /./[SYMBOL]; var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { if (regexp.exec === regexpExec) { if (DELEGATES_TO_SYMBOL && !forceStringMethod) { // The native String method already delegates to @@method (this // polyfilled function), leasing to infinite recursion. // We avoid it by directly calling the native @@method method. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; } return { done: true, value: nativeMethod.call(str, regexp, arg2) }; } return { done: false }; }, { REPLACE_KEEPS_$0: REPLACE_KEEPS_$0 }); var stringMethod = methods[0]; var regexMethod = methods[1]; redefine(String.prototype, KEY, stringMethod); redefine(RegExp.prototype, SYMBOL, length == 2 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) // 21.2.5.11 RegExp.prototype[@@split](string, limit) ? function (string, arg) { return regexMethod.call(string, this, arg); } // 21.2.5.6 RegExp.prototype[@@match](string) // 21.2.5.9 RegExp.prototype[@@search](string) : function (string) { return regexMethod.call(string, this); } ); } if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true); }; core-js-3.6.1/packages/core-js/internals/flatten-into-array.js000066400000000000000000000021131360057567700242750ustar00rootroot00000000000000'use strict'; var isArray = require('../internals/is-array'); var toLength = require('../internals/to-length'); var bind = require('../internals/bind-context'); // `FlattenIntoArray` abstract operation // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) { var targetIndex = start; var sourceIndex = 0; var mapFn = mapper ? bind(mapper, thisArg, 3) : false; var element; while (sourceIndex < sourceLen) { if (sourceIndex in source) { element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; if (depth > 0 && isArray(element)) { targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1; } else { if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length'); target[targetIndex] = element; } targetIndex++; } sourceIndex++; } return targetIndex; }; module.exports = flattenIntoArray; core-js-3.6.1/packages/core-js/internals/forced-object-prototype-accessors-methods.js000066400000000000000000000007241360057567700307600ustar00rootroot00000000000000'use strict'; var IS_PURE = require('../internals/is-pure'); var global = require('../internals/global'); var fails = require('../internals/fails'); // Forced replacement object prototype accessors methods module.exports = IS_PURE || !fails(function () { var key = Math.random(); // In FF throws only define methods // eslint-disable-next-line no-undef, no-useless-call __defineSetter__.call(null, key, function () { /* empty */ }); delete global[key]; }); core-js-3.6.1/packages/core-js/internals/forced-string-html-method.js000066400000000000000000000005021360057567700255430ustar00rootroot00000000000000var fails = require('../internals/fails'); // check the existence of a method, lowercase // of a tag and escaping quotes in arguments module.exports = function (METHOD_NAME) { return fails(function () { var test = ''[METHOD_NAME]('"'); return test !== test.toLowerCase() || test.split('"').length > 3; }); }; core-js-3.6.1/packages/core-js/internals/forced-string-trim-method.js000066400000000000000000000006471360057567700255640ustar00rootroot00000000000000var fails = require('../internals/fails'); var whitespaces = require('../internals/whitespaces'); var non = '\u200B\u0085\u180E'; // check that a method works with the correct list // of whitespaces and has a correct name module.exports = function (METHOD_NAME) { return fails(function () { return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME; }); }; core-js-3.6.1/packages/core-js/internals/freezing.js000066400000000000000000000002221360057567700223650ustar00rootroot00000000000000var fails = require('../internals/fails'); module.exports = !fails(function () { return Object.isExtensible(Object.preventExtensions({})); }); core-js-3.6.1/packages/core-js/internals/function-bind.js000066400000000000000000000020531360057567700233170ustar00rootroot00000000000000'use strict'; var aFunction = require('../internals/a-function'); var isObject = require('../internals/is-object'); var slice = [].slice; var factories = {}; var construct = function (C, argsLength, args) { if (!(argsLength in factories)) { for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; // eslint-disable-next-line no-new-func factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')'); } return factories[argsLength](C, args); }; // `Function.prototype.bind` method implementation // https://tc39.github.io/ecma262/#sec-function.prototype.bind module.exports = Function.bind || function bind(that /* , ...args */) { var fn = aFunction(this); var partArgs = slice.call(arguments, 1); var boundFunction = function bound(/* args... */) { var args = partArgs.concat(slice.call(arguments)); return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args); }; if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype; return boundFunction; }; core-js-3.6.1/packages/core-js/internals/get-async-iterator-method.js000066400000000000000000000005061360057567700255600ustar00rootroot00000000000000var getIteratorMethod = require('../internals/get-iterator-method'); var wellKnownSymbol = require('../internals/well-known-symbol'); var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator'); module.exports = function (it) { var method = it[ASYNC_ITERATOR]; return method === undefined ? getIteratorMethod(it) : method; }; core-js-3.6.1/packages/core-js/internals/get-built-in.js000066400000000000000000000006621360057567700230640ustar00rootroot00000000000000var path = require('../internals/path'); var global = require('../internals/global'); var aFunction = function (variable) { return typeof variable == 'function' ? variable : undefined; }; module.exports = function (namespace, method) { return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method]; }; core-js-3.6.1/packages/core-js/internals/get-iterator-method.js000066400000000000000000000005271360057567700244500ustar00rootroot00000000000000var classof = require('../internals/classof'); var Iterators = require('../internals/iterators'); var wellKnownSymbol = require('../internals/well-known-symbol'); var ITERATOR = wellKnownSymbol('iterator'); module.exports = function (it) { if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; core-js-3.6.1/packages/core-js/internals/get-iterator.js000066400000000000000000000005331360057567700231670ustar00rootroot00000000000000var anObject = require('../internals/an-object'); var getIteratorMethod = require('../internals/get-iterator-method'); module.exports = function (it) { var iteratorMethod = getIteratorMethod(it); if (typeof iteratorMethod != 'function') { throw TypeError(String(it) + ' is not iterable'); } return anObject(iteratorMethod.call(it)); }; core-js-3.6.1/packages/core-js/internals/get-map-iterator.js000066400000000000000000000003641360057567700237440ustar00rootroot00000000000000var IS_PURE = require('../internals/is-pure'); var getIterator = require('../internals/get-iterator'); module.exports = IS_PURE ? getIterator : function (it) { // eslint-disable-next-line no-undef return Map.prototype.entries.call(it); }; core-js-3.6.1/packages/core-js/internals/get-set-iterator.js000066400000000000000000000003631360057567700237610ustar00rootroot00000000000000var IS_PURE = require('../internals/is-pure'); var getIterator = require('../internals/get-iterator'); module.exports = IS_PURE ? getIterator : function (it) { // eslint-disable-next-line no-undef return Set.prototype.values.call(it); }; core-js-3.6.1/packages/core-js/internals/global.js000066400000000000000000000007211360057567700220200ustar00rootroot00000000000000var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 module.exports = // eslint-disable-next-line no-undef check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || // eslint-disable-next-line no-new-func Function('return this')(); core-js-3.6.1/packages/core-js/internals/has.js000066400000000000000000000001711360057567700213320ustar00rootroot00000000000000var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; core-js-3.6.1/packages/core-js/internals/hidden-keys.js000066400000000000000000000000251360057567700227610ustar00rootroot00000000000000module.exports = {}; core-js-3.6.1/packages/core-js/internals/host-report-errors.js000066400000000000000000000003371360057567700243630ustar00rootroot00000000000000var global = require('../internals/global'); module.exports = function (a, b) { var console = global.console; if (console && console.error) { arguments.length === 1 ? console.error(a) : console.error(a, b); } }; core-js-3.6.1/packages/core-js/internals/html.js000066400000000000000000000001641360057567700215250ustar00rootroot00000000000000var getBuiltIn = require('../internals/get-built-in'); module.exports = getBuiltIn('document', 'documentElement'); core-js-3.6.1/packages/core-js/internals/ie8-dom-define.js000066400000000000000000000005721360057567700232560ustar00rootroot00000000000000var DESCRIPTORS = require('../internals/descriptors'); var fails = require('../internals/fails'); var createElement = require('../internals/document-create-element'); // Thank's IE8 for his funny defineProperty module.exports = !DESCRIPTORS && !fails(function () { return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); core-js-3.6.1/packages/core-js/internals/ieee754.js000066400000000000000000000054201360057567700217300ustar00rootroot00000000000000// IEEE754 conversions based on https://github.com/feross/ieee754 // eslint-disable-next-line no-shadow-restricted-names var Infinity = 1 / 0; var abs = Math.abs; var pow = Math.pow; var floor = Math.floor; var log = Math.log; var LN2 = Math.LN2; var pack = function (number, mantissaLength, bytes) { var buffer = new Array(bytes); var exponentLength = bytes * 8 - mantissaLength - 1; var eMax = (1 << exponentLength) - 1; var eBias = eMax >> 1; var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0; var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0; var index = 0; var exponent, mantissa, c; number = abs(number); // eslint-disable-next-line no-self-compare if (number != number || number === Infinity) { // eslint-disable-next-line no-self-compare mantissa = number != number ? 1 : 0; exponent = eMax; } else { exponent = floor(log(number) / LN2); if (number * (c = pow(2, -exponent)) < 1) { exponent--; c *= 2; } if (exponent + eBias >= 1) { number += rt / c; } else { number += rt * pow(2, 1 - eBias); } if (number * c >= 2) { exponent++; c /= 2; } if (exponent + eBias >= eMax) { mantissa = 0; exponent = eMax; } else if (exponent + eBias >= 1) { mantissa = (number * c - 1) * pow(2, mantissaLength); exponent = exponent + eBias; } else { mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength); exponent = 0; } } for (; mantissaLength >= 8; buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8); exponent = exponent << mantissaLength | mantissa; exponentLength += mantissaLength; for (; exponentLength > 0; buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8); buffer[--index] |= sign * 128; return buffer; }; var unpack = function (buffer, mantissaLength) { var bytes = buffer.length; var exponentLength = bytes * 8 - mantissaLength - 1; var eMax = (1 << exponentLength) - 1; var eBias = eMax >> 1; var nBits = exponentLength - 7; var index = bytes - 1; var sign = buffer[index--]; var exponent = sign & 127; var mantissa; sign >>= 7; for (; nBits > 0; exponent = exponent * 256 + buffer[index], index--, nBits -= 8); mantissa = exponent & (1 << -nBits) - 1; exponent >>= -nBits; nBits += mantissaLength; for (; nBits > 0; mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8); if (exponent === 0) { exponent = 1 - eBias; } else if (exponent === eMax) { return mantissa ? NaN : sign ? -Infinity : Infinity; } else { mantissa = mantissa + pow(2, mantissaLength); exponent = exponent - eBias; } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength); }; module.exports = { pack: pack, unpack: unpack }; core-js-3.6.1/packages/core-js/internals/indexed-object.js000066400000000000000000000007671360057567700234560ustar00rootroot00000000000000var fails = require('../internals/fails'); var classof = require('../internals/classof-raw'); var split = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings module.exports = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins return !Object('z').propertyIsEnumerable(0); }) ? function (it) { return classof(it) == 'String' ? split.call(it, '') : Object(it); } : Object; core-js-3.6.1/packages/core-js/internals/inherit-if-required.js000066400000000000000000000012651360057567700244400ustar00rootroot00000000000000var isObject = require('../internals/is-object'); var setPrototypeOf = require('../internals/object-set-prototype-of'); // makes subclassing work correct for wrapped built-ins module.exports = function ($this, dummy, Wrapper) { var NewTarget, NewTargetPrototype; if ( // it can work only with native `setPrototypeOf` setPrototypeOf && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this typeof (NewTarget = dummy.constructor) == 'function' && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype ) setPrototypeOf($this, NewTargetPrototype); return $this; }; core-js-3.6.1/packages/core-js/internals/inspect-source.js000066400000000000000000000005221360057567700235220ustar00rootroot00000000000000var store = require('../internals/shared-store'); var functionToString = Function.toString; // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper if (typeof store.inspectSource != 'function') { store.inspectSource = function (it) { return functionToString.call(it); }; } module.exports = store.inspectSource; core-js-3.6.1/packages/core-js/internals/internal-metadata.js000066400000000000000000000033461360057567700241600ustar00rootroot00000000000000var hiddenKeys = require('../internals/hidden-keys'); var isObject = require('../internals/is-object'); var has = require('../internals/has'); var defineProperty = require('../internals/object-define-property').f; var uid = require('../internals/uid'); var FREEZING = require('../internals/freezing'); var METADATA = uid('meta'); var id = 0; var isExtensible = Object.isExtensible || function () { return true; }; var setMetadata = function (it) { defineProperty(it, METADATA, { value: { objectID: 'O' + ++id, // object ID weakData: {} // weak collections IDs } }); }; var fastKey = function (it, create) { // return a primitive with prefix if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!has(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return 'F'; // not necessary to add metadata if (!create) return 'E'; // add missing metadata setMetadata(it); // return object ID } return it[METADATA].objectID; }; var getWeakData = function (it, create) { if (!has(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return true; // not necessary to add metadata if (!create) return false; // add missing metadata setMetadata(it); // return the store of weak collections IDs } return it[METADATA].weakData; }; // add metadata on freeze-family methods calling var onFreeze = function (it) { if (FREEZING && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it); return it; }; var meta = module.exports = { REQUIRED: false, fastKey: fastKey, getWeakData: getWeakData, onFreeze: onFreeze }; hiddenKeys[METADATA] = true; core-js-3.6.1/packages/core-js/internals/internal-state.js000066400000000000000000000030121360057567700235060ustar00rootroot00000000000000var NATIVE_WEAK_MAP = require('../internals/native-weak-map'); var global = require('../internals/global'); var isObject = require('../internals/is-object'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var objectHas = require('../internals/has'); var sharedKey = require('../internals/shared-key'); var hiddenKeys = require('../internals/hidden-keys'); var WeakMap = global.WeakMap; var set, get, has; var enforce = function (it) { return has(it) ? get(it) : set(it, {}); }; var getterFor = function (TYPE) { return function (it) { var state; if (!isObject(it) || (state = get(it)).type !== TYPE) { throw TypeError('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (NATIVE_WEAK_MAP) { var store = new WeakMap(); var wmget = store.get; var wmhas = store.has; var wmset = store.set; set = function (it, metadata) { wmset.call(store, it, metadata); return metadata; }; get = function (it) { return wmget.call(store, it) || {}; }; has = function (it) { return wmhas.call(store, it); }; } else { var STATE = sharedKey('state'); hiddenKeys[STATE] = true; set = function (it, metadata) { createNonEnumerableProperty(it, STATE, metadata); return metadata; }; get = function (it) { return objectHas(it, STATE) ? it[STATE] : {}; }; has = function (it) { return objectHas(it, STATE); }; } module.exports = { set: set, get: get, has: has, enforce: enforce, getterFor: getterFor }; core-js-3.6.1/packages/core-js/internals/is-array-iterator-method.js000066400000000000000000000005511360057567700254150ustar00rootroot00000000000000var wellKnownSymbol = require('../internals/well-known-symbol'); var Iterators = require('../internals/iterators'); var ITERATOR = wellKnownSymbol('iterator'); var ArrayPrototype = Array.prototype; // check on default Array iterator module.exports = function (it) { return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); }; core-js-3.6.1/packages/core-js/internals/is-array.js000066400000000000000000000003421360057567700223060ustar00rootroot00000000000000var classof = require('../internals/classof-raw'); // `IsArray` abstract operation // https://tc39.github.io/ecma262/#sec-isarray module.exports = Array.isArray || function isArray(arg) { return classof(arg) == 'Array'; }; core-js-3.6.1/packages/core-js/internals/is-forced.js000066400000000000000000000010751360057567700224360ustar00rootroot00000000000000var fails = require('../internals/fails'); var replacement = /#|\.prototype\./; var isForced = function (feature, detection) { var value = data[normalize(feature)]; return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection; }; var normalize = isForced.normalize = function (string) { return String(string).replace(replacement, '.').toLowerCase(); }; var data = isForced.data = {}; var NATIVE = isForced.NATIVE = 'N'; var POLYFILL = isForced.POLYFILL = 'P'; module.exports = isForced; core-js-3.6.1/packages/core-js/internals/is-integer.js000066400000000000000000000004311360057567700226240ustar00rootroot00000000000000var isObject = require('../internals/is-object'); var floor = Math.floor; // `Number.isInteger` method implementation // https://tc39.github.io/ecma262/#sec-number.isinteger module.exports = function isInteger(it) { return !isObject(it) && isFinite(it) && floor(it) === it; }; core-js-3.6.1/packages/core-js/internals/is-ios.js000066400000000000000000000001721360057567700217630ustar00rootroot00000000000000var userAgent = require('../internals/user-agent'); module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent); core-js-3.6.1/packages/core-js/internals/is-iterable.js000066400000000000000000000006521360057567700227630ustar00rootroot00000000000000var classof = require('../internals/classof'); var wellKnownSymbol = require('../internals/well-known-symbol'); var Iterators = require('../internals/iterators'); var ITERATOR = wellKnownSymbol('iterator'); module.exports = function (it) { var O = Object(it); return O[ITERATOR] !== undefined || '@@iterator' in O // eslint-disable-next-line no-prototype-builtins || Iterators.hasOwnProperty(classof(O)); }; core-js-3.6.1/packages/core-js/internals/is-object.js000066400000000000000000000001561360057567700224410ustar00rootroot00000000000000module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; core-js-3.6.1/packages/core-js/internals/is-pure.js000066400000000000000000000000301360057567700221350ustar00rootroot00000000000000module.exports = false; core-js-3.6.1/packages/core-js/internals/is-regexp.js000066400000000000000000000006731360057567700224710ustar00rootroot00000000000000var isObject = require('../internals/is-object'); var classof = require('../internals/classof-raw'); var wellKnownSymbol = require('../internals/well-known-symbol'); var MATCH = wellKnownSymbol('match'); // `IsRegExp` abstract operation // https://tc39.github.io/ecma262/#sec-isregexp module.exports = function (it) { var isRegExp; return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp'); }; core-js-3.6.1/packages/core-js/internals/iterate.js000066400000000000000000000032251360057567700222170ustar00rootroot00000000000000var anObject = require('../internals/an-object'); var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); var toLength = require('../internals/to-length'); var bind = require('../internals/bind-context'); var getIteratorMethod = require('../internals/get-iterator-method'); var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); var Result = function (stopped, result) { this.stopped = stopped; this.result = result; }; var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) { var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1); var iterator, iterFn, index, length, result, next, step; if (IS_ITERATOR) { iterator = iterable; } else { iterFn = getIteratorMethod(iterable); if (typeof iterFn != 'function') throw TypeError('Target is not iterable'); // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = toLength(iterable.length); length > index; index++) { result = AS_ENTRIES ? boundFunction(anObject(step = iterable[index])[0], step[1]) : boundFunction(iterable[index]); if (result && result instanceof Result) return result; } return new Result(false); } iterator = iterFn.call(iterable); } next = iterator.next; while (!(step = next.call(iterator)).done) { result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES); if (typeof result == 'object' && result && result instanceof Result) return result; } return new Result(false); }; iterate.stop = function (result) { return new Result(true, result); }; core-js-3.6.1/packages/core-js/internals/iterators-core.js000066400000000000000000000025071360057567700235260ustar00rootroot00000000000000'use strict'; var getPrototypeOf = require('../internals/object-get-prototype-of'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var has = require('../internals/has'); var wellKnownSymbol = require('../internals/well-known-symbol'); var IS_PURE = require('../internals/is-pure'); var ITERATOR = wellKnownSymbol('iterator'); var BUGGY_SAFARI_ITERATORS = false; var returnThis = function () { return this; }; // `%IteratorPrototype%` object // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; if ([].keys) { arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next` if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; else { PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; } } if (IteratorPrototype == undefined) IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) { createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis); } module.exports = { IteratorPrototype: IteratorPrototype, BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS }; core-js-3.6.1/packages/core-js/internals/iterators.js000066400000000000000000000000251360057567700225710ustar00rootroot00000000000000module.exports = {}; core-js-3.6.1/packages/core-js/internals/map-upsert.js000066400000000000000000000013211360057567700226520ustar00rootroot00000000000000'use strict'; var anObject = require('../internals/an-object'); // `Map.prototype.upsert` method // https://github.com/thumbsupep/proposal-upsert module.exports = function upsert(key, updateFn /* , insertFn */) { var map = anObject(this); var insertFn = arguments.length > 2 ? arguments[2] : undefined; var value; if (typeof updateFn != 'function' && typeof insertFn != 'function') { throw TypeError('At least one callback required'); } if (map.has(key)) { value = map.get(key); if (typeof updateFn == 'function') { value = updateFn(value); map.set(key, value); } } else if (typeof insertFn == 'function') { value = insertFn(); map.set(key, value); } return value; }; core-js-3.6.1/packages/core-js/internals/math-expm1.js000066400000000000000000000007021360057567700225400ustar00rootroot00000000000000var nativeExpm1 = Math.expm1; var exp = Math.exp; // `Math.expm1` method implementation // https://tc39.github.io/ecma262/#sec-math.expm1 module.exports = (!nativeExpm1 // Old FF bug || nativeExpm1(10) > 22025.465794806719 || nativeExpm1(10) < 22025.4657948067165168 // Tor Browser bug || nativeExpm1(-2e-17) != -2e-17 ) ? function expm1(x) { return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1; } : nativeExpm1; core-js-3.6.1/packages/core-js/internals/math-fround.js000066400000000000000000000014441360057567700230070ustar00rootroot00000000000000var sign = require('../internals/math-sign'); var abs = Math.abs; var pow = Math.pow; var EPSILON = pow(2, -52); var EPSILON32 = pow(2, -23); var MAX32 = pow(2, 127) * (2 - EPSILON32); var MIN32 = pow(2, -126); var roundTiesToEven = function (n) { return n + 1 / EPSILON - 1 / EPSILON; }; // `Math.fround` method implementation // https://tc39.github.io/ecma262/#sec-math.fround module.exports = Math.fround || function fround(x) { var $abs = abs(x); var $sign = sign(x); var a, result; if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; a = (1 + EPSILON32 / EPSILON) * $abs; result = a - (a - $abs); // eslint-disable-next-line no-self-compare if (result > MAX32 || result != result) return $sign * Infinity; return $sign * result; }; core-js-3.6.1/packages/core-js/internals/math-log1p.js000066400000000000000000000003471360057567700225350ustar00rootroot00000000000000var log = Math.log; // `Math.log1p` method implementation // https://tc39.github.io/ecma262/#sec-math.log1p module.exports = Math.log1p || function log1p(x) { return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x); }; core-js-3.6.1/packages/core-js/internals/math-scale.js000066400000000000000000000010551360057567700225770ustar00rootroot00000000000000// `Math.scale` method implementation // https://rwaldron.github.io/proposal-math-extensions/ module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) { if ( arguments.length === 0 /* eslint-disable no-self-compare */ || x != x || inLow != inLow || inHigh != inHigh || outLow != outLow || outHigh != outHigh /* eslint-enable no-self-compare */ ) return NaN; if (x === Infinity || x === -Infinity) return x; return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow; }; core-js-3.6.1/packages/core-js/internals/math-sign.js000066400000000000000000000003571360057567700224540ustar00rootroot00000000000000// `Math.sign` method implementation // https://tc39.github.io/ecma262/#sec-math.sign module.exports = Math.sign || function sign(x) { // eslint-disable-next-line no-self-compare return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; }; core-js-3.6.1/packages/core-js/internals/microtask.js000066400000000000000000000046421360057567700225620ustar00rootroot00000000000000var global = require('../internals/global'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var classof = require('../internals/classof-raw'); var macrotask = require('../internals/task').set; var IS_IOS = require('../internals/is-ios'); var MutationObserver = global.MutationObserver || global.WebKitMutationObserver; var process = global.process; var Promise = global.Promise; var IS_NODE = classof(process) == 'process'; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask'); var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; var flush, head, last, notify, toggle, node, promise, then; // modern engines have queueMicrotask method if (!queueMicrotask) { flush = function () { var parent, fn; if (IS_NODE && (parent = process.domain)) parent.exit(); while (head) { fn = head.fn; head = head.next; try { fn(); } catch (error) { if (head) notify(); else last = undefined; throw error; } } last = undefined; if (parent) parent.enter(); }; // Node.js if (IS_NODE) { notify = function () { process.nextTick(flush); }; // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339 } else if (MutationObserver && !IS_IOS) { toggle = true; node = document.createTextNode(''); new MutationObserver(flush).observe(node, { characterData: true }); notify = function () { node.data = toggle = !toggle; }; // environments with maybe non-completely correct, but existent Promise } else if (Promise && Promise.resolve) { // Promise.resolve without an argument throws an error in LG WebOS 2 promise = Promise.resolve(undefined); then = promise.then; notify = function () { then.call(promise, flush); }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel // - window.postMessag // - onreadystatechange // - setTimeout } else { notify = function () { // strange IE + webpack dev server bug - use .call(global) macrotask.call(global, flush); }; } } module.exports = queueMicrotask || function (fn) { var task = { fn: fn, next: undefined }; if (last) last.next = task; if (!head) { head = task; notify(); } last = task; }; core-js-3.6.1/packages/core-js/internals/native-promise-constructor.js000066400000000000000000000001171360057567700261040ustar00rootroot00000000000000var global = require('../internals/global'); module.exports = global.Promise; core-js-3.6.1/packages/core-js/internals/native-symbol.js000066400000000000000000000003631360057567700233530ustar00rootroot00000000000000var fails = require('../internals/fails'); module.exports = !!Object.getOwnPropertySymbols && !fails(function () { // Chrome 38 Symbol has incorrect toString conversion // eslint-disable-next-line no-undef return !String(Symbol()); }); core-js-3.6.1/packages/core-js/internals/native-url.js000066400000000000000000000022001360057567700226400ustar00rootroot00000000000000var fails = require('../internals/fails'); var wellKnownSymbol = require('../internals/well-known-symbol'); var IS_PURE = require('../internals/is-pure'); var ITERATOR = wellKnownSymbol('iterator'); module.exports = !fails(function () { var url = new URL('b?a=1&b=2&c=3', 'http://a'); var searchParams = url.searchParams; var result = ''; url.pathname = 'c%20d'; searchParams.forEach(function (value, key) { searchParams['delete']('b'); result += key + value; }); return (IS_PURE && !url.toJSON) || !searchParams.sort || url.href !== 'http://a/c%20d?a=1&c=3' || searchParams.get('c') !== '3' || String(new URLSearchParams('?a=1')) !== 'a=1' || !searchParams[ITERATOR] // throws in Edge || new URL('https://a@b').username !== 'a' || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' // not punycoded in Edge || new URL('http://тест').host !== 'xn--e1aybc' // not escaped in Chrome 62- || new URL('http://a#б').hash !== '#%D0%B1' // fails in Chrome 66- || result !== 'a1c3' // throws in Safari || new URL('http://x', undefined).host !== 'x'; }); core-js-3.6.1/packages/core-js/internals/native-weak-map.js000066400000000000000000000003471360057567700235520ustar00rootroot00000000000000var global = require('../internals/global'); var inspectSource = require('../internals/inspect-source'); var WeakMap = global.WeakMap; module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap)); core-js-3.6.1/packages/core-js/internals/new-promise-capability.js000066400000000000000000000010121360057567700251360ustar00rootroot00000000000000'use strict'; var aFunction = require('../internals/a-function'); var PromiseCapability = function (C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aFunction(resolve); this.reject = aFunction(reject); }; // 25.4.1.5 NewPromiseCapability(C) module.exports.f = function (C) { return new PromiseCapability(C); }; core-js-3.6.1/packages/core-js/internals/not-a-regexp.js000066400000000000000000000003021360057567700230610ustar00rootroot00000000000000var isRegExp = require('../internals/is-regexp'); module.exports = function (it) { if (isRegExp(it)) { throw TypeError("The method doesn't accept regular expressions"); } return it; }; core-js-3.6.1/packages/core-js/internals/number-is-finite.js000066400000000000000000000004351360057567700237370ustar00rootroot00000000000000var global = require('../internals/global'); var globalIsFinite = global.isFinite; // `Number.isFinite` method // https://tc39.github.io/ecma262/#sec-number.isfinite module.exports = Number.isFinite || function isFinite(it) { return typeof it == 'number' && globalIsFinite(it); }; core-js-3.6.1/packages/core-js/internals/object-assign.js000066400000000000000000000040321360057567700233070ustar00rootroot00000000000000'use strict'; var DESCRIPTORS = require('../internals/descriptors'); var fails = require('../internals/fails'); var objectKeys = require('../internals/object-keys'); var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols'); var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); var toObject = require('../internals/to-object'); var IndexedObject = require('../internals/indexed-object'); var nativeAssign = Object.assign; var defineProperty = Object.defineProperty; // `Object.assign` method // https://tc39.github.io/ecma262/#sec-object.assign module.exports = !nativeAssign || fails(function () { // should have correct order of operations (Edge bug) if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', { enumerable: true, get: function () { defineProperty(this, 'b', { value: 3, enumerable: false }); } }), { b: 2 })).b !== 1) return true; // should work with symbols and should have deterministic property order (V8 bug) var A = {}; var B = {}; // eslint-disable-next-line no-undef var symbol = Symbol(); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars var T = toObject(target); var argumentsLength = arguments.length; var index = 1; var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; var propertyIsEnumerable = propertyIsEnumerableModule.f; while (argumentsLength > index) { var S = IndexedObject(arguments[index++]); var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); var length = keys.length; var j = 0; var key; while (length > j) { key = keys[j++]; if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key]; } } return T; } : nativeAssign; core-js-3.6.1/packages/core-js/internals/object-create.js000066400000000000000000000055021360057567700232710ustar00rootroot00000000000000var anObject = require('../internals/an-object'); var defineProperties = require('../internals/object-define-properties'); var enumBugKeys = require('../internals/enum-bug-keys'); var hiddenKeys = require('../internals/hidden-keys'); var html = require('../internals/html'); var documentCreateElement = require('../internals/document-create-element'); var sharedKey = require('../internals/shared-key'); var GT = '>'; var LT = '<'; var PROTOTYPE = 'prototype'; var SCRIPT = 'script'; var IE_PROTO = sharedKey('IE_PROTO'); var EmptyConstructor = function () { /* empty */ }; var scriptTag = function (content) { return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype var NullProtoObjectViaActiveX = function (activeXDocument) { activeXDocument.write(scriptTag('')); activeXDocument.close(); var temp = activeXDocument.parentWindow.Object; activeXDocument = null; // avoid memory leak return temp; }; // Create object with fake `null` prototype: use iframe Object with cleared prototype var NullProtoObjectViaIFrame = function () { // Thrash, waste and sodomy: IE GC bug var iframe = documentCreateElement('iframe'); var JS = 'java' + SCRIPT + ':'; var iframeDocument; iframe.style.display = 'none'; html.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475 iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag('document.F=Object')); iframeDocument.close(); return iframeDocument.F; }; // Check for document.domain and active x support // No need to use active x approach when document.domain is not set // see https://github.com/es-shims/es5-shim/issues/150 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 // avoid IE GC bug var activeXDocument; var NullProtoObject = function () { try { /* global ActiveXObject */ activeXDocument = document.domain && new ActiveXObject('htmlfile'); } catch (error) { /* ignore */ } NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame(); var length = enumBugKeys.length; while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; return NullProtoObject(); }; hiddenKeys[IE_PROTO] = true; // `Object.create` method // https://tc39.github.io/ecma262/#sec-object.create module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { EmptyConstructor[PROTOTYPE] = anObject(O); result = new EmptyConstructor(); EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = NullProtoObject(); return Properties === undefined ? result : defineProperties(result, Properties); }; core-js-3.6.1/packages/core-js/internals/object-define-properties.js000066400000000000000000000012071360057567700254500ustar00rootroot00000000000000var DESCRIPTORS = require('../internals/descriptors'); var definePropertyModule = require('../internals/object-define-property'); var anObject = require('../internals/an-object'); var objectKeys = require('../internals/object-keys'); // `Object.defineProperties` method // https://tc39.github.io/ecma262/#sec-object.defineproperties module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = objectKeys(Properties); var length = keys.length; var index = 0; var key; while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]); return O; }; core-js-3.6.1/packages/core-js/internals/object-define-property.js000066400000000000000000000014451360057567700251440ustar00rootroot00000000000000var DESCRIPTORS = require('../internals/descriptors'); var IE8_DOM_DEFINE = require('../internals/ie8-dom-define'); var anObject = require('../internals/an-object'); var toPrimitive = require('../internals/to-primitive'); var nativeDefineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.github.io/ecma262/#sec-object.defineproperty exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return nativeDefineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; core-js-3.6.1/packages/core-js/internals/object-get-own-property-descriptor.js000066400000000000000000000017511360057567700274460ustar00rootroot00000000000000var DESCRIPTORS = require('../internals/descriptors'); var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); var toIndexedObject = require('../internals/to-indexed-object'); var toPrimitive = require('../internals/to-primitive'); var has = require('../internals/has'); var IE8_DOM_DEFINE = require('../internals/ie8-dom-define'); var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); if (IE8_DOM_DEFINE) try { return nativeGetOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); }; core-js-3.6.1/packages/core-js/internals/object-get-own-property-names-external.js000066400000000000000000000013411360057567700302060ustar00rootroot00000000000000var toIndexedObject = require('../internals/to-indexed-object'); var nativeGetOwnPropertyNames = require('../internals/object-get-own-property-names').f; var toString = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function (it) { try { return nativeGetOwnPropertyNames(it); } catch (error) { return windowNames.slice(); } }; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window module.exports.f = function getOwnPropertyNames(it) { return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : nativeGetOwnPropertyNames(toIndexedObject(it)); }; core-js-3.6.1/packages/core-js/internals/object-get-own-property-names.js000066400000000000000000000006421360057567700263710ustar00rootroot00000000000000var internalObjectKeys = require('../internals/object-keys-internal'); var enumBugKeys = require('../internals/enum-bug-keys'); var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.github.io/ecma262/#sec-object.getownpropertynames exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return internalObjectKeys(O, hiddenKeys); }; core-js-3.6.1/packages/core-js/internals/object-get-own-property-symbols.js000066400000000000000000000000521360057567700267510ustar00rootroot00000000000000exports.f = Object.getOwnPropertySymbols; core-js-3.6.1/packages/core-js/internals/object-get-prototype-of.js000066400000000000000000000013111360057567700252440ustar00rootroot00000000000000var has = require('../internals/has'); var toObject = require('../internals/to-object'); var sharedKey = require('../internals/shared-key'); var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter'); var IE_PROTO = sharedKey('IE_PROTO'); var ObjectPrototype = Object.prototype; // `Object.getPrototypeOf` method // https://tc39.github.io/ecma262/#sec-object.getprototypeof module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) { O = toObject(O); if (has(O, IE_PROTO)) return O[IE_PROTO]; if (typeof O.constructor == 'function' && O instanceof O.constructor) { return O.constructor.prototype; } return O instanceof Object ? ObjectPrototype : null; }; core-js-3.6.1/packages/core-js/internals/object-iterator.js000066400000000000000000000024401360057567700236550ustar00rootroot00000000000000'use strict'; var InternalStateModule = require('../internals/internal-state'); var createIteratorConstructor = require('../internals/create-iterator-constructor'); var has = require('../internals/has'); var objectKeys = require('../internals/object-keys'); var toObject = require('../internals/to-object'); var OBJECT_ITERATOR = 'Object Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(OBJECT_ITERATOR); module.exports = createIteratorConstructor(function ObjectIterator(source, mode) { var object = toObject(source); setInternalState(this, { type: OBJECT_ITERATOR, mode: mode, object: object, keys: objectKeys(object), index: 0 }); }, 'Object', function next() { var state = getInternalState(this); var keys = state.keys; while (true) { if (keys === null || state.index >= keys.length) { state.object = state.keys = null; return { value: undefined, done: true }; } var key = keys[state.index++]; var object = state.object; if (!has(object, key)) continue; switch (state.mode) { case 'keys': return { value: key, done: false }; case 'values': return { value: object[key], done: false }; } /* entries */ return { value: [key, object[key]], done: false }; } }); core-js-3.6.1/packages/core-js/internals/object-keys-internal.js000066400000000000000000000011061360057567700246070ustar00rootroot00000000000000var has = require('../internals/has'); var toIndexedObject = require('../internals/to-indexed-object'); var indexOf = require('../internals/array-includes').indexOf; var hiddenKeys = require('../internals/hidden-keys'); module.exports = function (object, names) { var O = toIndexedObject(object); var i = 0; var result = []; var key; for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (has(O, key = names[i++])) { ~indexOf(result, key) || result.push(key); } return result; }; core-js-3.6.1/packages/core-js/internals/object-keys.js000066400000000000000000000004571360057567700230050ustar00rootroot00000000000000var internalObjectKeys = require('../internals/object-keys-internal'); var enumBugKeys = require('../internals/enum-bug-keys'); // `Object.keys` method // https://tc39.github.io/ecma262/#sec-object.keys module.exports = Object.keys || function keys(O) { return internalObjectKeys(O, enumBugKeys); }; core-js-3.6.1/packages/core-js/internals/object-property-is-enumerable.js000066400000000000000000000011161360057567700264350ustar00rootroot00000000000000'use strict'; var nativePropertyIsEnumerable = {}.propertyIsEnumerable; var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor(this, V); return !!descriptor && descriptor.enumerable; } : nativePropertyIsEnumerable; core-js-3.6.1/packages/core-js/internals/object-set-prototype-of.js000066400000000000000000000015331360057567700252660ustar00rootroot00000000000000var anObject = require('../internals/an-object'); var aPossiblePrototype = require('../internals/a-possible-prototype'); // `Object.setPrototypeOf` method // https://tc39.github.io/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. /* eslint-disable no-proto */ module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { var CORRECT_SETTER = false; var test = {}; var setter; try { setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; setter.call(test, []); CORRECT_SETTER = test instanceof Array; } catch (error) { /* empty */ } return function setPrototypeOf(O, proto) { anObject(O); aPossiblePrototype(proto); if (CORRECT_SETTER) setter.call(O, proto); else O.__proto__ = proto; return O; }; }() : undefined); core-js-3.6.1/packages/core-js/internals/object-to-array.js000066400000000000000000000017321360057567700235650ustar00rootroot00000000000000var DESCRIPTORS = require('../internals/descriptors'); var objectKeys = require('../internals/object-keys'); var toIndexedObject = require('../internals/to-indexed-object'); var propertyIsEnumerable = require('../internals/object-property-is-enumerable').f; // `Object.{ entries, values }` methods implementation var createMethod = function (TO_ENTRIES) { return function (it) { var O = toIndexedObject(it); var keys = objectKeys(O); var length = keys.length; var i = 0; var result = []; var key; while (length > i) { key = keys[i++]; if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) { result.push(TO_ENTRIES ? [key, O[key]] : O[key]); } } return result; }; }; module.exports = { // `Object.entries` method // https://tc39.github.io/ecma262/#sec-object.entries entries: createMethod(true), // `Object.values` method // https://tc39.github.io/ecma262/#sec-object.values values: createMethod(false) }; core-js-3.6.1/packages/core-js/internals/object-to-string.js000066400000000000000000000005721360057567700237560ustar00rootroot00000000000000'use strict'; var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support'); var classof = require('../internals/classof'); // `Object.prototype.toString` method implementation // https://tc39.github.io/ecma262/#sec-object.prototype.tostring module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() { return '[object ' + classof(this) + ']'; }; core-js-3.6.1/packages/core-js/internals/own-keys.js000066400000000000000000000011501360057567700223310ustar00rootroot00000000000000var getBuiltIn = require('../internals/get-built-in'); var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names'); var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols'); var anObject = require('../internals/an-object'); // all object keys, includes non-enumerable and symbols module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { var keys = getOwnPropertyNamesModule.f(anObject(it)); var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; }; core-js-3.6.1/packages/core-js/internals/parse-float.js000066400000000000000000000011131360057567700227710ustar00rootroot00000000000000var global = require('../internals/global'); var trim = require('../internals/string-trim').trim; var whitespaces = require('../internals/whitespaces'); var nativeParseFloat = global.parseFloat; var FORCED = 1 / nativeParseFloat(whitespaces + '-0') !== -Infinity; // `parseFloat` method // https://tc39.github.io/ecma262/#sec-parsefloat-string module.exports = FORCED ? function parseFloat(string) { var trimmedString = trim(String(string)); var result = nativeParseFloat(trimmedString); return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result; } : nativeParseFloat; core-js-3.6.1/packages/core-js/internals/parse-int.js000066400000000000000000000011111360057567700224540ustar00rootroot00000000000000var global = require('../internals/global'); var trim = require('../internals/string-trim').trim; var whitespaces = require('../internals/whitespaces'); var nativeParseInt = global.parseInt; var hex = /^[+-]?0[Xx]/; var FORCED = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22; // `parseInt` method // https://tc39.github.io/ecma262/#sec-parseint-string-radix module.exports = FORCED ? function parseInt(string, radix) { var S = trim(String(string)); return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10)); } : nativeParseInt; core-js-3.6.1/packages/core-js/internals/path.js000066400000000000000000000001071360057567700215120ustar00rootroot00000000000000var global = require('../internals/global'); module.exports = global; core-js-3.6.1/packages/core-js/internals/perform.js000066400000000000000000000002341360057567700222310ustar00rootroot00000000000000module.exports = function (exec) { try { return { error: false, value: exec() }; } catch (error) { return { error: true, value: error }; } }; core-js-3.6.1/packages/core-js/internals/promise-resolve.js000066400000000000000000000006531360057567700237170ustar00rootroot00000000000000var anObject = require('../internals/an-object'); var isObject = require('../internals/is-object'); var newPromiseCapability = require('../internals/new-promise-capability'); module.exports = function (C, x) { anObject(C); if (isObject(x) && x.constructor === C) return x; var promiseCapability = newPromiseCapability.f(C); var resolve = promiseCapability.resolve; resolve(x); return promiseCapability.promise; }; core-js-3.6.1/packages/core-js/internals/punycode-to-ascii.js000066400000000000000000000121531360057567700241160ustar00rootroot00000000000000'use strict'; // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 var base = 36; var tMin = 1; var tMax = 26; var skew = 38; var damp = 700; var initialBias = 72; var initialN = 128; // 0x80 var delimiter = '-'; // '\x2D' var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process'; var baseMinusTMin = base - tMin; var floor = Math.floor; var stringFromCharCode = String.fromCharCode; /** * Creates an array containing the numeric code points of each Unicode * character in the string. While JavaScript uses UCS-2 internally, * this function will convert a pair of surrogate halves (each of which * UCS-2 exposes as separate characters) into a single code point, * matching UTF-16. */ var ucs2decode = function (string) { var output = []; var counter = 0; var length = string.length; while (counter < length) { var value = string.charCodeAt(counter++); if (value >= 0xD800 && value <= 0xDBFF && counter < length) { // It's a high surrogate, and there is a next character. var extra = string.charCodeAt(counter++); if ((extra & 0xFC00) == 0xDC00) { // Low surrogate. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); } else { // It's an unmatched surrogate; only append this code unit, in case the // next code unit is the high surrogate of a surrogate pair. output.push(value); counter--; } } else { output.push(value); } } return output; }; /** * Converts a digit/integer into a basic code point. */ var digitToBasic = function (digit) { // 0..25 map to ASCII a..z or A..Z // 26..35 map to ASCII 0..9 return digit + 22 + 75 * (digit < 26); }; /** * Bias adaptation function as per section 3.4 of RFC 3492. * https://tools.ietf.org/html/rfc3492#section-3.4 */ var adapt = function (delta, numPoints, firstTime) { var k = 0; delta = firstTime ? floor(delta / damp) : delta >> 1; delta += floor(delta / numPoints); for (; delta > baseMinusTMin * tMax >> 1; k += base) { delta = floor(delta / baseMinusTMin); } return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); }; /** * Converts a string of Unicode symbols (e.g. a domain name label) to a * Punycode string of ASCII-only symbols. */ // eslint-disable-next-line max-statements var encode = function (input) { var output = []; // Convert the input in UCS-2 to an array of Unicode code points. input = ucs2decode(input); // Cache the length. var inputLength = input.length; // Initialize the state. var n = initialN; var delta = 0; var bias = initialBias; var i, currentValue; // Handle the basic code points. for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue < 0x80) { output.push(stringFromCharCode(currentValue)); } } var basicLength = output.length; // number of basic code points. var handledCPCount = basicLength; // number of code points that have been handled; // Finish the basic string with a delimiter unless it's empty. if (basicLength) { output.push(delimiter); } // Main encoding loop: while (handledCPCount < inputLength) { // All non-basic code points < n have been handled already. Find the next larger one: var m = maxInt; for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue >= n && currentValue < m) { m = currentValue; } } // Increase `delta` enough to advance the decoder's state to , but guard against overflow. var handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { throw RangeError(OVERFLOW_ERROR); } delta += (m - n) * handledCPCountPlusOne; n = m; for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue < n && ++delta > maxInt) { throw RangeError(OVERFLOW_ERROR); } if (currentValue == n) { // Represent delta as a generalized variable-length integer. var q = delta; for (var k = base; /* no condition */; k += base) { var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (q < t) break; var qMinusT = q - t; var baseMinusT = base - t; output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT))); q = floor(qMinusT / baseMinusT); } output.push(stringFromCharCode(digitToBasic(q))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; ++handledCPCount; } } ++delta; ++n; } return output.join(''); }; module.exports = function (input) { var encoded = []; var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.'); var i, label; for (i = 0; i < labels.length; i++) { label = labels[i]; encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label); } return encoded.join('.'); }; core-js-3.6.1/packages/core-js/internals/redefine-all.js000066400000000000000000000002721360057567700231100ustar00rootroot00000000000000var redefine = require('../internals/redefine'); module.exports = function (target, src, options) { for (var key in src) redefine(target, key, src[key], options); return target; }; core-js-3.6.1/packages/core-js/internals/redefine.js000066400000000000000000000027461360057567700223520ustar00rootroot00000000000000var global = require('../internals/global'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var has = require('../internals/has'); var setGlobal = require('../internals/set-global'); var inspectSource = require('../internals/inspect-source'); var InternalStateModule = require('../internals/internal-state'); var getInternalState = InternalStateModule.get; var enforceInternalState = InternalStateModule.enforce; var TEMPLATE = String(String).split('String'); (module.exports = function (O, key, value, options) { var unsafe = options ? !!options.unsafe : false; var simple = options ? !!options.enumerable : false; var noTargetGet = options ? !!options.noTargetGet : false; if (typeof value == 'function') { if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key); enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : ''); } if (O === global) { if (simple) O[key] = value; else setGlobal(key, value); return; } else if (!unsafe) { delete O[key]; } else if (!noTargetGet && O[key]) { simple = true; } if (simple) O[key] = value; else createNonEnumerableProperty(O, key, value); // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, 'toString', function toString() { return typeof this == 'function' && getInternalState(this).source || inspectSource(this); }); core-js-3.6.1/packages/core-js/internals/reflect-metadata.js000066400000000000000000000035341360057567700237670ustar00rootroot00000000000000// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` var Map = require('../modules/es.map'); var WeakMap = require('../modules/es.weak-map'); var shared = require('../internals/shared'); var metadata = shared('metadata'); var store = metadata.store || (metadata.store = new WeakMap()); var getOrCreateMetadataMap = function (target, targetKey, create) { var targetMetadata = store.get(target); if (!targetMetadata) { if (!create) return; store.set(target, targetMetadata = new Map()); } var keyMetadata = targetMetadata.get(targetKey); if (!keyMetadata) { if (!create) return; targetMetadata.set(targetKey, keyMetadata = new Map()); } return keyMetadata; }; var ordinaryHasOwnMetadata = function (MetadataKey, O, P) { var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? false : metadataMap.has(MetadataKey); }; var ordinaryGetOwnMetadata = function (MetadataKey, O, P) { var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); }; var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) { getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); }; var ordinaryOwnMetadataKeys = function (target, targetKey) { var metadataMap = getOrCreateMetadataMap(target, targetKey, false); var keys = []; if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); }); return keys; }; var toMetadataKey = function (it) { return it === undefined || typeof it == 'symbol' ? it : String(it); }; module.exports = { store: store, getMap: getOrCreateMetadataMap, has: ordinaryHasOwnMetadata, get: ordinaryGetOwnMetadata, set: ordinaryDefineOwnMetadata, keys: ordinaryOwnMetadataKeys, toKey: toMetadataKey }; core-js-3.6.1/packages/core-js/internals/regexp-exec-abstract.js000066400000000000000000000011261360057567700245750ustar00rootroot00000000000000var classof = require('./classof-raw'); var regexpExec = require('./regexp-exec'); // `RegExpExec` abstract operation // https://tc39.github.io/ecma262/#sec-regexpexec module.exports = function (R, S) { var exec = R.exec; if (typeof exec === 'function') { var result = exec.call(R, S); if (typeof result !== 'object') { throw TypeError('RegExp exec method returned something other than an Object or null'); } return result; } if (classof(R) !== 'RegExp') { throw TypeError('RegExp#exec called on incompatible receiver'); } return regexpExec.call(R, S); }; core-js-3.6.1/packages/core-js/internals/regexp-exec.js000066400000000000000000000054001360057567700227730ustar00rootroot00000000000000'use strict'; var regexpFlags = require('./regexp-flags'); var stickyHelpers = require('./regexp-sticky-helpers'); var nativeExec = RegExp.prototype.exec; // This always refers to the native implementation, because the // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, // which loads this file before patching the method. var nativeReplace = String.prototype.replace; var patchedExec = nativeExec; var UPDATES_LAST_INDEX_WRONG = (function () { var re1 = /a/; var re2 = /b*/g; nativeExec.call(re1, 'a'); nativeExec.call(re2, 'a'); return re1.lastIndex !== 0 || re2.lastIndex !== 0; })(); var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET; // nonparticipating capturing group, copied from es5-shim's String#split patch. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y; if (PATCH) { patchedExec = function exec(str) { var re = this; var lastIndex, reCopy, match, i; var sticky = UNSUPPORTED_Y && re.sticky; var flags = regexpFlags.call(re); var source = re.source; var charsAdded = 0; var strCopy = str; if (sticky) { flags = flags.replace('y', ''); if (flags.indexOf('g') === -1) { flags += 'g'; } strCopy = String(str).slice(re.lastIndex); // Support anchored sticky behavior. if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) { source = '(?: ' + source + ')'; strCopy = ' ' + strCopy; charsAdded++; } // ^(? + rx + ) is needed, in combination with some str slicing, to // simulate the 'y' flag. reCopy = new RegExp('^(?:' + source + ')', flags); } if (NPCG_INCLUDED) { reCopy = new RegExp('^' + source + '$(?!\\s)', flags); } if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; match = nativeExec.call(sticky ? reCopy : re, strCopy); if (sticky) { if (match) { match.input = match.input.slice(charsAdded); match[0] = match[0].slice(charsAdded); match.index = re.lastIndex; re.lastIndex += match[0].length; } else re.lastIndex = 0; } else if (UPDATES_LAST_INDEX_WRONG && match) { re.lastIndex = re.global ? match.index + match[0].length : lastIndex; } if (NPCG_INCLUDED && match && match.length > 1) { // Fix browsers whose `exec` methods don't consistently return `undefined` // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ nativeReplace.call(match[0], reCopy, function () { for (i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undefined) match[i] = undefined; } }); } return match; }; } module.exports = patchedExec; core-js-3.6.1/packages/core-js/internals/regexp-flags.js000066400000000000000000000007541360057567700231520ustar00rootroot00000000000000'use strict'; var anObject = require('../internals/an-object'); // `RegExp.prototype.flags` getter implementation // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags module.exports = function () { var that = anObject(this); var result = ''; if (that.global) result += 'g'; if (that.ignoreCase) result += 'i'; if (that.multiline) result += 'm'; if (that.dotAll) result += 's'; if (that.unicode) result += 'u'; if (that.sticky) result += 'y'; return result; }; core-js-3.6.1/packages/core-js/internals/regexp-sticky-helpers.js000066400000000000000000000011341360057567700250150ustar00rootroot00000000000000'use strict'; var fails = require('./fails'); // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError, // so we use an intermediate function. function RE(s, f) { return RegExp(s, f); } exports.UNSUPPORTED_Y = fails(function () { // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError var re = RE('a', 'y'); re.lastIndex = 2; return re.exec('abcd') != null; }); exports.BROKEN_CARET = fails(function () { // https://bugzilla.mozilla.org/show_bug.cgi?id=773687 var re = RE('^r', 'gy'); re.lastIndex = 2; return re.exec('str') != null; }); core-js-3.6.1/packages/core-js/internals/require-object-coercible.js000066400000000000000000000003441360057567700254260ustar00rootroot00000000000000// `RequireObjectCoercible` abstract operation // https://tc39.github.io/ecma262/#sec-requireobjectcoercible module.exports = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; core-js-3.6.1/packages/core-js/internals/same-value-zero.js000066400000000000000000000003251360057567700235740ustar00rootroot00000000000000// `SameValueZero` abstract operation // https://tc39.github.io/ecma262/#sec-samevaluezero module.exports = function (x, y) { // eslint-disable-next-line no-self-compare return x === y || x != x && y != y; }; core-js-3.6.1/packages/core-js/internals/same-value.js000066400000000000000000000003701360057567700226170ustar00rootroot00000000000000// `SameValue` abstract operation // https://tc39.github.io/ecma262/#sec-samevalue module.exports = Object.is || function is(x, y) { // eslint-disable-next-line no-self-compare return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; }; core-js-3.6.1/packages/core-js/internals/set-global.js000066400000000000000000000004601360057567700226110ustar00rootroot00000000000000var global = require('../internals/global'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); module.exports = function (key, value) { try { createNonEnumerableProperty(global, key, value); } catch (error) { global[key] = value; } return value; }; core-js-3.6.1/packages/core-js/internals/set-species.js000066400000000000000000000011761360057567700230110ustar00rootroot00000000000000'use strict'; var getBuiltIn = require('../internals/get-built-in'); var definePropertyModule = require('../internals/object-define-property'); var wellKnownSymbol = require('../internals/well-known-symbol'); var DESCRIPTORS = require('../internals/descriptors'); var SPECIES = wellKnownSymbol('species'); module.exports = function (CONSTRUCTOR_NAME) { var Constructor = getBuiltIn(CONSTRUCTOR_NAME); var defineProperty = definePropertyModule.f; if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) { defineProperty(Constructor, SPECIES, { configurable: true, get: function () { return this; } }); } }; core-js-3.6.1/packages/core-js/internals/set-to-string-tag.js000066400000000000000000000006511360057567700240520ustar00rootroot00000000000000var defineProperty = require('../internals/object-define-property').f; var has = require('../internals/has'); var wellKnownSymbol = require('../internals/well-known-symbol'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); module.exports = function (it, TAG, STATIC) { if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG }); } }; core-js-3.6.1/packages/core-js/internals/shared-key.js000066400000000000000000000003041360057567700226110ustar00rootroot00000000000000var shared = require('../internals/shared'); var uid = require('../internals/uid'); var keys = shared('keys'); module.exports = function (key) { return keys[key] || (keys[key] = uid(key)); }; core-js-3.6.1/packages/core-js/internals/shared-store.js000066400000000000000000000003231360057567700231560ustar00rootroot00000000000000var global = require('../internals/global'); var setGlobal = require('../internals/set-global'); var SHARED = '__core-js_shared__'; var store = global[SHARED] || setGlobal(SHARED, {}); module.exports = store; core-js-3.6.1/packages/core-js/internals/shared.js000066400000000000000000000005401360057567700220250ustar00rootroot00000000000000var IS_PURE = require('../internals/is-pure'); var store = require('../internals/shared-store'); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ version: '3.6.1', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2019 Denis Pushkarev (zloirock.ru)' }); core-js-3.6.1/packages/core-js/internals/sloppy-array-method.js000066400000000000000000000005011360057567700244740ustar00rootroot00000000000000'use strict'; var fails = require('../internals/fails'); module.exports = function (METHOD_NAME, argument) { var method = [][METHOD_NAME]; return !method || !fails(function () { // eslint-disable-next-line no-useless-call,no-throw-literal method.call(null, argument || function () { throw 1; }, 1); }); }; core-js-3.6.1/packages/core-js/internals/species-constructor.js000066400000000000000000000010041360057567700245710ustar00rootroot00000000000000var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var wellKnownSymbol = require('../internals/well-known-symbol'); var SPECIES = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation // https://tc39.github.io/ecma262/#sec-speciesconstructor module.exports = function (O, defaultConstructor) { var C = anObject(O).constructor; var S; return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S); }; core-js-3.6.1/packages/core-js/internals/string-multibyte.js000066400000000000000000000021761360057567700241100ustar00rootroot00000000000000var toInteger = require('../internals/to-integer'); var requireObjectCoercible = require('../internals/require-object-coercible'); // `String.prototype.{ codePointAt, at }` methods implementation var createMethod = function (CONVERT_TO_STRING) { return function ($this, pos) { var S = String(requireObjectCoercible($this)); var position = toInteger(pos); var size = S.length; var first, second; if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; first = S.charCodeAt(position); return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; }; }; module.exports = { // `String.prototype.codePointAt` method // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat codeAt: createMethod(false), // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at charAt: createMethod(true) }; core-js-3.6.1/packages/core-js/internals/string-pad.js000066400000000000000000000023651360057567700226360ustar00rootroot00000000000000// https://github.com/tc39/proposal-string-pad-start-end var toLength = require('../internals/to-length'); var repeat = require('../internals/string-repeat'); var requireObjectCoercible = require('../internals/require-object-coercible'); var ceil = Math.ceil; // `String.prototype.{ padStart, padEnd }` methods implementation var createMethod = function (IS_END) { return function ($this, maxLength, fillString) { var S = String(requireObjectCoercible($this)); var stringLength = S.length; var fillStr = fillString === undefined ? ' ' : String(fillString); var intMaxLength = toLength(maxLength); var fillLen, stringFiller; if (intMaxLength <= stringLength || fillStr == '') return S; fillLen = intMaxLength - stringLength; stringFiller = repeat.call(fillStr, ceil(fillLen / fillStr.length)); if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen); return IS_END ? S + stringFiller : stringFiller + S; }; }; module.exports = { // `String.prototype.padStart` method // https://tc39.github.io/ecma262/#sec-string.prototype.padstart start: createMethod(false), // `String.prototype.padEnd` method // https://tc39.github.io/ecma262/#sec-string.prototype.padend end: createMethod(true) }; core-js-3.6.1/packages/core-js/internals/string-repeat.js000066400000000000000000000011041360057567700233400ustar00rootroot00000000000000'use strict'; var toInteger = require('../internals/to-integer'); var requireObjectCoercible = require('../internals/require-object-coercible'); // `String.prototype.repeat` method implementation // https://tc39.github.io/ecma262/#sec-string.prototype.repeat module.exports = ''.repeat || function repeat(count) { var str = String(requireObjectCoercible(this)); var result = ''; var n = toInteger(count); if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions'); for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str; return result; }; core-js-3.6.1/packages/core-js/internals/string-trim.js000066400000000000000000000020671360057567700230440ustar00rootroot00000000000000var requireObjectCoercible = require('../internals/require-object-coercible'); var whitespaces = require('../internals/whitespaces'); var whitespace = '[' + whitespaces + ']'; var ltrim = RegExp('^' + whitespace + whitespace + '*'); var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation var createMethod = function (TYPE) { return function ($this) { var string = String(requireObjectCoercible($this)); if (TYPE & 1) string = string.replace(ltrim, ''); if (TYPE & 2) string = string.replace(rtrim, ''); return string; }; }; module.exports = { // `String.prototype.{ trimLeft, trimStart }` methods // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart start: createMethod(1), // `String.prototype.{ trimRight, trimEnd }` methods // https://tc39.github.io/ecma262/#sec-string.prototype.trimend end: createMethod(2), // `String.prototype.trim` method // https://tc39.github.io/ecma262/#sec-string.prototype.trim trim: createMethod(3) }; core-js-3.6.1/packages/core-js/internals/task.js000066400000000000000000000055261360057567700215320ustar00rootroot00000000000000var global = require('../internals/global'); var fails = require('../internals/fails'); var classof = require('../internals/classof-raw'); var bind = require('../internals/bind-context'); var html = require('../internals/html'); var createElement = require('../internals/document-create-element'); var IS_IOS = require('../internals/is-ios'); var location = global.location; var set = global.setImmediate; var clear = global.clearImmediate; var process = global.process; var MessageChannel = global.MessageChannel; var Dispatch = global.Dispatch; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var defer, channel, port; var run = function (id) { // eslint-disable-next-line no-prototype-builtins if (queue.hasOwnProperty(id)) { var fn = queue[id]; delete queue[id]; fn(); } }; var runner = function (id) { return function () { run(id); }; }; var listener = function (event) { run(event.data); }; var post = function (id) { // old engines have not location.origin global.postMessage(id + '', location.protocol + '//' + location.host); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!set || !clear) { set = function setImmediate(fn) { var args = []; var i = 1; while (arguments.length > i) args.push(arguments[i++]); queue[++counter] = function () { // eslint-disable-next-line no-new-func (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args); }; defer(counter); return counter; }; clear = function clearImmediate(id) { delete queue[id]; }; // Node.js 0.8- if (classof(process) == 'process') { defer = function (id) { process.nextTick(runner(id)); }; // Sphere (JS game engine) Dispatch API } else if (Dispatch && Dispatch.now) { defer = function (id) { Dispatch.now(runner(id)); }; // Browsers with MessageChannel, includes WebWorkers // except iOS - https://github.com/zloirock/core-js/issues/624 } else if (MessageChannel && !IS_IOS) { channel = new MessageChannel(); port = channel.port2; channel.port1.onmessage = listener; defer = bind(port.postMessage, port, 1); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts && !fails(post)) { defer = post; global.addEventListener('message', listener, false); // IE8- } else if (ONREADYSTATECHANGE in createElement('script')) { defer = function (id) { html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () { html.removeChild(this); run(id); }; }; // Rest old browsers } else { defer = function (id) { setTimeout(runner(id), 0); }; } } module.exports = { set: set, clear: clear }; core-js-3.6.1/packages/core-js/internals/this-number-value.js000066400000000000000000000004741360057567700241340ustar00rootroot00000000000000var classof = require('../internals/classof-raw'); // `thisNumberValue` abstract operation // https://tc39.github.io/ecma262/#sec-thisnumbervalue module.exports = function (value) { if (typeof value != 'number' && classof(value) != 'Number') { throw TypeError('Incorrect invocation'); } return +value; }; core-js-3.6.1/packages/core-js/internals/to-absolute-index.js000066400000000000000000000006671360057567700241340ustar00rootroot00000000000000var toInteger = require('../internals/to-integer'); var max = Math.max; var min = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). module.exports = function (index, length) { var integer = toInteger(index); return integer < 0 ? max(integer + length, 0) : min(integer, length); }; core-js-3.6.1/packages/core-js/internals/to-index.js000066400000000000000000000006201360057567700223050ustar00rootroot00000000000000var toInteger = require('../internals/to-integer'); var toLength = require('../internals/to-length'); // `ToIndex` abstract operation // https://tc39.github.io/ecma262/#sec-toindex module.exports = function (it) { if (it === undefined) return 0; var number = toInteger(it); var length = toLength(number); if (number !== length) throw RangeError('Wrong length or index'); return length; }; core-js-3.6.1/packages/core-js/internals/to-indexed-object.js000066400000000000000000000004351360057567700240660ustar00rootroot00000000000000// toObject with fallback for non-array-like ES3 strings var IndexedObject = require('../internals/indexed-object'); var requireObjectCoercible = require('../internals/require-object-coercible'); module.exports = function (it) { return IndexedObject(requireObjectCoercible(it)); }; core-js-3.6.1/packages/core-js/internals/to-integer.js000066400000000000000000000004001360057567700226270ustar00rootroot00000000000000var ceil = Math.ceil; var floor = Math.floor; // `ToInteger` abstract operation // https://tc39.github.io/ecma262/#sec-tointeger module.exports = function (argument) { return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); }; core-js-3.6.1/packages/core-js/internals/to-length.js000066400000000000000000000004601360057567700224610ustar00rootroot00000000000000var toInteger = require('../internals/to-integer'); var min = Math.min; // `ToLength` abstract operation // https://tc39.github.io/ecma262/#sec-tolength module.exports = function (argument) { return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; core-js-3.6.1/packages/core-js/internals/to-object.js000066400000000000000000000003761360057567700224540ustar00rootroot00000000000000var requireObjectCoercible = require('../internals/require-object-coercible'); // `ToObject` abstract operation // https://tc39.github.io/ecma262/#sec-toobject module.exports = function (argument) { return Object(requireObjectCoercible(argument)); }; core-js-3.6.1/packages/core-js/internals/to-offset.js000066400000000000000000000003401360057567700224630ustar00rootroot00000000000000var toPositiveInteger = require('../internals/to-positive-integer'); module.exports = function (it, BYTES) { var offset = toPositiveInteger(it); if (offset % BYTES) throw RangeError('Wrong offset'); return offset; }; core-js-3.6.1/packages/core-js/internals/to-positive-integer.js000066400000000000000000000003211360057567700244710ustar00rootroot00000000000000var toInteger = require('../internals/to-integer'); module.exports = function (it) { var result = toInteger(it); if (result < 0) throw RangeError("The argument can't be less than 0"); return result; }; core-js-3.6.1/packages/core-js/internals/to-primitive.js000066400000000000000000000014131360057567700232070ustar00rootroot00000000000000var isObject = require('../internals/is-object'); // `ToPrimitive` abstract operation // https://tc39.github.io/ecma262/#sec-toprimitive // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function (input, PREFERRED_STRING) { if (!isObject(input)) return input; var fn, val; if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; throw TypeError("Can't convert object to primitive value"); }; core-js-3.6.1/packages/core-js/internals/to-string-tag-support.js000066400000000000000000000003221360057567700247660ustar00rootroot00000000000000var wellKnownSymbol = require('../internals/well-known-symbol'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var test = {}; test[TO_STRING_TAG] = 'z'; module.exports = String(test) === '[object z]'; core-js-3.6.1/packages/core-js/internals/typed-array-constructor.js000066400000000000000000000227301360057567700254100ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var global = require('../internals/global'); var DESCRIPTORS = require('../internals/descriptors'); var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-arrays-constructors-requires-wrappers'); var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var ArrayBufferModule = require('../internals/array-buffer'); var anInstance = require('../internals/an-instance'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var toLength = require('../internals/to-length'); var toIndex = require('../internals/to-index'); var toOffset = require('../internals/to-offset'); var toPrimitive = require('../internals/to-primitive'); var has = require('../internals/has'); var classof = require('../internals/classof'); var isObject = require('../internals/is-object'); var create = require('../internals/object-create'); var setPrototypeOf = require('../internals/object-set-prototype-of'); var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; var typedArrayFrom = require('../internals/typed-array-from'); var forEach = require('../internals/array-iteration').forEach; var setSpecies = require('../internals/set-species'); var definePropertyModule = require('../internals/object-define-property'); var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); var InternalStateModule = require('../internals/internal-state'); var inheritIfRequired = require('../internals/inherit-if-required'); var getInternalState = InternalStateModule.get; var setInternalState = InternalStateModule.set; var nativeDefineProperty = definePropertyModule.f; var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var round = Math.round; var RangeError = global.RangeError; var ArrayBuffer = ArrayBufferModule.ArrayBuffer; var DataView = ArrayBufferModule.DataView; var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; var TYPED_ARRAY_TAG = ArrayBufferViewCore.TYPED_ARRAY_TAG; var TypedArray = ArrayBufferViewCore.TypedArray; var TypedArrayPrototype = ArrayBufferViewCore.TypedArrayPrototype; var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; var isTypedArray = ArrayBufferViewCore.isTypedArray; var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; var WRONG_LENGTH = 'Wrong length'; var fromList = function (C, list) { var index = 0; var length = list.length; var result = new (aTypedArrayConstructor(C))(length); while (length > index) result[index] = list[index++]; return result; }; var addGetter = function (it, key) { nativeDefineProperty(it, key, { get: function () { return getInternalState(this)[key]; } }); }; var isArrayBuffer = function (it) { var klass; return it instanceof ArrayBuffer || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer'; }; var isTypedArrayIndex = function (target, key) { return isTypedArray(target) && typeof key != 'symbol' && key in target && String(+key) == String(key); }; var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) { return isTypedArrayIndex(target, key = toPrimitive(key, true)) ? createPropertyDescriptor(2, target[key]) : nativeGetOwnPropertyDescriptor(target, key); }; var wrappedDefineProperty = function defineProperty(target, key, descriptor) { if (isTypedArrayIndex(target, key = toPrimitive(key, true)) && isObject(descriptor) && has(descriptor, 'value') && !has(descriptor, 'get') && !has(descriptor, 'set') // TODO: add validation descriptor w/o calling accessors && !descriptor.configurable && (!has(descriptor, 'writable') || descriptor.writable) && (!has(descriptor, 'enumerable') || descriptor.enumerable) ) { target[key] = descriptor.value; return target; } return nativeDefineProperty(target, key, descriptor); }; if (DESCRIPTORS) { if (!NATIVE_ARRAY_BUFFER_VIEWS) { getOwnPropertyDescriptorModule.f = wrappedGetOwnPropertyDescriptor; definePropertyModule.f = wrappedDefineProperty; addGetter(TypedArrayPrototype, 'buffer'); addGetter(TypedArrayPrototype, 'byteOffset'); addGetter(TypedArrayPrototype, 'byteLength'); addGetter(TypedArrayPrototype, 'length'); } $({ target: 'Object', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, { getOwnPropertyDescriptor: wrappedGetOwnPropertyDescriptor, defineProperty: wrappedDefineProperty }); module.exports = function (TYPE, wrapper, CLAMPED) { var BYTES = TYPE.match(/\d+$/)[0] / 8; var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array'; var GETTER = 'get' + TYPE; var SETTER = 'set' + TYPE; var NativeTypedArrayConstructor = global[CONSTRUCTOR_NAME]; var TypedArrayConstructor = NativeTypedArrayConstructor; var TypedArrayConstructorPrototype = TypedArrayConstructor && TypedArrayConstructor.prototype; var exported = {}; var getter = function (that, index) { var data = getInternalState(that); return data.view[GETTER](index * BYTES + data.byteOffset, true); }; var setter = function (that, index, value) { var data = getInternalState(that); if (CLAMPED) value = (value = round(value)) < 0 ? 0 : value > 0xFF ? 0xFF : value & 0xFF; data.view[SETTER](index * BYTES + data.byteOffset, value, true); }; var addElement = function (that, index) { nativeDefineProperty(that, index, { get: function () { return getter(this, index); }, set: function (value) { return setter(this, index, value); }, enumerable: true }); }; if (!NATIVE_ARRAY_BUFFER_VIEWS) { TypedArrayConstructor = wrapper(function (that, data, offset, $length) { anInstance(that, TypedArrayConstructor, CONSTRUCTOR_NAME); var index = 0; var byteOffset = 0; var buffer, byteLength, length; if (!isObject(data)) { length = toIndex(data); byteLength = length * BYTES; buffer = new ArrayBuffer(byteLength); } else if (isArrayBuffer(data)) { buffer = data; byteOffset = toOffset(offset, BYTES); var $len = data.byteLength; if ($length === undefined) { if ($len % BYTES) throw RangeError(WRONG_LENGTH); byteLength = $len - byteOffset; if (byteLength < 0) throw RangeError(WRONG_LENGTH); } else { byteLength = toLength($length) * BYTES; if (byteLength + byteOffset > $len) throw RangeError(WRONG_LENGTH); } length = byteLength / BYTES; } else if (isTypedArray(data)) { return fromList(TypedArrayConstructor, data); } else { return typedArrayFrom.call(TypedArrayConstructor, data); } setInternalState(that, { buffer: buffer, byteOffset: byteOffset, byteLength: byteLength, length: length, view: new DataView(buffer) }); while (index < length) addElement(that, index++); }); if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray); TypedArrayConstructorPrototype = TypedArrayConstructor.prototype = create(TypedArrayPrototype); } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) { TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) { anInstance(dummy, TypedArrayConstructor, CONSTRUCTOR_NAME); return inheritIfRequired(function () { if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data)); if (isArrayBuffer(data)) return $length !== undefined ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES), $length) : typedArrayOffset !== undefined ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES)) : new NativeTypedArrayConstructor(data); if (isTypedArray(data)) return fromList(TypedArrayConstructor, data); return typedArrayFrom.call(TypedArrayConstructor, data); }(), dummy, TypedArrayConstructor); }); if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray); forEach(getOwnPropertyNames(NativeTypedArrayConstructor), function (key) { if (!(key in TypedArrayConstructor)) { createNonEnumerableProperty(TypedArrayConstructor, key, NativeTypedArrayConstructor[key]); } }); TypedArrayConstructor.prototype = TypedArrayConstructorPrototype; } if (TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor) { createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor); } if (TYPED_ARRAY_TAG) { createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME); } exported[CONSTRUCTOR_NAME] = TypedArrayConstructor; $({ global: true, forced: TypedArrayConstructor != NativeTypedArrayConstructor, sham: !NATIVE_ARRAY_BUFFER_VIEWS }, exported); if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) { createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES); } if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) { createNonEnumerableProperty(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES); } setSpecies(CONSTRUCTOR_NAME); }; } else module.exports = function () { /* empty */ }; core-js-3.6.1/packages/core-js/internals/typed-array-from.js000066400000000000000000000023311360057567700237610ustar00rootroot00000000000000var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); var getIteratorMethod = require('../internals/get-iterator-method'); var isArrayIteratorMethod = require('../internals/is-array-iterator-method'); var bind = require('../internals/bind-context'); var aTypedArrayConstructor = require('../internals/array-buffer-view-core').aTypedArrayConstructor; module.exports = function from(source /* , mapfn, thisArg */) { var O = toObject(source); var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; var iteratorMethod = getIteratorMethod(O); var i, length, result, step, iterator, next; if (iteratorMethod != undefined && !isArrayIteratorMethod(iteratorMethod)) { iterator = iteratorMethod.call(O); next = iterator.next; O = []; while (!(step = next.call(iterator)).done) { O.push(step.value); } } if (mapping && argumentsLength > 2) { mapfn = bind(mapfn, arguments[2], 2); } length = toLength(O.length); result = new (aTypedArrayConstructor(this))(length); for (i = 0; length > i; i++) { result[i] = mapping ? mapfn(O[i], i) : O[i]; } return result; }; core-js-3.6.1/packages/core-js/internals/typed-arrays-constructors-requires-wrappers.js000066400000000000000000000015341360057567700314530ustar00rootroot00000000000000/* eslint-disable no-new */ var global = require('../internals/global'); var fails = require('../internals/fails'); var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); var NATIVE_ARRAY_BUFFER_VIEWS = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER_VIEWS; var ArrayBuffer = global.ArrayBuffer; var Int8Array = global.Int8Array; module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () { Int8Array(1); }) || !fails(function () { new Int8Array(-1); }) || !checkCorrectnessOfIteration(function (iterable) { new Int8Array(); new Int8Array(null); new Int8Array(1.5); new Int8Array(iterable); }, true) || fails(function () { // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill return new Int8Array(new ArrayBuffer(2), 1, undefined).length !== 1; }); core-js-3.6.1/packages/core-js/internals/uid.js000066400000000000000000000002611360057567700213400ustar00rootroot00000000000000var id = 0; var postfix = Math.random(); module.exports = function (key) { return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); }; core-js-3.6.1/packages/core-js/internals/use-symbol-as-uid.js000066400000000000000000000003441360057567700240400ustar00rootroot00000000000000var NATIVE_SYMBOL = require('../internals/native-symbol'); module.exports = NATIVE_SYMBOL // eslint-disable-next-line no-undef && !Symbol.sham // eslint-disable-next-line no-undef && typeof Symbol.iterator == 'symbol'; core-js-3.6.1/packages/core-js/internals/user-agent.js000066400000000000000000000001651360057567700226340ustar00rootroot00000000000000var getBuiltIn = require('../internals/get-built-in'); module.exports = getBuiltIn('navigator', 'userAgent') || ''; core-js-3.6.1/packages/core-js/internals/v8-version.js000066400000000000000000000010111360057567700225710ustar00rootroot00000000000000var global = require('../internals/global'); var userAgent = require('../internals/user-agent'); var process = global.process; var versions = process && process.versions; var v8 = versions && versions.v8; var match, version; if (v8) { match = v8.split('.'); version = match[0] + match[1]; } else if (userAgent) { match = userAgent.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent.match(/Chrome\/(\d+)/); if (match) version = match[1]; } } module.exports = version && +version; core-js-3.6.1/packages/core-js/internals/webkit-string-pad-bug.js000066400000000000000000000003601360057567700246650ustar00rootroot00000000000000// https://github.com/zloirock/core-js/issues/280 var userAgent = require('../internals/user-agent'); // eslint-disable-next-line unicorn/no-unsafe-regex module.exports = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent); core-js-3.6.1/packages/core-js/internals/well-known-symbol.js000066400000000000000000000013601360057567700241600ustar00rootroot00000000000000var global = require('../internals/global'); var shared = require('../internals/shared'); var has = require('../internals/has'); var uid = require('../internals/uid'); var NATIVE_SYMBOL = require('../internals/native-symbol'); var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid'); var WellKnownSymbolsStore = shared('wks'); var Symbol = global.Symbol; var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid; module.exports = function (name) { if (!has(WellKnownSymbolsStore, name)) { if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name]; else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); } return WellKnownSymbolsStore[name]; }; core-js-3.6.1/packages/core-js/internals/whitespaces.js000066400000000000000000000003741360057567700231030ustar00rootroot00000000000000// a string of all valid unicode whitespaces // eslint-disable-next-line max-len module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; core-js-3.6.1/packages/core-js/internals/wrapped-well-known-symbol.js000066400000000000000000000001371360057567700256210ustar00rootroot00000000000000var wellKnownSymbol = require('../internals/well-known-symbol'); exports.f = wellKnownSymbol; core-js-3.6.1/packages/core-js/modules/000077500000000000000000000000001360057567700176735ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/modules/README.md000066400000000000000000000002441360057567700211520ustar00rootroot00000000000000This folder contains implementations of polyfills. It's not recommended to include in your projects directly if you don't completely understand what are you doing. core-js-3.6.1/packages/core-js/modules/es.array-buffer.constructor.js000066400000000000000000000010631360057567700256100ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var global = require('../internals/global'); var arrayBufferModule = require('../internals/array-buffer'); var setSpecies = require('../internals/set-species'); var ARRAY_BUFFER = 'ArrayBuffer'; var ArrayBuffer = arrayBufferModule[ARRAY_BUFFER]; var NativeArrayBuffer = global[ARRAY_BUFFER]; // `ArrayBuffer` constructor // https://tc39.github.io/ecma262/#sec-arraybuffer-constructor $({ global: true, forced: NativeArrayBuffer !== ArrayBuffer }, { ArrayBuffer: ArrayBuffer }); setSpecies(ARRAY_BUFFER); core-js-3.6.1/packages/core-js/modules/es.array-buffer.is-view.js000066400000000000000000000006241360057567700246100ustar00rootroot00000000000000var $ = require('../internals/export'); var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; // `ArrayBuffer.isView` method // https://tc39.github.io/ecma262/#sec-arraybuffer.isview $({ target: 'ArrayBuffer', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, { isView: ArrayBufferViewCore.isView }); core-js-3.6.1/packages/core-js/modules/es.array-buffer.slice.js000066400000000000000000000027421360057567700243270ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var fails = require('../internals/fails'); var ArrayBufferModule = require('../internals/array-buffer'); var anObject = require('../internals/an-object'); var toAbsoluteIndex = require('../internals/to-absolute-index'); var toLength = require('../internals/to-length'); var speciesConstructor = require('../internals/species-constructor'); var ArrayBuffer = ArrayBufferModule.ArrayBuffer; var DataView = ArrayBufferModule.DataView; var nativeArrayBufferSlice = ArrayBuffer.prototype.slice; var INCORRECT_SLICE = fails(function () { return !new ArrayBuffer(2).slice(1, undefined).byteLength; }); // `ArrayBuffer.prototype.slice` method // https://tc39.github.io/ecma262/#sec-arraybuffer.prototype.slice $({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, { slice: function slice(start, end) { if (nativeArrayBufferSlice !== undefined && end === undefined) { return nativeArrayBufferSlice.call(anObject(this), start); // FF fix } var length = anObject(this).byteLength; var first = toAbsoluteIndex(start, length); var fin = toAbsoluteIndex(end === undefined ? length : end, length); var result = new (speciesConstructor(this, ArrayBuffer))(toLength(fin - first)); var viewSource = new DataView(this); var viewTarget = new DataView(result); var index = 0; while (first < fin) { viewTarget.setUint8(index++, viewSource.getUint8(first++)); } return result; } }); core-js-3.6.1/packages/core-js/modules/es.array.concat.js000066400000000000000000000045321360057567700232270ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var fails = require('../internals/fails'); var isArray = require('../internals/is-array'); var isObject = require('../internals/is-object'); var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); var createProperty = require('../internals/create-property'); var arraySpeciesCreate = require('../internals/array-species-create'); var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); var wellKnownSymbol = require('../internals/well-known-symbol'); var V8_VERSION = require('../internals/v8-version'); var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/679 var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () { var array = []; array[IS_CONCAT_SPREADABLE] = false; return array.concat()[0] !== array; }); var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); var isConcatSpreadable = function (O) { if (!isObject(O)) return false; var spreadable = O[IS_CONCAT_SPREADABLE]; return spreadable !== undefined ? !!spreadable : isArray(O); }; var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; // `Array.prototype.concat` method // https://tc39.github.io/ecma262/#sec-array.prototype.concat // with adding support of @@isConcatSpreadable and @@species $({ target: 'Array', proto: true, forced: FORCED }, { concat: function concat(arg) { // eslint-disable-line no-unused-vars var O = toObject(this); var A = arraySpeciesCreate(O, 0); var n = 0; var i, k, length, len, E; for (i = -1, length = arguments.length; i < length; i++) { E = i === -1 ? O : arguments[i]; if (isConcatSpreadable(E)) { len = toLength(E.length); if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); } else { if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); createProperty(A, n++, E); } } A.length = n; return A; } }); core-js-3.6.1/packages/core-js/modules/es.array.copy-within.js000066400000000000000000000006721360057567700242330ustar00rootroot00000000000000var $ = require('../internals/export'); var copyWithin = require('../internals/array-copy-within'); var addToUnscopables = require('../internals/add-to-unscopables'); // `Array.prototype.copyWithin` method // https://tc39.github.io/ecma262/#sec-array.prototype.copywithin $({ target: 'Array', proto: true }, { copyWithin: copyWithin }); // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('copyWithin'); core-js-3.6.1/packages/core-js/modules/es.array.every.js000066400000000000000000000007651360057567700231160ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $every = require('../internals/array-iteration').every; var sloppyArrayMethod = require('../internals/sloppy-array-method'); // `Array.prototype.every` method // https://tc39.github.io/ecma262/#sec-array.prototype.every $({ target: 'Array', proto: true, forced: sloppyArrayMethod('every') }, { every: function every(callbackfn /* , thisArg */) { return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); core-js-3.6.1/packages/core-js/modules/es.array.fill.js000066400000000000000000000006171360057567700227060ustar00rootroot00000000000000var $ = require('../internals/export'); var fill = require('../internals/array-fill'); var addToUnscopables = require('../internals/add-to-unscopables'); // `Array.prototype.fill` method // https://tc39.github.io/ecma262/#sec-array.prototype.fill $({ target: 'Array', proto: true }, { fill: fill }); // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('fill'); core-js-3.6.1/packages/core-js/modules/es.array.filter.js000066400000000000000000000015171360057567700232450ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $filter = require('../internals/array-iteration').filter; var fails = require('../internals/fails'); var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); // Edge 14- issue var USES_TO_LENGTH = HAS_SPECIES_SUPPORT && !fails(function () { [].filter.call({ length: -1, 0: 1 }, function (it) { throw it; }); }); // `Array.prototype.filter` method // https://tc39.github.io/ecma262/#sec-array.prototype.filter // with adding support of @@species $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, { filter: function filter(callbackfn /* , thisArg */) { return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); core-js-3.6.1/packages/core-js/modules/es.array.find-index.js000066400000000000000000000014171360057567700240040ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $findIndex = require('../internals/array-iteration').findIndex; var addToUnscopables = require('../internals/add-to-unscopables'); var FIND_INDEX = 'findIndex'; var SKIPS_HOLES = true; // Shouldn't skip holes if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; }); // `Array.prototype.findIndex` method // https://tc39.github.io/ecma262/#sec-array.prototype.findindex $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { findIndex: function findIndex(callbackfn /* , that = undefined */) { return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables(FIND_INDEX); core-js-3.6.1/packages/core-js/modules/es.array.find.js000066400000000000000000000013171360057567700226760ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $find = require('../internals/array-iteration').find; var addToUnscopables = require('../internals/add-to-unscopables'); var FIND = 'find'; var SKIPS_HOLES = true; // Shouldn't skip holes if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); // `Array.prototype.find` method // https://tc39.github.io/ecma262/#sec-array.prototype.find $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { find: function find(callbackfn /* , that = undefined */) { return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables(FIND); core-js-3.6.1/packages/core-js/modules/es.array.flat-map.js000066400000000000000000000014431360057567700234570ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var flattenIntoArray = require('../internals/flatten-into-array'); var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); var aFunction = require('../internals/a-function'); var arraySpeciesCreate = require('../internals/array-species-create'); // `Array.prototype.flatMap` method // https://github.com/tc39/proposal-flatMap $({ target: 'Array', proto: true }, { flatMap: function flatMap(callbackfn /* , thisArg */) { var O = toObject(this); var sourceLen = toLength(O.length); var A; aFunction(callbackfn); A = arraySpeciesCreate(O, 0); A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined); return A; } }); core-js-3.6.1/packages/core-js/modules/es.array.flat.js000066400000000000000000000014421360057567700227030ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var flattenIntoArray = require('../internals/flatten-into-array'); var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); var toInteger = require('../internals/to-integer'); var arraySpeciesCreate = require('../internals/array-species-create'); // `Array.prototype.flat` method // https://github.com/tc39/proposal-flatMap $({ target: 'Array', proto: true }, { flat: function flat(/* depthArg = 1 */) { var depthArg = arguments.length ? arguments[0] : undefined; var O = toObject(this); var sourceLen = toLength(O.length); var A = arraySpeciesCreate(O, 0); A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg)); return A; } }); core-js-3.6.1/packages/core-js/modules/es.array.for-each.js000066400000000000000000000004541360057567700234430ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var forEach = require('../internals/array-for-each'); // `Array.prototype.forEach` method // https://tc39.github.io/ecma262/#sec-array.prototype.foreach $({ target: 'Array', proto: true, forced: [].forEach != forEach }, { forEach: forEach }); core-js-3.6.1/packages/core-js/modules/es.array.from.js000066400000000000000000000006701360057567700227220ustar00rootroot00000000000000var $ = require('../internals/export'); var from = require('../internals/array-from'); var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { Array.from(iterable); }); // `Array.from` method // https://tc39.github.io/ecma262/#sec-array.from $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { from: from }); core-js-3.6.1/packages/core-js/modules/es.array.includes.js000066400000000000000000000010751360057567700235650ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $includes = require('../internals/array-includes').includes; var addToUnscopables = require('../internals/add-to-unscopables'); // `Array.prototype.includes` method // https://tc39.github.io/ecma262/#sec-array.prototype.includes $({ target: 'Array', proto: true }, { includes: function includes(el /* , fromIndex = 0 */) { return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('includes'); core-js-3.6.1/packages/core-js/modules/es.array.index-of.js000066400000000000000000000014131360057567700234640ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $indexOf = require('../internals/array-includes').indexOf; var sloppyArrayMethod = require('../internals/sloppy-array-method'); var nativeIndexOf = [].indexOf; var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0; var SLOPPY_METHOD = sloppyArrayMethod('indexOf'); // `Array.prototype.indexOf` method // https://tc39.github.io/ecma262/#sec-array.prototype.indexof $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, { indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { return NEGATIVE_ZERO // convert -0 to +0 ? nativeIndexOf.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined); } }); core-js-3.6.1/packages/core-js/modules/es.array.is-array.js000066400000000000000000000003441360057567700235040ustar00rootroot00000000000000var $ = require('../internals/export'); var isArray = require('../internals/is-array'); // `Array.isArray` method // https://tc39.github.io/ecma262/#sec-array.isarray $({ target: 'Array', stat: true }, { isArray: isArray }); core-js-3.6.1/packages/core-js/modules/es.array.iterator.js000066400000000000000000000042501360057567700236060ustar00rootroot00000000000000'use strict'; var toIndexedObject = require('../internals/to-indexed-object'); var addToUnscopables = require('../internals/add-to-unscopables'); var Iterators = require('../internals/iterators'); var InternalStateModule = require('../internals/internal-state'); var defineIterator = require('../internals/define-iterator'); var ARRAY_ITERATOR = 'Array Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method // https://tc39.github.io/ecma262/#sec-array.prototype.entries // `Array.prototype.keys` method // https://tc39.github.io/ecma262/#sec-array.prototype.keys // `Array.prototype.values` method // https://tc39.github.io/ecma262/#sec-array.prototype.values // `Array.prototype[@@iterator]` method // https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator // `CreateArrayIterator` internal method // https://tc39.github.io/ecma262/#sec-createarrayiterator module.exports = defineIterator(Array, 'Array', function (iterated, kind) { setInternalState(this, { type: ARRAY_ITERATOR, target: toIndexedObject(iterated), // target index: 0, // next index kind: kind // kind }); // `%ArrayIteratorPrototype%.next` method // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next }, function () { var state = getInternalState(this); var target = state.target; var kind = state.kind; var index = state.index++; if (!target || index >= target.length) { state.target = undefined; return { value: undefined, done: true }; } if (kind == 'keys') return { value: index, done: false }; if (kind == 'values') return { value: target[index], done: false }; return { value: [index, target[index]], done: false }; }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% // https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject // https://tc39.github.io/ecma262/#sec-createmappedargumentsobject Iterators.Arguments = Iterators.Array; // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); core-js-3.6.1/packages/core-js/modules/es.array.join.js000066400000000000000000000012461360057567700227160ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IndexedObject = require('../internals/indexed-object'); var toIndexedObject = require('../internals/to-indexed-object'); var sloppyArrayMethod = require('../internals/sloppy-array-method'); var nativeJoin = [].join; var ES3_STRINGS = IndexedObject != Object; var SLOPPY_METHOD = sloppyArrayMethod('join', ','); // `Array.prototype.join` method // https://tc39.github.io/ecma262/#sec-array.prototype.join $({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, { join: function join(separator) { return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator); } }); core-js-3.6.1/packages/core-js/modules/es.array.last-index-of.js000066400000000000000000000005001360057567700244210ustar00rootroot00000000000000var $ = require('../internals/export'); var lastIndexOf = require('../internals/array-last-index-of'); // `Array.prototype.lastIndexOf` method // https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof $({ target: 'Array', proto: true, forced: lastIndexOf !== [].lastIndexOf }, { lastIndexOf: lastIndexOf }); core-js-3.6.1/packages/core-js/modules/es.array.map.js000066400000000000000000000014611360057567700225330ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $map = require('../internals/array-iteration').map; var fails = require('../internals/fails'); var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map'); // FF49- issue var USES_TO_LENGTH = HAS_SPECIES_SUPPORT && !fails(function () { [].map.call({ length: -1, 0: 1 }, function (it) { throw it; }); }); // `Array.prototype.map` method // https://tc39.github.io/ecma262/#sec-array.prototype.map // with adding support of @@species $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, { map: function map(callbackfn /* , thisArg */) { return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); core-js-3.6.1/packages/core-js/modules/es.array.of.js000066400000000000000000000014021360057567700223550ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var fails = require('../internals/fails'); var createProperty = require('../internals/create-property'); var ISNT_GENERIC = fails(function () { function F() { /* empty */ } return !(Array.of.call(F) instanceof F); }); // `Array.of` method // https://tc39.github.io/ecma262/#sec-array.of // WebKit Array.of isn't generic $({ target: 'Array', stat: true, forced: ISNT_GENERIC }, { of: function of(/* ...args */) { var index = 0; var argumentsLength = arguments.length; var result = new (typeof this == 'function' ? this : Array)(argumentsLength); while (argumentsLength > index) createProperty(result, index, arguments[index++]); result.length = argumentsLength; return result; } }); core-js-3.6.1/packages/core-js/modules/es.array.reduce-right.js000066400000000000000000000010631360057567700243360ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $reduceRight = require('../internals/array-reduce').right; var sloppyArrayMethod = require('../internals/sloppy-array-method'); // `Array.prototype.reduceRight` method // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright $({ target: 'Array', proto: true, forced: sloppyArrayMethod('reduceRight') }, { reduceRight: function reduceRight(callbackfn /* , initialValue */) { return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); } }); core-js-3.6.1/packages/core-js/modules/es.array.reduce.js000066400000000000000000000010171360057567700232220ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $reduce = require('../internals/array-reduce').left; var sloppyArrayMethod = require('../internals/sloppy-array-method'); // `Array.prototype.reduce` method // https://tc39.github.io/ecma262/#sec-array.prototype.reduce $({ target: 'Array', proto: true, forced: sloppyArrayMethod('reduce') }, { reduce: function reduce(callbackfn /* , initialValue */) { return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); } }); core-js-3.6.1/packages/core-js/modules/es.array.reverse.js000066400000000000000000000011201360057567700234210ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var isArray = require('../internals/is-array'); var nativeReverse = [].reverse; var test = [1, 2]; // `Array.prototype.reverse` method // https://tc39.github.io/ecma262/#sec-array.prototype.reverse // fix for Safari 12.0 bug // https://bugs.webkit.org/show_bug.cgi?id=188794 $({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, { reverse: function reverse() { // eslint-disable-next-line no-self-assign if (isArray(this)) this.length = this.length; return nativeReverse.call(this); } }); core-js-3.6.1/packages/core-js/modules/es.array.slice.js000066400000000000000000000036321360057567700230570ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var isObject = require('../internals/is-object'); var isArray = require('../internals/is-array'); var toAbsoluteIndex = require('../internals/to-absolute-index'); var toLength = require('../internals/to-length'); var toIndexedObject = require('../internals/to-indexed-object'); var createProperty = require('../internals/create-property'); var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); var wellKnownSymbol = require('../internals/well-known-symbol'); var SPECIES = wellKnownSymbol('species'); var nativeSlice = [].slice; var max = Math.max; // `Array.prototype.slice` method // https://tc39.github.io/ecma262/#sec-array.prototype.slice // fallback for not array-like ES3 strings and DOM objects $({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('slice') }, { slice: function slice(start, end) { var O = toIndexedObject(this); var length = toLength(O.length); var k = toAbsoluteIndex(start, length); var fin = toAbsoluteIndex(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible var Constructor, result, n; if (isArray(O)) { Constructor = O.constructor; // cross-realm fallback if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) { Constructor = undefined; } else if (isObject(Constructor)) { Constructor = Constructor[SPECIES]; if (Constructor === null) Constructor = undefined; } if (Constructor === Array || Constructor === undefined) { return nativeSlice.call(O, k, fin); } } result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0)); for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]); result.length = n; return result; } }); core-js-3.6.1/packages/core-js/modules/es.array.some.js000066400000000000000000000007551360057567700227260ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $some = require('../internals/array-iteration').some; var sloppyArrayMethod = require('../internals/sloppy-array-method'); // `Array.prototype.some` method // https://tc39.github.io/ecma262/#sec-array.prototype.some $({ target: 'Array', proto: true, forced: sloppyArrayMethod('some') }, { some: function some(callbackfn /* , thisArg */) { return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); core-js-3.6.1/packages/core-js/modules/es.array.sort.js000066400000000000000000000016361360057567700227510ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var toObject = require('../internals/to-object'); var fails = require('../internals/fails'); var sloppyArrayMethod = require('../internals/sloppy-array-method'); var test = []; var nativeSort = test.sort; // IE8- var FAILS_ON_UNDEFINED = fails(function () { test.sort(undefined); }); // V8 bug var FAILS_ON_NULL = fails(function () { test.sort(null); }); // Old WebKit var SLOPPY_METHOD = sloppyArrayMethod('sort'); var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD; // `Array.prototype.sort` method // https://tc39.github.io/ecma262/#sec-array.prototype.sort $({ target: 'Array', proto: true, forced: FORCED }, { sort: function sort(comparefn) { return comparefn === undefined ? nativeSort.call(toObject(this)) : nativeSort.call(toObject(this), aFunction(comparefn)); } }); core-js-3.6.1/packages/core-js/modules/es.array.species.js000066400000000000000000000002441360057567700234070ustar00rootroot00000000000000var setSpecies = require('../internals/set-species'); // `Array[@@species]` getter // https://tc39.github.io/ecma262/#sec-get-array-@@species setSpecies('Array'); core-js-3.6.1/packages/core-js/modules/es.array.splice.js000066400000000000000000000050461360057567700232400ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var toAbsoluteIndex = require('../internals/to-absolute-index'); var toInteger = require('../internals/to-integer'); var toLength = require('../internals/to-length'); var toObject = require('../internals/to-object'); var arraySpeciesCreate = require('../internals/array-species-create'); var createProperty = require('../internals/create-property'); var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support'); var max = Math.max; var min = Math.min; var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; // `Array.prototype.splice` method // https://tc39.github.io/ecma262/#sec-array.prototype.splice // with adding support of @@species $({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('splice') }, { splice: function splice(start, deleteCount /* , ...items */) { var O = toObject(this); var len = toLength(O.length); var actualStart = toAbsoluteIndex(start, len); var argumentsLength = arguments.length; var insertCount, actualDeleteCount, A, k, from, to; if (argumentsLength === 0) { insertCount = actualDeleteCount = 0; } else if (argumentsLength === 1) { insertCount = 0; actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart); } if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) { throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); } A = arraySpeciesCreate(O, actualDeleteCount); for (k = 0; k < actualDeleteCount; k++) { from = actualStart + k; if (from in O) createProperty(A, k, O[from]); } A.length = actualDeleteCount; if (insertCount < actualDeleteCount) { for (k = actualStart; k < len - actualDeleteCount; k++) { from = k + actualDeleteCount; to = k + insertCount; if (from in O) O[to] = O[from]; else delete O[to]; } for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1]; } else if (insertCount > actualDeleteCount) { for (k = len - actualDeleteCount; k > actualStart; k--) { from = k + actualDeleteCount - 1; to = k + insertCount - 1; if (from in O) O[to] = O[from]; else delete O[to]; } } for (k = 0; k < insertCount; k++) { O[k + actualStart] = arguments[k + 2]; } O.length = len - actualDeleteCount + insertCount; return A; } }); core-js-3.6.1/packages/core-js/modules/es.array.unscopables.flat-map.js000066400000000000000000000003301360057567700257660ustar00rootroot00000000000000// this method was added to unscopables after implementation // in popular engines, so it's moved to a separate module var addToUnscopables = require('../internals/add-to-unscopables'); addToUnscopables('flatMap'); core-js-3.6.1/packages/core-js/modules/es.array.unscopables.flat.js000066400000000000000000000003251360057567700252170ustar00rootroot00000000000000// this method was added to unscopables after implementation // in popular engines, so it's moved to a separate module var addToUnscopables = require('../internals/add-to-unscopables'); addToUnscopables('flat'); core-js-3.6.1/packages/core-js/modules/es.data-view.js000066400000000000000000000005721360057567700225240ustar00rootroot00000000000000var $ = require('../internals/export'); var ArrayBufferModule = require('../internals/array-buffer'); var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER; // `DataView` constructor // https://tc39.github.io/ecma262/#sec-dataview-constructor $({ global: true, forced: !NATIVE_ARRAY_BUFFER }, { DataView: ArrayBufferModule.DataView }); core-js-3.6.1/packages/core-js/modules/es.date.now.js000066400000000000000000000003231360057567700223540ustar00rootroot00000000000000var $ = require('../internals/export'); // `Date.now` method // https://tc39.github.io/ecma262/#sec-date.now $({ target: 'Date', stat: true }, { now: function now() { return new Date().getTime(); } }); core-js-3.6.1/packages/core-js/modules/es.date.to-iso-string.js000066400000000000000000000005771360057567700243020ustar00rootroot00000000000000var $ = require('../internals/export'); var toISOString = require('../internals/date-to-iso-string'); // `Date.prototype.toISOString` method // https://tc39.github.io/ecma262/#sec-date.prototype.toisostring // PhantomJS / old WebKit has a broken implementations $({ target: 'Date', proto: true, forced: Date.prototype.toISOString !== toISOString }, { toISOString: toISOString }); core-js-3.6.1/packages/core-js/modules/es.date.to-json.js000066400000000000000000000013371360057567700231500ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var fails = require('../internals/fails'); var toObject = require('../internals/to-object'); var toPrimitive = require('../internals/to-primitive'); var FORCED = fails(function () { return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; }); // `Date.prototype.toJSON` method // https://tc39.github.io/ecma262/#sec-date.prototype.tojson $({ target: 'Date', proto: true, forced: FORCED }, { // eslint-disable-next-line no-unused-vars toJSON: function toJSON(key) { var O = toObject(this); var pv = toPrimitive(O); return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); } }); core-js-3.6.1/packages/core-js/modules/es.date.to-primitive.js000066400000000000000000000010321360057567700241770ustar00rootroot00000000000000var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var dateToPrimitive = require('../internals/date-to-primitive'); var wellKnownSymbol = require('../internals/well-known-symbol'); var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); var DatePrototype = Date.prototype; // `Date.prototype[@@toPrimitive]` method // https://tc39.github.io/ecma262/#sec-date.prototype-@@toprimitive if (!(TO_PRIMITIVE in DatePrototype)) { createNonEnumerableProperty(DatePrototype, TO_PRIMITIVE, dateToPrimitive); } core-js-3.6.1/packages/core-js/modules/es.date.to-string.js000066400000000000000000000011351360057567700235010ustar00rootroot00000000000000var redefine = require('../internals/redefine'); var DatePrototype = Date.prototype; var INVALID_DATE = 'Invalid Date'; var TO_STRING = 'toString'; var nativeDateToString = DatePrototype[TO_STRING]; var getTime = DatePrototype.getTime; // `Date.prototype.toString` method // https://tc39.github.io/ecma262/#sec-date.prototype.tostring if (new Date(NaN) + '' != INVALID_DATE) { redefine(DatePrototype, TO_STRING, function toString() { var value = getTime.call(this); // eslint-disable-next-line no-self-compare return value === value ? nativeDateToString.call(this) : INVALID_DATE; }); } core-js-3.6.1/packages/core-js/modules/es.function.bind.js000066400000000000000000000003701360057567700233770ustar00rootroot00000000000000var $ = require('../internals/export'); var bind = require('../internals/function-bind'); // `Function.prototype.bind` method // https://tc39.github.io/ecma262/#sec-function.prototype.bind $({ target: 'Function', proto: true }, { bind: bind }); core-js-3.6.1/packages/core-js/modules/es.function.has-instance.js000066400000000000000000000016451360057567700250460ustar00rootroot00000000000000'use strict'; var isObject = require('../internals/is-object'); var definePropertyModule = require('../internals/object-define-property'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var wellKnownSymbol = require('../internals/well-known-symbol'); var HAS_INSTANCE = wellKnownSymbol('hasInstance'); var FunctionPrototype = Function.prototype; // `Function.prototype[@@hasInstance]` method // https://tc39.github.io/ecma262/#sec-function.prototype-@@hasinstance if (!(HAS_INSTANCE in FunctionPrototype)) { definePropertyModule.f(FunctionPrototype, HAS_INSTANCE, { value: function (O) { if (typeof this != 'function' || !isObject(O)) return false; if (!isObject(this.prototype)) return O instanceof this; // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: while (O = getPrototypeOf(O)) if (this.prototype === O) return true; return false; } }); } core-js-3.6.1/packages/core-js/modules/es.function.name.js000066400000000000000000000012501360057567700234010ustar00rootroot00000000000000var DESCRIPTORS = require('../internals/descriptors'); var defineProperty = require('../internals/object-define-property').f; var FunctionPrototype = Function.prototype; var FunctionPrototypeToString = FunctionPrototype.toString; var nameRE = /^\s*function ([^ (]*)/; var NAME = 'name'; // Function instances `.name` property // https://tc39.github.io/ecma262/#sec-function-instances-name if (DESCRIPTORS && !(NAME in FunctionPrototype)) { defineProperty(FunctionPrototype, NAME, { configurable: true, get: function () { try { return FunctionPrototypeToString.call(this).match(nameRE)[1]; } catch (error) { return ''; } } }); } core-js-3.6.1/packages/core-js/modules/es.global-this.js000066400000000000000000000003071360057567700230440ustar00rootroot00000000000000var $ = require('../internals/export'); var global = require('../internals/global'); // `globalThis` object // https://github.com/tc39/proposal-global $({ global: true }, { globalThis: global }); core-js-3.6.1/packages/core-js/modules/es.json.stringify.js000066400000000000000000000020751360057567700236310ustar00rootroot00000000000000var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); var fails = require('../internals/fails'); var $stringify = getBuiltIn('JSON', 'stringify'); var re = /[\uD800-\uDFFF]/g; var low = /^[\uD800-\uDBFF]$/; var hi = /^[\uDC00-\uDFFF]$/; var fix = function (match, offset, string) { var prev = string.charAt(offset - 1); var next = string.charAt(offset + 1); if ((low.test(match) && !hi.test(next)) || (hi.test(match) && !low.test(prev))) { return '\\u' + match.charCodeAt(0).toString(16); } return match; }; var FORCED = fails(function () { return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' || $stringify('\uDEAD') !== '"\\udead"'; }); if ($stringify) { // https://github.com/tc39/proposal-well-formed-stringify $({ target: 'JSON', stat: true, forced: FORCED }, { // eslint-disable-next-line no-unused-vars stringify: function stringify(it, replacer, space) { var result = $stringify.apply(null, arguments); return typeof result == 'string' ? result.replace(re, fix) : result; } }); } core-js-3.6.1/packages/core-js/modules/es.json.to-string-tag.js000066400000000000000000000003631360057567700243100ustar00rootroot00000000000000var global = require('../internals/global'); var setToStringTag = require('../internals/set-to-string-tag'); // JSON[@@toStringTag] property // https://tc39.github.io/ecma262/#sec-json-@@tostringtag setToStringTag(global.JSON, 'JSON', true); core-js-3.6.1/packages/core-js/modules/es.map.js000066400000000000000000000005661360057567700214230ustar00rootroot00000000000000'use strict'; var collection = require('../internals/collection'); var collectionStrong = require('../internals/collection-strong'); // `Map` constructor // https://tc39.github.io/ecma262/#sec-map-objects module.exports = collection('Map', function (init) { return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); core-js-3.6.1/packages/core-js/modules/es.math.acosh.js000066400000000000000000000013001360057567700226560ustar00rootroot00000000000000var $ = require('../internals/export'); var log1p = require('../internals/math-log1p'); var nativeAcosh = Math.acosh; var log = Math.log; var sqrt = Math.sqrt; var LN2 = Math.LN2; var FORCED = !nativeAcosh // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 || Math.floor(nativeAcosh(Number.MAX_VALUE)) != 710 // Tor Browser bug: Math.acosh(Infinity) -> NaN || nativeAcosh(Infinity) != Infinity; // `Math.acosh` method // https://tc39.github.io/ecma262/#sec-math.acosh $({ target: 'Math', stat: true, forced: FORCED }, { acosh: function acosh(x) { return (x = +x) < 1 ? NaN : x > 94906265.62425156 ? log(x) + LN2 : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); } }); core-js-3.6.1/packages/core-js/modules/es.math.asinh.js000066400000000000000000000006751360057567700227010ustar00rootroot00000000000000var $ = require('../internals/export'); var nativeAsinh = Math.asinh; var log = Math.log; var sqrt = Math.sqrt; function asinh(x) { return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1)); } // `Math.asinh` method // https://tc39.github.io/ecma262/#sec-math.asinh // Tor Browser bug: Math.asinh(0) -> -0 $({ target: 'Math', stat: true, forced: !(nativeAsinh && 1 / nativeAsinh(0) > 0) }, { asinh: asinh }); core-js-3.6.1/packages/core-js/modules/es.math.atanh.js000066400000000000000000000006041360057567700226620ustar00rootroot00000000000000var $ = require('../internals/export'); var nativeAtanh = Math.atanh; var log = Math.log; // `Math.atanh` method // https://tc39.github.io/ecma262/#sec-math.atanh // Tor Browser bug: Math.atanh(-0) -> 0 $({ target: 'Math', stat: true, forced: !(nativeAtanh && 1 / nativeAtanh(-0) < 0) }, { atanh: function atanh(x) { return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2; } }); core-js-3.6.1/packages/core-js/modules/es.math.cbrt.js000066400000000000000000000004741360057567700225260ustar00rootroot00000000000000var $ = require('../internals/export'); var sign = require('../internals/math-sign'); var abs = Math.abs; var pow = Math.pow; // `Math.cbrt` method // https://tc39.github.io/ecma262/#sec-math.cbrt $({ target: 'Math', stat: true }, { cbrt: function cbrt(x) { return sign(x = +x) * pow(abs(x), 1 / 3); } }); core-js-3.6.1/packages/core-js/modules/es.math.clz32.js000066400000000000000000000004771360057567700225340ustar00rootroot00000000000000var $ = require('../internals/export'); var floor = Math.floor; var log = Math.log; var LOG2E = Math.LOG2E; // `Math.clz32` method // https://tc39.github.io/ecma262/#sec-math.clz32 $({ target: 'Math', stat: true }, { clz32: function clz32(x) { return (x >>>= 0) ? 31 - floor(log(x + 0.5) * LOG2E) : 32; } }); core-js-3.6.1/packages/core-js/modules/es.math.cosh.js000066400000000000000000000006541360057567700225300ustar00rootroot00000000000000var $ = require('../internals/export'); var expm1 = require('../internals/math-expm1'); var nativeCosh = Math.cosh; var abs = Math.abs; var E = Math.E; // `Math.cosh` method // https://tc39.github.io/ecma262/#sec-math.cosh $({ target: 'Math', stat: true, forced: !nativeCosh || nativeCosh(710) === Infinity }, { cosh: function cosh(x) { var t = expm1(abs(x) - 1) + 1; return (t + 1 / (t * E * E)) * (E / 2); } }); core-js-3.6.1/packages/core-js/modules/es.math.expm1.js000066400000000000000000000003641360057567700226240ustar00rootroot00000000000000var $ = require('../internals/export'); var expm1 = require('../internals/math-expm1'); // `Math.expm1` method // https://tc39.github.io/ecma262/#sec-math.expm1 $({ target: 'Math', stat: true, forced: expm1 != Math.expm1 }, { expm1: expm1 }); core-js-3.6.1/packages/core-js/modules/es.math.fround.js000066400000000000000000000003351360057567700230650ustar00rootroot00000000000000var $ = require('../internals/export'); var fround = require('../internals/math-fround'); // `Math.fround` method // https://tc39.github.io/ecma262/#sec-math.fround $({ target: 'Math', stat: true }, { fround: fround }); core-js-3.6.1/packages/core-js/modules/es.math.hypot.js000066400000000000000000000015701360057567700227350ustar00rootroot00000000000000var $ = require('../internals/export'); var $hypot = Math.hypot; var abs = Math.abs; var sqrt = Math.sqrt; // Chrome 77 bug // https://bugs.chromium.org/p/v8/issues/detail?id=9546 var BUGGY = !!$hypot && $hypot(Infinity, NaN) !== Infinity; // `Math.hypot` method // https://tc39.github.io/ecma262/#sec-math.hypot $({ target: 'Math', stat: true, forced: BUGGY }, { hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars var sum = 0; var i = 0; var aLen = arguments.length; var larg = 0; var arg, div; while (i < aLen) { arg = abs(arguments[i++]); if (larg < arg) { div = larg / arg; sum = sum * div * div + 1; larg = arg; } else if (arg > 0) { div = arg / larg; sum += div * div; } else sum += arg; } return larg === Infinity ? Infinity : larg * sqrt(sum); } }); core-js-3.6.1/packages/core-js/modules/es.math.imul.js000066400000000000000000000012161360057567700225350ustar00rootroot00000000000000var $ = require('../internals/export'); var fails = require('../internals/fails'); var nativeImul = Math.imul; var FORCED = fails(function () { return nativeImul(0xFFFFFFFF, 5) != -5 || nativeImul.length != 2; }); // `Math.imul` method // https://tc39.github.io/ecma262/#sec-math.imul // some WebKit versions fails with big numbers, some has wrong arity $({ target: 'Math', stat: true, forced: FORCED }, { imul: function imul(x, y) { var UINT16 = 0xFFFF; var xn = +x; var yn = +y; var xl = UINT16 & xn; var yl = UINT16 & yn; return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); } }); core-js-3.6.1/packages/core-js/modules/es.math.log10.js000066400000000000000000000004061360057567700225110ustar00rootroot00000000000000var $ = require('../internals/export'); var log = Math.log; var LOG10E = Math.LOG10E; // `Math.log10` method // https://tc39.github.io/ecma262/#sec-math.log10 $({ target: 'Math', stat: true }, { log10: function log10(x) { return log(x) * LOG10E; } }); core-js-3.6.1/packages/core-js/modules/es.math.log1p.js000066400000000000000000000003271360057567700226130ustar00rootroot00000000000000var $ = require('../internals/export'); var log1p = require('../internals/math-log1p'); // `Math.log1p` method // https://tc39.github.io/ecma262/#sec-math.log1p $({ target: 'Math', stat: true }, { log1p: log1p }); core-js-3.6.1/packages/core-js/modules/es.math.log2.js000066400000000000000000000003711360057567700224330ustar00rootroot00000000000000var $ = require('../internals/export'); var log = Math.log; var LN2 = Math.LN2; // `Math.log2` method // https://tc39.github.io/ecma262/#sec-math.log2 $({ target: 'Math', stat: true }, { log2: function log2(x) { return log(x) / LN2; } }); core-js-3.6.1/packages/core-js/modules/es.math.sign.js000066400000000000000000000003231360057567700225250ustar00rootroot00000000000000var $ = require('../internals/export'); var sign = require('../internals/math-sign'); // `Math.sign` method // https://tc39.github.io/ecma262/#sec-math.sign $({ target: 'Math', stat: true }, { sign: sign }); core-js-3.6.1/packages/core-js/modules/es.math.sinh.js000066400000000000000000000011041360057567700225240ustar00rootroot00000000000000var $ = require('../internals/export'); var fails = require('../internals/fails'); var expm1 = require('../internals/math-expm1'); var abs = Math.abs; var exp = Math.exp; var E = Math.E; var FORCED = fails(function () { return Math.sinh(-2e-17) != -2e-17; }); // `Math.sinh` method // https://tc39.github.io/ecma262/#sec-math.sinh // V8 near Chromium 38 has a problem with very small numbers $({ target: 'Math', stat: true, forced: FORCED }, { sinh: function sinh(x) { return abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (E / 2); } }); core-js-3.6.1/packages/core-js/modules/es.math.tanh.js000066400000000000000000000006001360057567700225150ustar00rootroot00000000000000var $ = require('../internals/export'); var expm1 = require('../internals/math-expm1'); var exp = Math.exp; // `Math.tanh` method // https://tc39.github.io/ecma262/#sec-math.tanh $({ target: 'Math', stat: true }, { tanh: function tanh(x) { var a = expm1(x = +x); var b = expm1(-x); return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); } }); core-js-3.6.1/packages/core-js/modules/es.math.to-string-tag.js000066400000000000000000000002771360057567700242740ustar00rootroot00000000000000var setToStringTag = require('../internals/set-to-string-tag'); // Math[@@toStringTag] property // https://tc39.github.io/ecma262/#sec-math-@@tostringtag setToStringTag(Math, 'Math', true); core-js-3.6.1/packages/core-js/modules/es.math.trunc.js000066400000000000000000000004231360057567700227210ustar00rootroot00000000000000var $ = require('../internals/export'); var ceil = Math.ceil; var floor = Math.floor; // `Math.trunc` method // https://tc39.github.io/ecma262/#sec-math.trunc $({ target: 'Math', stat: true }, { trunc: function trunc(it) { return (it > 0 ? floor : ceil)(it); } }); core-js-3.6.1/packages/core-js/modules/es.number.constructor.js000066400000000000000000000067141360057567700245230ustar00rootroot00000000000000'use strict'; var DESCRIPTORS = require('../internals/descriptors'); var global = require('../internals/global'); var isForced = require('../internals/is-forced'); var redefine = require('../internals/redefine'); var has = require('../internals/has'); var classof = require('../internals/classof-raw'); var inheritIfRequired = require('../internals/inherit-if-required'); var toPrimitive = require('../internals/to-primitive'); var fails = require('../internals/fails'); var create = require('../internals/object-create'); var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var defineProperty = require('../internals/object-define-property').f; var trim = require('../internals/string-trim').trim; var NUMBER = 'Number'; var NativeNumber = global[NUMBER]; var NumberPrototype = NativeNumber.prototype; // Opera ~12 has broken Object#toString var BROKEN_CLASSOF = classof(create(NumberPrototype)) == NUMBER; // `ToNumber` abstract operation // https://tc39.github.io/ecma262/#sec-tonumber var toNumber = function (argument) { var it = toPrimitive(argument, false); var first, third, radix, maxCode, digits, length, index, code; if (typeof it == 'string' && it.length > 2) { it = trim(it); first = it.charCodeAt(0); if (first === 43 || first === 45) { third = it.charCodeAt(2); if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix } else if (first === 48) { switch (it.charCodeAt(1)) { case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i default: return +it; } digits = it.slice(2); length = digits.length; for (index = 0; index < length; index++) { code = digits.charCodeAt(index); // parseInt parses a string to a first unavailable symbol // but ToNumber should return NaN if a string contains unavailable symbols if (code < 48 || code > maxCode) return NaN; } return parseInt(digits, radix); } } return +it; }; // `Number` constructor // https://tc39.github.io/ecma262/#sec-number-constructor if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) { var NumberWrapper = function Number(value) { var it = arguments.length < 1 ? 0 : value; var dummy = this; return dummy instanceof NumberWrapper // check on 1..constructor(foo) case && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classof(dummy) != NUMBER) ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it); }; for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : ( // ES3: 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES2015 (in case, if modules with ES2015 Number statics required before): 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' ).split(','), j = 0, key; keys.length > j; j++) { if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) { defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key)); } } NumberWrapper.prototype = NumberPrototype; NumberPrototype.constructor = NumberWrapper; redefine(global, NUMBER, NumberWrapper); } core-js-3.6.1/packages/core-js/modules/es.number.epsilon.js000066400000000000000000000003021360057567700235720ustar00rootroot00000000000000var $ = require('../internals/export'); // `Number.EPSILON` constant // https://tc39.github.io/ecma262/#sec-number.epsilon $({ target: 'Number', stat: true }, { EPSILON: Math.pow(2, -52) }); core-js-3.6.1/packages/core-js/modules/es.number.is-finite.js000066400000000000000000000003761360057567700240230ustar00rootroot00000000000000var $ = require('../internals/export'); var numberIsFinite = require('../internals/number-is-finite'); // `Number.isFinite` method // https://tc39.github.io/ecma262/#sec-number.isfinite $({ target: 'Number', stat: true }, { isFinite: numberIsFinite }); core-js-3.6.1/packages/core-js/modules/es.number.is-integer.js000066400000000000000000000003631360057567700241760ustar00rootroot00000000000000var $ = require('../internals/export'); var isInteger = require('../internals/is-integer'); // `Number.isInteger` method // https://tc39.github.io/ecma262/#sec-number.isinteger $({ target: 'Number', stat: true }, { isInteger: isInteger }); core-js-3.6.1/packages/core-js/modules/es.number.is-nan.js000066400000000000000000000004231360057567700233120ustar00rootroot00000000000000var $ = require('../internals/export'); // `Number.isNaN` method // https://tc39.github.io/ecma262/#sec-number.isnan $({ target: 'Number', stat: true }, { isNaN: function isNaN(number) { // eslint-disable-next-line no-self-compare return number != number; } }); core-js-3.6.1/packages/core-js/modules/es.number.is-safe-integer.js000066400000000000000000000005601360057567700251110ustar00rootroot00000000000000var $ = require('../internals/export'); var isInteger = require('../internals/is-integer'); var abs = Math.abs; // `Number.isSafeInteger` method // https://tc39.github.io/ecma262/#sec-number.issafeinteger $({ target: 'Number', stat: true }, { isSafeInteger: function isSafeInteger(number) { return isInteger(number) && abs(number) <= 0x1FFFFFFFFFFFFF; } }); core-js-3.6.1/packages/core-js/modules/es.number.max-safe-integer.js000066400000000000000000000003351360057567700252630ustar00rootroot00000000000000var $ = require('../internals/export'); // `Number.MAX_SAFE_INTEGER` constant // https://tc39.github.io/ecma262/#sec-number.max_safe_integer $({ target: 'Number', stat: true }, { MAX_SAFE_INTEGER: 0x1FFFFFFFFFFFFF }); core-js-3.6.1/packages/core-js/modules/es.number.min-safe-integer.js000066400000000000000000000003361360057567700252620ustar00rootroot00000000000000var $ = require('../internals/export'); // `Number.MIN_SAFE_INTEGER` constant // https://tc39.github.io/ecma262/#sec-number.min_safe_integer $({ target: 'Number', stat: true }, { MIN_SAFE_INTEGER: -0x1FFFFFFFFFFFFF }); core-js-3.6.1/packages/core-js/modules/es.number.parse-float.js000066400000000000000000000004421360057567700243430ustar00rootroot00000000000000var $ = require('../internals/export'); var parseFloat = require('../internals/parse-float'); // `Number.parseFloat` method // https://tc39.github.io/ecma262/#sec-number.parseFloat $({ target: 'Number', stat: true, forced: Number.parseFloat != parseFloat }, { parseFloat: parseFloat }); core-js-3.6.1/packages/core-js/modules/es.number.parse-int.js000066400000000000000000000004221360057567700240260ustar00rootroot00000000000000var $ = require('../internals/export'); var parseInt = require('../internals/parse-int'); // `Number.parseInt` method // https://tc39.github.io/ecma262/#sec-number.parseint $({ target: 'Number', stat: true, forced: Number.parseInt != parseInt }, { parseInt: parseInt }); core-js-3.6.1/packages/core-js/modules/es.number.to-fixed.js000066400000000000000000000064771360057567700236630ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var toInteger = require('../internals/to-integer'); var thisNumberValue = require('../internals/this-number-value'); var repeat = require('../internals/string-repeat'); var fails = require('../internals/fails'); var nativeToFixed = 1.0.toFixed; var floor = Math.floor; var pow = function (x, n, acc) { return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); }; var log = function (x) { var n = 0; var x2 = x; while (x2 >= 4096) { n += 12; x2 /= 4096; } while (x2 >= 2) { n += 1; x2 /= 2; } return n; }; var FORCED = nativeToFixed && ( 0.00008.toFixed(3) !== '0.000' || 0.9.toFixed(0) !== '1' || 1.255.toFixed(2) !== '1.25' || 1000000000000000128.0.toFixed(0) !== '1000000000000000128' ) || !fails(function () { // V8 ~ Android 4.3- nativeToFixed.call({}); }); // `Number.prototype.toFixed` method // https://tc39.github.io/ecma262/#sec-number.prototype.tofixed $({ target: 'Number', proto: true, forced: FORCED }, { // eslint-disable-next-line max-statements toFixed: function toFixed(fractionDigits) { var number = thisNumberValue(this); var fractDigits = toInteger(fractionDigits); var data = [0, 0, 0, 0, 0, 0]; var sign = ''; var result = '0'; var e, z, j, k; var multiply = function (n, c) { var index = -1; var c2 = c; while (++index < 6) { c2 += n * data[index]; data[index] = c2 % 1e7; c2 = floor(c2 / 1e7); } }; var divide = function (n) { var index = 6; var c = 0; while (--index >= 0) { c += data[index]; data[index] = floor(c / n); c = (c % n) * 1e7; } }; var dataToString = function () { var index = 6; var s = ''; while (--index >= 0) { if (s !== '' || index === 0 || data[index] !== 0) { var t = String(data[index]); s = s === '' ? t : s + repeat.call('0', 7 - t.length) + t; } } return s; }; if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits'); // eslint-disable-next-line no-self-compare if (number != number) return 'NaN'; if (number <= -1e21 || number >= 1e21) return String(number); if (number < 0) { sign = '-'; number = -number; } if (number > 1e-21) { e = log(number * pow(2, 69, 1)) - 69; z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1); z *= 0x10000000000000; e = 52 - e; if (e > 0) { multiply(0, z); j = fractDigits; while (j >= 7) { multiply(1e7, 0); j -= 7; } multiply(pow(10, j, 1), 0); j = e - 1; while (j >= 23) { divide(1 << 23); j -= 23; } divide(1 << j); multiply(1, 1); divide(2); result = dataToString(); } else { multiply(0, z); multiply(1 << -e, 0); result = dataToString() + repeat.call('0', fractDigits); } } if (fractDigits > 0) { k = result.length; result = sign + (k <= fractDigits ? '0.' + repeat.call('0', fractDigits - k) + result : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits)); } else { result = sign + result; } return result; } }); core-js-3.6.1/packages/core-js/modules/es.number.to-precision.js000066400000000000000000000013741360057567700245460ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var fails = require('../internals/fails'); var thisNumberValue = require('../internals/this-number-value'); var nativeToPrecision = 1.0.toPrecision; var FORCED = fails(function () { // IE7- return nativeToPrecision.call(1, undefined) !== '1'; }) || !fails(function () { // V8 ~ Android 4.3- nativeToPrecision.call({}); }); // `Number.prototype.toPrecision` method // https://tc39.github.io/ecma262/#sec-number.prototype.toprecision $({ target: 'Number', proto: true, forced: FORCED }, { toPrecision: function toPrecision(precision) { return precision === undefined ? nativeToPrecision.call(thisNumberValue(this)) : nativeToPrecision.call(thisNumberValue(this), precision); } }); core-js-3.6.1/packages/core-js/modules/es.object.assign.js000066400000000000000000000004111360057567700233640ustar00rootroot00000000000000var $ = require('../internals/export'); var assign = require('../internals/object-assign'); // `Object.assign` method // https://tc39.github.io/ecma262/#sec-object.assign $({ target: 'Object', stat: true, forced: Object.assign !== assign }, { assign: assign }); core-js-3.6.1/packages/core-js/modules/es.object.create.js000066400000000000000000000004621360057567700233510ustar00rootroot00000000000000var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var create = require('../internals/object-create'); // `Object.create` method // https://tc39.github.io/ecma262/#sec-object.create $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, { create: create }); core-js-3.6.1/packages/core-js/modules/es.object.define-getter.js000066400000000000000000000013601360057567700246260ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var FORCED = require('../internals/forced-object-prototype-accessors-methods'); var toObject = require('../internals/to-object'); var aFunction = require('../internals/a-function'); var definePropertyModule = require('../internals/object-define-property'); // `Object.prototype.__defineGetter__` method // https://tc39.github.io/ecma262/#sec-object.prototype.__defineGetter__ if (DESCRIPTORS) { $({ target: 'Object', proto: true, forced: FORCED }, { __defineGetter__: function __defineGetter__(P, getter) { definePropertyModule.f(toObject(this), P, { get: aFunction(getter), enumerable: true, configurable: true }); } }); } core-js-3.6.1/packages/core-js/modules/es.object.define-properties.js000066400000000000000000000006051360057567700255310ustar00rootroot00000000000000var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var defineProperties = require('../internals/object-define-properties'); // `Object.defineProperties` method // https://tc39.github.io/ecma262/#sec-object.defineproperties $({ target: 'Object', stat: true, forced: !DESCRIPTORS, sham: !DESCRIPTORS }, { defineProperties: defineProperties }); core-js-3.6.1/packages/core-js/modules/es.object.define-property.js000066400000000000000000000006231360057567700252210ustar00rootroot00000000000000var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var objectDefinePropertyModile = require('../internals/object-define-property'); // `Object.defineProperty` method // https://tc39.github.io/ecma262/#sec-object.defineproperty $({ target: 'Object', stat: true, forced: !DESCRIPTORS, sham: !DESCRIPTORS }, { defineProperty: objectDefinePropertyModile.f }); core-js-3.6.1/packages/core-js/modules/es.object.define-setter.js000066400000000000000000000013601360057567700246420ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var FORCED = require('../internals/forced-object-prototype-accessors-methods'); var toObject = require('../internals/to-object'); var aFunction = require('../internals/a-function'); var definePropertyModule = require('../internals/object-define-property'); // `Object.prototype.__defineSetter__` method // https://tc39.github.io/ecma262/#sec-object.prototype.__defineSetter__ if (DESCRIPTORS) { $({ target: 'Object', proto: true, forced: FORCED }, { __defineSetter__: function __defineSetter__(P, setter) { definePropertyModule.f(toObject(this), P, { set: aFunction(setter), enumerable: true, configurable: true }); } }); } core-js-3.6.1/packages/core-js/modules/es.object.entries.js000066400000000000000000000004411360057567700235540ustar00rootroot00000000000000var $ = require('../internals/export'); var $entries = require('../internals/object-to-array').entries; // `Object.entries` method // https://tc39.github.io/ecma262/#sec-object.entries $({ target: 'Object', stat: true }, { entries: function entries(O) { return $entries(O); } }); core-js-3.6.1/packages/core-js/modules/es.object.freeze.js000066400000000000000000000011661360057567700233700ustar00rootroot00000000000000var $ = require('../internals/export'); var FREEZING = require('../internals/freezing'); var fails = require('../internals/fails'); var isObject = require('../internals/is-object'); var onFreeze = require('../internals/internal-metadata').onFreeze; var nativeFreeze = Object.freeze; var FAILS_ON_PRIMITIVES = fails(function () { nativeFreeze(1); }); // `Object.freeze` method // https://tc39.github.io/ecma262/#sec-object.freeze $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, { freeze: function freeze(it) { return nativeFreeze && isObject(it) ? nativeFreeze(onFreeze(it)) : it; } }); core-js-3.6.1/packages/core-js/modules/es.object.from-entries.js000066400000000000000000000007171360057567700245230ustar00rootroot00000000000000var $ = require('../internals/export'); var iterate = require('../internals/iterate'); var createProperty = require('../internals/create-property'); // `Object.fromEntries` method // https://github.com/tc39/proposal-object-from-entries $({ target: 'Object', stat: true }, { fromEntries: function fromEntries(iterable) { var obj = {}; iterate(iterable, function (k, v) { createProperty(obj, k, v); }, undefined, true); return obj; } }); core-js-3.6.1/packages/core-js/modules/es.object.get-own-property-descriptor.js000066400000000000000000000014121360057567700275200ustar00rootroot00000000000000var $ = require('../internals/export'); var fails = require('../internals/fails'); var toIndexedObject = require('../internals/to-indexed-object'); var nativeGetOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var DESCRIPTORS = require('../internals/descriptors'); var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); }); var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES; // `Object.getOwnPropertyDescriptor` method // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor $({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key); } }); core-js-3.6.1/packages/core-js/modules/es.object.get-own-property-descriptors.js000066400000000000000000000020041360057567700277010ustar00rootroot00000000000000var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var ownKeys = require('../internals/own-keys'); var toIndexedObject = require('../internals/to-indexed-object'); var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); var createProperty = require('../internals/create-property'); // `Object.getOwnPropertyDescriptors` method // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, { getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { var O = toIndexedObject(object); var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var keys = ownKeys(O); var result = {}; var index = 0; var key, descriptor; while (keys.length > index) { descriptor = getOwnPropertyDescriptor(O, key = keys[index++]); if (descriptor !== undefined) createProperty(result, key, descriptor); } return result; } }); core-js-3.6.1/packages/core-js/modules/es.object.get-own-property-names.js000066400000000000000000000007611360057567700264530ustar00rootroot00000000000000var $ = require('../internals/export'); var fails = require('../internals/fails'); var nativeGetOwnPropertyNames = require('../internals/object-get-own-property-names-external').f; var FAILS_ON_PRIMITIVES = fails(function () { return !Object.getOwnPropertyNames(1); }); // `Object.getOwnPropertyNames` method // https://tc39.github.io/ecma262/#sec-object.getownpropertynames $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { getOwnPropertyNames: nativeGetOwnPropertyNames }); core-js-3.6.1/packages/core-js/modules/es.object.get-prototype-of.js000066400000000000000000000012321360057567700253260ustar00rootroot00000000000000var $ = require('../internals/export'); var fails = require('../internals/fails'); var toObject = require('../internals/to-object'); var nativeGetPrototypeOf = require('../internals/object-get-prototype-of'); var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter'); var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); }); // `Object.getPrototypeOf` method // https://tc39.github.io/ecma262/#sec-object.getprototypeof $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, { getPrototypeOf: function getPrototypeOf(it) { return nativeGetPrototypeOf(toObject(it)); } }); core-js-3.6.1/packages/core-js/modules/es.object.is-extensible.js000066400000000000000000000010461360057567700246600ustar00rootroot00000000000000var $ = require('../internals/export'); var fails = require('../internals/fails'); var isObject = require('../internals/is-object'); var nativeIsExtensible = Object.isExtensible; var FAILS_ON_PRIMITIVES = fails(function () { nativeIsExtensible(1); }); // `Object.isExtensible` method // https://tc39.github.io/ecma262/#sec-object.isextensible $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { isExtensible: function isExtensible(it) { return isObject(it) ? nativeIsExtensible ? nativeIsExtensible(it) : true : false; } }); core-js-3.6.1/packages/core-js/modules/es.object.is-frozen.js000066400000000000000000000010021360057567700240110ustar00rootroot00000000000000var $ = require('../internals/export'); var fails = require('../internals/fails'); var isObject = require('../internals/is-object'); var nativeIsFrozen = Object.isFrozen; var FAILS_ON_PRIMITIVES = fails(function () { nativeIsFrozen(1); }); // `Object.isFrozen` method // https://tc39.github.io/ecma262/#sec-object.isfrozen $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { isFrozen: function isFrozen(it) { return isObject(it) ? nativeIsFrozen ? nativeIsFrozen(it) : false : true; } }); core-js-3.6.1/packages/core-js/modules/es.object.is-sealed.js000066400000000000000000000010021360057567700237430ustar00rootroot00000000000000var $ = require('../internals/export'); var fails = require('../internals/fails'); var isObject = require('../internals/is-object'); var nativeIsSealed = Object.isSealed; var FAILS_ON_PRIMITIVES = fails(function () { nativeIsSealed(1); }); // `Object.isSealed` method // https://tc39.github.io/ecma262/#sec-object.issealed $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { isSealed: function isSealed(it) { return isObject(it) ? nativeIsSealed ? nativeIsSealed(it) : false : true; } }); core-js-3.6.1/packages/core-js/modules/es.object.is.js000066400000000000000000000003201360057567700225120ustar00rootroot00000000000000var $ = require('../internals/export'); var is = require('../internals/same-value'); // `Object.is` method // https://tc39.github.io/ecma262/#sec-object.is $({ target: 'Object', stat: true }, { is: is }); core-js-3.6.1/packages/core-js/modules/es.object.keys.js000066400000000000000000000007251360057567700230630ustar00rootroot00000000000000var $ = require('../internals/export'); var toObject = require('../internals/to-object'); var nativeKeys = require('../internals/object-keys'); var fails = require('../internals/fails'); var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); }); // `Object.keys` method // https://tc39.github.io/ecma262/#sec-object.keys $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { keys: function keys(it) { return nativeKeys(toObject(it)); } }); core-js-3.6.1/packages/core-js/modules/es.object.lookup-getter.js000066400000000000000000000016351360057567700247120ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var FORCED = require('../internals/forced-object-prototype-accessors-methods'); var toObject = require('../internals/to-object'); var toPrimitive = require('../internals/to-primitive'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; // `Object.prototype.__lookupGetter__` method // https://tc39.github.io/ecma262/#sec-object.prototype.__lookupGetter__ if (DESCRIPTORS) { $({ target: 'Object', proto: true, forced: FORCED }, { __lookupGetter__: function __lookupGetter__(P) { var O = toObject(this); var key = toPrimitive(P, true); var desc; do { if (desc = getOwnPropertyDescriptor(O, key)) return desc.get; } while (O = getPrototypeOf(O)); } }); } core-js-3.6.1/packages/core-js/modules/es.object.lookup-setter.js000066400000000000000000000016351360057567700247260ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var FORCED = require('../internals/forced-object-prototype-accessors-methods'); var toObject = require('../internals/to-object'); var toPrimitive = require('../internals/to-primitive'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; // `Object.prototype.__lookupSetter__` method // https://tc39.github.io/ecma262/#sec-object.prototype.__lookupSetter__ if (DESCRIPTORS) { $({ target: 'Object', proto: true, forced: FORCED }, { __lookupSetter__: function __lookupSetter__(P) { var O = toObject(this); var key = toPrimitive(P, true); var desc; do { if (desc = getOwnPropertyDescriptor(O, key)) return desc.set; } while (O = getPrototypeOf(O)); } }); } core-js-3.6.1/packages/core-js/modules/es.object.prevent-extensions.js000066400000000000000000000013311360057567700257620ustar00rootroot00000000000000var $ = require('../internals/export'); var isObject = require('../internals/is-object'); var onFreeze = require('../internals/internal-metadata').onFreeze; var FREEZING = require('../internals/freezing'); var fails = require('../internals/fails'); var nativePreventExtensions = Object.preventExtensions; var FAILS_ON_PRIMITIVES = fails(function () { nativePreventExtensions(1); }); // `Object.preventExtensions` method // https://tc39.github.io/ecma262/#sec-object.preventextensions $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, { preventExtensions: function preventExtensions(it) { return nativePreventExtensions && isObject(it) ? nativePreventExtensions(onFreeze(it)) : it; } }); core-js-3.6.1/packages/core-js/modules/es.object.seal.js000066400000000000000000000011441360057567700230300ustar00rootroot00000000000000var $ = require('../internals/export'); var isObject = require('../internals/is-object'); var onFreeze = require('../internals/internal-metadata').onFreeze; var FREEZING = require('../internals/freezing'); var fails = require('../internals/fails'); var nativeSeal = Object.seal; var FAILS_ON_PRIMITIVES = fails(function () { nativeSeal(1); }); // `Object.seal` method // https://tc39.github.io/ecma262/#sec-object.seal $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, { seal: function seal(it) { return nativeSeal && isObject(it) ? nativeSeal(onFreeze(it)) : it; } }); core-js-3.6.1/packages/core-js/modules/es.object.set-prototype-of.js000066400000000000000000000004311360057567700253420ustar00rootroot00000000000000var $ = require('../internals/export'); var setPrototypeOf = require('../internals/object-set-prototype-of'); // `Object.setPrototypeOf` method // https://tc39.github.io/ecma262/#sec-object.setprototypeof $({ target: 'Object', stat: true }, { setPrototypeOf: setPrototypeOf }); core-js-3.6.1/packages/core-js/modules/es.object.to-string.js000066400000000000000000000006031360057567700240310ustar00rootroot00000000000000var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support'); var redefine = require('../internals/redefine'); var toString = require('../internals/object-to-string'); // `Object.prototype.toString` method // https://tc39.github.io/ecma262/#sec-object.prototype.tostring if (!TO_STRING_TAG_SUPPORT) { redefine(Object.prototype, 'toString', toString, { unsafe: true }); } core-js-3.6.1/packages/core-js/modules/es.object.values.js000066400000000000000000000004321360057567700234020ustar00rootroot00000000000000var $ = require('../internals/export'); var $values = require('../internals/object-to-array').values; // `Object.values` method // https://tc39.github.io/ecma262/#sec-object.values $({ target: 'Object', stat: true }, { values: function values(O) { return $values(O); } }); core-js-3.6.1/packages/core-js/modules/es.parse-float.js000066400000000000000000000004561360057567700230610ustar00rootroot00000000000000var $ = require('../internals/export'); var parseFloatImplementation = require('../internals/parse-float'); // `parseFloat` method // https://tc39.github.io/ecma262/#sec-parsefloat-string $({ global: true, forced: parseFloat != parseFloatImplementation }, { parseFloat: parseFloatImplementation }); core-js-3.6.1/packages/core-js/modules/es.parse-int.js000066400000000000000000000004441360057567700225430ustar00rootroot00000000000000var $ = require('../internals/export'); var parseIntImplementation = require('../internals/parse-int'); // `parseInt` method // https://tc39.github.io/ecma262/#sec-parseint-string-radix $({ global: true, forced: parseInt != parseIntImplementation }, { parseInt: parseIntImplementation }); core-js-3.6.1/packages/core-js/modules/es.promise.all-settled.js000066400000000000000000000027471360057567700245400ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var newPromiseCapabilityModule = require('../internals/new-promise-capability'); var perform = require('../internals/perform'); var iterate = require('../internals/iterate'); // `Promise.allSettled` method // https://github.com/tc39/proposal-promise-allSettled $({ target: 'Promise', stat: true }, { allSettled: function allSettled(iterable) { var C = this; var capability = newPromiseCapabilityModule.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var promiseResolve = aFunction(C.resolve); var values = []; var counter = 0; var remaining = 1; iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; values.push(undefined); remaining++; promiseResolve.call(C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = { status: 'fulfilled', value: value }; --remaining || resolve(values); }, function (e) { if (alreadyCalled) return; alreadyCalled = true; values[index] = { status: 'rejected', reason: e }; --remaining || resolve(values); }); }); --remaining || resolve(values); }); if (result.error) reject(result.value); return capability.promise; } }); core-js-3.6.1/packages/core-js/modules/es.promise.finally.js000066400000000000000000000030351360057567700237530ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var NativePromise = require('../internals/native-promise-constructor'); var fails = require('../internals/fails'); var getBuiltIn = require('../internals/get-built-in'); var speciesConstructor = require('../internals/species-constructor'); var promiseResolve = require('../internals/promise-resolve'); var redefine = require('../internals/redefine'); // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829 var NON_GENERIC = !!NativePromise && fails(function () { NativePromise.prototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ }); }); // `Promise.prototype.finally` method // https://tc39.github.io/ecma262/#sec-promise.prototype.finally $({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, { 'finally': function (onFinally) { var C = speciesConstructor(this, getBuiltIn('Promise')); var isFunction = typeof onFinally == 'function'; return this.then( isFunction ? function (x) { return promiseResolve(C, onFinally()).then(function () { return x; }); } : onFinally, isFunction ? function (e) { return promiseResolve(C, onFinally()).then(function () { throw e; }); } : onFinally ); } }); // patch native Promise.prototype for native async functions if (!IS_PURE && typeof NativePromise == 'function' && !NativePromise.prototype['finally']) { redefine(NativePromise.prototype, 'finally', getBuiltIn('Promise').prototype['finally']); } core-js-3.6.1/packages/core-js/modules/es.promise.js000066400000000000000000000324261360057567700223240ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var global = require('../internals/global'); var getBuiltIn = require('../internals/get-built-in'); var NativePromise = require('../internals/native-promise-constructor'); var redefine = require('../internals/redefine'); var redefineAll = require('../internals/redefine-all'); var setToStringTag = require('../internals/set-to-string-tag'); var setSpecies = require('../internals/set-species'); var isObject = require('../internals/is-object'); var aFunction = require('../internals/a-function'); var anInstance = require('../internals/an-instance'); var classof = require('../internals/classof-raw'); var inspectSource = require('../internals/inspect-source'); var iterate = require('../internals/iterate'); var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration'); var speciesConstructor = require('../internals/species-constructor'); var task = require('../internals/task').set; var microtask = require('../internals/microtask'); var promiseResolve = require('../internals/promise-resolve'); var hostReportErrors = require('../internals/host-report-errors'); var newPromiseCapabilityModule = require('../internals/new-promise-capability'); var perform = require('../internals/perform'); var InternalStateModule = require('../internals/internal-state'); var isForced = require('../internals/is-forced'); var wellKnownSymbol = require('../internals/well-known-symbol'); var V8_VERSION = require('../internals/v8-version'); var SPECIES = wellKnownSymbol('species'); var PROMISE = 'Promise'; var getInternalState = InternalStateModule.get; var setInternalState = InternalStateModule.set; var getInternalPromiseState = InternalStateModule.getterFor(PROMISE); var PromiseConstructor = NativePromise; var TypeError = global.TypeError; var document = global.document; var process = global.process; var $fetch = getBuiltIn('fetch'); var newPromiseCapability = newPromiseCapabilityModule.f; var newGenericPromiseCapability = newPromiseCapability; var IS_NODE = classof(process) == 'process'; var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent); var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; var FULFILLED = 1; var REJECTED = 2; var HANDLED = 1; var UNHANDLED = 2; var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; var FORCED = isForced(PROMISE, function () { var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor); if (!GLOBAL_CORE_JS_PROMISE) { // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 // We can't detect it synchronously, so just check versions if (V8_VERSION === 66) return true; // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test if (!IS_NODE && typeof PromiseRejectionEvent != 'function') return true; } // We need Promise#finally in the pure version for preventing prototype pollution if (IS_PURE && !PromiseConstructor.prototype['finally']) return true; // We can't use @@species feature detection in V8 since it causes // deoptimization and performance degradation // https://github.com/zloirock/core-js/issues/679 if (V8_VERSION >= 51 && /native code/.test(PromiseConstructor)) return false; // Detect correctness of subclassing with @@species support var promise = PromiseConstructor.resolve(1); var FakePromise = function (exec) { exec(function () { /* empty */ }, function () { /* empty */ }); }; var constructor = promise.constructor = {}; constructor[SPECIES] = FakePromise; return !(promise.then(function () { /* empty */ }) instanceof FakePromise); }); var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) { PromiseConstructor.all(iterable)['catch'](function () { /* empty */ }); }); // helpers var isThenable = function (it) { var then; return isObject(it) && typeof (then = it.then) == 'function' ? then : false; }; var notify = function (promise, state, isReject) { if (state.notified) return; state.notified = true; var chain = state.reactions; microtask(function () { var value = state.value; var ok = state.state == FULFILLED; var index = 0; // variable length - can't use forEach while (chain.length > index) { var reaction = chain[index++]; var handler = ok ? reaction.ok : reaction.fail; var resolve = reaction.resolve; var reject = reaction.reject; var domain = reaction.domain; var result, then, exited; try { if (handler) { if (!ok) { if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state); state.rejection = HANDLED; } if (handler === true) result = value; else { if (domain) domain.enter(); result = handler(value); // can throw if (domain) { domain.exit(); exited = true; } } if (result === reaction.promise) { reject(TypeError('Promise-chain cycle')); } else if (then = isThenable(result)) { then.call(result, resolve, reject); } else resolve(result); } else reject(value); } catch (error) { if (domain && !exited) domain.exit(); reject(error); } } state.reactions = []; state.notified = false; if (isReject && !state.rejection) onUnhandled(promise, state); }); }; var dispatchEvent = function (name, promise, reason) { var event, handler; if (DISPATCH_EVENT) { event = document.createEvent('Event'); event.promise = promise; event.reason = reason; event.initEvent(name, false, true); global.dispatchEvent(event); } else event = { promise: promise, reason: reason }; if (handler = global['on' + name]) handler(event); else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); }; var onUnhandled = function (promise, state) { task.call(global, function () { var value = state.value; var IS_UNHANDLED = isUnhandled(state); var result; if (IS_UNHANDLED) { result = perform(function () { if (IS_NODE) { process.emit('unhandledRejection', value, promise); } else dispatchEvent(UNHANDLED_REJECTION, promise, value); }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED; if (result.error) throw result.value; } }); }; var isUnhandled = function (state) { return state.rejection !== HANDLED && !state.parent; }; var onHandleUnhandled = function (promise, state) { task.call(global, function () { if (IS_NODE) { process.emit('rejectionHandled', promise); } else dispatchEvent(REJECTION_HANDLED, promise, state.value); }); }; var bind = function (fn, promise, state, unwrap) { return function (value) { fn(promise, state, value, unwrap); }; }; var internalReject = function (promise, state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; state.value = value; state.state = REJECTED; notify(promise, state, true); }; var internalResolve = function (promise, state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; try { if (promise === value) throw TypeError("Promise can't be resolved itself"); var then = isThenable(value); if (then) { microtask(function () { var wrapper = { done: false }; try { then.call(value, bind(internalResolve, promise, wrapper, state), bind(internalReject, promise, wrapper, state) ); } catch (error) { internalReject(promise, wrapper, error, state); } }); } else { state.value = value; state.state = FULFILLED; notify(promise, state, false); } } catch (error) { internalReject(promise, { done: false }, error, state); } }; // constructor polyfill if (FORCED) { // 25.4.3.1 Promise(executor) PromiseConstructor = function Promise(executor) { anInstance(this, PromiseConstructor, PROMISE); aFunction(executor); Internal.call(this); var state = getInternalState(this); try { executor(bind(internalResolve, this, state), bind(internalReject, this, state)); } catch (error) { internalReject(this, state, error); } }; // eslint-disable-next-line no-unused-vars Internal = function Promise(executor) { setInternalState(this, { type: PROMISE, done: false, notified: false, parent: false, reactions: [], rejection: false, state: PENDING, value: undefined }); }; Internal.prototype = redefineAll(PromiseConstructor.prototype, { // `Promise.prototype.then` method // https://tc39.github.io/ecma262/#sec-promise.prototype.then then: function then(onFulfilled, onRejected) { var state = getInternalPromiseState(this); var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; reaction.fail = typeof onRejected == 'function' && onRejected; reaction.domain = IS_NODE ? process.domain : undefined; state.parent = true; state.reactions.push(reaction); if (state.state != PENDING) notify(this, state, false); return reaction.promise; }, // `Promise.prototype.catch` method // https://tc39.github.io/ecma262/#sec-promise.prototype.catch 'catch': function (onRejected) { return this.then(undefined, onRejected); } }); OwnPromiseCapability = function () { var promise = new Internal(); var state = getInternalState(promise); this.promise = promise; this.resolve = bind(internalResolve, promise, state); this.reject = bind(internalReject, promise, state); }; newPromiseCapabilityModule.f = newPromiseCapability = function (C) { return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); }; if (!IS_PURE && typeof NativePromise == 'function') { nativeThen = NativePromise.prototype.then; // wrap native Promise#then for native async functions redefine(NativePromise.prototype, 'then', function then(onFulfilled, onRejected) { var that = this; return new PromiseConstructor(function (resolve, reject) { nativeThen.call(that, resolve, reject); }).then(onFulfilled, onRejected); // https://github.com/zloirock/core-js/issues/640 }, { unsafe: true }); // wrap fetch result if (typeof $fetch == 'function') $({ global: true, enumerable: true, forced: true }, { // eslint-disable-next-line no-unused-vars fetch: function fetch(input /* , init */) { return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments)); } }); } } $({ global: true, wrap: true, forced: FORCED }, { Promise: PromiseConstructor }); setToStringTag(PromiseConstructor, PROMISE, false, true); setSpecies(PROMISE); PromiseWrapper = getBuiltIn(PROMISE); // statics $({ target: PROMISE, stat: true, forced: FORCED }, { // `Promise.reject` method // https://tc39.github.io/ecma262/#sec-promise.reject reject: function reject(r) { var capability = newPromiseCapability(this); capability.reject.call(undefined, r); return capability.promise; } }); $({ target: PROMISE, stat: true, forced: IS_PURE || FORCED }, { // `Promise.resolve` method // https://tc39.github.io/ecma262/#sec-promise.resolve resolve: function resolve(x) { return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x); } }); $({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { // `Promise.all` method // https://tc39.github.io/ecma262/#sec-promise.all all: function all(iterable) { var C = this; var capability = newPromiseCapability(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var $promiseResolve = aFunction(C.resolve); var values = []; var counter = 0; var remaining = 1; iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; values.push(undefined); remaining++; $promiseResolve.call(C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = value; --remaining || resolve(values); }, reject); }); --remaining || resolve(values); }); if (result.error) reject(result.value); return capability.promise; }, // `Promise.race` method // https://tc39.github.io/ecma262/#sec-promise.race race: function race(iterable) { var C = this; var capability = newPromiseCapability(C); var reject = capability.reject; var result = perform(function () { var $promiseResolve = aFunction(C.resolve); iterate(iterable, function (promise) { $promiseResolve.call(C, promise).then(capability.resolve, reject); }); }); if (result.error) reject(result.value); return capability.promise; } }); core-js-3.6.1/packages/core-js/modules/es.reflect.apply.js000066400000000000000000000015751360057567700234170ustar00rootroot00000000000000var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var fails = require('../internals/fails'); var nativeApply = getBuiltIn('Reflect', 'apply'); var functionApply = Function.apply; // MS Edge argumentsList argument is optional var OPTIONAL_ARGUMENTS_LIST = !fails(function () { nativeApply(function () { /* empty */ }); }); // `Reflect.apply` method // https://tc39.github.io/ecma262/#sec-reflect.apply $({ target: 'Reflect', stat: true, forced: OPTIONAL_ARGUMENTS_LIST }, { apply: function apply(target, thisArgument, argumentsList) { aFunction(target); anObject(argumentsList); return nativeApply ? nativeApply(target, thisArgument, argumentsList) : functionApply.call(target, thisArgument, argumentsList); } }); core-js-3.6.1/packages/core-js/modules/es.reflect.construct.js000066400000000000000000000042131360057567700243060ustar00rootroot00000000000000var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var isObject = require('../internals/is-object'); var create = require('../internals/object-create'); var bind = require('../internals/function-bind'); var fails = require('../internals/fails'); var nativeConstruct = getBuiltIn('Reflect', 'construct'); // `Reflect.construct` method // https://tc39.github.io/ecma262/#sec-reflect.construct // MS Edge supports only 2 arguments and argumentsList argument is optional // FF Nightly sets third argument as `new.target`, but does not create `this` from it var NEW_TARGET_BUG = fails(function () { function F() { /* empty */ } return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F); }); var ARGS_BUG = !fails(function () { nativeConstruct(function () { /* empty */ }); }); var FORCED = NEW_TARGET_BUG || ARGS_BUG; $({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, { construct: function construct(Target, args /* , newTarget */) { aFunction(Target); anObject(args); var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget); if (Target == newTarget) { // w/o altered newTarget, optimization for 0-4 arguments switch (args.length) { case 0: return new Target(); case 1: return new Target(args[0]); case 2: return new Target(args[0], args[1]); case 3: return new Target(args[0], args[1], args[2]); case 4: return new Target(args[0], args[1], args[2], args[3]); } // w/o altered newTarget, lot of arguments case var $args = [null]; $args.push.apply($args, args); return new (bind.apply(Target, $args))(); } // with altered newTarget, not support built-in constructors var proto = newTarget.prototype; var instance = create(isObject(proto) ? proto : Object.prototype); var result = Function.apply.call(Target, instance, args); return isObject(result) ? result : instance; } }); core-js-3.6.1/packages/core-js/modules/es.reflect.define-property.js000066400000000000000000000020731360057567700254000ustar00rootroot00000000000000var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var anObject = require('../internals/an-object'); var toPrimitive = require('../internals/to-primitive'); var definePropertyModule = require('../internals/object-define-property'); var fails = require('../internals/fails'); // MS Edge has broken Reflect.defineProperty - throwing instead of returning false var ERROR_INSTEAD_OF_FALSE = fails(function () { // eslint-disable-next-line no-undef Reflect.defineProperty(definePropertyModule.f({}, 1, { value: 1 }), 1, { value: 2 }); }); // `Reflect.defineProperty` method // https://tc39.github.io/ecma262/#sec-reflect.defineproperty $({ target: 'Reflect', stat: true, forced: ERROR_INSTEAD_OF_FALSE, sham: !DESCRIPTORS }, { defineProperty: function defineProperty(target, propertyKey, attributes) { anObject(target); var key = toPrimitive(propertyKey, true); anObject(attributes); try { definePropertyModule.f(target, key, attributes); return true; } catch (error) { return false; } } }); core-js-3.6.1/packages/core-js/modules/es.reflect.delete-property.js000066400000000000000000000010571360057567700254110ustar00rootroot00000000000000var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; // `Reflect.deleteProperty` method // https://tc39.github.io/ecma262/#sec-reflect.deleteproperty $({ target: 'Reflect', stat: true }, { deleteProperty: function deleteProperty(target, propertyKey) { var descriptor = getOwnPropertyDescriptor(anObject(target), propertyKey); return descriptor && !descriptor.configurable ? false : delete target[propertyKey]; } }); core-js-3.6.1/packages/core-js/modules/es.reflect.get-own-property-descriptor.js000066400000000000000000000011141360057567700276750ustar00rootroot00000000000000var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var anObject = require('../internals/an-object'); var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); // `Reflect.getOwnPropertyDescriptor` method // https://tc39.github.io/ecma262/#sec-reflect.getownpropertydescriptor $({ target: 'Reflect', stat: true, sham: !DESCRIPTORS }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) { return getOwnPropertyDescriptorModule.f(anObject(target), propertyKey); } }); core-js-3.6.1/packages/core-js/modules/es.reflect.get-prototype-of.js000066400000000000000000000010201360057567700254770ustar00rootroot00000000000000var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var objectGetPrototypeOf = require('../internals/object-get-prototype-of'); var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter'); // `Reflect.getPrototypeOf` method // https://tc39.github.io/ecma262/#sec-reflect.getprototypeof $({ target: 'Reflect', stat: true, sham: !CORRECT_PROTOTYPE_GETTER }, { getPrototypeOf: function getPrototypeOf(target) { return objectGetPrototypeOf(anObject(target)); } }); core-js-3.6.1/packages/core-js/modules/es.reflect.get.js000066400000000000000000000017601360057567700230450ustar00rootroot00000000000000var $ = require('../internals/export'); var isObject = require('../internals/is-object'); var anObject = require('../internals/an-object'); var has = require('../internals/has'); var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); var getPrototypeOf = require('../internals/object-get-prototype-of'); // `Reflect.get` method // https://tc39.github.io/ecma262/#sec-reflect.get function get(target, propertyKey /* , receiver */) { var receiver = arguments.length < 3 ? target : arguments[2]; var descriptor, prototype; if (anObject(target) === receiver) return target[propertyKey]; if (descriptor = getOwnPropertyDescriptorModule.f(target, propertyKey)) return has(descriptor, 'value') ? descriptor.value : descriptor.get === undefined ? undefined : descriptor.get.call(receiver); if (isObject(prototype = getPrototypeOf(target))) return get(prototype, propertyKey, receiver); } $({ target: 'Reflect', stat: true }, { get: get }); core-js-3.6.1/packages/core-js/modules/es.reflect.has.js000066400000000000000000000003601360057567700230340ustar00rootroot00000000000000var $ = require('../internals/export'); // `Reflect.has` method // https://tc39.github.io/ecma262/#sec-reflect.has $({ target: 'Reflect', stat: true }, { has: function has(target, propertyKey) { return propertyKey in target; } }); core-js-3.6.1/packages/core-js/modules/es.reflect.is-extensible.js000066400000000000000000000006371360057567700250430ustar00rootroot00000000000000var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var objectIsExtensible = Object.isExtensible; // `Reflect.isExtensible` method // https://tc39.github.io/ecma262/#sec-reflect.isextensible $({ target: 'Reflect', stat: true }, { isExtensible: function isExtensible(target) { anObject(target); return objectIsExtensible ? objectIsExtensible(target) : true; } }); core-js-3.6.1/packages/core-js/modules/es.reflect.own-keys.js000066400000000000000000000003521360057567700240360ustar00rootroot00000000000000var $ = require('../internals/export'); var ownKeys = require('../internals/own-keys'); // `Reflect.ownKeys` method // https://tc39.github.io/ecma262/#sec-reflect.ownkeys $({ target: 'Reflect', stat: true }, { ownKeys: ownKeys }); core-js-3.6.1/packages/core-js/modules/es.reflect.prevent-extensions.js000066400000000000000000000012321360057567700261400ustar00rootroot00000000000000var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var FREEZING = require('../internals/freezing'); // `Reflect.preventExtensions` method // https://tc39.github.io/ecma262/#sec-reflect.preventextensions $({ target: 'Reflect', stat: true, sham: !FREEZING }, { preventExtensions: function preventExtensions(target) { anObject(target); try { var objectPreventExtensions = getBuiltIn('Object', 'preventExtensions'); if (objectPreventExtensions) objectPreventExtensions(target); return true; } catch (error) { return false; } } }); core-js-3.6.1/packages/core-js/modules/es.reflect.set-prototype-of.js000066400000000000000000000012001360057567700255130ustar00rootroot00000000000000var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var aPossiblePrototype = require('../internals/a-possible-prototype'); var objectSetPrototypeOf = require('../internals/object-set-prototype-of'); // `Reflect.setPrototypeOf` method // https://tc39.github.io/ecma262/#sec-reflect.setprototypeof if (objectSetPrototypeOf) $({ target: 'Reflect', stat: true }, { setPrototypeOf: function setPrototypeOf(target, proto) { anObject(target); aPossiblePrototype(proto); try { objectSetPrototypeOf(target, proto); return true; } catch (error) { return false; } } }); core-js-3.6.1/packages/core-js/modules/es.reflect.set.js000066400000000000000000000041011360057567700230510ustar00rootroot00000000000000var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var isObject = require('../internals/is-object'); var has = require('../internals/has'); var fails = require('../internals/fails'); var definePropertyModule = require('../internals/object-define-property'); var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); // `Reflect.set` method // https://tc39.github.io/ecma262/#sec-reflect.set function set(target, propertyKey, V /* , receiver */) { var receiver = arguments.length < 4 ? target : arguments[3]; var ownDescriptor = getOwnPropertyDescriptorModule.f(anObject(target), propertyKey); var existingDescriptor, prototype; if (!ownDescriptor) { if (isObject(prototype = getPrototypeOf(target))) { return set(prototype, propertyKey, V, receiver); } ownDescriptor = createPropertyDescriptor(0); } if (has(ownDescriptor, 'value')) { if (ownDescriptor.writable === false || !isObject(receiver)) return false; if (existingDescriptor = getOwnPropertyDescriptorModule.f(receiver, propertyKey)) { if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false; existingDescriptor.value = V; definePropertyModule.f(receiver, propertyKey, existingDescriptor); } else definePropertyModule.f(receiver, propertyKey, createPropertyDescriptor(0, V)); return true; } return ownDescriptor.set === undefined ? false : (ownDescriptor.set.call(receiver, V), true); } // MS Edge 17-18 Reflect.set allows setting the property to object // with non-writable property on the prototype var MS_EDGE_BUG = fails(function () { var object = definePropertyModule.f({}, 'a', { configurable: true }); // eslint-disable-next-line no-undef return Reflect.set(getPrototypeOf(object), 'a', 1, object) !== false; }); $({ target: 'Reflect', stat: true, forced: MS_EDGE_BUG }, { set: set }); core-js-3.6.1/packages/core-js/modules/es.regexp.constructor.js000066400000000000000000000061141360057567700245170ustar00rootroot00000000000000var DESCRIPTORS = require('../internals/descriptors'); var global = require('../internals/global'); var isForced = require('../internals/is-forced'); var inheritIfRequired = require('../internals/inherit-if-required'); var defineProperty = require('../internals/object-define-property').f; var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; var isRegExp = require('../internals/is-regexp'); var getFlags = require('../internals/regexp-flags'); var stickyHelpers = require('../internals/regexp-sticky-helpers'); var redefine = require('../internals/redefine'); var fails = require('../internals/fails'); var setInternalState = require('../internals/internal-state').set; var setSpecies = require('../internals/set-species'); var wellKnownSymbol = require('../internals/well-known-symbol'); var MATCH = wellKnownSymbol('match'); var NativeRegExp = global.RegExp; var RegExpPrototype = NativeRegExp.prototype; var re1 = /a/g; var re2 = /a/g; // "new" should create a new object, old webkit bug var CORRECT_NEW = new NativeRegExp(re1) !== re1; var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; var FORCED = DESCRIPTORS && isForced('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y || fails(function () { re2[MATCH] = false; // RegExp constructor can alter flags and IsRegExp works correct with @@match return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; }))); // `RegExp` constructor // https://tc39.github.io/ecma262/#sec-regexp-constructor if (FORCED) { var RegExpWrapper = function RegExp(pattern, flags) { var thisIsRegExp = this instanceof RegExpWrapper; var patternIsRegExp = isRegExp(pattern); var flagsAreUndefined = flags === undefined; var sticky; if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) { return pattern; } if (CORRECT_NEW) { if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source; } else if (pattern instanceof RegExpWrapper) { if (flagsAreUndefined) flags = getFlags.call(pattern); pattern = pattern.source; } if (UNSUPPORTED_Y) { sticky = !!flags && flags.indexOf('y') > -1; if (sticky) flags = flags.replace(/y/g, ''); } var result = inheritIfRequired( CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper ); if (UNSUPPORTED_Y && sticky) setInternalState(result, { sticky: sticky }); return result; }; var proxy = function (key) { key in RegExpWrapper || defineProperty(RegExpWrapper, key, { configurable: true, get: function () { return NativeRegExp[key]; }, set: function (it) { NativeRegExp[key] = it; } }); }; var keys = getOwnPropertyNames(NativeRegExp); var index = 0; while (keys.length > index) proxy(keys[index++]); RegExpPrototype.constructor = RegExpWrapper; RegExpWrapper.prototype = RegExpPrototype; redefine(global, 'RegExp', RegExpWrapper); } // https://tc39.github.io/ecma262/#sec-get-regexp-@@species setSpecies('RegExp'); core-js-3.6.1/packages/core-js/modules/es.regexp.exec.js000066400000000000000000000002721360057567700230550ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var exec = require('../internals/regexp-exec'); $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, { exec: exec }); core-js-3.6.1/packages/core-js/modules/es.regexp.flags.js000066400000000000000000000010431360057567700232220ustar00rootroot00000000000000var DESCRIPTORS = require('../internals/descriptors'); var objectDefinePropertyModule = require('../internals/object-define-property'); var regExpFlags = require('../internals/regexp-flags'); var UNSUPPORTED_Y = require('../internals/regexp-sticky-helpers').UNSUPPORTED_Y; // `RegExp.prototype.flags` getter // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags if (DESCRIPTORS && (/./g.flags != 'g' || UNSUPPORTED_Y)) { objectDefinePropertyModule.f(RegExp.prototype, 'flags', { configurable: true, get: regExpFlags }); } core-js-3.6.1/packages/core-js/modules/es.regexp.sticky.js000066400000000000000000000014771360057567700234470ustar00rootroot00000000000000var DESCRIPTORS = require('../internals/descriptors'); var UNSUPPORTED_Y = require('../internals/regexp-sticky-helpers').UNSUPPORTED_Y; var defineProperty = require('../internals/object-define-property').f; var getInternalState = require('../internals/internal-state').get; var RegExpPrototype = RegExp.prototype; // `RegExp.prototype.sticky` getter if (DESCRIPTORS && UNSUPPORTED_Y) { defineProperty(RegExp.prototype, 'sticky', { configurable: true, get: function () { if (this === RegExpPrototype) return undefined; // We can't use InternalStateModule.getterFor because // we don't add metadata for regexps created by a literal. if (this instanceof RegExp) { return !!getInternalState(this).sticky; } throw TypeError('Incompatible receiver, RegExp required'); } }); } core-js-3.6.1/packages/core-js/modules/es.regexp.test.js000066400000000000000000000013671360057567700231160ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var isObject = require('../internals/is-object'); var DELEGATES_TO_EXEC = function () { var execCalled = false; var re = /[ac]/; re.exec = function () { execCalled = true; return /./.exec.apply(this, arguments); }; return re.test('abc') === true && execCalled; }(); var nativeTest = /./.test; $({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, { test: function (str) { if (typeof this.exec !== 'function') { return nativeTest.call(this, str); } var result = this.exec(str); if (result !== null && !isObject(result)) { throw new Error('RegExp exec method returned something other than an Object or null'); } return !!result; } }); core-js-3.6.1/packages/core-js/modules/es.regexp.to-string.js000066400000000000000000000017311360057567700240600ustar00rootroot00000000000000'use strict'; var redefine = require('../internals/redefine'); var anObject = require('../internals/an-object'); var fails = require('../internals/fails'); var flags = require('../internals/regexp-flags'); var TO_STRING = 'toString'; var RegExpPrototype = RegExp.prototype; var nativeToString = RegExpPrototype[TO_STRING]; var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); // FF44- RegExp#toString has a wrong name var INCORRECT_NAME = nativeToString.name != TO_STRING; // `RegExp.prototype.toString` method // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring if (NOT_GENERIC || INCORRECT_NAME) { redefine(RegExp.prototype, TO_STRING, function toString() { var R = anObject(this); var p = String(R.source); var rf = R.flags; var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf); return '/' + p + '/' + f; }, { unsafe: true }); } core-js-3.6.1/packages/core-js/modules/es.set.js000066400000000000000000000005661360057567700214410ustar00rootroot00000000000000'use strict'; var collection = require('../internals/collection'); var collectionStrong = require('../internals/collection-strong'); // `Set` constructor // https://tc39.github.io/ecma262/#sec-set-objects module.exports = collection('Set', function (init) { return function Set() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); core-js-3.6.1/packages/core-js/modules/es.string.anchor.js000066400000000000000000000007131360057567700234170ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.anchor` method // https://tc39.github.io/ecma262/#sec-string.prototype.anchor $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('anchor') }, { anchor: function anchor(name) { return createHTML(this, 'a', 'name', name); } }); core-js-3.6.1/packages/core-js/modules/es.string.big.js000066400000000000000000000006641360057567700227130ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.big` method // https://tc39.github.io/ecma262/#sec-string.prototype.big $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('big') }, { big: function big() { return createHTML(this, 'big', '', ''); } }); core-js-3.6.1/packages/core-js/modules/es.string.blink.js000066400000000000000000000007001360057567700232400ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.blink` method // https://tc39.github.io/ecma262/#sec-string.prototype.blink $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('blink') }, { blink: function blink() { return createHTML(this, 'blink', '', ''); } }); core-js-3.6.1/packages/core-js/modules/es.string.bold.js000066400000000000000000000006671360057567700230750ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.bold` method // https://tc39.github.io/ecma262/#sec-string.prototype.bold $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('bold') }, { bold: function bold() { return createHTML(this, 'b', '', ''); } }); core-js-3.6.1/packages/core-js/modules/es.string.code-point-at.js000066400000000000000000000005321360057567700246070ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var codeAt = require('../internals/string-multibyte').codeAt; // `String.prototype.codePointAt` method // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat $({ target: 'String', proto: true }, { codePointAt: function codePointAt(pos) { return codeAt(this, pos); } }); core-js-3.6.1/packages/core-js/modules/es.string.ends-with.js000066400000000000000000000030151360057567700240450ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var toLength = require('../internals/to-length'); var notARegExp = require('../internals/not-a-regexp'); var requireObjectCoercible = require('../internals/require-object-coercible'); var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic'); var IS_PURE = require('../internals/is-pure'); var nativeEndsWith = ''.endsWith; var min = Math.min; var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('endsWith'); // https://github.com/zloirock/core-js/pull/702 var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () { var descriptor = getOwnPropertyDescriptor(String.prototype, 'endsWith'); return descriptor && !descriptor.writable; }(); // `String.prototype.endsWith` method // https://tc39.github.io/ecma262/#sec-string.prototype.endswith $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, { endsWith: function endsWith(searchString /* , endPosition = @length */) { var that = String(requireObjectCoercible(this)); notARegExp(searchString); var endPosition = arguments.length > 1 ? arguments[1] : undefined; var len = toLength(that.length); var end = endPosition === undefined ? len : min(toLength(endPosition), len); var search = String(searchString); return nativeEndsWith ? nativeEndsWith.call(that, search, end) : that.slice(end - search.length, end) === search; } }); core-js-3.6.1/packages/core-js/modules/es.string.fixed.js000066400000000000000000000006751360057567700232530ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.fixed` method // https://tc39.github.io/ecma262/#sec-string.prototype.fixed $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('fixed') }, { fixed: function fixed() { return createHTML(this, 'tt', '', ''); } }); core-js-3.6.1/packages/core-js/modules/es.string.fontcolor.js000066400000000000000000000007401360057567700241520ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.fontcolor` method // https://tc39.github.io/ecma262/#sec-string.prototype.fontcolor $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('fontcolor') }, { fontcolor: function fontcolor(color) { return createHTML(this, 'font', 'color', color); } }); core-js-3.6.1/packages/core-js/modules/es.string.fontsize.js000066400000000000000000000007301360057567700240050ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.fontsize` method // https://tc39.github.io/ecma262/#sec-string.prototype.fontsize $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('fontsize') }, { fontsize: function fontsize(size) { return createHTML(this, 'font', 'size', size); } }); core-js-3.6.1/packages/core-js/modules/es.string.from-code-point.js000066400000000000000000000017471360057567700251570ustar00rootroot00000000000000var $ = require('../internals/export'); var toAbsoluteIndex = require('../internals/to-absolute-index'); var fromCharCode = String.fromCharCode; var nativeFromCodePoint = String.fromCodePoint; // length should be 1, old FF problem var INCORRECT_LENGTH = !!nativeFromCodePoint && nativeFromCodePoint.length != 1; // `String.fromCodePoint` method // https://tc39.github.io/ecma262/#sec-string.fromcodepoint $({ target: 'String', stat: true, forced: INCORRECT_LENGTH }, { fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars var elements = []; var length = arguments.length; var i = 0; var code; while (length > i) { code = +arguments[i++]; if (toAbsoluteIndex(code, 0x10FFFF) !== code) throw RangeError(code + ' is not a valid code point'); elements.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00) ); } return elements.join(''); } }); core-js-3.6.1/packages/core-js/modules/es.string.includes.js000066400000000000000000000012331360057567700237510ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var notARegExp = require('../internals/not-a-regexp'); var requireObjectCoercible = require('../internals/require-object-coercible'); var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic'); // `String.prototype.includes` method // https://tc39.github.io/ecma262/#sec-string.prototype.includes $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, { includes: function includes(searchString /* , position = 0 */) { return !!~String(requireObjectCoercible(this)) .indexOf(notARegExp(searchString), arguments.length > 1 ? arguments[1] : undefined); } }); core-js-3.6.1/packages/core-js/modules/es.string.italics.js000066400000000000000000000007061360057567700235770ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.italics` method // https://tc39.github.io/ecma262/#sec-string.prototype.italics $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('italics') }, { italics: function italics() { return createHTML(this, 'i', '', ''); } }); core-js-3.6.1/packages/core-js/modules/es.string.iterator.js000066400000000000000000000020341360057567700237740ustar00rootroot00000000000000'use strict'; var charAt = require('../internals/string-multibyte').charAt; var InternalStateModule = require('../internals/internal-state'); var defineIterator = require('../internals/define-iterator'); var STRING_ITERATOR = 'String Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method // https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator defineIterator(String, 'String', function (iterated) { setInternalState(this, { type: STRING_ITERATOR, string: String(iterated), index: 0 }); // `%StringIteratorPrototype%.next` method // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next }, function next() { var state = getInternalState(this); var string = state.string; var index = state.index; var point; if (index >= string.length) return { value: undefined, done: true }; point = charAt(string, index); state.index += point.length; return { value: point, done: false }; }); core-js-3.6.1/packages/core-js/modules/es.string.link.js000066400000000000000000000006771360057567700231130ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.link` method // https://tc39.github.io/ecma262/#sec-string.prototype.link $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('link') }, { link: function link(url) { return createHTML(this, 'a', 'href', url); } }); core-js-3.6.1/packages/core-js/modules/es.string.match-all.js000066400000000000000000000105461360057567700240140ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createIteratorConstructor = require('../internals/create-iterator-constructor'); var requireObjectCoercible = require('../internals/require-object-coercible'); var toLength = require('../internals/to-length'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var classof = require('../internals/classof-raw'); var isRegExp = require('../internals/is-regexp'); var getRegExpFlags = require('../internals/regexp-flags'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var fails = require('../internals/fails'); var wellKnownSymbol = require('../internals/well-known-symbol'); var speciesConstructor = require('../internals/species-constructor'); var advanceStringIndex = require('../internals/advance-string-index'); var InternalStateModule = require('../internals/internal-state'); var IS_PURE = require('../internals/is-pure'); var MATCH_ALL = wellKnownSymbol('matchAll'); var REGEXP_STRING = 'RegExp String'; var REGEXP_STRING_ITERATOR = REGEXP_STRING + ' Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(REGEXP_STRING_ITERATOR); var RegExpPrototype = RegExp.prototype; var regExpBuiltinExec = RegExpPrototype.exec; var nativeMatchAll = ''.matchAll; var WORKS_WITH_NON_GLOBAL_REGEX = !!nativeMatchAll && !fails(function () { 'a'.matchAll(/./); }); var regExpExec = function (R, S) { var exec = R.exec; var result; if (typeof exec == 'function') { result = exec.call(R, S); if (typeof result != 'object') throw TypeError('Incorrect exec result'); return result; } return regExpBuiltinExec.call(R, S); }; // eslint-disable-next-line max-len var $RegExpStringIterator = createIteratorConstructor(function RegExpStringIterator(regexp, string, global, fullUnicode) { setInternalState(this, { type: REGEXP_STRING_ITERATOR, regexp: regexp, string: string, global: global, unicode: fullUnicode, done: false }); }, REGEXP_STRING, function next() { var state = getInternalState(this); if (state.done) return { value: undefined, done: true }; var R = state.regexp; var S = state.string; var match = regExpExec(R, S); if (match === null) return { value: undefined, done: state.done = true }; if (state.global) { if (String(match[0]) == '') R.lastIndex = advanceStringIndex(S, toLength(R.lastIndex), state.unicode); return { value: match, done: false }; } state.done = true; return { value: match, done: false }; }); var $matchAll = function (string) { var R = anObject(this); var S = String(string); var C, flagsValue, flags, matcher, global, fullUnicode; C = speciesConstructor(R, RegExp); flagsValue = R.flags; if (flagsValue === undefined && R instanceof RegExp && !('flags' in RegExpPrototype)) { flagsValue = getRegExpFlags.call(R); } flags = flagsValue === undefined ? '' : String(flagsValue); matcher = new C(C === RegExp ? R.source : R, flags); global = !!~flags.indexOf('g'); fullUnicode = !!~flags.indexOf('u'); matcher.lastIndex = toLength(R.lastIndex); return new $RegExpStringIterator(matcher, S, global, fullUnicode); }; // `String.prototype.matchAll` method // https://github.com/tc39/proposal-string-matchall $({ target: 'String', proto: true, forced: WORKS_WITH_NON_GLOBAL_REGEX }, { matchAll: function matchAll(regexp) { var O = requireObjectCoercible(this); var flags, S, matcher, rx; if (regexp != null) { if (isRegExp(regexp)) { flags = String(requireObjectCoercible('flags' in RegExpPrototype ? regexp.flags : getRegExpFlags.call(regexp) )); if (!~flags.indexOf('g')) throw TypeError('`.matchAll` does not allow non-global regexes'); } if (WORKS_WITH_NON_GLOBAL_REGEX) return nativeMatchAll.apply(O, arguments); matcher = regexp[MATCH_ALL]; if (matcher === undefined && IS_PURE && classof(regexp) == 'RegExp') matcher = $matchAll; if (matcher != null) return aFunction(matcher).call(regexp, O); } else if (WORKS_WITH_NON_GLOBAL_REGEX) return nativeMatchAll.apply(O, arguments); S = String(O); rx = new RegExp(regexp, 'g'); return IS_PURE ? $matchAll.call(rx, S) : rx[MATCH_ALL](S); } }); IS_PURE || MATCH_ALL in RegExpPrototype || createNonEnumerableProperty(RegExpPrototype, MATCH_ALL, $matchAll); core-js-3.6.1/packages/core-js/modules/es.string.match.js000066400000000000000000000031611360057567700232410ustar00rootroot00000000000000'use strict'; var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); var anObject = require('../internals/an-object'); var toLength = require('../internals/to-length'); var requireObjectCoercible = require('../internals/require-object-coercible'); var advanceStringIndex = require('../internals/advance-string-index'); var regExpExec = require('../internals/regexp-exec-abstract'); // @@match logic fixRegExpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) { return [ // `String.prototype.match` method // https://tc39.github.io/ecma262/#sec-string.prototype.match function match(regexp) { var O = requireObjectCoercible(this); var matcher = regexp == undefined ? undefined : regexp[MATCH]; return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); }, // `RegExp.prototype[@@match]` method // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match function (regexp) { var res = maybeCallNative(nativeMatch, regexp, this); if (res.done) return res.value; var rx = anObject(regexp); var S = String(this); if (!rx.global) return regExpExec(rx, S); var fullUnicode = rx.unicode; rx.lastIndex = 0; var A = []; var n = 0; var result; while ((result = regExpExec(rx, S)) !== null) { var matchStr = String(result[0]); A[n] = matchStr; if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); n++; } return n === 0 ? null : A; } ]; }); core-js-3.6.1/packages/core-js/modules/es.string.pad-end.js000066400000000000000000000007511360057567700234570ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $padEnd = require('../internals/string-pad').end; var WEBKIT_BUG = require('../internals/webkit-string-pad-bug'); // `String.prototype.padEnd` method // https://tc39.github.io/ecma262/#sec-string.prototype.padend $({ target: 'String', proto: true, forced: WEBKIT_BUG }, { padEnd: function padEnd(maxLength /* , fillString = ' ' */) { return $padEnd(this, maxLength, arguments.length > 1 ? arguments[1] : undefined); } }); core-js-3.6.1/packages/core-js/modules/es.string.pad-start.js000066400000000000000000000007671360057567700240550ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $padStart = require('../internals/string-pad').start; var WEBKIT_BUG = require('../internals/webkit-string-pad-bug'); // `String.prototype.padStart` method // https://tc39.github.io/ecma262/#sec-string.prototype.padstart $({ target: 'String', proto: true, forced: WEBKIT_BUG }, { padStart: function padStart(maxLength /* , fillString = ' ' */) { return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined); } }); core-js-3.6.1/packages/core-js/modules/es.string.raw.js000066400000000000000000000012471360057567700227410ustar00rootroot00000000000000var $ = require('../internals/export'); var toIndexedObject = require('../internals/to-indexed-object'); var toLength = require('../internals/to-length'); // `String.raw` method // https://tc39.github.io/ecma262/#sec-string.raw $({ target: 'String', stat: true }, { raw: function raw(template) { var rawTemplate = toIndexedObject(template.raw); var literalSegments = toLength(rawTemplate.length); var argumentsLength = arguments.length; var elements = []; var i = 0; while (literalSegments > i) { elements.push(String(rawTemplate[i++])); if (i < argumentsLength) elements.push(String(arguments[i])); } return elements.join(''); } }); core-js-3.6.1/packages/core-js/modules/es.string.repeat.js000066400000000000000000000003741360057567700234300ustar00rootroot00000000000000var $ = require('../internals/export'); var repeat = require('../internals/string-repeat'); // `String.prototype.repeat` method // https://tc39.github.io/ecma262/#sec-string.prototype.repeat $({ target: 'String', proto: true }, { repeat: repeat }); core-js-3.6.1/packages/core-js/modules/es.string.replace.js000066400000000000000000000117251360057567700235650ustar00rootroot00000000000000'use strict'; var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); var anObject = require('../internals/an-object'); var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); var toInteger = require('../internals/to-integer'); var requireObjectCoercible = require('../internals/require-object-coercible'); var advanceStringIndex = require('../internals/advance-string-index'); var regExpExec = require('../internals/regexp-exec-abstract'); var max = Math.max; var min = Math.min; var floor = Math.floor; var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g; var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g; var maybeToString = function (it) { return it === undefined ? it : String(it); }; // @@replace logic fixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) { return [ // `String.prototype.replace` method // https://tc39.github.io/ecma262/#sec-string.prototype.replace function replace(searchValue, replaceValue) { var O = requireObjectCoercible(this); var replacer = searchValue == undefined ? undefined : searchValue[REPLACE]; return replacer !== undefined ? replacer.call(searchValue, O, replaceValue) : nativeReplace.call(String(O), searchValue, replaceValue); }, // `RegExp.prototype[@@replace]` method // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace function (regexp, replaceValue) { if (reason.REPLACE_KEEPS_$0 || (typeof replaceValue === 'string' && replaceValue.indexOf('$0') === -1)) { var res = maybeCallNative(nativeReplace, regexp, this, replaceValue); if (res.done) return res.value; } var rx = anObject(regexp); var S = String(this); var functionalReplace = typeof replaceValue === 'function'; if (!functionalReplace) replaceValue = String(replaceValue); var global = rx.global; if (global) { var fullUnicode = rx.unicode; rx.lastIndex = 0; } var results = []; while (true) { var result = regExpExec(rx, S); if (result === null) break; results.push(result); if (!global) break; var matchStr = String(result[0]); if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); } var accumulatedResult = ''; var nextSourcePosition = 0; for (var i = 0; i < results.length; i++) { result = results[i]; var matched = String(result[0]); var position = max(min(toInteger(result.index), S.length), 0); var captures = []; // NOTE: This is equivalent to // captures = result.slice(1).map(maybeToString) // but for some reason `nativeSlice.call(result, 1, result.length)` (called in // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); var namedCaptures = result.groups; if (functionalReplace) { var replacerArgs = [matched].concat(captures, position, S); if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); var replacement = String(replaceValue.apply(undefined, replacerArgs)); } else { replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); } if (position >= nextSourcePosition) { accumulatedResult += S.slice(nextSourcePosition, position) + replacement; nextSourcePosition = position + matched.length; } } return accumulatedResult + S.slice(nextSourcePosition); } ]; // https://tc39.github.io/ecma262/#sec-getsubstitution function getSubstitution(matched, str, position, captures, namedCaptures, replacement) { var tailPos = position + matched.length; var m = captures.length; var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; if (namedCaptures !== undefined) { namedCaptures = toObject(namedCaptures); symbols = SUBSTITUTION_SYMBOLS; } return nativeReplace.call(replacement, symbols, function (match, ch) { var capture; switch (ch.charAt(0)) { case '$': return '$'; case '&': return matched; case '`': return str.slice(0, position); case "'": return str.slice(tailPos); case '<': capture = namedCaptures[ch.slice(1, -1)]; break; default: // \d\d? var n = +ch; if (n === 0) return match; if (n > m) { var f = floor(n / 10); if (f === 0) return match; if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); return match; } capture = captures[n - 1]; } return capture === undefined ? '' : capture; }); } }); core-js-3.6.1/packages/core-js/modules/es.string.search.js000066400000000000000000000026351360057567700234170ustar00rootroot00000000000000'use strict'; var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); var anObject = require('../internals/an-object'); var requireObjectCoercible = require('../internals/require-object-coercible'); var sameValue = require('../internals/same-value'); var regExpExec = require('../internals/regexp-exec-abstract'); // @@search logic fixRegExpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) { return [ // `String.prototype.search` method // https://tc39.github.io/ecma262/#sec-string.prototype.search function search(regexp) { var O = requireObjectCoercible(this); var searcher = regexp == undefined ? undefined : regexp[SEARCH]; return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); }, // `RegExp.prototype[@@search]` method // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search function (regexp) { var res = maybeCallNative(nativeSearch, regexp, this); if (res.done) return res.value; var rx = anObject(regexp); var S = String(this); var previousLastIndex = rx.lastIndex; if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0; var result = regExpExec(rx, S); if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex; return result === null ? -1 : result.index; } ]; }); core-js-3.6.1/packages/core-js/modules/es.string.small.js000066400000000000000000000007001360057567700232510ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.small` method // https://tc39.github.io/ecma262/#sec-string.prototype.small $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('small') }, { small: function small() { return createHTML(this, 'small', '', ''); } }); core-js-3.6.1/packages/core-js/modules/es.string.split.js000066400000000000000000000125271360057567700233060ustar00rootroot00000000000000'use strict'; var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); var isRegExp = require('../internals/is-regexp'); var anObject = require('../internals/an-object'); var requireObjectCoercible = require('../internals/require-object-coercible'); var speciesConstructor = require('../internals/species-constructor'); var advanceStringIndex = require('../internals/advance-string-index'); var toLength = require('../internals/to-length'); var callRegExpExec = require('../internals/regexp-exec-abstract'); var regexpExec = require('../internals/regexp-exec'); var fails = require('../internals/fails'); var arrayPush = [].push; var min = Math.min; var MAX_UINT32 = 0xFFFFFFFF; // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); }); // @@split logic fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) { var internalSplit; if ( 'abbc'.split(/(b)*/)[1] == 'c' || 'test'.split(/(?:)/, -1).length != 4 || 'ab'.split(/(?:ab)*/).length != 2 || '.'.split(/(.?)(.?)/).length != 4 || '.'.split(/()()/).length > 1 || ''.split(/.?/).length ) { // based on es5-shim implementation, need to rework it internalSplit = function (separator, limit) { var string = String(requireObjectCoercible(this)); var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; if (lim === 0) return []; if (separator === undefined) return [string]; // If `separator` is not a regex, use native split if (!isRegExp(separator)) { return nativeSplit.call(string, separator, lim); } var output = []; var flags = (separator.ignoreCase ? 'i' : '') + (separator.multiline ? 'm' : '') + (separator.unicode ? 'u' : '') + (separator.sticky ? 'y' : ''); var lastLastIndex = 0; // Make `global` and avoid `lastIndex` issues by working with a copy var separatorCopy = new RegExp(separator.source, flags + 'g'); var match, lastIndex, lastLength; while (match = regexpExec.call(separatorCopy, string)) { lastIndex = separatorCopy.lastIndex; if (lastIndex > lastLastIndex) { output.push(string.slice(lastLastIndex, match.index)); if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1)); lastLength = match[0].length; lastLastIndex = lastIndex; if (output.length >= lim) break; } if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop } if (lastLastIndex === string.length) { if (lastLength || !separatorCopy.test('')) output.push(''); } else output.push(string.slice(lastLastIndex)); return output.length > lim ? output.slice(0, lim) : output; }; // Chakra, V8 } else if ('0'.split(undefined, 0).length) { internalSplit = function (separator, limit) { return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit); }; } else internalSplit = nativeSplit; return [ // `String.prototype.split` method // https://tc39.github.io/ecma262/#sec-string.prototype.split function split(separator, limit) { var O = requireObjectCoercible(this); var splitter = separator == undefined ? undefined : separator[SPLIT]; return splitter !== undefined ? splitter.call(separator, O, limit) : internalSplit.call(String(O), separator, limit); }, // `RegExp.prototype[@@split]` method // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split // // NOTE: This cannot be properly polyfilled in engines that don't support // the 'y' flag. function (regexp, limit) { var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit); if (res.done) return res.value; var rx = anObject(regexp); var S = String(this); var C = speciesConstructor(rx, RegExp); var unicodeMatching = rx.unicode; var flags = (rx.ignoreCase ? 'i' : '') + (rx.multiline ? 'm' : '') + (rx.unicode ? 'u' : '') + (SUPPORTS_Y ? 'y' : 'g'); // ^(? + rx + ) is needed, in combination with some S slicing, to // simulate the 'y' flag. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags); var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; if (lim === 0) return []; if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : []; var p = 0; var q = 0; var A = []; while (q < S.length) { splitter.lastIndex = SUPPORTS_Y ? q : 0; var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q)); var e; if ( z === null || (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p ) { q = advanceStringIndex(S, q, unicodeMatching); } else { A.push(S.slice(p, q)); if (A.length === lim) return A; for (var i = 1; i <= z.length - 1; i++) { A.push(z[i]); if (A.length === lim) return A; } q = p = e; } } A.push(S.slice(p)); return A; } ]; }, !SUPPORTS_Y); core-js-3.6.1/packages/core-js/modules/es.string.starts-with.js000066400000000000000000000026761360057567700244500ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; var toLength = require('../internals/to-length'); var notARegExp = require('../internals/not-a-regexp'); var requireObjectCoercible = require('../internals/require-object-coercible'); var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic'); var IS_PURE = require('../internals/is-pure'); var nativeStartsWith = ''.startsWith; var min = Math.min; var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith'); // https://github.com/zloirock/core-js/pull/702 var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () { var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith'); return descriptor && !descriptor.writable; }(); // `String.prototype.startsWith` method // https://tc39.github.io/ecma262/#sec-string.prototype.startswith $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, { startsWith: function startsWith(searchString /* , position = 0 */) { var that = String(requireObjectCoercible(this)); notARegExp(searchString); var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length)); var search = String(searchString); return nativeStartsWith ? nativeStartsWith.call(that, search, index) : that.slice(index, index + search.length) === search; } }); core-js-3.6.1/packages/core-js/modules/es.string.strike.js000066400000000000000000000007061360057567700234500ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.strike` method // https://tc39.github.io/ecma262/#sec-string.prototype.strike $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('strike') }, { strike: function strike() { return createHTML(this, 'strike', '', ''); } }); core-js-3.6.1/packages/core-js/modules/es.string.sub.js000066400000000000000000000006641360057567700227430ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.sub` method // https://tc39.github.io/ecma262/#sec-string.prototype.sub $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('sub') }, { sub: function sub() { return createHTML(this, 'sub', '', ''); } }); core-js-3.6.1/packages/core-js/modules/es.string.sup.js000066400000000000000000000006641360057567700227610ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createHTML = require('../internals/create-html'); var forcedStringHTMLMethod = require('../internals/forced-string-html-method'); // `String.prototype.sup` method // https://tc39.github.io/ecma262/#sec-string.prototype.sup $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('sup') }, { sup: function sup() { return createHTML(this, 'sup', '', ''); } }); core-js-3.6.1/packages/core-js/modules/es.string.trim-end.js000066400000000000000000000010341360057567700236610ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $trimEnd = require('../internals/string-trim').end; var forcedStringTrimMethod = require('../internals/forced-string-trim-method'); var FORCED = forcedStringTrimMethod('trimEnd'); var trimEnd = FORCED ? function trimEnd() { return $trimEnd(this); } : ''.trimEnd; // `String.prototype.{ trimEnd, trimRight }` methods // https://github.com/tc39/ecmascript-string-left-right-trim $({ target: 'String', proto: true, forced: FORCED }, { trimEnd: trimEnd, trimRight: trimEnd }); core-js-3.6.1/packages/core-js/modules/es.string.trim-start.js000066400000000000000000000010601360057567700242470ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $trimStart = require('../internals/string-trim').start; var forcedStringTrimMethod = require('../internals/forced-string-trim-method'); var FORCED = forcedStringTrimMethod('trimStart'); var trimStart = FORCED ? function trimStart() { return $trimStart(this); } : ''.trimStart; // `String.prototype.{ trimStart, trimLeft }` methods // https://github.com/tc39/ecmascript-string-left-right-trim $({ target: 'String', proto: true, forced: FORCED }, { trimStart: trimStart, trimLeft: trimStart }); core-js-3.6.1/packages/core-js/modules/es.string.trim.js000066400000000000000000000006451360057567700231240ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var $trim = require('../internals/string-trim').trim; var forcedStringTrimMethod = require('../internals/forced-string-trim-method'); // `String.prototype.trim` method // https://tc39.github.io/ecma262/#sec-string.prototype.trim $({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, { trim: function trim() { return $trim(this); } }); core-js-3.6.1/packages/core-js/modules/es.symbol.async-iterator.js000066400000000000000000000003371360057567700251120ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.asyncIterator` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.asynciterator defineWellKnownSymbol('asyncIterator'); core-js-3.6.1/packages/core-js/modules/es.symbol.description.js000066400000000000000000000041211360057567700244640ustar00rootroot00000000000000// `Symbol.prototype.description` getter // https://tc39.github.io/ecma262/#sec-symbol.prototype.description 'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var global = require('../internals/global'); var has = require('../internals/has'); var isObject = require('../internals/is-object'); var defineProperty = require('../internals/object-define-property').f; var copyConstructorProperties = require('../internals/copy-constructor-properties'); var NativeSymbol = global.Symbol; if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) || // Safari 12 bug NativeSymbol().description !== undefined )) { var EmptyStringDescriptionStore = {}; // wrap Symbol constructor for correct work with undefined description var SymbolWrapper = function Symbol() { var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]); var result = this instanceof SymbolWrapper ? new NativeSymbol(description) // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)' : description === undefined ? NativeSymbol() : NativeSymbol(description); if (description === '') EmptyStringDescriptionStore[result] = true; return result; }; copyConstructorProperties(SymbolWrapper, NativeSymbol); var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype; symbolPrototype.constructor = SymbolWrapper; var symbolToString = symbolPrototype.toString; var native = String(NativeSymbol('test')) == 'Symbol(test)'; var regexp = /^Symbol\((.*)\)[^)]+$/; defineProperty(symbolPrototype, 'description', { configurable: true, get: function description() { var symbol = isObject(this) ? this.valueOf() : this; var string = symbolToString.call(symbol); if (has(EmptyStringDescriptionStore, symbol)) return ''; var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1'); return desc === '' ? undefined : desc; } }); $({ global: true, forced: true }, { Symbol: SymbolWrapper }); } core-js-3.6.1/packages/core-js/modules/es.symbol.has-instance.js000066400000000000000000000003311360057567700245150ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.hasInstance` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.hasinstance defineWellKnownSymbol('hasInstance'); core-js-3.6.1/packages/core-js/modules/es.symbol.is-concat-spreadable.js000066400000000000000000000003561360057567700261270ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.isConcatSpreadable` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.isconcatspreadable defineWellKnownSymbol('isConcatSpreadable'); core-js-3.6.1/packages/core-js/modules/es.symbol.iterator.js000066400000000000000000000003201360057567700237670ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.iterator` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.iterator defineWellKnownSymbol('iterator'); core-js-3.6.1/packages/core-js/modules/es.symbol.js000066400000000000000000000314741360057567700221550ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var global = require('../internals/global'); var getBuiltIn = require('../internals/get-built-in'); var IS_PURE = require('../internals/is-pure'); var DESCRIPTORS = require('../internals/descriptors'); var NATIVE_SYMBOL = require('../internals/native-symbol'); var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid'); var fails = require('../internals/fails'); var has = require('../internals/has'); var isArray = require('../internals/is-array'); var isObject = require('../internals/is-object'); var anObject = require('../internals/an-object'); var toObject = require('../internals/to-object'); var toIndexedObject = require('../internals/to-indexed-object'); var toPrimitive = require('../internals/to-primitive'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); var nativeObjectCreate = require('../internals/object-create'); var objectKeys = require('../internals/object-keys'); var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names'); var getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external'); var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols'); var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor'); var definePropertyModule = require('../internals/object-define-property'); var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var redefine = require('../internals/redefine'); var shared = require('../internals/shared'); var sharedKey = require('../internals/shared-key'); var hiddenKeys = require('../internals/hidden-keys'); var uid = require('../internals/uid'); var wellKnownSymbol = require('../internals/well-known-symbol'); var wrappedWellKnownSymbolModule = require('../internals/wrapped-well-known-symbol'); var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); var setToStringTag = require('../internals/set-to-string-tag'); var InternalStateModule = require('../internals/internal-state'); var $forEach = require('../internals/array-iteration').forEach; var HIDDEN = sharedKey('hidden'); var SYMBOL = 'Symbol'; var PROTOTYPE = 'prototype'; var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(SYMBOL); var ObjectPrototype = Object[PROTOTYPE]; var $Symbol = global.Symbol; var $stringify = getBuiltIn('JSON', 'stringify'); var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var nativeDefineProperty = definePropertyModule.f; var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; var AllSymbols = shared('symbols'); var ObjectPrototypeSymbols = shared('op-symbols'); var StringToSymbolRegistry = shared('string-to-symbol-registry'); var SymbolToStringRegistry = shared('symbol-to-string-registry'); var WellKnownSymbolsStore = shared('wks'); var QObject = global.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 var setSymbolDescriptor = DESCRIPTORS && fails(function () { return nativeObjectCreate(nativeDefineProperty({}, 'a', { get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; } })).a != 7; }) ? function (O, P, Attributes) { var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P); if (ObjectPrototypeDescriptor) delete ObjectPrototype[P]; nativeDefineProperty(O, P, Attributes); if (ObjectPrototypeDescriptor && O !== ObjectPrototype) { nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor); } } : nativeDefineProperty; var wrap = function (tag, description) { var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]); setInternalState(symbol, { type: SYMBOL, tag: tag, description: description }); if (!DESCRIPTORS) symbol.description = description; return symbol; }; var isSymbol = USE_SYMBOL_AS_UID ? function (it) { return typeof it == 'symbol'; } : function (it) { return Object(it) instanceof $Symbol; }; var $defineProperty = function defineProperty(O, P, Attributes) { if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes); anObject(O); var key = toPrimitive(P, true); anObject(Attributes); if (has(AllSymbols, key)) { if (!Attributes.enumerable) { if (!has(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {})); O[HIDDEN][key] = true; } else { if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) }); } return setSymbolDescriptor(O, key, Attributes); } return nativeDefineProperty(O, key, Attributes); }; var $defineProperties = function defineProperties(O, Properties) { anObject(O); var properties = toIndexedObject(Properties); var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); $forEach(keys, function (key) { if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]); }); return O; }; var $create = function create(O, Properties) { return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); }; var $propertyIsEnumerable = function propertyIsEnumerable(V) { var P = toPrimitive(V, true); var enumerable = nativePropertyIsEnumerable.call(this, P); if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false; return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { var it = toIndexedObject(O); var key = toPrimitive(P, true); if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return; var descriptor = nativeGetOwnPropertyDescriptor(it, key); if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) { descriptor.enumerable = true; } return descriptor; }; var $getOwnPropertyNames = function getOwnPropertyNames(O) { var names = nativeGetOwnPropertyNames(toIndexedObject(O)); var result = []; $forEach(names, function (key) { if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key); }); return result; }; var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { var IS_OBJECT_PROTOTYPE = O === ObjectPrototype; var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O)); var result = []; $forEach(names, function (key) { if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) { result.push(AllSymbols[key]); } }); return result; }; // `Symbol` constructor // https://tc39.github.io/ecma262/#sec-symbol-constructor if (!NATIVE_SYMBOL) { $Symbol = function Symbol() { if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor'); var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]); var tag = uid(description); var setter = function (value) { if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value); if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value)); }; if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter }); return wrap(tag, description); }; redefine($Symbol[PROTOTYPE], 'toString', function toString() { return getInternalState(this).tag; }); redefine($Symbol, 'withoutSetter', function (description) { return wrap(uid(description), description); }); propertyIsEnumerableModule.f = $propertyIsEnumerable; definePropertyModule.f = $defineProperty; getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor; getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; getOwnPropertySymbolsModule.f = $getOwnPropertySymbols; wrappedWellKnownSymbolModule.f = function (name) { return wrap(wellKnownSymbol(name), name); }; if (DESCRIPTORS) { // https://github.com/tc39/proposal-Symbol-description nativeDefineProperty($Symbol[PROTOTYPE], 'description', { configurable: true, get: function description() { return getInternalState(this).description; } }); if (!IS_PURE) { redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true }); } } } $({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, { Symbol: $Symbol }); $forEach(objectKeys(WellKnownSymbolsStore), function (name) { defineWellKnownSymbol(name); }); $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, { // `Symbol.for` method // https://tc39.github.io/ecma262/#sec-symbol.for 'for': function (key) { var string = String(key); if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; var symbol = $Symbol(string); StringToSymbolRegistry[string] = symbol; SymbolToStringRegistry[symbol] = string; return symbol; }, // `Symbol.keyFor` method // https://tc39.github.io/ecma262/#sec-symbol.keyfor keyFor: function keyFor(sym) { if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol'); if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; }, useSetter: function () { USE_SETTER = true; }, useSimple: function () { USE_SETTER = false; } }); $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, { // `Object.create` method // https://tc39.github.io/ecma262/#sec-object.create create: $create, // `Object.defineProperty` method // https://tc39.github.io/ecma262/#sec-object.defineproperty defineProperty: $defineProperty, // `Object.defineProperties` method // https://tc39.github.io/ecma262/#sec-object.defineproperties defineProperties: $defineProperties, // `Object.getOwnPropertyDescriptor` method // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors getOwnPropertyDescriptor: $getOwnPropertyDescriptor }); $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, { // `Object.getOwnPropertyNames` method // https://tc39.github.io/ecma262/#sec-object.getownpropertynames getOwnPropertyNames: $getOwnPropertyNames, // `Object.getOwnPropertySymbols` method // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols getOwnPropertySymbols: $getOwnPropertySymbols }); // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives // https://bugs.chromium.org/p/v8/issues/detail?id=3443 $({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymbolsModule.f(1); }) }, { getOwnPropertySymbols: function getOwnPropertySymbols(it) { return getOwnPropertySymbolsModule.f(toObject(it)); } }); // `JSON.stringify` method behavior with symbols // https://tc39.github.io/ecma262/#sec-json.stringify if ($stringify) { var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () { var symbol = $Symbol(); // MS Edge converts symbol values to JSON as {} return $stringify([symbol]) != '[null]' // WebKit converts symbol values to JSON as null || $stringify({ a: symbol }) != '{}' // V8 throws on boxed symbols || $stringify(Object(symbol)) != '{}'; }); $({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, { // eslint-disable-next-line no-unused-vars stringify: function stringify(it, replacer, space) { var args = [it]; var index = 1; var $replacer; while (arguments.length > index) args.push(arguments[index++]); $replacer = replacer; if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined if (!isArray(replacer)) replacer = function (key, value) { if (typeof $replacer == 'function') value = $replacer.call(this, key, value); if (!isSymbol(value)) return value; }; args[1] = replacer; return $stringify.apply(null, args); } }); } // `Symbol.prototype[@@toPrimitive]` method // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) { createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); } // `Symbol.prototype[@@toStringTag]` property // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag setToStringTag($Symbol, SYMBOL); hiddenKeys[HIDDEN] = true; core-js-3.6.1/packages/core-js/modules/es.symbol.match-all.js000066400000000000000000000002311360057567700240010ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.matchAll` well-known symbol defineWellKnownSymbol('matchAll'); core-js-3.6.1/packages/core-js/modules/es.symbol.match.js000066400000000000000000000003071360057567700232370ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.match` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.match defineWellKnownSymbol('match'); core-js-3.6.1/packages/core-js/modules/es.symbol.replace.js000066400000000000000000000003151360057567700235550ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.replace` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.replace defineWellKnownSymbol('replace'); core-js-3.6.1/packages/core-js/modules/es.symbol.search.js000066400000000000000000000003121360057567700234040ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.search` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.search defineWellKnownSymbol('search'); core-js-3.6.1/packages/core-js/modules/es.symbol.species.js000066400000000000000000000003151360057567700235750ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.species` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.species defineWellKnownSymbol('species'); core-js-3.6.1/packages/core-js/modules/es.symbol.split.js000066400000000000000000000003071360057567700232760ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.split` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.split defineWellKnownSymbol('split'); core-js-3.6.1/packages/core-js/modules/es.symbol.to-primitive.js000066400000000000000000000003311360057567700245700ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.toPrimitive` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.toprimitive defineWellKnownSymbol('toPrimitive'); core-js-3.6.1/packages/core-js/modules/es.symbol.to-string-tag.js000066400000000000000000000003311360057567700246370ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.toStringTag` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.tostringtag defineWellKnownSymbol('toStringTag'); core-js-3.6.1/packages/core-js/modules/es.symbol.unscopables.js000066400000000000000000000003311360057567700244560ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.unscopables` well-known symbol // https://tc39.github.io/ecma262/#sec-symbol.unscopables defineWellKnownSymbol('unscopables'); core-js-3.6.1/packages/core-js/modules/es.typed-array.copy-within.js000066400000000000000000000011221360057567700253450ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $copyWithin = require('../internals/array-copy-within'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.copyWithin` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.copywithin exportTypedArrayMethod('copyWithin', function copyWithin(target, start /* , end */) { return $copyWithin.call(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.every.js000066400000000000000000000010611360057567700242270ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $every = require('../internals/array-iteration').every; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.every` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.every exportTypedArrayMethod('every', function every(callbackfn /* , thisArg */) { return $every(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.fill.js000066400000000000000000000010351360057567700240240ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $fill = require('../internals/array-fill'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.fill` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.fill // eslint-disable-next-line no-unused-vars exportTypedArrayMethod('fill', function fill(value /* , start, end */) { return $fill.apply(aTypedArray(this), arguments); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.filter.js000066400000000000000000000016571360057567700243750ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $filter = require('../internals/array-iteration').filter; var speciesConstructor = require('../internals/species-constructor'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.filter` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.filter exportTypedArrayMethod('filter', function filter(callbackfn /* , thisArg */) { var list = $filter(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); var C = speciesConstructor(this, this.constructor); var index = 0; var length = list.length; var result = new (aTypedArrayConstructor(C))(length); while (length > index) result[index] = list[index++]; return result; }); core-js-3.6.1/packages/core-js/modules/es.typed-array.find-index.js000066400000000000000000000011131360057567700251200ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $findIndex = require('../internals/array-iteration').findIndex; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.findIndex` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.findindex exportTypedArrayMethod('findIndex', function findIndex(predicate /* , thisArg */) { return $findIndex(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.find.js000066400000000000000000000010501360057567700240130ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $find = require('../internals/array-iteration').find; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.find` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.find exportTypedArrayMethod('find', function find(predicate /* , thisArg */) { return $find(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.float32-array.js000066400000000000000000000005321360057567700254650ustar00rootroot00000000000000var createTypedArrayConstructor = require('../internals/typed-array-constructor'); // `Float32Array` constructor // https://tc39.github.io/ecma262/#sec-typedarray-objects createTypedArrayConstructor('Float32', function (init) { return function Float32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); core-js-3.6.1/packages/core-js/modules/es.typed-array.float64-array.js000066400000000000000000000005321360057567700254720ustar00rootroot00000000000000var createTypedArrayConstructor = require('../internals/typed-array-constructor'); // `Float64Array` constructor // https://tc39.github.io/ecma262/#sec-typedarray-objects createTypedArrayConstructor('Float64', function (init) { return function Float64Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); core-js-3.6.1/packages/core-js/modules/es.typed-array.for-each.js000066400000000000000000000010701360057567700245610ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $forEach = require('../internals/array-iteration').forEach; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.forEach` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.foreach exportTypedArrayMethod('forEach', function forEach(callbackfn /* , thisArg */) { $forEach(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.from.js000066400000000000000000000007571360057567700240530ustar00rootroot00000000000000'use strict'; var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-arrays-constructors-requires-wrappers'); var exportTypedArrayStaticMethod = require('../internals/array-buffer-view-core').exportTypedArrayStaticMethod; var typedArrayFrom = require('../internals/typed-array-from'); // `%TypedArray%.from` method // https://tc39.github.io/ecma262/#sec-%typedarray%.from exportTypedArrayStaticMethod('from', typedArrayFrom, TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS); core-js-3.6.1/packages/core-js/modules/es.typed-array.includes.js000066400000000000000000000011151360057567700247030ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $includes = require('../internals/array-includes').includes; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.includes` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.includes exportTypedArrayMethod('includes', function includes(searchElement /* , fromIndex */) { return $includes(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.index-of.js000066400000000000000000000011061360057567700246060ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $indexOf = require('../internals/array-includes').indexOf; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.indexOf` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.indexof exportTypedArrayMethod('indexOf', function indexOf(searchElement /* , fromIndex */) { return $indexOf(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.int16-array.js000066400000000000000000000005241360057567700251550ustar00rootroot00000000000000var createTypedArrayConstructor = require('../internals/typed-array-constructor'); // `Int16Array` constructor // https://tc39.github.io/ecma262/#sec-typedarray-objects createTypedArrayConstructor('Int16', function (init) { return function Int16Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); core-js-3.6.1/packages/core-js/modules/es.typed-array.int32-array.js000066400000000000000000000005241360057567700251530ustar00rootroot00000000000000var createTypedArrayConstructor = require('../internals/typed-array-constructor'); // `Int32Array` constructor // https://tc39.github.io/ecma262/#sec-typedarray-objects createTypedArrayConstructor('Int32', function (init) { return function Int32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); core-js-3.6.1/packages/core-js/modules/es.typed-array.int8-array.js000066400000000000000000000005211360057567700250730ustar00rootroot00000000000000var createTypedArrayConstructor = require('../internals/typed-array-constructor'); // `Int8Array` constructor // https://tc39.github.io/ecma262/#sec-typedarray-objects createTypedArrayConstructor('Int8', function (init) { return function Int8Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); core-js-3.6.1/packages/core-js/modules/es.typed-array.iterator.js000066400000000000000000000032471360057567700247360ustar00rootroot00000000000000'use strict'; var global = require('../internals/global'); var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var ArrayIterators = require('../modules/es.array.iterator'); var wellKnownSymbol = require('../internals/well-known-symbol'); var ITERATOR = wellKnownSymbol('iterator'); var Uint8Array = global.Uint8Array; var arrayValues = ArrayIterators.values; var arrayKeys = ArrayIterators.keys; var arrayEntries = ArrayIterators.entries; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var nativeTypedArrayIterator = Uint8Array && Uint8Array.prototype[ITERATOR]; var CORRECT_ITER_NAME = !!nativeTypedArrayIterator && (nativeTypedArrayIterator.name == 'values' || nativeTypedArrayIterator.name == undefined); var typedArrayValues = function values() { return arrayValues.call(aTypedArray(this)); }; // `%TypedArray%.prototype.entries` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.entries exportTypedArrayMethod('entries', function entries() { return arrayEntries.call(aTypedArray(this)); }); // `%TypedArray%.prototype.keys` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.keys exportTypedArrayMethod('keys', function keys() { return arrayKeys.call(aTypedArray(this)); }); // `%TypedArray%.prototype.values` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.values exportTypedArrayMethod('values', typedArrayValues, !CORRECT_ITER_NAME); // `%TypedArray%.prototype[@@iterator]` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype-@@iterator exportTypedArrayMethod(ITERATOR, typedArrayValues, !CORRECT_ITER_NAME); core-js-3.6.1/packages/core-js/modules/es.typed-array.join.js000066400000000000000000000007631360057567700240440ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var $join = [].join; // `%TypedArray%.prototype.join` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join // eslint-disable-next-line no-unused-vars exportTypedArrayMethod('join', function join(separator) { return $join.apply(aTypedArray(this), arguments); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.last-index-of.js000066400000000000000000000011271360057567700255520ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $lastIndexOf = require('../internals/array-last-index-of'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.lastIndexOf` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.lastindexof // eslint-disable-next-line no-unused-vars exportTypedArrayMethod('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) { return $lastIndexOf.apply(aTypedArray(this), arguments); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.map.js000066400000000000000000000014331360057567700236550ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $map = require('../internals/array-iteration').map; var speciesConstructor = require('../internals/species-constructor'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.map` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.map exportTypedArrayMethod('map', function map(mapfn /* , thisArg */) { return $map(aTypedArray(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) { return new (aTypedArrayConstructor(speciesConstructor(O, O.constructor)))(length); }); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.of.js000066400000000000000000000013571360057567700235110ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-arrays-constructors-requires-wrappers'); var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayStaticMethod = ArrayBufferViewCore.exportTypedArrayStaticMethod; // `%TypedArray%.of` method // https://tc39.github.io/ecma262/#sec-%typedarray%.of exportTypedArrayStaticMethod('of', function of(/* ...items */) { var index = 0; var length = arguments.length; var result = new (aTypedArrayConstructor(this))(length); while (length > index) result[index] = arguments[index++]; return result; }, TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS); core-js-3.6.1/packages/core-js/modules/es.typed-array.reduce-right.js000066400000000000000000000011511360057567700254570ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $reduceRight = require('../internals/array-reduce').right; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.reduceRicht` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduceright exportTypedArrayMethod('reduceRight', function reduceRight(callbackfn /* , initialValue */) { return $reduceRight(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.reduce.js000066400000000000000000000011121360057567700243410ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $reduce = require('../internals/array-reduce').left; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.reduce` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduce exportTypedArrayMethod('reduce', function reduce(callbackfn /* , initialValue */) { return $reduce(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.reverse.js000066400000000000000000000012311360057567700245470ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var floor = Math.floor; // `%TypedArray%.prototype.reverse` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reverse exportTypedArrayMethod('reverse', function reverse() { var that = this; var length = aTypedArray(that).length; var middle = floor(length / 2); var index = 0; var value; while (index < middle) { value = that[index]; that[index++] = that[--length]; that[length] = value; } return that; }); core-js-3.6.1/packages/core-js/modules/es.typed-array.set.js000066400000000000000000000020101360057567700236630ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var toLength = require('../internals/to-length'); var toOffset = require('../internals/to-offset'); var toObject = require('../internals/to-object'); var fails = require('../internals/fails'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var FORCED = fails(function () { // eslint-disable-next-line no-undef new Int8Array(1).set({}); }); // `%TypedArray%.prototype.set` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.set exportTypedArrayMethod('set', function set(arrayLike /* , offset */) { aTypedArray(this); var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1); var length = this.length; var src = toObject(arrayLike); var len = toLength(src.length); var index = 0; if (len + offset > length) throw RangeError('Wrong length'); while (index < len) this[offset + index] = src[index++]; }, FORCED); core-js-3.6.1/packages/core-js/modules/es.typed-array.slice.js000066400000000000000000000017431360057567700242030ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var speciesConstructor = require('../internals/species-constructor'); var fails = require('../internals/fails'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var $slice = [].slice; var FORCED = fails(function () { // eslint-disable-next-line no-undef new Int8Array(1).slice(); }); // `%TypedArray%.prototype.slice` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.slice exportTypedArrayMethod('slice', function slice(start, end) { var list = $slice.call(aTypedArray(this), start, end); var C = speciesConstructor(this, this.constructor); var index = 0; var length = list.length; var result = new (aTypedArrayConstructor(C))(length); while (length > index) result[index] = list[index++]; return result; }, FORCED); core-js-3.6.1/packages/core-js/modules/es.typed-array.some.js000066400000000000000000000010521360057567700240400ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var $some = require('../internals/array-iteration').some; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.some` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.some exportTypedArrayMethod('some', function some(callbackfn /* , thisArg */) { return $some(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.sort.js000066400000000000000000000007071360057567700240720ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var $sort = [].sort; // `%TypedArray%.prototype.sort` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.sort exportTypedArrayMethod('sort', function sort(comparefn) { return $sort.call(aTypedArray(this), comparefn); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.subarray.js000066400000000000000000000016061360057567700247320ustar00rootroot00000000000000'use strict'; var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var toLength = require('../internals/to-length'); var toAbsoluteIndex = require('../internals/to-absolute-index'); var speciesConstructor = require('../internals/species-constructor'); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.subarray` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.subarray exportTypedArrayMethod('subarray', function subarray(begin, end) { var O = aTypedArray(this); var length = O.length; var beginIndex = toAbsoluteIndex(begin, length); return new (speciesConstructor(O, O.constructor))( O.buffer, O.byteOffset + beginIndex * O.BYTES_PER_ELEMENT, toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - beginIndex) ); }); core-js-3.6.1/packages/core-js/modules/es.typed-array.to-locale-string.js000066400000000000000000000020401360057567700262560ustar00rootroot00000000000000'use strict'; var global = require('../internals/global'); var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); var fails = require('../internals/fails'); var Int8Array = global.Int8Array; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var $toLocaleString = [].toLocaleString; var $slice = [].slice; // iOS Safari 6.x fails here var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () { $toLocaleString.call(new Int8Array(1)); }); var FORCED = fails(function () { return [1, 2].toLocaleString() != new Int8Array([1, 2]).toLocaleString(); }) || !fails(function () { Int8Array.prototype.toLocaleString.call([1, 2]); }); // `%TypedArray%.prototype.toLocaleString` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tolocalestring exportTypedArrayMethod('toLocaleString', function toLocaleString() { return $toLocaleString.apply(TO_LOCALE_STRING_BUG ? $slice.call(aTypedArray(this)) : aTypedArray(this), arguments); }, FORCED); core-js-3.6.1/packages/core-js/modules/es.typed-array.to-string.js000066400000000000000000000013721360057567700250300ustar00rootroot00000000000000'use strict'; var exportTypedArrayMethod = require('../internals/array-buffer-view-core').exportTypedArrayMethod; var fails = require('../internals/fails'); var global = require('../internals/global'); var Uint8Array = global.Uint8Array; var Uint8ArrayPrototype = Uint8Array && Uint8Array.prototype || {}; var arrayToString = [].toString; var arrayJoin = [].join; if (fails(function () { arrayToString.call({}); })) { arrayToString = function toString() { return arrayJoin.call(this); }; } var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString; // `%TypedArray%.prototype.toString` method // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tostring exportTypedArrayMethod('toString', arrayToString, IS_NOT_ARRAY_METHOD); core-js-3.6.1/packages/core-js/modules/es.typed-array.uint16-array.js000066400000000000000000000005271360057567700253450ustar00rootroot00000000000000var createTypedArrayConstructor = require('../internals/typed-array-constructor'); // `Uint16Array` constructor // https://tc39.github.io/ecma262/#sec-typedarray-objects createTypedArrayConstructor('Uint16', function (init) { return function Uint16Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); core-js-3.6.1/packages/core-js/modules/es.typed-array.uint32-array.js000066400000000000000000000005271360057567700253430ustar00rootroot00000000000000var createTypedArrayConstructor = require('../internals/typed-array-constructor'); // `Uint32Array` constructor // https://tc39.github.io/ecma262/#sec-typedarray-objects createTypedArrayConstructor('Uint32', function (init) { return function Uint32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); core-js-3.6.1/packages/core-js/modules/es.typed-array.uint8-array.js000066400000000000000000000005241360057567700252630ustar00rootroot00000000000000var createTypedArrayConstructor = require('../internals/typed-array-constructor'); // `Uint8Array` constructor // https://tc39.github.io/ecma262/#sec-typedarray-objects createTypedArrayConstructor('Uint8', function (init) { return function Uint8Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); core-js-3.6.1/packages/core-js/modules/es.typed-array.uint8-clamped-array.js000066400000000000000000000005501360057567700266650ustar00rootroot00000000000000var createTypedArrayConstructor = require('../internals/typed-array-constructor'); // `Uint8ClampedArray` constructor // https://tc39.github.io/ecma262/#sec-typedarray-objects createTypedArrayConstructor('Uint8', function (init) { return function Uint8ClampedArray(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }, true); core-js-3.6.1/packages/core-js/modules/es.weak-map.js000066400000000000000000000053741360057567700223520ustar00rootroot00000000000000'use strict'; var global = require('../internals/global'); var redefineAll = require('../internals/redefine-all'); var InternalMetadataModule = require('../internals/internal-metadata'); var collection = require('../internals/collection'); var collectionWeak = require('../internals/collection-weak'); var isObject = require('../internals/is-object'); var enforceIternalState = require('../internals/internal-state').enforce; var NATIVE_WEAK_MAP = require('../internals/native-weak-map'); var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; var isExtensible = Object.isExtensible; var InternalWeakMap; var wrapper = function (init) { return function WeakMap() { return init(this, arguments.length ? arguments[0] : undefined); }; }; // `WeakMap` constructor // https://tc39.github.io/ecma262/#sec-weakmap-constructor var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak); // IE11 WeakMap frozen keys fix // We can't use feature detection because it crash some old IE builds // https://github.com/zloirock/core-js/issues/485 if (NATIVE_WEAK_MAP && IS_IE11) { InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true); InternalMetadataModule.REQUIRED = true; var WeakMapPrototype = $WeakMap.prototype; var nativeDelete = WeakMapPrototype['delete']; var nativeHas = WeakMapPrototype.has; var nativeGet = WeakMapPrototype.get; var nativeSet = WeakMapPrototype.set; redefineAll(WeakMapPrototype, { 'delete': function (key) { if (isObject(key) && !isExtensible(key)) { var state = enforceIternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeDelete.call(this, key) || state.frozen['delete'](key); } return nativeDelete.call(this, key); }, has: function has(key) { if (isObject(key) && !isExtensible(key)) { var state = enforceIternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas.call(this, key) || state.frozen.has(key); } return nativeHas.call(this, key); }, get: function get(key) { if (isObject(key) && !isExtensible(key)) { var state = enforceIternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key); } return nativeGet.call(this, key); }, set: function set(key, value) { if (isObject(key) && !isExtensible(key)) { var state = enforceIternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value); } else nativeSet.call(this, key, value); return this; } }); } core-js-3.6.1/packages/core-js/modules/es.weak-set.js000066400000000000000000000005631360057567700223630ustar00rootroot00000000000000'use strict'; var collection = require('../internals/collection'); var collectionWeak = require('../internals/collection-weak'); // `WeakSet` constructor // https://tc39.github.io/ecma262/#sec-weakset-constructor collection('WeakSet', function (init) { return function WeakSet() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionWeak); core-js-3.6.1/packages/core-js/modules/esnext.aggregate-error.js000066400000000000000000000034461360057567700246220ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var setPrototypeOf = require('../internals/object-set-prototype-of'); var create = require('../internals/object-create'); var defineProperty = require('../internals/object-define-property'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); var iterate = require('../internals/iterate'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var InternalStateModule = require('../internals/internal-state'); var setInternalState = InternalStateModule.set; var getInternalAggregateErrorState = InternalStateModule.getterFor('AggregateError'); var $AggregateError = function AggregateError(errors, message) { var that = this; if (!(that instanceof $AggregateError)) return new $AggregateError(errors, message); if (setPrototypeOf) { that = setPrototypeOf(new Error(message), getPrototypeOf(that)); } var errorsArray = []; iterate(errors, errorsArray.push, errorsArray); if (DESCRIPTORS) setInternalState(that, { errors: errorsArray, type: 'AggregateError' }); else that.errors = errorsArray; if (message !== undefined) createNonEnumerableProperty(that, 'message', String(message)); return that; }; $AggregateError.prototype = create(Error.prototype, { constructor: createPropertyDescriptor(5, $AggregateError), message: createPropertyDescriptor(5, ''), name: createPropertyDescriptor(5, 'AggregateError') }); if (DESCRIPTORS) defineProperty.f($AggregateError.prototype, 'errors', { get: function () { return getInternalAggregateErrorState(this).errors; }, configurable: true }); $({ global: true }, { AggregateError: $AggregateError }); core-js-3.6.1/packages/core-js/modules/esnext.array.is-template-object.js000066400000000000000000000016101360057567700263410ustar00rootroot00000000000000var $ = require('../internals/export'); var isArray = require('../internals/is-array'); var isFrozen = Object.isFrozen; var isFrozenStringArray = function (array, allowUndefined) { if (!isFrozen || !isArray(array) || !isFrozen(array)) return false; var index = 0; var length = array.length; var element; while (index < length) { element = array[index++]; if (!(typeof element === 'string' || (allowUndefined && typeof element === 'undefined'))) { return false; } } return length !== 0; }; // `Array.isTemplateObject` method // https://github.com/tc39/proposal-array-is-template-object $({ target: 'Array', stat: true }, { isTemplateObject: function isTemplateObject(value) { if (!isFrozenStringArray(value, true)) return false; var raw = value.raw; if (raw.length !== value.length || !isFrozenStringArray(raw, false)) return false; return true; } }); core-js-3.6.1/packages/core-js/modules/esnext.array.last-index.js000066400000000000000000000012711360057567700247240ustar00rootroot00000000000000'use strict'; var DESCRIPTORS = require('../internals/descriptors'); var addToUnscopables = require('../internals/add-to-unscopables'); var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); var defineProperty = require('../internals/object-define-property').f; // `Array.prototype.lastIndex` getter // https://github.com/keithamus/proposal-array-last if (DESCRIPTORS && !('lastIndex' in [])) { defineProperty(Array.prototype, 'lastIndex', { configurable: true, get: function lastIndex() { var O = toObject(this); var len = toLength(O.length); return len == 0 ? 0 : len - 1; } }); addToUnscopables('lastIndex'); } core-js-3.6.1/packages/core-js/modules/esnext.array.last-item.js000066400000000000000000000015371360057567700245600ustar00rootroot00000000000000'use strict'; var DESCRIPTORS = require('../internals/descriptors'); var addToUnscopables = require('../internals/add-to-unscopables'); var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); var defineProperty = require('../internals/object-define-property').f; // `Array.prototype.lastIndex` accessor // https://github.com/keithamus/proposal-array-last if (DESCRIPTORS && !('lastItem' in [])) { defineProperty(Array.prototype, 'lastItem', { configurable: true, get: function lastItem() { var O = toObject(this); var len = toLength(O.length); return len == 0 ? undefined : O[len - 1]; }, set: function lastItem(value) { var O = toObject(this); var len = toLength(O.length); return O[len == 0 ? 0 : len - 1] = value; } }); addToUnscopables('lastItem'); } core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.as-indexed-pairs.js000066400000000000000000000015211360057567700276350ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) { var state = this; var iterator = state.iterator; return Promise.resolve(anObject(state.next.call(iterator, arg))).then(function (step) { if (anObject(step).done) { state.done = true; return { done: true, value: undefined }; } return { done: false, value: [state.index++, step.value] }; }); }); $({ target: 'AsyncIterator', proto: true, real: true }, { asIndexedPairs: function asIndexedPairs() { return new AsyncIteratorProxy({ iterator: anObject(this), index: 0 }); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.constructor.js000066400000000000000000000021521360057567700270660ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var anInstance = require('../internals/an-instance'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var has = require('../internals/has'); var wellKnownSymbol = require('../internals/well-known-symbol'); var AsyncIteratorPrototype = require('../internals/async-iterator-prototype'); var IS_PURE = require('../internals/is-pure'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var AsyncIteratorConstructor = function AsyncIterator() { anInstance(this, AsyncIteratorConstructor); }; AsyncIteratorConstructor.prototype = AsyncIteratorPrototype; if (!has(AsyncIteratorPrototype, TO_STRING_TAG)) { createNonEnumerableProperty(AsyncIteratorPrototype, TO_STRING_TAG, 'AsyncIterator'); } if (!has(AsyncIteratorPrototype, 'constructor') || AsyncIteratorPrototype.constructor === Object) { createNonEnumerableProperty(AsyncIteratorPrototype, 'constructor', AsyncIteratorConstructor); } $({ global: true, forced: IS_PURE }, { AsyncIterator: AsyncIteratorConstructor }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.drop.js000066400000000000000000000024221360057567700254450ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var toPositiveInteger = require('../internals/to-positive-integer'); var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) { var state = this; return new Promise(function (resolve, reject) { var loop = function () { try { Promise.resolve( anObject(state.next.call(state.iterator, state.remaining ? undefined : arg)) ).then(function (step) { try { if (anObject(step).done) { state.done = true; resolve({ done: true, value: undefined }); } else if (state.remaining) { state.remaining--; loop(); } else resolve({ done: false, value: step.value }); } catch (err) { reject(err); } }, reject); } catch (error) { reject(error); } }; loop(); }); }); $({ target: 'AsyncIterator', proto: true, real: true }, { drop: function drop(limit) { return new AsyncIteratorProxy({ iterator: anObject(this), remaining: toPositiveInteger(limit) }); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.every.js000066400000000000000000000004561360057567700256400ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var $every = require('../internals/async-iterator-iteration').every; $({ target: 'AsyncIterator', proto: true, real: true }, { every: function every(fn) { return $every(this, fn); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.filter.js000066400000000000000000000025111360057567700257650ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) { var state = this; var filterer = state.filterer; return new Promise(function (resolve, reject) { var loop = function () { try { Promise.resolve(anObject(state.next.call(state.iterator, arg))).then(function (step) { try { if (anObject(step).done) { state.done = true; resolve({ done: true, value: undefined }); } else { var value = step.value; Promise.resolve(filterer(value)).then(function (selected) { selected ? resolve({ done: false, value: value }) : loop(); }, reject); } } catch (err) { reject(err); } }, reject); } catch (error) { reject(error); } }; loop(); }); }); $({ target: 'AsyncIterator', proto: true, real: true }, { filter: function filter(filterer) { return new AsyncIteratorProxy({ iterator: anObject(this), filterer: aFunction(filterer) }); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.find.js000066400000000000000000000004511360057567700254210ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var $find = require('../internals/async-iterator-iteration').find; $({ target: 'AsyncIterator', proto: true, real: true }, { find: function find(fn) { return $find(this, fn); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.flat-map.js000066400000000000000000000046511360057567700262100ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); var getAsyncIteratorMethod = require('../internals/get-async-iterator-method'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) { var state = this; var mapper = state.mapper; var innerIterator, iteratorMethod; return new Promise(function (resolve, reject) { var outerLoop = function () { try { Promise.resolve(anObject(state.next.call(state.iterator, arg))).then(function (step) { try { if (anObject(step).done) { state.done = true; resolve({ done: true, value: undefined }); } else { Promise.resolve(mapper(step.value)).then(function (mapped) { try { iteratorMethod = getAsyncIteratorMethod(mapped); if (iteratorMethod !== undefined) { state.innerIterator = innerIterator = anObject(iteratorMethod.call(mapped)); state.innerNext = aFunction(innerIterator.next); return innerLoop(); } reject(TypeError('.flatMap callback should return an iterable object')); } catch (error2) { reject(error2); } }, reject); } } catch (error1) { reject(error1); } }, reject); } catch (error) { reject(error); } }; var innerLoop = function () { if (innerIterator = state.innerIterator) { try { Promise.resolve(anObject(state.innerNext.call(innerIterator))).then(function (result) { try { if (anObject(result).done) { state.innerIterator = state.innerNext = null; outerLoop(); } else resolve({ done: false, value: result.value }); } catch (error1) { reject(error1); } }, reject); } catch (error) { reject(error); } } else outerLoop(); }; innerLoop(); }); }); $({ target: 'AsyncIterator', proto: true, real: true }, { flatMap: function flatMap(mapper) { return new AsyncIteratorProxy({ iterator: anObject(this), mapper: aFunction(mapper), innerIterator: null, innerNext: null }); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.for-each.js000066400000000000000000000004701360057567700261660ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var $forEach = require('../internals/async-iterator-iteration').forEach; $({ target: 'AsyncIterator', proto: true, real: true }, { forEach: function forEach(fn) { return $forEach(this, fn); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.from.js000066400000000000000000000020551360057567700254460ustar00rootroot00000000000000// https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var path = require('../internals/path'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var toObject = require('../internals/to-object'); var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); var getAsyncIteratorMethod = require('../internals/get-async-iterator-method'); var AsyncIterator = path.AsyncIterator; var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg) { return anObject(this.next.call(this.iterator, arg)); }, true); $({ target: 'AsyncIterator', stat: true }, { from: function from(O) { var object = toObject(O); var usingIterator = getAsyncIteratorMethod(object); var iterator; if (usingIterator != null) { iterator = aFunction(usingIterator).call(object); if (iterator instanceof AsyncIterator) return iterator; } else { iterator = object; } return new AsyncIteratorProxy({ iterator: iterator }); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.map.js000066400000000000000000000017031360057567700252570ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) { var state = this; var mapper = state.mapper; return Promise.resolve(anObject(state.next.call(state.iterator, arg))).then(function (step) { if (anObject(step).done) { state.done = true; return { done: true, value: undefined }; } return Promise.resolve(mapper(step.value)).then(function (value) { return { done: false, value: value }; }); }); }); $({ target: 'AsyncIterator', proto: true, real: true }, { map: function map(mapper) { return new AsyncIteratorProxy({ iterator: anObject(this), mapper: aFunction(mapper) }); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.reduce.js000066400000000000000000000030431360057567700257500ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var getBuiltIn = require('../internals/get-built-in'); var Promise = getBuiltIn('Promise'); $({ target: 'AsyncIterator', proto: true, real: true }, { reduce: function reduce(reducer /* , initialValue */) { var iterator = anObject(this); var next = aFunction(iterator.next); var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; aFunction(reducer); return new Promise(function (resolve, reject) { var loop = function () { try { Promise.resolve(anObject(next.call(iterator))).then(function (step) { try { if (anObject(step).done) { noInitial ? reject(TypeError('Reduce of empty iterator with no initial value')) : resolve(accumulator); } else { var value = step.value; if (noInitial) { noInitial = false; accumulator = value; loop(); } else { Promise.resolve(reducer(accumulator, value)).then(function (result) { accumulator = result; loop(); }, reject); } } } catch (err) { reject(err); } }, reject); } catch (error) { reject(error); } }; loop(); }); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.some.js000066400000000000000000000004511360057567700254440ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var $some = require('../internals/async-iterator-iteration').some; $({ target: 'AsyncIterator', proto: true, real: true }, { some: function some(fn) { return $some(this, fn); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.take.js000066400000000000000000000013431360057567700254260ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var toPositiveInteger = require('../internals/to-positive-integer'); var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy'); var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg) { if (!this.remaining--) { this.done = true; return { done: true, value: undefined }; } return this.next.call(this.iterator, arg); }); $({ target: 'AsyncIterator', proto: true, real: true }, { take: function take(limit) { return new AsyncIteratorProxy({ iterator: anObject(this), remaining: toPositiveInteger(limit) }); } }); core-js-3.6.1/packages/core-js/modules/esnext.async-iterator.to-array.js000066400000000000000000000004621360057567700262410ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var $toArray = require('../internals/async-iterator-iteration').toArray; $({ target: 'AsyncIterator', proto: true, real: true }, { toArray: function toArray() { return $toArray(this); } }); core-js-3.6.1/packages/core-js/modules/esnext.composite-key.js000066400000000000000000000011041360057567700243220ustar00rootroot00000000000000var $ = require('../internals/export'); var getCompositeKeyNode = require('../internals/composite-key'); var getBuiltIn = require('../internals/get-built-in'); var create = require('../internals/object-create'); var initializer = function () { var freeze = getBuiltIn('Object', 'freeze'); return freeze ? freeze(create(null)) : create(null); }; // https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey $({ global: true }, { compositeKey: function compositeKey() { return getCompositeKeyNode.apply(Object, arguments).get('object', initializer); } }); core-js-3.6.1/packages/core-js/modules/esnext.composite-symbol.js000066400000000000000000000010111360057567700250340ustar00rootroot00000000000000var $ = require('../internals/export'); var getCompositeKeyNode = require('../internals/composite-key'); var getBuiltIn = require('../internals/get-built-in'); // https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey $({ global: true }, { compositeSymbol: function compositeSymbol() { if (arguments.length === 1 && typeof arguments[0] === 'string') return getBuiltIn('Symbol')['for'](arguments[0]); return getCompositeKeyNode.apply(null, arguments).get('symbol', getBuiltIn('Symbol')); } }); core-js-3.6.1/packages/core-js/modules/esnext.global-this.js000066400000000000000000000000761360057567700237460ustar00rootroot00000000000000// TODO: Remove from `core-js@4` require('./es.global-this'); core-js-3.6.1/packages/core-js/modules/esnext.iterator.as-indexed-pairs.js000066400000000000000000000011751360057567700265270ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var createIteratorProxy = require('../internals/create-iterator-proxy'); var IteratorProxy = createIteratorProxy(function (arg) { var result = anObject(this.next.call(this.iterator, arg)); var done = this.done = !!result.done; if (!done) return [this.index++, result.value]; }); $({ target: 'Iterator', proto: true, real: true }, { asIndexedPairs: function asIndexedPairs() { return new IteratorProxy({ iterator: anObject(this), index: 0 }); } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.constructor.js000066400000000000000000000031711360057567700257550ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var global = require('../internals/global'); var anInstance = require('../internals/an-instance'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var fails = require('../internals/fails'); var has = require('../internals/has'); var wellKnownSymbol = require('../internals/well-known-symbol'); var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype; var IS_PURE = require('../internals/is-pure'); var ITERATOR = wellKnownSymbol('iterator'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var NativeIterator = global.Iterator; // FF56- have non-standard global helper `Iterator` var FORCED = IS_PURE || typeof NativeIterator != 'function' || NativeIterator.prototype !== IteratorPrototype // FF44- non-standard `Iterator` passes previous tests || !fails(function () { NativeIterator({}); }); var IteratorConstructor = function Iterator() { anInstance(this, IteratorConstructor); }; if (IS_PURE) { IteratorPrototype = {}; createNonEnumerableProperty(IteratorPrototype, ITERATOR, function () { return this; }); } if (!has(IteratorPrototype, TO_STRING_TAG)) { createNonEnumerableProperty(IteratorPrototype, TO_STRING_TAG, 'Iterator'); } if (FORCED || !has(IteratorPrototype, 'constructor') || IteratorPrototype.constructor === Object) { createNonEnumerableProperty(IteratorPrototype, 'constructor', IteratorConstructor); } IteratorConstructor.prototype = IteratorPrototype; $({ global: true, forced: FORCED }, { Iterator: IteratorConstructor }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.drop.js000066400000000000000000000016251360057567700243360ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var toPositiveInteger = require('../internals/to-positive-integer'); var createIteratorProxy = require('../internals/create-iterator-proxy'); var IteratorProxy = createIteratorProxy(function (arg) { var iterator = this.iterator; var next = this.next; var result, done; while (this.remaining) { this.remaining--; result = anObject(next.call(iterator)); done = this.done = !!result.done; if (done) return; } result = anObject(next.call(iterator, arg)); done = this.done = !!result.done; if (!done) return result.value; }); $({ target: 'Iterator', proto: true, real: true }, { drop: function drop(limit) { return new IteratorProxy({ iterator: anObject(this), remaining: toPositiveInteger(limit) }); } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.every.js000066400000000000000000000010051360057567700245140ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var iterate = require('../internals/iterate'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); $({ target: 'Iterator', proto: true, real: true }, { every: function every(fn) { anObject(this); aFunction(fn); return !iterate(this, function (value) { if (!fn(value)) return iterate.stop(); }, undefined, false, true).stopped; } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.filter.js000066400000000000000000000017421360057567700246570ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var createIteratorProxy = require('../internals/create-iterator-proxy'); var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); var IteratorProxy = createIteratorProxy(function (arg) { var iterator = this.iterator; var filterer = this.filterer; var next = this.next; var result, done, value; while (true) { result = anObject(next.call(iterator, arg)); done = this.done = !!result.done; if (done) return; value = result.value; if (callWithSafeIterationClosing(iterator, filterer, value)) return value; } }); $({ target: 'Iterator', proto: true, real: true }, { filter: function filter(filterer) { return new IteratorProxy({ iterator: anObject(this), filterer: aFunction(filterer) }); } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.find.js000066400000000000000000000010051360057567700243020ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var iterate = require('../internals/iterate'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); $({ target: 'Iterator', proto: true, real: true }, { find: function find(fn) { anObject(this); aFunction(fn); return iterate(this, function (value) { if (fn(value)) return iterate.stop(value); }, undefined, false, true).result; } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.flat-map.js000066400000000000000000000030271360057567700250710ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var getIteratorMethod = require('../internals/get-iterator-method'); var createIteratorProxy = require('../internals/create-iterator-proxy'); var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); var IteratorProxy = createIteratorProxy(function (arg) { var iterator = this.iterator; var result, mapped, iteratorMethod, innerIterator; while (true) { if (innerIterator = this.innerIterator) { result = anObject(this.innerNext.call(innerIterator)); if (!result.done) return result.value; this.innerIterator = this.innerNext = null; } result = anObject(this.next.call(iterator, arg)); if (this.done = !!result.done) return; mapped = callWithSafeIterationClosing(iterator, this.mapper, result.value); iteratorMethod = getIteratorMethod(mapped); if (iteratorMethod === undefined) { throw TypeError('.flatMap callback should return an iterable object'); } this.innerIterator = innerIterator = anObject(iteratorMethod.call(mapped)); this.innerNext = aFunction(innerIterator.next); } }); $({ target: 'Iterator', proto: true, real: true }, { flatMap: function flatMap(mapper) { return new IteratorProxy({ iterator: anObject(this), mapper: aFunction(mapper), innerIterator: null, innerNext: null }); } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.for-each.js000066400000000000000000000005451360057567700250560ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var iterate = require('../internals/iterate'); var anObject = require('../internals/an-object'); $({ target: 'Iterator', proto: true, real: true }, { forEach: function forEach(fn) { iterate(anObject(this), fn, undefined, false, true); } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.from.js000066400000000000000000000020771360057567700243370ustar00rootroot00000000000000// https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var path = require('../internals/path'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var toObject = require('../internals/to-object'); var createIteratorProxy = require('../internals/create-iterator-proxy'); var getIteratorMethod = require('../internals/get-iterator-method'); var Iterator = path.Iterator; var IteratorProxy = createIteratorProxy(function (arg) { var result = anObject(this.next.call(this.iterator, arg)); var done = this.done = !!result.done; if (!done) return result.value; }, true); $({ target: 'Iterator', stat: true }, { from: function from(O) { var object = toObject(O); var usingIterator = getIteratorMethod(object); var iterator; if (usingIterator != null) { iterator = aFunction(usingIterator).call(object); if (iterator instanceof Iterator) return iterator; } else { iterator = object; } return new IteratorProxy({ iterator: iterator }); } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.map.js000066400000000000000000000015171360057567700241470ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var createIteratorProxy = require('../internals/create-iterator-proxy'); var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing'); var IteratorProxy = createIteratorProxy(function (arg) { var iterator = this.iterator; var result = anObject(this.next.call(iterator, arg)); var done = this.done = !!result.done; if (!done) return callWithSafeIterationClosing(iterator, this.mapper, result.value); }); $({ target: 'Iterator', proto: true, real: true }, { map: function map(mapper) { return new IteratorProxy({ iterator: anObject(this), mapper: aFunction(mapper) }); } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.reduce.js000066400000000000000000000015261360057567700246410ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var iterate = require('../internals/iterate'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); $({ target: 'Iterator', proto: true, real: true }, { reduce: function reduce(reducer /* , initialValue */) { anObject(this); aFunction(reducer); var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; iterate(this, function (value) { if (noInitial) { noInitial = false; accumulator = value; } else { accumulator = reducer(accumulator, value); } }, undefined, false, true); if (noInitial) throw TypeError('Reduce of empty iterator with no initial value'); return accumulator; } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.some.js000066400000000000000000000010011360057567700243210ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var iterate = require('../internals/iterate'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); $({ target: 'Iterator', proto: true, real: true }, { some: function some(fn) { anObject(this); aFunction(fn); return iterate(this, function (value) { if (fn(value)) return iterate.stop(); }, undefined, false, true).stopped; } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.take.js000066400000000000000000000013771360057567700243220ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var toPositiveInteger = require('../internals/to-positive-integer'); var createIteratorProxy = require('../internals/create-iterator-proxy'); var IteratorProxy = createIteratorProxy(function (arg) { if (!this.remaining--) { this.done = true; return; } var result = anObject(this.next.call(this.iterator, arg)); var done = this.done = !!result.done; if (!done) return result.value; }); $({ target: 'Iterator', proto: true, real: true }, { take: function take(limit) { return new IteratorProxy({ iterator: anObject(this), remaining: toPositiveInteger(limit) }); } }); core-js-3.6.1/packages/core-js/modules/esnext.iterator.to-array.js000066400000000000000000000006371360057567700251320ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var iterate = require('../internals/iterate'); var anObject = require('../internals/an-object'); var push = [].push; $({ target: 'Iterator', proto: true, real: true }, { toArray: function toArray() { var result = []; iterate(anObject(this), push, result, false, true); return result; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.delete-all.js000066400000000000000000000006771360057567700243340ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var collectionDeleteAll = require('../internals/collection-delete-all'); // `Map.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { deleteAll: function deleteAll(/* ...elements */) { return collectionDeleteAll.apply(this, arguments); } }); core-js-3.6.1/packages/core-js/modules/esnext.map.every.js000066400000000000000000000015201360057567700234420ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var bind = require('../internals/bind-context'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); // `Map.prototype.every` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { every: function every(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); return !iterate(iterator, function (key, value) { if (!boundFunction(value, key, map)) return iterate.stop(); }, undefined, true, true).stopped; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.filter.js000066400000000000000000000021751360057567700236040ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var bind = require('../internals/bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); // `Map.prototype.filter` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { filter: function filter(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); var setter = aFunction(newMap.set); iterate(iterator, function (key, value) { if (boundFunction(value, key, map)) setter.call(newMap, key, value); }, undefined, true, true); return newMap; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.find-key.js000066400000000000000000000015261360057567700240240ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var bind = require('../internals/bind-context'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); // `Map.prototype.findKey` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { findKey: function findKey(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); return iterate(iterator, function (key, value) { if (boundFunction(value, key, map)) return iterate.stop(key); }, undefined, true, true).result; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.find.js000066400000000000000000000015171360057567700232360ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var bind = require('../internals/bind-context'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); // `Map.prototype.find` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { find: function find(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); return iterate(iterator, function (key, value) { if (boundFunction(value, key, map)) return iterate.stop(value); }, undefined, true, true).result; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.from.js000066400000000000000000000003451360057567700232570ustar00rootroot00000000000000var $ = require('../internals/export'); var from = require('../internals/collection-from'); // `Map.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from $({ target: 'Map', stat: true }, { from: from }); core-js-3.6.1/packages/core-js/modules/esnext.map.group-by.js000066400000000000000000000013631360057567700240610ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var iterate = require('../internals/iterate'); var aFunction = require('../internals/a-function'); // `Map.groupBy` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', stat: true }, { groupBy: function groupBy(iterable, keyDerivative) { var newMap = new this(); aFunction(keyDerivative); var has = aFunction(newMap.has); var get = aFunction(newMap.get); var set = aFunction(newMap.set); iterate(iterable, function (element) { var derivedKey = keyDerivative(element); if (!has.call(newMap, derivedKey)) set.call(newMap, derivedKey, [element]); else get.call(newMap, derivedKey).push(element); }); return newMap; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.includes.js000066400000000000000000000013151360057567700241200ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var getMapIterator = require('../internals/get-map-iterator'); var sameValueZero = require('../internals/same-value-zero'); var iterate = require('../internals/iterate'); // `Map.prototype.includes` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { includes: function includes(searchElement) { return iterate(getMapIterator(anObject(this)), function (key, value) { if (sameValueZero(value, searchElement)) return iterate.stop(); }, undefined, true, true).stopped; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.key-by.js000066400000000000000000000010521360057567700235100ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var iterate = require('../internals/iterate'); var aFunction = require('../internals/a-function'); // `Map.keyBy` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', stat: true }, { keyBy: function keyBy(iterable, keyDerivative) { var newMap = new this(); aFunction(keyDerivative); var setter = aFunction(newMap.set); iterate(iterable, function (element) { setter.call(newMap, keyDerivative(element), element); }); return newMap; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.key-of.js000066400000000000000000000012001360057567700234750ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); // `Map.prototype.includes` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { keyOf: function keyOf(searchElement) { return iterate(getMapIterator(anObject(this)), function (key, value) { if (value === searchElement) return iterate.stop(key); }, undefined, true, true).result; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.map-keys.js000066400000000000000000000021671360057567700240460ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var bind = require('../internals/bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); // `Map.prototype.mapKeys` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { mapKeys: function mapKeys(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); var setter = aFunction(newMap.set); iterate(iterator, function (key, value) { setter.call(newMap, boundFunction(value, key, map), value); }, undefined, true, true); return newMap; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.map-values.js000066400000000000000000000021731360057567700243670ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var bind = require('../internals/bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); // `Map.prototype.mapValues` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { mapValues: function mapValues(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); var setter = aFunction(newMap.set); iterate(iterator, function (key, value) { setter.call(newMap, key, boundFunction(value, key, map)); }, undefined, true, true); return newMap; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.merge.js000066400000000000000000000012731360057567700234140ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var iterate = require('../internals/iterate'); // `Map.prototype.merge` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { // eslint-disable-next-line no-unused-vars merge: function merge(iterable /* ...iterbles */) { var map = anObject(this); var setter = aFunction(map.set); var i = 0; while (i < arguments.length) { iterate(arguments[i++], setter, map, true); } return map; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.of.js000066400000000000000000000003311360057567700227130ustar00rootroot00000000000000var $ = require('../internals/export'); var of = require('../internals/collection-of'); // `Map.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of $({ target: 'Map', stat: true }, { of: of }); core-js-3.6.1/packages/core-js/modules/esnext.map.reduce.js000066400000000000000000000020731360057567700235630ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); // `Map.prototype.reduce` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { reduce: function reduce(callbackfn /* , initialValue */) { var map = anObject(this); var iterator = getMapIterator(map); var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; aFunction(callbackfn); iterate(iterator, function (key, value) { if (noInitial) { noInitial = false; accumulator = value; } else { accumulator = callbackfn(accumulator, value, key, map); } }, undefined, true, true); if (noInitial) throw TypeError('Reduce of empty map with no initial value'); return accumulator; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.some.js000066400000000000000000000015131360057567700232550ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var bind = require('../internals/bind-context'); var getMapIterator = require('../internals/get-map-iterator'); var iterate = require('../internals/iterate'); // `Set.prototype.some` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { some: function some(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); return iterate(iterator, function (key, value) { if (boundFunction(value, key, map)) return iterate.stop(); }, undefined, true, true).stopped; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.update-or-insert.js000066400000000000000000000006271360057567700255210ustar00rootroot00000000000000'use strict'; // TODO: remove from `core-js@4` var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var $upsert = require('../internals/map-upsert'); // `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.upsert`) // https://github.com/thumbsupep/proposal-upsert $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { updateOrInsert: $upsert }); core-js-3.6.1/packages/core-js/modules/esnext.map.update.js000066400000000000000000000014571360057567700236030ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); // `Set.prototype.update` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { update: function update(key, callback /* , thunk */) { var map = anObject(this); var length = arguments.length; aFunction(callback); var isPresentInMap = map.has(key); if (!isPresentInMap && length < 3) { throw TypeError('Updating absent value'); } var value = isPresentInMap ? map.get(key) : aFunction(length > 2 ? arguments[2] : undefined)(key, map); map.set(key, callback(value, key, map)); return map; } }); core-js-3.6.1/packages/core-js/modules/esnext.map.upsert.js000066400000000000000000000005011360057567700236300ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var $upsert = require('../internals/map-upsert'); // `Map.prototype.upsert` method // https://github.com/thumbsupep/proposal-upsert $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { upsert: $upsert }); core-js-3.6.1/packages/core-js/modules/esnext.math.clamp.js000066400000000000000000000004361360057567700235650ustar00rootroot00000000000000var $ = require('../internals/export'); var min = Math.min; var max = Math.max; // `Math.clamp` method // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true }, { clamp: function clamp(x, lower, upper) { return min(upper, max(lower, x)); } }); core-js-3.6.1/packages/core-js/modules/esnext.math.deg-per-rad.js000066400000000000000000000003051360057567700245530ustar00rootroot00000000000000var $ = require('../internals/export'); // `Math.DEG_PER_RAD` constant // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true }, { DEG_PER_RAD: Math.PI / 180 }); core-js-3.6.1/packages/core-js/modules/esnext.math.degrees.js000066400000000000000000000004211360057567700241010ustar00rootroot00000000000000var $ = require('../internals/export'); var RAD_PER_DEG = 180 / Math.PI; // `Math.degrees` method // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true }, { degrees: function degrees(radians) { return radians * RAD_PER_DEG; } }); core-js-3.6.1/packages/core-js/modules/esnext.math.fscale.js000066400000000000000000000006041360057567700237230ustar00rootroot00000000000000var $ = require('../internals/export'); var scale = require('../internals/math-scale'); var fround = require('../internals/math-fround'); // `Math.fscale` method // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true }, { fscale: function fscale(x, inLow, inHigh, outLow, outHigh) { return fround(scale(x, inLow, inHigh, outLow, outHigh)); } }); core-js-3.6.1/packages/core-js/modules/esnext.math.iaddh.js000066400000000000000000000006261360057567700235430ustar00rootroot00000000000000var $ = require('../internals/export'); // `Math.iaddh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` $({ target: 'Math', stat: true }, { iaddh: function iaddh(x0, x1, y0, y1) { var $x0 = x0 >>> 0; var $x1 = x1 >>> 0; var $y0 = y0 >>> 0; return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0; } }); core-js-3.6.1/packages/core-js/modules/esnext.math.imulh.js000066400000000000000000000007771360057567700236170ustar00rootroot00000000000000var $ = require('../internals/export'); // `Math.imulh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` $({ target: 'Math', stat: true }, { imulh: function imulh(u, v) { var UINT16 = 0xFFFF; var $u = +u; var $v = +v; var u0 = $u & UINT16; var v0 = $v & UINT16; var u1 = $u >> 16; var v1 = $v >> 16; var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16); } }); core-js-3.6.1/packages/core-js/modules/esnext.math.isubh.js000066400000000000000000000006251360057567700236030ustar00rootroot00000000000000var $ = require('../internals/export'); // `Math.isubh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` $({ target: 'Math', stat: true }, { isubh: function isubh(x0, x1, y0, y1) { var $x0 = x0 >>> 0; var $x1 = x1 >>> 0; var $y0 = y0 >>> 0; return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0; } }); core-js-3.6.1/packages/core-js/modules/esnext.math.rad-per-deg.js000066400000000000000000000003051360057567700245530ustar00rootroot00000000000000var $ = require('../internals/export'); // `Math.RAD_PER_DEG` constant // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true }, { RAD_PER_DEG: 180 / Math.PI }); core-js-3.6.1/packages/core-js/modules/esnext.math.radians.js000066400000000000000000000004211360057567700241040ustar00rootroot00000000000000var $ = require('../internals/export'); var DEG_PER_RAD = Math.PI / 180; // `Math.radians` method // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true }, { radians: function radians(degrees) { return degrees * DEG_PER_RAD; } }); core-js-3.6.1/packages/core-js/modules/esnext.math.scale.js000066400000000000000000000003371360057567700235600ustar00rootroot00000000000000var $ = require('../internals/export'); var scale = require('../internals/math-scale'); // `Math.scale` method // https://rwaldron.github.io/proposal-math-extensions/ $({ target: 'Math', stat: true }, { scale: scale }); core-js-3.6.1/packages/core-js/modules/esnext.math.seeded-prng.js000066400000000000000000000027031360057567700246650ustar00rootroot00000000000000var $ = require('../internals/export'); var anObject = require('../internals/an-object'); var numberIsFinite = require('../internals/number-is-finite'); var createIteratorConstructor = require('../internals/create-iterator-constructor'); var InternalStateModule = require('../internals/internal-state'); var SEEDED_RANDOM = 'Seeded Random'; var SEEDED_RANDOM_GENERATOR = SEEDED_RANDOM + ' Generator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(SEEDED_RANDOM_GENERATOR); var SEED_TYPE_ERROR = 'Math.seededPRNG() argument should have a "seed" field with a finite value.'; var $SeededRandomGenerator = createIteratorConstructor(function SeededRandomGenerator(seed) { setInternalState(this, { type: SEEDED_RANDOM_GENERATOR, seed: seed % 2147483647 }); }, SEEDED_RANDOM, function next() { var state = getInternalState(this); var seed = state.seed = (state.seed * 1103515245 + 12345) % 2147483647; return { value: (seed & 1073741823) / 1073741823, done: false }; }); // `Math.seededPRNG` method // https://github.com/tc39/proposal-seeded-random // based on https://github.com/tc39/proposal-seeded-random/blob/78b8258835b57fc2100d076151ab506bc3202ae6/demo.html $({ target: 'Math', stat: true, forced: true }, { seededPRNG: function seededPRNG(it) { var seed = anObject(it).seed; if (!numberIsFinite(seed)) throw TypeError(SEED_TYPE_ERROR); return new $SeededRandomGenerator(seed); } }); core-js-3.6.1/packages/core-js/modules/esnext.math.signbit.js000066400000000000000000000004011360057567700241200ustar00rootroot00000000000000var $ = require('../internals/export'); // `Math.signbit` method // https://github.com/tc39/proposal-Math.signbit $({ target: 'Math', stat: true }, { signbit: function signbit(x) { return (x = +x) == x && x == 0 ? 1 / x == -Infinity : x < 0; } }); core-js-3.6.1/packages/core-js/modules/esnext.math.umulh.js000066400000000000000000000010031360057567700236120ustar00rootroot00000000000000var $ = require('../internals/export'); // `Math.umulh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` $({ target: 'Math', stat: true }, { umulh: function umulh(u, v) { var UINT16 = 0xFFFF; var $u = +u; var $v = +v; var u0 = $u & UINT16; var v0 = $v & UINT16; var u1 = $u >>> 16; var v1 = $v >>> 16; var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16); } }); core-js-3.6.1/packages/core-js/modules/esnext.number.from-string.js000066400000000000000000000021411360057567700252720ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var toInteger = require('../internals/to-integer'); var parseInt = require('../internals/parse-int'); var INVALID_NUMBER_REPRESENTATION = 'Invalid number representation'; var INVALID_RADIX = 'Invalid radix'; var valid = /^[\da-z]+$/; // `Number.fromString` method // https://github.com/tc39/proposal-number-fromstring $({ target: 'Number', stat: true }, { fromString: function fromString(string, radix) { var sign = 1; var R, mathNum; if (typeof string != 'string') throw TypeError(INVALID_NUMBER_REPRESENTATION); if (!string.length) throw SyntaxError(INVALID_NUMBER_REPRESENTATION); if (string.charAt(0) == '-') { sign = -1; string = string.slice(1); if (!string.length) throw SyntaxError(INVALID_NUMBER_REPRESENTATION); } R = radix === undefined ? 10 : toInteger(radix); if (R < 2 || R > 36) throw RangeError(INVALID_RADIX); if (!valid.test(string) || (mathNum = parseInt(string, R)).toString(R) !== string) { throw SyntaxError(INVALID_NUMBER_REPRESENTATION); } return sign * mathNum; } }); core-js-3.6.1/packages/core-js/modules/esnext.object.iterate-entries.js000066400000000000000000000005401360057567700261060ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var ObjectIterator = require('../internals/object-iterator'); // `Object.iterateEntries` method // https://github.com/tc39/proposal-object-iteration $({ target: 'Object', stat: true }, { iterateEntries: function iterateEntries(object) { return new ObjectIterator(object, 'entries'); } }); core-js-3.6.1/packages/core-js/modules/esnext.object.iterate-keys.js000066400000000000000000000005241360057567700254120ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var ObjectIterator = require('../internals/object-iterator'); // `Object.iterateKeys` method // https://github.com/tc39/proposal-object-iteration $({ target: 'Object', stat: true }, { iterateKeys: function iterateKeys(object) { return new ObjectIterator(object, 'keys'); } }); core-js-3.6.1/packages/core-js/modules/esnext.object.iterate-values.js000066400000000000000000000005341360057567700257370ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var ObjectIterator = require('../internals/object-iterator'); // `Object.iterateValues` method // https://github.com/tc39/proposal-object-iteration $({ target: 'Object', stat: true }, { iterateValues: function iterateValues(object) { return new ObjectIterator(object, 'values'); } }); core-js-3.6.1/packages/core-js/modules/esnext.observable.js000066400000000000000000000156241360057567700236720ustar00rootroot00000000000000'use strict'; // https://github.com/tc39/proposal-observable var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var setSpecies = require('../internals/set-species'); var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var isObject = require('../internals/is-object'); var anInstance = require('../internals/an-instance'); var defineProperty = require('../internals/object-define-property').f; var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var redefineAll = require('../internals/redefine-all'); var getIterator = require('../internals/get-iterator'); var iterate = require('../internals/iterate'); var hostReportErrors = require('../internals/host-report-errors'); var wellKnownSymbol = require('../internals/well-known-symbol'); var InternalStateModule = require('../internals/internal-state'); var OBSERVABLE = wellKnownSymbol('observable'); var getInternalState = InternalStateModule.get; var setInternalState = InternalStateModule.set; var getMethod = function (fn) { return fn == null ? undefined : aFunction(fn); }; var cleanupSubscription = function (subscriptionState) { var cleanup = subscriptionState.cleanup; if (cleanup) { subscriptionState.cleanup = undefined; try { cleanup(); } catch (error) { hostReportErrors(error); } } }; var subscriptionClosed = function (subscriptionState) { return subscriptionState.observer === undefined; }; var close = function (subscription, subscriptionState) { if (!DESCRIPTORS) { subscription.closed = true; var subscriptionObserver = subscriptionState.subscriptionObserver; if (subscriptionObserver) subscriptionObserver.closed = true; } subscriptionState.observer = undefined; }; var Subscription = function (observer, subscriber) { var subscriptionState = setInternalState(this, { cleanup: undefined, observer: anObject(observer), subscriptionObserver: undefined }); var start; if (!DESCRIPTORS) this.closed = false; try { if (start = getMethod(observer.start)) start.call(observer, this); } catch (error) { hostReportErrors(error); } if (subscriptionClosed(subscriptionState)) return; var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(this); try { var cleanup = subscriber(subscriptionObserver); var subscription = cleanup; if (cleanup != null) subscriptionState.cleanup = typeof cleanup.unsubscribe === 'function' ? function () { subscription.unsubscribe(); } : aFunction(cleanup); } catch (error) { subscriptionObserver.error(error); return; } if (subscriptionClosed(subscriptionState)) cleanupSubscription(subscriptionState); }; Subscription.prototype = redefineAll({}, { unsubscribe: function unsubscribe() { var subscriptionState = getInternalState(this); if (!subscriptionClosed(subscriptionState)) { close(this, subscriptionState); cleanupSubscription(subscriptionState); } } }); if (DESCRIPTORS) defineProperty(Subscription.prototype, 'closed', { configurable: true, get: function () { return subscriptionClosed(getInternalState(this)); } }); var SubscriptionObserver = function (subscription) { setInternalState(this, { subscription: subscription }); if (!DESCRIPTORS) this.closed = false; }; SubscriptionObserver.prototype = redefineAll({}, { next: function next(value) { var subscriptionState = getInternalState(getInternalState(this).subscription); if (!subscriptionClosed(subscriptionState)) { var observer = subscriptionState.observer; try { var nextMethod = getMethod(observer.next); if (nextMethod) nextMethod.call(observer, value); } catch (error) { hostReportErrors(error); } } }, error: function error(value) { var subscription = getInternalState(this).subscription; var subscriptionState = getInternalState(subscription); if (!subscriptionClosed(subscriptionState)) { var observer = subscriptionState.observer; close(subscription, subscriptionState); try { var errorMethod = getMethod(observer.error); if (errorMethod) errorMethod.call(observer, value); else hostReportErrors(value); } catch (err) { hostReportErrors(err); } cleanupSubscription(subscriptionState); } }, complete: function complete() { var subscription = getInternalState(this).subscription; var subscriptionState = getInternalState(subscription); if (!subscriptionClosed(subscriptionState)) { var observer = subscriptionState.observer; close(subscription, subscriptionState); try { var completeMethod = getMethod(observer.complete); if (completeMethod) completeMethod.call(observer); } catch (error) { hostReportErrors(error); } cleanupSubscription(subscriptionState); } } }); if (DESCRIPTORS) defineProperty(SubscriptionObserver.prototype, 'closed', { configurable: true, get: function () { return subscriptionClosed(getInternalState(getInternalState(this).subscription)); } }); var $Observable = function Observable(subscriber) { anInstance(this, $Observable, 'Observable'); setInternalState(this, { subscriber: aFunction(subscriber) }); }; redefineAll($Observable.prototype, { subscribe: function subscribe(observer) { var length = arguments.length; return new Subscription(typeof observer === 'function' ? { next: observer, error: length > 1 ? arguments[1] : undefined, complete: length > 2 ? arguments[2] : undefined } : isObject(observer) ? observer : {}, getInternalState(this).subscriber); } }); redefineAll($Observable, { from: function from(x) { var C = typeof this === 'function' ? this : $Observable; var observableMethod = getMethod(anObject(x)[OBSERVABLE]); if (observableMethod) { var observable = anObject(observableMethod.call(x)); return observable.constructor === C ? observable : new C(function (observer) { return observable.subscribe(observer); }); } var iterator = getIterator(x); return new C(function (observer) { iterate(iterator, function (it) { observer.next(it); if (observer.closed) return iterate.stop(); }, undefined, false, true); observer.complete(); }); }, of: function of() { var C = typeof this === 'function' ? this : $Observable; var length = arguments.length; var items = new Array(length); var index = 0; while (index < length) items[index] = arguments[index++]; return new C(function (observer) { for (var i = 0; i < length; i++) { observer.next(items[i]); if (observer.closed) return; } observer.complete(); }); } }); createNonEnumerableProperty($Observable.prototype, OBSERVABLE, function () { return this; }); $({ global: true }, { Observable: $Observable }); setSpecies('Observable'); core-js-3.6.1/packages/core-js/modules/esnext.promise.all-settled.js000066400000000000000000000001111360057567700254160ustar00rootroot00000000000000// TODO: Remove from `core-js@4` require('./es.promise.all-settled.js'); core-js-3.6.1/packages/core-js/modules/esnext.promise.any.js000066400000000000000000000032041360057567700240010ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var aFunction = require('../internals/a-function'); var getBuiltIn = require('../internals/get-built-in'); var newPromiseCapabilityModule = require('../internals/new-promise-capability'); var perform = require('../internals/perform'); var iterate = require('../internals/iterate'); var PROMISE_ANY_ERROR = 'No one promise resolved'; // `Promise.any` method // https://github.com/tc39/proposal-promise-any $({ target: 'Promise', stat: true }, { any: function any(iterable) { var C = this; var capability = newPromiseCapabilityModule.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var promiseResolve = aFunction(C.resolve); var errors = []; var counter = 0; var remaining = 1; var alreadyResolved = false; iterate(iterable, function (promise) { var index = counter++; var alreadyRejected = false; errors.push(undefined); remaining++; promiseResolve.call(C, promise).then(function (value) { if (alreadyRejected || alreadyResolved) return; alreadyResolved = true; resolve(value); }, function (e) { if (alreadyRejected || alreadyResolved) return; alreadyRejected = true; errors[index] = e; --remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR)); }); }); --remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR)); }); if (result.error) reject(result.value); return capability.promise; } }); core-js-3.6.1/packages/core-js/modules/esnext.promise.try.js000066400000000000000000000010641360057567700240320ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var newPromiseCapabilityModule = require('../internals/new-promise-capability'); var perform = require('../internals/perform'); // `Promise.try` method // https://github.com/tc39/proposal-promise-try $({ target: 'Promise', stat: true }, { 'try': function (callbackfn) { var promiseCapability = newPromiseCapabilityModule.f(this); var result = perform(callbackfn); (result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value); return promiseCapability.promise; } }); core-js-3.6.1/packages/core-js/modules/esnext.reflect.define-metadata.js000066400000000000000000000012361360057567700261730ustar00rootroot00000000000000var $ = require('../internals/export'); var ReflectMetadataModule = require('../internals/reflect-metadata'); var anObject = require('../internals/an-object'); var toMetadataKey = ReflectMetadataModule.toKey; var ordinaryDefineOwnMetadata = ReflectMetadataModule.set; // `Reflect.defineMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { defineMetadata: function defineMetadata(metadataKey, metadataValue, target /* , targetKey */) { var targetKey = arguments.length < 4 ? undefined : toMetadataKey(arguments[3]); ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), targetKey); } }); core-js-3.6.1/packages/core-js/modules/esnext.reflect.delete-metadata.js000066400000000000000000000017031360057567700262020ustar00rootroot00000000000000var $ = require('../internals/export'); var ReflectMetadataModule = require('../internals/reflect-metadata'); var anObject = require('../internals/an-object'); var toMetadataKey = ReflectMetadataModule.toKey; var getOrCreateMetadataMap = ReflectMetadataModule.getMap; var store = ReflectMetadataModule.store; // `Reflect.deleteMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) { var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false; if (metadataMap.size) return true; var targetMetadata = store.get(target); targetMetadata['delete'](targetKey); return !!targetMetadata.size || store['delete'](target); } }); core-js-3.6.1/packages/core-js/modules/esnext.reflect.get-metadata-keys.js000066400000000000000000000024311360057567700264670ustar00rootroot00000000000000var $ = require('../internals/export'); // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` var Set = require('../modules/es.set'); var ReflectMetadataModule = require('../internals/reflect-metadata'); var anObject = require('../internals/an-object'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var iterate = require('../internals/iterate'); var ordinaryOwnMetadataKeys = ReflectMetadataModule.keys; var toMetadataKey = ReflectMetadataModule.toKey; var from = function (iter) { var result = []; iterate(iter, result.push, result); return result; }; var ordinaryMetadataKeys = function (O, P) { var oKeys = ordinaryOwnMetadataKeys(O, P); var parent = getPrototypeOf(O); if (parent === null) return oKeys; var pKeys = ordinaryMetadataKeys(parent, P); return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys; }; // `Reflect.getMetadataKeys` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { getMetadataKeys: function getMetadataKeys(target /* , targetKey */) { var targetKey = arguments.length < 2 ? undefined : toMetadataKey(arguments[1]); return ordinaryMetadataKeys(anObject(target), targetKey); } }); core-js-3.6.1/packages/core-js/modules/esnext.reflect.get-metadata.js000066400000000000000000000020401360057567700255120ustar00rootroot00000000000000var $ = require('../internals/export'); var ReflectMetadataModule = require('../internals/reflect-metadata'); var anObject = require('../internals/an-object'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var ordinaryHasOwnMetadata = ReflectMetadataModule.has; var ordinaryGetOwnMetadata = ReflectMetadataModule.get; var toMetadataKey = ReflectMetadataModule.toKey; var ordinaryGetMetadata = function (MetadataKey, O, P) { var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P); var parent = getPrototypeOf(O); return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; }; // `Reflect.getMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { getMetadata: function getMetadata(metadataKey, target /* , targetKey */) { var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); return ordinaryGetMetadata(metadataKey, anObject(target), targetKey); } }); core-js-3.6.1/packages/core-js/modules/esnext.reflect.get-own-metadata-keys.js000066400000000000000000000011661360057567700272740ustar00rootroot00000000000000var $ = require('../internals/export'); var ReflectMetadataModule = require('../internals/reflect-metadata'); var anObject = require('../internals/an-object'); var ordinaryOwnMetadataKeys = ReflectMetadataModule.keys; var toMetadataKey = ReflectMetadataModule.toKey; // `Reflect.getOwnMetadataKeys` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) { var targetKey = arguments.length < 2 ? undefined : toMetadataKey(arguments[1]); return ordinaryOwnMetadataKeys(anObject(target), targetKey); } }); core-js-3.6.1/packages/core-js/modules/esnext.reflect.get-own-metadata.js000066400000000000000000000012011360057567700263110ustar00rootroot00000000000000var $ = require('../internals/export'); var ReflectMetadataModule = require('../internals/reflect-metadata'); var anObject = require('../internals/an-object'); var ordinaryGetOwnMetadata = ReflectMetadataModule.get; var toMetadataKey = ReflectMetadataModule.toKey; // `Reflect.getOwnMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) { var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); return ordinaryGetOwnMetadata(metadataKey, anObject(target), targetKey); } }); core-js-3.6.1/packages/core-js/modules/esnext.reflect.has-metadata.js000066400000000000000000000016771360057567700255250ustar00rootroot00000000000000var $ = require('../internals/export'); var ReflectMetadataModule = require('../internals/reflect-metadata'); var anObject = require('../internals/an-object'); var getPrototypeOf = require('../internals/object-get-prototype-of'); var ordinaryHasOwnMetadata = ReflectMetadataModule.has; var toMetadataKey = ReflectMetadataModule.toKey; var ordinaryHasMetadata = function (MetadataKey, O, P) { var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return true; var parent = getPrototypeOf(O); return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; }; // `Reflect.hasMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) { var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); return ordinaryHasMetadata(metadataKey, anObject(target), targetKey); } }); core-js-3.6.1/packages/core-js/modules/esnext.reflect.has-own-metadata.js000066400000000000000000000012011360057567700263050ustar00rootroot00000000000000var $ = require('../internals/export'); var ReflectMetadataModule = require('../internals/reflect-metadata'); var anObject = require('../internals/an-object'); var ordinaryHasOwnMetadata = ReflectMetadataModule.has; var toMetadataKey = ReflectMetadataModule.toKey; // `Reflect.hasOwnMetadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) { var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); return ordinaryHasOwnMetadata(metadataKey, anObject(target), targetKey); } }); core-js-3.6.1/packages/core-js/modules/esnext.reflect.metadata.js000066400000000000000000000011351360057567700247410ustar00rootroot00000000000000var $ = require('../internals/export'); var ReflectMetadataModule = require('../internals/reflect-metadata'); var anObject = require('../internals/an-object'); var toMetadataKey = ReflectMetadataModule.toKey; var ordinaryDefineOwnMetadata = ReflectMetadataModule.set; // `Reflect.metadata` method // https://github.com/rbuckton/reflect-metadata $({ target: 'Reflect', stat: true }, { metadata: function metadata(metadataKey, metadataValue) { return function decorator(target, key) { ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetadataKey(key)); }; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.add-all.js000066400000000000000000000006551360057567700236340ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var collectionAddAll = require('../internals/collection-add-all'); // `Set.prototype.addAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { addAll: function addAll(/* ...elements */) { return collectionAddAll.apply(this, arguments); } }); core-js-3.6.1/packages/core-js/modules/esnext.set.delete-all.js000066400000000000000000000006771360057567700243520ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var collectionDeleteAll = require('../internals/collection-delete-all'); // `Set.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { deleteAll: function deleteAll(/* ...elements */) { return collectionDeleteAll.apply(this, arguments); } }); core-js-3.6.1/packages/core-js/modules/esnext.set.difference.js000066400000000000000000000015001360057567700244160ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var speciesConstructor = require('../internals/species-constructor'); var iterate = require('../internals/iterate'); // `Set.prototype.difference` method // https://github.com/tc39/proposal-set-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { difference: function difference(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(set); var remover = aFunction(newSet['delete']); iterate(iterable, function (value) { remover.call(newSet, value); }); return newSet; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.every.js000066400000000000000000000015161360057567700234650ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var bind = require('../internals/bind-context'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); // `Set.prototype.every` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { every: function every(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); return !iterate(iterator, function (value) { if (!boundFunction(value, value, set)) return iterate.stop(); }, undefined, false, true).stopped; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.filter.js000066400000000000000000000021641360057567700236200ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var bind = require('../internals/bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); // `Set.prototype.filter` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { filter: function filter(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(); var adder = aFunction(newSet.add); iterate(iterator, function (value) { if (boundFunction(value, value, set)) adder.call(newSet, value); }, undefined, false, true); return newSet; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.find.js000066400000000000000000000015151360057567700232520ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var bind = require('../internals/bind-context'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); // `Set.prototype.find` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { find: function find(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); return iterate(iterator, function (value) { if (boundFunction(value, value, set)) return iterate.stop(value); }, undefined, false, true).result; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.from.js000066400000000000000000000003451360057567700232750ustar00rootroot00000000000000var $ = require('../internals/export'); var from = require('../internals/collection-from'); // `Set.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from $({ target: 'Set', stat: true }, { from: from }); core-js-3.6.1/packages/core-js/modules/esnext.set.intersection.js000066400000000000000000000015771360057567700250500ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var speciesConstructor = require('../internals/species-constructor'); var iterate = require('../internals/iterate'); // `Set.prototype.intersection` method // https://github.com/tc39/proposal-set-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { intersection: function intersection(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(); var hasCheck = aFunction(set.has); var adder = aFunction(newSet.add); iterate(iterable, function (value) { if (hasCheck.call(set, value)) adder.call(newSet, value); }); return newSet; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.is-disjoint-from.js000066400000000000000000000012731360057567700255300ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var iterate = require('../internals/iterate'); // `Set.prototype.isDisjointFrom` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isDisjointFrom $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { isDisjointFrom: function isDisjointFrom(iterable) { var set = anObject(this); var hasCheck = aFunction(set.has); return !iterate(iterable, function (value) { if (hasCheck.call(set, value) === true) return iterate.stop(); }).stopped; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.is-subset-of.js000066400000000000000000000017561360057567700246610ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var getIterator = require('../internals/get-iterator'); var iterate = require('../internals/iterate'); // `Set.prototype.isSubsetOf` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSubsetOf $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { isSubsetOf: function isSubsetOf(iterable) { var iterator = getIterator(this); var otherSet = anObject(iterable); var hasCheck = otherSet.has; if (typeof hasCheck != 'function') { otherSet = new (getBuiltIn('Set'))(iterable); hasCheck = aFunction(otherSet.has); } return !iterate(iterator, function (value) { if (hasCheck.call(otherSet, value) === false) return iterate.stop(); }, undefined, false, true).stopped; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.is-superset-of.js000066400000000000000000000012641360057567700252200ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var iterate = require('../internals/iterate'); // `Set.prototype.isSupersetOf` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSupersetOf $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { isSupersetOf: function isSupersetOf(iterable) { var set = anObject(this); var hasCheck = aFunction(set.has); return !iterate(iterable, function (value) { if (hasCheck.call(set, value) === false) return iterate.stop(); }).stopped; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.join.js000066400000000000000000000012721360057567700232710ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); // `Set.prototype.join` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { join: function join(separator) { var set = anObject(this); var iterator = getSetIterator(set); var sep = separator === undefined ? ',' : String(separator); var result = []; iterate(iterator, result.push, result, false, true); return result.join(sep); } }); core-js-3.6.1/packages/core-js/modules/esnext.set.map.js000066400000000000000000000021401360057567700231020ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var bind = require('../internals/bind-context'); var speciesConstructor = require('../internals/species-constructor'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); // `Set.prototype.map` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { map: function map(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(); var adder = aFunction(newSet.add); iterate(iterator, function (value) { adder.call(newSet, boundFunction(value, value, set)); }, undefined, false, true); return newSet; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.of.js000066400000000000000000000003311360057567700227310ustar00rootroot00000000000000var $ = require('../internals/export'); var of = require('../internals/collection-of'); // `Set.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of $({ target: 'Set', stat: true }, { of: of }); core-js-3.6.1/packages/core-js/modules/esnext.set.reduce.js000066400000000000000000000020711360057567700235770ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); // `Set.prototype.reduce` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { reduce: function reduce(callbackfn /* , initialValue */) { var set = anObject(this); var iterator = getSetIterator(set); var noInitial = arguments.length < 2; var accumulator = noInitial ? undefined : arguments[1]; aFunction(callbackfn); iterate(iterator, function (value) { if (noInitial) { noInitial = false; accumulator = value; } else { accumulator = callbackfn(accumulator, value, value, set); } }, undefined, false, true); if (noInitial) throw TypeError('Reduce of empty set with no initial value'); return accumulator; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.some.js000066400000000000000000000015111360057567700232710ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var bind = require('../internals/bind-context'); var getSetIterator = require('../internals/get-set-iterator'); var iterate = require('../internals/iterate'); // `Set.prototype.some` method // https://github.com/tc39/proposal-collection-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { some: function some(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); return iterate(iterator, function (value) { if (boundFunction(value, value, set)) return iterate.stop(); }, undefined, false, true).stopped; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.symmetric-difference.js000066400000000000000000000016371360057567700264430ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var speciesConstructor = require('../internals/species-constructor'); var iterate = require('../internals/iterate'); // `Set.prototype.symmetricDifference` method // https://github.com/tc39/proposal-set-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { symmetricDifference: function symmetricDifference(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(set); var remover = aFunction(newSet['delete']); var adder = aFunction(newSet.add); iterate(iterable, function (value) { remover.call(newSet, value) || adder.call(newSet, value); }); return newSet; } }); core-js-3.6.1/packages/core-js/modules/esnext.set.union.js000066400000000000000000000013441360057567700234620ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var getBuiltIn = require('../internals/get-built-in'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var speciesConstructor = require('../internals/species-constructor'); var iterate = require('../internals/iterate'); // `Set.prototype.union` method // https://github.com/tc39/proposal-set-methods $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { union: function union(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(set); iterate(iterable, aFunction(newSet.add), newSet); return newSet; } }); core-js-3.6.1/packages/core-js/modules/esnext.string.at.js000066400000000000000000000004631360057567700234520ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var charAt = require('../internals/string-multibyte').charAt; // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at $({ target: 'String', proto: true }, { at: function at(pos) { return charAt(this, pos); } }); core-js-3.6.1/packages/core-js/modules/esnext.string.code-points.js000066400000000000000000000026331360057567700252730ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var createIteratorConstructor = require('../internals/create-iterator-constructor'); var requireObjectCoercible = require('../internals/require-object-coercible'); var InternalStateModule = require('../internals/internal-state'); var StringMultibyteModule = require('../internals/string-multibyte'); var codeAt = StringMultibyteModule.codeAt; var charAt = StringMultibyteModule.charAt; var STRING_ITERATOR = 'String Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); // TODO: unify with String#@@iterator var $StringIterator = createIteratorConstructor(function StringIterator(string) { setInternalState(this, { type: STRING_ITERATOR, string: string, index: 0 }); }, 'String', function next() { var state = getInternalState(this); var string = state.string; var index = state.index; var point; if (index >= string.length) return { value: undefined, done: true }; point = charAt(string, index); state.index += point.length; return { value: { codePoint: codeAt(point, 0), position: index }, done: false }; }); // `String.prototype.codePoints` method // https://github.com/tc39/proposal-string-prototype-codepoints $({ target: 'String', proto: true }, { codePoints: function codePoints() { return new $StringIterator(String(requireObjectCoercible(this))); } }); core-js-3.6.1/packages/core-js/modules/esnext.string.match-all.js000066400000000000000000000001031360057567700246770ustar00rootroot00000000000000// TODO: Remove from `core-js@4` require('./es.string.match-all'); core-js-3.6.1/packages/core-js/modules/esnext.string.replace-all.js000066400000000000000000000037131360057567700252300ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var requireObjectCoercible = require('../internals/require-object-coercible'); var isRegExp = require('../internals/is-regexp'); var getRegExpFlags = require('../internals/regexp-flags'); var wellKnownSymbol = require('../internals/well-known-symbol'); var IS_PURE = require('../internals/is-pure'); var REPLACE = wellKnownSymbol('replace'); var RegExpPrototype = RegExp.prototype; // `String.prototype.replaceAll` method // https://github.com/tc39/proposal-string-replace-all $({ target: 'String', proto: true }, { replaceAll: function replaceAll(searchValue, replaceValue) { var O = requireObjectCoercible(this); var IS_REG_EXP, flags, replacer, string, searchString, template, result, position, index; if (searchValue != null) { IS_REG_EXP = isRegExp(searchValue); if (IS_REG_EXP) { flags = String(requireObjectCoercible('flags' in RegExpPrototype ? searchValue.flags : getRegExpFlags.call(searchValue) )); if (!~flags.indexOf('g')) throw TypeError('`.replaceAll` does not allow non-global regexes'); } replacer = searchValue[REPLACE]; if (replacer !== undefined) { return replacer.call(searchValue, O, replaceValue); } else if (IS_PURE && IS_REG_EXP) { return String(O).replace(searchValue, replaceValue); } } string = String(O); searchString = String(searchValue); if (searchString === '') return replaceAll.call(string, /(?:)/g, replaceValue); template = string.split(searchString); if (typeof replaceValue !== 'function') { return template.join(String(replaceValue)); } result = template[0]; position = result.length; for (index = 1; index < template.length; index++) { result += String(replaceValue(searchString, position, string)); position += searchString.length + template[index].length; result += template[index]; } return result; } }); core-js-3.6.1/packages/core-js/modules/esnext.symbol.async-dispose.js000066400000000000000000000003251360057567700256230ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.asyncDispose` well-known symbol // https://github.com/tc39/proposal-using-statement defineWellKnownSymbol('asyncDispose'); core-js-3.6.1/packages/core-js/modules/esnext.symbol.dispose.js000066400000000000000000000003131360057567700245050ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.dispose` well-known symbol // https://github.com/tc39/proposal-using-statement defineWellKnownSymbol('dispose'); core-js-3.6.1/packages/core-js/modules/esnext.symbol.observable.js000066400000000000000000000003141360057567700251640ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.observable` well-known symbol // https://github.com/tc39/proposal-observable defineWellKnownSymbol('observable'); core-js-3.6.1/packages/core-js/modules/esnext.symbol.pattern-match.js000066400000000000000000000003261360057567700256120ustar00rootroot00000000000000var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); // `Symbol.patternMatch` well-known symbol // https://github.com/tc39/proposal-pattern-matching defineWellKnownSymbol('patternMatch'); core-js-3.6.1/packages/core-js/modules/esnext.symbol.replace-all.js000066400000000000000000000002251360057567700252220ustar00rootroot00000000000000// TODO: remove from `core-js@4` var defineWellKnownSymbol = require('../internals/define-well-known-symbol'); defineWellKnownSymbol('replaceAll'); core-js-3.6.1/packages/core-js/modules/esnext.weak-map.delete-all.js000066400000000000000000000007071360057567700252530ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var collectionDeleteAll = require('../internals/collection-delete-all'); // `WeakMap.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'WeakMap', proto: true, real: true, forced: IS_PURE }, { deleteAll: function deleteAll(/* ...elements */) { return collectionDeleteAll.apply(this, arguments); } }); core-js-3.6.1/packages/core-js/modules/esnext.weak-map.from.js000066400000000000000000000003611360057567700242020ustar00rootroot00000000000000var $ = require('../internals/export'); var from = require('../internals/collection-from'); // `WeakMap.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from $({ target: 'WeakMap', stat: true }, { from: from }); core-js-3.6.1/packages/core-js/modules/esnext.weak-map.of.js000066400000000000000000000003451360057567700236450ustar00rootroot00000000000000var $ = require('../internals/export'); var of = require('../internals/collection-of'); // `WeakMap.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of $({ target: 'WeakMap', stat: true }, { of: of }); core-js-3.6.1/packages/core-js/modules/esnext.weak-map.upsert.js000066400000000000000000000005111360057567700245560ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var $upsert = require('../internals/map-upsert'); // `WeakMap.prototype.upsert` method // https://github.com/thumbsupep/proposal-upsert $({ target: 'WeakMap', proto: true, real: true, forced: IS_PURE }, { upsert: $upsert }); core-js-3.6.1/packages/core-js/modules/esnext.weak-set.add-all.js000066400000000000000000000006651360057567700245620ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var collectionAddAll = require('../internals/collection-add-all'); // `WeakSet.prototype.addAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'WeakSet', proto: true, real: true, forced: IS_PURE }, { addAll: function addAll(/* ...elements */) { return collectionAddAll.apply(this, arguments); } }); core-js-3.6.1/packages/core-js/modules/esnext.weak-set.delete-all.js000066400000000000000000000007071360057567700252710ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var collectionDeleteAll = require('../internals/collection-delete-all'); // `WeakSet.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods $({ target: 'WeakSet', proto: true, real: true, forced: IS_PURE }, { deleteAll: function deleteAll(/* ...elements */) { return collectionDeleteAll.apply(this, arguments); } }); core-js-3.6.1/packages/core-js/modules/esnext.weak-set.from.js000066400000000000000000000003611360057567700242200ustar00rootroot00000000000000var $ = require('../internals/export'); var from = require('../internals/collection-from'); // `WeakSet.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from $({ target: 'WeakSet', stat: true }, { from: from }); core-js-3.6.1/packages/core-js/modules/esnext.weak-set.of.js000066400000000000000000000003451360057567700236630ustar00rootroot00000000000000var $ = require('../internals/export'); var of = require('../internals/collection-of'); // `WeakSet.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of $({ target: 'WeakSet', stat: true }, { of: of }); core-js-3.6.1/packages/core-js/modules/web.dom-collections.for-each.js000066400000000000000000000012631360057567700255650ustar00rootroot00000000000000var global = require('../internals/global'); var DOMIterables = require('../internals/dom-iterables'); var forEach = require('../internals/array-for-each'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); for (var COLLECTION_NAME in DOMIterables) { var Collection = global[COLLECTION_NAME]; var CollectionPrototype = Collection && Collection.prototype; // some Chrome versions have non-configurable methods on DOMTokenList if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try { createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach); } catch (error) { CollectionPrototype.forEach = forEach; } } core-js-3.6.1/packages/core-js/modules/web.dom-collections.iterator.js000066400000000000000000000030351360057567700257310ustar00rootroot00000000000000var global = require('../internals/global'); var DOMIterables = require('../internals/dom-iterables'); var ArrayIteratorMethods = require('../modules/es.array.iterator'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); var wellKnownSymbol = require('../internals/well-known-symbol'); var ITERATOR = wellKnownSymbol('iterator'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var ArrayValues = ArrayIteratorMethods.values; for (var COLLECTION_NAME in DOMIterables) { var Collection = global[COLLECTION_NAME]; var CollectionPrototype = Collection && Collection.prototype; if (CollectionPrototype) { // some Chrome versions have non-configurable methods on DOMTokenList if (CollectionPrototype[ITERATOR] !== ArrayValues) try { createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues); } catch (error) { CollectionPrototype[ITERATOR] = ArrayValues; } if (!CollectionPrototype[TO_STRING_TAG]) { createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME); } if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) { // some Chrome versions have non-configurable methods on DOMTokenList if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try { createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]); } catch (error) { CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME]; } } } } core-js-3.6.1/packages/core-js/modules/web.immediate.js000066400000000000000000000010141360057567700227370ustar00rootroot00000000000000var $ = require('../internals/export'); var global = require('../internals/global'); var task = require('../internals/task'); var FORCED = !global.setImmediate || !global.clearImmediate; // http://w3c.github.io/setImmediate/ $({ global: true, bind: true, enumerable: true, forced: FORCED }, { // `setImmediate` method // http://w3c.github.io/setImmediate/#si-setImmediate setImmediate: task.set, // `clearImmediate` method // http://w3c.github.io/setImmediate/#si-clearImmediate clearImmediate: task.clear }); core-js-3.6.1/packages/core-js/modules/web.queue-microtask.js000066400000000000000000000011101360057567700241140ustar00rootroot00000000000000var $ = require('../internals/export'); var global = require('../internals/global'); var microtask = require('../internals/microtask'); var classof = require('../internals/classof-raw'); var process = global.process; var isNode = classof(process) == 'process'; // `queueMicrotask` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask $({ global: true, enumerable: true, noTargetGet: true }, { queueMicrotask: function queueMicrotask(fn) { var domain = isNode && process.domain; microtask(domain ? domain.bind(fn) : fn); } }); core-js-3.6.1/packages/core-js/modules/web.timers.js000066400000000000000000000021571360057567700223150ustar00rootroot00000000000000var $ = require('../internals/export'); var global = require('../internals/global'); var userAgent = require('../internals/user-agent'); var slice = [].slice; var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check var wrap = function (scheduler) { return function (handler, timeout /* , ...arguments */) { var boundArgs = arguments.length > 2; var args = boundArgs ? slice.call(arguments, 2) : undefined; return scheduler(boundArgs ? function () { // eslint-disable-next-line no-new-func (typeof handler == 'function' ? handler : Function(handler)).apply(this, args); } : handler, timeout); }; }; // ie9- setTimeout & setInterval additional parameters fix // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers $({ global: true, bind: true, forced: MSIE }, { // `setTimeout` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout setTimeout: wrap(global.setTimeout), // `setInterval` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval setInterval: wrap(global.setInterval) }); core-js-3.6.1/packages/core-js/modules/web.url-search-params.js000066400000000000000000000271341360057567700243420ustar00rootroot00000000000000'use strict'; // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` require('../modules/es.array.iterator'); var $ = require('../internals/export'); var getBuiltIn = require('../internals/get-built-in'); var USE_NATIVE_URL = require('../internals/native-url'); var redefine = require('../internals/redefine'); var redefineAll = require('../internals/redefine-all'); var setToStringTag = require('../internals/set-to-string-tag'); var createIteratorConstructor = require('../internals/create-iterator-constructor'); var InternalStateModule = require('../internals/internal-state'); var anInstance = require('../internals/an-instance'); var hasOwn = require('../internals/has'); var bind = require('../internals/bind-context'); var classof = require('../internals/classof'); var anObject = require('../internals/an-object'); var isObject = require('../internals/is-object'); var create = require('../internals/object-create'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); var getIterator = require('../internals/get-iterator'); var getIteratorMethod = require('../internals/get-iterator-method'); var wellKnownSymbol = require('../internals/well-known-symbol'); var $fetch = getBuiltIn('fetch'); var Headers = getBuiltIn('Headers'); var ITERATOR = wellKnownSymbol('iterator'); var URL_SEARCH_PARAMS = 'URLSearchParams'; var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator'; var setInternalState = InternalStateModule.set; var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS); var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR); var plus = /\+/g; var sequences = Array(4); var percentSequence = function (bytes) { return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\da-f]{2}){' + bytes + '})', 'gi')); }; var percentDecode = function (sequence) { try { return decodeURIComponent(sequence); } catch (error) { return sequence; } }; var deserialize = function (it) { var result = it.replace(plus, ' '); var bytes = 4; try { return decodeURIComponent(result); } catch (error) { while (bytes) { result = result.replace(percentSequence(bytes--), percentDecode); } return result; } }; var find = /[!'()~]|%20/g; var replace = { '!': '%21', "'": '%27', '(': '%28', ')': '%29', '~': '%7E', '%20': '+' }; var replacer = function (match) { return replace[match]; }; var serialize = function (it) { return encodeURIComponent(it).replace(find, replacer); }; var parseSearchParams = function (result, query) { if (query) { var attributes = query.split('&'); var index = 0; var attribute, entry; while (index < attributes.length) { attribute = attributes[index++]; if (attribute.length) { entry = attribute.split('='); result.push({ key: deserialize(entry.shift()), value: deserialize(entry.join('=')) }); } } } }; var updateSearchParams = function (query) { this.entries.length = 0; parseSearchParams(this.entries, query); }; var validateArgumentsLength = function (passed, required) { if (passed < required) throw TypeError('Not enough arguments'); }; var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) { setInternalState(this, { type: URL_SEARCH_PARAMS_ITERATOR, iterator: getIterator(getInternalParamsState(params).entries), kind: kind }); }, 'Iterator', function next() { var state = getInternalIteratorState(this); var kind = state.kind; var step = state.iterator.next(); var entry = step.value; if (!step.done) { step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value]; } return step; }); // `URLSearchParams` constructor // https://url.spec.whatwg.org/#interface-urlsearchparams var URLSearchParamsConstructor = function URLSearchParams(/* init */) { anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS); var init = arguments.length > 0 ? arguments[0] : undefined; var that = this; var entries = []; var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key; setInternalState(that, { type: URL_SEARCH_PARAMS, entries: entries, updateURL: function () { /* empty */ }, updateSearchParams: updateSearchParams }); if (init !== undefined) { if (isObject(init)) { iteratorMethod = getIteratorMethod(init); if (typeof iteratorMethod === 'function') { iterator = iteratorMethod.call(init); next = iterator.next; while (!(step = next.call(iterator)).done) { entryIterator = getIterator(anObject(step.value)); entryNext = entryIterator.next; if ( (first = entryNext.call(entryIterator)).done || (second = entryNext.call(entryIterator)).done || !entryNext.call(entryIterator).done ) throw TypeError('Expected sequence with length 2'); entries.push({ key: first.value + '', value: second.value + '' }); } } else for (key in init) if (hasOwn(init, key)) entries.push({ key: key, value: init[key] + '' }); } else { parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + ''); } } }; var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype; redefineAll(URLSearchParamsPrototype, { // `URLSearchParams.prototype.appent` method // https://url.spec.whatwg.org/#dom-urlsearchparams-append append: function append(name, value) { validateArgumentsLength(arguments.length, 2); var state = getInternalParamsState(this); state.entries.push({ key: name + '', value: value + '' }); state.updateURL(); }, // `URLSearchParams.prototype.delete` method // https://url.spec.whatwg.org/#dom-urlsearchparams-delete 'delete': function (name) { validateArgumentsLength(arguments.length, 1); var state = getInternalParamsState(this); var entries = state.entries; var key = name + ''; var index = 0; while (index < entries.length) { if (entries[index].key === key) entries.splice(index, 1); else index++; } state.updateURL(); }, // `URLSearchParams.prototype.get` method // https://url.spec.whatwg.org/#dom-urlsearchparams-get get: function get(name) { validateArgumentsLength(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = name + ''; var index = 0; for (; index < entries.length; index++) { if (entries[index].key === key) return entries[index].value; } return null; }, // `URLSearchParams.prototype.getAll` method // https://url.spec.whatwg.org/#dom-urlsearchparams-getall getAll: function getAll(name) { validateArgumentsLength(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = name + ''; var result = []; var index = 0; for (; index < entries.length; index++) { if (entries[index].key === key) result.push(entries[index].value); } return result; }, // `URLSearchParams.prototype.has` method // https://url.spec.whatwg.org/#dom-urlsearchparams-has has: function has(name) { validateArgumentsLength(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = name + ''; var index = 0; while (index < entries.length) { if (entries[index++].key === key) return true; } return false; }, // `URLSearchParams.prototype.set` method // https://url.spec.whatwg.org/#dom-urlsearchparams-set set: function set(name, value) { validateArgumentsLength(arguments.length, 1); var state = getInternalParamsState(this); var entries = state.entries; var found = false; var key = name + ''; var val = value + ''; var index = 0; var entry; for (; index < entries.length; index++) { entry = entries[index]; if (entry.key === key) { if (found) entries.splice(index--, 1); else { found = true; entry.value = val; } } } if (!found) entries.push({ key: key, value: val }); state.updateURL(); }, // `URLSearchParams.prototype.sort` method // https://url.spec.whatwg.org/#dom-urlsearchparams-sort sort: function sort() { var state = getInternalParamsState(this); var entries = state.entries; // Array#sort is not stable in some engines var slice = entries.slice(); var entry, entriesIndex, sliceIndex; entries.length = 0; for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) { entry = slice[sliceIndex]; for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) { if (entries[entriesIndex].key > entry.key) { entries.splice(entriesIndex, 0, entry); break; } } if (entriesIndex === sliceIndex) entries.push(entry); } state.updateURL(); }, // `URLSearchParams.prototype.forEach` method forEach: function forEach(callback /* , thisArg */) { var entries = getInternalParamsState(this).entries; var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3); var index = 0; var entry; while (index < entries.length) { entry = entries[index++]; boundFunction(entry.value, entry.key, this); } }, // `URLSearchParams.prototype.keys` method keys: function keys() { return new URLSearchParamsIterator(this, 'keys'); }, // `URLSearchParams.prototype.values` method values: function values() { return new URLSearchParamsIterator(this, 'values'); }, // `URLSearchParams.prototype.entries` method entries: function entries() { return new URLSearchParamsIterator(this, 'entries'); } }, { enumerable: true }); // `URLSearchParams.prototype[@@iterator]` method redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries); // `URLSearchParams.prototype.toString` method // https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior redefine(URLSearchParamsPrototype, 'toString', function toString() { var entries = getInternalParamsState(this).entries; var result = []; var index = 0; var entry; while (index < entries.length) { entry = entries[index++]; result.push(serialize(entry.key) + '=' + serialize(entry.value)); } return result.join('&'); }, { enumerable: true }); setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS); $({ global: true, forced: !USE_NATIVE_URL }, { URLSearchParams: URLSearchParamsConstructor }); // Wrap `fetch` for correct work with polyfilled `URLSearchParams` // https://github.com/zloirock/core-js/issues/674 if (!USE_NATIVE_URL && typeof $fetch == 'function' && typeof Headers == 'function') { $({ global: true, enumerable: true, forced: true }, { fetch: function fetch(input /* , init */) { var args = [input]; var init, body, headers; if (arguments.length > 1) { init = arguments[1]; if (isObject(init)) { body = init.body; if (classof(body) === URL_SEARCH_PARAMS) { headers = init.headers ? new Headers(init.headers) : new Headers(); if (!headers.has('content-type')) { headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); } init = create(init, { body: createPropertyDescriptor(0, String(body)), headers: createPropertyDescriptor(0, headers) }); } } args.push(init); } return $fetch.apply(this, args); } }); } module.exports = { URLSearchParams: URLSearchParamsConstructor, getState: getInternalParamsState }; core-js-3.6.1/packages/core-js/modules/web.url.js000066400000000000000000000776231360057567700216260ustar00rootroot00000000000000'use strict'; // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` require('../modules/es.string.iterator'); var $ = require('../internals/export'); var DESCRIPTORS = require('../internals/descriptors'); var USE_NATIVE_URL = require('../internals/native-url'); var global = require('../internals/global'); var defineProperties = require('../internals/object-define-properties'); var redefine = require('../internals/redefine'); var anInstance = require('../internals/an-instance'); var has = require('../internals/has'); var assign = require('../internals/object-assign'); var arrayFrom = require('../internals/array-from'); var codeAt = require('../internals/string-multibyte').codeAt; var toASCII = require('../internals/punycode-to-ascii'); var setToStringTag = require('../internals/set-to-string-tag'); var URLSearchParamsModule = require('../modules/web.url-search-params'); var InternalStateModule = require('../internals/internal-state'); var NativeURL = global.URL; var URLSearchParams = URLSearchParamsModule.URLSearchParams; var getInternalSearchParamsState = URLSearchParamsModule.getState; var setInternalState = InternalStateModule.set; var getInternalURLState = InternalStateModule.getterFor('URL'); var floor = Math.floor; var pow = Math.pow; var INVALID_AUTHORITY = 'Invalid authority'; var INVALID_SCHEME = 'Invalid scheme'; var INVALID_HOST = 'Invalid host'; var INVALID_PORT = 'Invalid port'; var ALPHA = /[A-Za-z]/; var ALPHANUMERIC = /[\d+\-.A-Za-z]/; var DIGIT = /\d/; var HEX_START = /^(0x|0X)/; var OCT = /^[0-7]+$/; var DEC = /^\d+$/; var HEX = /^[\dA-Fa-f]+$/; // eslint-disable-next-line no-control-regex var FORBIDDEN_HOST_CODE_POINT = /[\u0000\u0009\u000A\u000D #%/:?@[\\]]/; // eslint-disable-next-line no-control-regex var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\u0009\u000A\u000D #/:?@[\\]]/; // eslint-disable-next-line no-control-regex var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g; // eslint-disable-next-line no-control-regex var TAB_AND_NEW_LINE = /[\u0009\u000A\u000D]/g; var EOF; var parseHost = function (url, input) { var result, codePoints, index; if (input.charAt(0) == '[') { if (input.charAt(input.length - 1) != ']') return INVALID_HOST; result = parseIPv6(input.slice(1, -1)); if (!result) return INVALID_HOST; url.host = result; // opaque host } else if (!isSpecial(url)) { if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST; result = ''; codePoints = arrayFrom(input); for (index = 0; index < codePoints.length; index++) { result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); } url.host = result; } else { input = toASCII(input); if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST; result = parseIPv4(input); if (result === null) return INVALID_HOST; url.host = result; } }; var parseIPv4 = function (input) { var parts = input.split('.'); var partsLength, numbers, index, part, radix, number, ipv4; if (parts.length && parts[parts.length - 1] == '') { parts.pop(); } partsLength = parts.length; if (partsLength > 4) return input; numbers = []; for (index = 0; index < partsLength; index++) { part = parts[index]; if (part == '') return input; radix = 10; if (part.length > 1 && part.charAt(0) == '0') { radix = HEX_START.test(part) ? 16 : 8; part = part.slice(radix == 8 ? 1 : 2); } if (part === '') { number = 0; } else { if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input; number = parseInt(part, radix); } numbers.push(number); } for (index = 0; index < partsLength; index++) { number = numbers[index]; if (index == partsLength - 1) { if (number >= pow(256, 5 - partsLength)) return null; } else if (number > 255) return null; } ipv4 = numbers.pop(); for (index = 0; index < numbers.length; index++) { ipv4 += numbers[index] * pow(256, 3 - index); } return ipv4; }; // eslint-disable-next-line max-statements var parseIPv6 = function (input) { var address = [0, 0, 0, 0, 0, 0, 0, 0]; var pieceIndex = 0; var compress = null; var pointer = 0; var value, length, numbersSeen, ipv4Piece, number, swaps, swap; var char = function () { return input.charAt(pointer); }; if (char() == ':') { if (input.charAt(1) != ':') return; pointer += 2; pieceIndex++; compress = pieceIndex; } while (char()) { if (pieceIndex == 8) return; if (char() == ':') { if (compress !== null) return; pointer++; pieceIndex++; compress = pieceIndex; continue; } value = length = 0; while (length < 4 && HEX.test(char())) { value = value * 16 + parseInt(char(), 16); pointer++; length++; } if (char() == '.') { if (length == 0) return; pointer -= length; if (pieceIndex > 6) return; numbersSeen = 0; while (char()) { ipv4Piece = null; if (numbersSeen > 0) { if (char() == '.' && numbersSeen < 4) pointer++; else return; } if (!DIGIT.test(char())) return; while (DIGIT.test(char())) { number = parseInt(char(), 10); if (ipv4Piece === null) ipv4Piece = number; else if (ipv4Piece == 0) return; else ipv4Piece = ipv4Piece * 10 + number; if (ipv4Piece > 255) return; pointer++; } address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece; numbersSeen++; if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++; } if (numbersSeen != 4) return; break; } else if (char() == ':') { pointer++; if (!char()) return; } else if (char()) return; address[pieceIndex++] = value; } if (compress !== null) { swaps = pieceIndex - compress; pieceIndex = 7; while (pieceIndex != 0 && swaps > 0) { swap = address[pieceIndex]; address[pieceIndex--] = address[compress + swaps - 1]; address[compress + --swaps] = swap; } } else if (pieceIndex != 8) return; return address; }; var findLongestZeroSequence = function (ipv6) { var maxIndex = null; var maxLength = 1; var currStart = null; var currLength = 0; var index = 0; for (; index < 8; index++) { if (ipv6[index] !== 0) { if (currLength > maxLength) { maxIndex = currStart; maxLength = currLength; } currStart = null; currLength = 0; } else { if (currStart === null) currStart = index; ++currLength; } } if (currLength > maxLength) { maxIndex = currStart; maxLength = currLength; } return maxIndex; }; var serializeHost = function (host) { var result, index, compress, ignore0; // ipv4 if (typeof host == 'number') { result = []; for (index = 0; index < 4; index++) { result.unshift(host % 256); host = floor(host / 256); } return result.join('.'); // ipv6 } else if (typeof host == 'object') { result = ''; compress = findLongestZeroSequence(host); for (index = 0; index < 8; index++) { if (ignore0 && host[index] === 0) continue; if (ignore0) ignore0 = false; if (compress === index) { result += index ? ':' : '::'; ignore0 = true; } else { result += host[index].toString(16); if (index < 7) result += ':'; } } return '[' + result + ']'; } return host; }; var C0ControlPercentEncodeSet = {}; var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, { ' ': 1, '"': 1, '<': 1, '>': 1, '`': 1 }); var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, { '#': 1, '?': 1, '{': 1, '}': 1 }); var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, { '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\': 1, ']': 1, '^': 1, '|': 1 }); var percentEncode = function (char, set) { var code = codeAt(char, 0); return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char); }; var specialSchemes = { ftp: 21, file: null, http: 80, https: 443, ws: 80, wss: 443 }; var isSpecial = function (url) { return has(specialSchemes, url.scheme); }; var includesCredentials = function (url) { return url.username != '' || url.password != ''; }; var cannotHaveUsernamePasswordPort = function (url) { return !url.host || url.cannotBeABaseURL || url.scheme == 'file'; }; var isWindowsDriveLetter = function (string, normalized) { var second; return string.length == 2 && ALPHA.test(string.charAt(0)) && ((second = string.charAt(1)) == ':' || (!normalized && second == '|')); }; var startsWithWindowsDriveLetter = function (string) { var third; return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && ( string.length == 2 || ((third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#') ); }; var shortenURLsPath = function (url) { var path = url.path; var pathSize = path.length; if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { path.pop(); } }; var isSingleDot = function (segment) { return segment === '.' || segment.toLowerCase() === '%2e'; }; var isDoubleDot = function (segment) { segment = segment.toLowerCase(); return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e'; }; // States: var SCHEME_START = {}; var SCHEME = {}; var NO_SCHEME = {}; var SPECIAL_RELATIVE_OR_AUTHORITY = {}; var PATH_OR_AUTHORITY = {}; var RELATIVE = {}; var RELATIVE_SLASH = {}; var SPECIAL_AUTHORITY_SLASHES = {}; var SPECIAL_AUTHORITY_IGNORE_SLASHES = {}; var AUTHORITY = {}; var HOST = {}; var HOSTNAME = {}; var PORT = {}; var FILE = {}; var FILE_SLASH = {}; var FILE_HOST = {}; var PATH_START = {}; var PATH = {}; var CANNOT_BE_A_BASE_URL_PATH = {}; var QUERY = {}; var FRAGMENT = {}; // eslint-disable-next-line max-statements var parseURL = function (url, input, stateOverride, base) { var state = stateOverride || SCHEME_START; var pointer = 0; var buffer = ''; var seenAt = false; var seenBracket = false; var seenPasswordToken = false; var codePoints, char, bufferCodePoints, failure; if (!stateOverride) { url.scheme = ''; url.username = ''; url.password = ''; url.host = null; url.port = null; url.path = []; url.query = null; url.fragment = null; url.cannotBeABaseURL = false; input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); } input = input.replace(TAB_AND_NEW_LINE, ''); codePoints = arrayFrom(input); while (pointer <= codePoints.length) { char = codePoints[pointer]; switch (state) { case SCHEME_START: if (char && ALPHA.test(char)) { buffer += char.toLowerCase(); state = SCHEME; } else if (!stateOverride) { state = NO_SCHEME; continue; } else return INVALID_SCHEME; break; case SCHEME: if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) { buffer += char.toLowerCase(); } else if (char == ':') { if (stateOverride && ( (isSpecial(url) != has(specialSchemes, buffer)) || (buffer == 'file' && (includesCredentials(url) || url.port !== null)) || (url.scheme == 'file' && !url.host) )) return; url.scheme = buffer; if (stateOverride) { if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null; return; } buffer = ''; if (url.scheme == 'file') { state = FILE; } else if (isSpecial(url) && base && base.scheme == url.scheme) { state = SPECIAL_RELATIVE_OR_AUTHORITY; } else if (isSpecial(url)) { state = SPECIAL_AUTHORITY_SLASHES; } else if (codePoints[pointer + 1] == '/') { state = PATH_OR_AUTHORITY; pointer++; } else { url.cannotBeABaseURL = true; url.path.push(''); state = CANNOT_BE_A_BASE_URL_PATH; } } else if (!stateOverride) { buffer = ''; state = NO_SCHEME; pointer = 0; continue; } else return INVALID_SCHEME; break; case NO_SCHEME: if (!base || (base.cannotBeABaseURL && char != '#')) return INVALID_SCHEME; if (base.cannotBeABaseURL && char == '#') { url.scheme = base.scheme; url.path = base.path.slice(); url.query = base.query; url.fragment = ''; url.cannotBeABaseURL = true; state = FRAGMENT; break; } state = base.scheme == 'file' ? FILE : RELATIVE; continue; case SPECIAL_RELATIVE_OR_AUTHORITY: if (char == '/' && codePoints[pointer + 1] == '/') { state = SPECIAL_AUTHORITY_IGNORE_SLASHES; pointer++; } else { state = RELATIVE; continue; } break; case PATH_OR_AUTHORITY: if (char == '/') { state = AUTHORITY; break; } else { state = PATH; continue; } case RELATIVE: url.scheme = base.scheme; if (char == EOF) { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = base.path.slice(); url.query = base.query; } else if (char == '/' || (char == '\\' && isSpecial(url))) { state = RELATIVE_SLASH; } else if (char == '?') { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = base.path.slice(); url.query = ''; state = QUERY; } else if (char == '#') { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = base.path.slice(); url.query = base.query; url.fragment = ''; state = FRAGMENT; } else { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = base.path.slice(); url.path.pop(); state = PATH; continue; } break; case RELATIVE_SLASH: if (isSpecial(url) && (char == '/' || char == '\\')) { state = SPECIAL_AUTHORITY_IGNORE_SLASHES; } else if (char == '/') { state = AUTHORITY; } else { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; state = PATH; continue; } break; case SPECIAL_AUTHORITY_SLASHES: state = SPECIAL_AUTHORITY_IGNORE_SLASHES; if (char != '/' || buffer.charAt(pointer + 1) != '/') continue; pointer++; break; case SPECIAL_AUTHORITY_IGNORE_SLASHES: if (char != '/' && char != '\\') { state = AUTHORITY; continue; } break; case AUTHORITY: if (char == '@') { if (seenAt) buffer = '%40' + buffer; seenAt = true; bufferCodePoints = arrayFrom(buffer); for (var i = 0; i < bufferCodePoints.length; i++) { var codePoint = bufferCodePoints[i]; if (codePoint == ':' && !seenPasswordToken) { seenPasswordToken = true; continue; } var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet); if (seenPasswordToken) url.password += encodedCodePoints; else url.username += encodedCodePoints; } buffer = ''; } else if ( char == EOF || char == '/' || char == '?' || char == '#' || (char == '\\' && isSpecial(url)) ) { if (seenAt && buffer == '') return INVALID_AUTHORITY; pointer -= arrayFrom(buffer).length + 1; buffer = ''; state = HOST; } else buffer += char; break; case HOST: case HOSTNAME: if (stateOverride && url.scheme == 'file') { state = FILE_HOST; continue; } else if (char == ':' && !seenBracket) { if (buffer == '') return INVALID_HOST; failure = parseHost(url, buffer); if (failure) return failure; buffer = ''; state = PORT; if (stateOverride == HOSTNAME) return; } else if ( char == EOF || char == '/' || char == '?' || char == '#' || (char == '\\' && isSpecial(url)) ) { if (isSpecial(url) && buffer == '') return INVALID_HOST; if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return; failure = parseHost(url, buffer); if (failure) return failure; buffer = ''; state = PATH_START; if (stateOverride) return; continue; } else { if (char == '[') seenBracket = true; else if (char == ']') seenBracket = false; buffer += char; } break; case PORT: if (DIGIT.test(char)) { buffer += char; } else if ( char == EOF || char == '/' || char == '?' || char == '#' || (char == '\\' && isSpecial(url)) || stateOverride ) { if (buffer != '') { var port = parseInt(buffer, 10); if (port > 0xFFFF) return INVALID_PORT; url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port; buffer = ''; } if (stateOverride) return; state = PATH_START; continue; } else return INVALID_PORT; break; case FILE: url.scheme = 'file'; if (char == '/' || char == '\\') state = FILE_SLASH; else if (base && base.scheme == 'file') { if (char == EOF) { url.host = base.host; url.path = base.path.slice(); url.query = base.query; } else if (char == '?') { url.host = base.host; url.path = base.path.slice(); url.query = ''; state = QUERY; } else if (char == '#') { url.host = base.host; url.path = base.path.slice(); url.query = base.query; url.fragment = ''; state = FRAGMENT; } else { if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { url.host = base.host; url.path = base.path.slice(); shortenURLsPath(url); } state = PATH; continue; } } else { state = PATH; continue; } break; case FILE_SLASH: if (char == '/' || char == '\\') { state = FILE_HOST; break; } if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]); else url.host = base.host; } state = PATH; continue; case FILE_HOST: if (char == EOF || char == '/' || char == '\\' || char == '?' || char == '#') { if (!stateOverride && isWindowsDriveLetter(buffer)) { state = PATH; } else if (buffer == '') { url.host = ''; if (stateOverride) return; state = PATH_START; } else { failure = parseHost(url, buffer); if (failure) return failure; if (url.host == 'localhost') url.host = ''; if (stateOverride) return; buffer = ''; state = PATH_START; } continue; } else buffer += char; break; case PATH_START: if (isSpecial(url)) { state = PATH; if (char != '/' && char != '\\') continue; } else if (!stateOverride && char == '?') { url.query = ''; state = QUERY; } else if (!stateOverride && char == '#') { url.fragment = ''; state = FRAGMENT; } else if (char != EOF) { state = PATH; if (char != '/') continue; } break; case PATH: if ( char == EOF || char == '/' || (char == '\\' && isSpecial(url)) || (!stateOverride && (char == '?' || char == '#')) ) { if (isDoubleDot(buffer)) { shortenURLsPath(url); if (char != '/' && !(char == '\\' && isSpecial(url))) { url.path.push(''); } } else if (isSingleDot(buffer)) { if (char != '/' && !(char == '\\' && isSpecial(url))) { url.path.push(''); } } else { if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) { if (url.host) url.host = ''; buffer = buffer.charAt(0) + ':'; // normalize windows drive letter } url.path.push(buffer); } buffer = ''; if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) { while (url.path.length > 1 && url.path[0] === '') { url.path.shift(); } } if (char == '?') { url.query = ''; state = QUERY; } else if (char == '#') { url.fragment = ''; state = FRAGMENT; } } else { buffer += percentEncode(char, pathPercentEncodeSet); } break; case CANNOT_BE_A_BASE_URL_PATH: if (char == '?') { url.query = ''; state = QUERY; } else if (char == '#') { url.fragment = ''; state = FRAGMENT; } else if (char != EOF) { url.path[0] += percentEncode(char, C0ControlPercentEncodeSet); } break; case QUERY: if (!stateOverride && char == '#') { url.fragment = ''; state = FRAGMENT; } else if (char != EOF) { if (char == "'" && isSpecial(url)) url.query += '%27'; else if (char == '#') url.query += '%23'; else url.query += percentEncode(char, C0ControlPercentEncodeSet); } break; case FRAGMENT: if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet); break; } pointer++; } }; // `URL` constructor // https://url.spec.whatwg.org/#url-class var URLConstructor = function URL(url /* , base */) { var that = anInstance(this, URLConstructor, 'URL'); var base = arguments.length > 1 ? arguments[1] : undefined; var urlString = String(url); var state = setInternalState(that, { type: 'URL' }); var baseState, failure; if (base !== undefined) { if (base instanceof URLConstructor) baseState = getInternalURLState(base); else { failure = parseURL(baseState = {}, String(base)); if (failure) throw TypeError(failure); } } failure = parseURL(state, urlString, null, baseState); if (failure) throw TypeError(failure); var searchParams = state.searchParams = new URLSearchParams(); var searchParamsState = getInternalSearchParamsState(searchParams); searchParamsState.updateSearchParams(state.query); searchParamsState.updateURL = function () { state.query = String(searchParams) || null; }; if (!DESCRIPTORS) { that.href = serializeURL.call(that); that.origin = getOrigin.call(that); that.protocol = getProtocol.call(that); that.username = getUsername.call(that); that.password = getPassword.call(that); that.host = getHost.call(that); that.hostname = getHostname.call(that); that.port = getPort.call(that); that.pathname = getPathname.call(that); that.search = getSearch.call(that); that.searchParams = getSearchParams.call(that); that.hash = getHash.call(that); } }; var URLPrototype = URLConstructor.prototype; var serializeURL = function () { var url = getInternalURLState(this); var scheme = url.scheme; var username = url.username; var password = url.password; var host = url.host; var port = url.port; var path = url.path; var query = url.query; var fragment = url.fragment; var output = scheme + ':'; if (host !== null) { output += '//'; if (includesCredentials(url)) { output += username + (password ? ':' + password : '') + '@'; } output += serializeHost(host); if (port !== null) output += ':' + port; } else if (scheme == 'file') output += '//'; output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; if (query !== null) output += '?' + query; if (fragment !== null) output += '#' + fragment; return output; }; var getOrigin = function () { var url = getInternalURLState(this); var scheme = url.scheme; var port = url.port; if (scheme == 'blob') try { return new URL(scheme.path[0]).origin; } catch (error) { return 'null'; } if (scheme == 'file' || !isSpecial(url)) return 'null'; return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : ''); }; var getProtocol = function () { return getInternalURLState(this).scheme + ':'; }; var getUsername = function () { return getInternalURLState(this).username; }; var getPassword = function () { return getInternalURLState(this).password; }; var getHost = function () { var url = getInternalURLState(this); var host = url.host; var port = url.port; return host === null ? '' : port === null ? serializeHost(host) : serializeHost(host) + ':' + port; }; var getHostname = function () { var host = getInternalURLState(this).host; return host === null ? '' : serializeHost(host); }; var getPort = function () { var port = getInternalURLState(this).port; return port === null ? '' : String(port); }; var getPathname = function () { var url = getInternalURLState(this); var path = url.path; return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; }; var getSearch = function () { var query = getInternalURLState(this).query; return query ? '?' + query : ''; }; var getSearchParams = function () { return getInternalURLState(this).searchParams; }; var getHash = function () { var fragment = getInternalURLState(this).fragment; return fragment ? '#' + fragment : ''; }; var accessorDescriptor = function (getter, setter) { return { get: getter, set: setter, configurable: true, enumerable: true }; }; if (DESCRIPTORS) { defineProperties(URLPrototype, { // `URL.prototype.href` accessors pair // https://url.spec.whatwg.org/#dom-url-href href: accessorDescriptor(serializeURL, function (href) { var url = getInternalURLState(this); var urlString = String(href); var failure = parseURL(url, urlString); if (failure) throw TypeError(failure); getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); }), // `URL.prototype.origin` getter // https://url.spec.whatwg.org/#dom-url-origin origin: accessorDescriptor(getOrigin), // `URL.prototype.protocol` accessors pair // https://url.spec.whatwg.org/#dom-url-protocol protocol: accessorDescriptor(getProtocol, function (protocol) { var url = getInternalURLState(this); parseURL(url, String(protocol) + ':', SCHEME_START); }), // `URL.prototype.username` accessors pair // https://url.spec.whatwg.org/#dom-url-username username: accessorDescriptor(getUsername, function (username) { var url = getInternalURLState(this); var codePoints = arrayFrom(String(username)); if (cannotHaveUsernamePasswordPort(url)) return; url.username = ''; for (var i = 0; i < codePoints.length; i++) { url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet); } }), // `URL.prototype.password` accessors pair // https://url.spec.whatwg.org/#dom-url-password password: accessorDescriptor(getPassword, function (password) { var url = getInternalURLState(this); var codePoints = arrayFrom(String(password)); if (cannotHaveUsernamePasswordPort(url)) return; url.password = ''; for (var i = 0; i < codePoints.length; i++) { url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet); } }), // `URL.prototype.host` accessors pair // https://url.spec.whatwg.org/#dom-url-host host: accessorDescriptor(getHost, function (host) { var url = getInternalURLState(this); if (url.cannotBeABaseURL) return; parseURL(url, String(host), HOST); }), // `URL.prototype.hostname` accessors pair // https://url.spec.whatwg.org/#dom-url-hostname hostname: accessorDescriptor(getHostname, function (hostname) { var url = getInternalURLState(this); if (url.cannotBeABaseURL) return; parseURL(url, String(hostname), HOSTNAME); }), // `URL.prototype.port` accessors pair // https://url.spec.whatwg.org/#dom-url-port port: accessorDescriptor(getPort, function (port) { var url = getInternalURLState(this); if (cannotHaveUsernamePasswordPort(url)) return; port = String(port); if (port == '') url.port = null; else parseURL(url, port, PORT); }), // `URL.prototype.pathname` accessors pair // https://url.spec.whatwg.org/#dom-url-pathname pathname: accessorDescriptor(getPathname, function (pathname) { var url = getInternalURLState(this); if (url.cannotBeABaseURL) return; url.path = []; parseURL(url, pathname + '', PATH_START); }), // `URL.prototype.search` accessors pair // https://url.spec.whatwg.org/#dom-url-search search: accessorDescriptor(getSearch, function (search) { var url = getInternalURLState(this); search = String(search); if (search == '') { url.query = null; } else { if ('?' == search.charAt(0)) search = search.slice(1); url.query = ''; parseURL(url, search, QUERY); } getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); }), // `URL.prototype.searchParams` getter // https://url.spec.whatwg.org/#dom-url-searchparams searchParams: accessorDescriptor(getSearchParams), // `URL.prototype.hash` accessors pair // https://url.spec.whatwg.org/#dom-url-hash hash: accessorDescriptor(getHash, function (hash) { var url = getInternalURLState(this); hash = String(hash); if (hash == '') { url.fragment = null; return; } if ('#' == hash.charAt(0)) hash = hash.slice(1); url.fragment = ''; parseURL(url, hash, FRAGMENT); }) }); } // `URL.prototype.toJSON` method // https://url.spec.whatwg.org/#dom-url-tojson redefine(URLPrototype, 'toJSON', function toJSON() { return serializeURL.call(this); }, { enumerable: true }); // `URL.prototype.toString` method // https://url.spec.whatwg.org/#URL-stringification-behavior redefine(URLPrototype, 'toString', function toString() { return serializeURL.call(this); }, { enumerable: true }); if (NativeURL) { var nativeCreateObjectURL = NativeURL.createObjectURL; var nativeRevokeObjectURL = NativeURL.revokeObjectURL; // `URL.createObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL // eslint-disable-next-line no-unused-vars if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) { return nativeCreateObjectURL.apply(NativeURL, arguments); }); // `URL.revokeObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL // eslint-disable-next-line no-unused-vars if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) { return nativeRevokeObjectURL.apply(NativeURL, arguments); }); } setToStringTag(URLConstructor, 'URL'); $({ global: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, { URL: URLConstructor }); core-js-3.6.1/packages/core-js/modules/web.url.to-json.js000066400000000000000000000004211360057567700231740ustar00rootroot00000000000000'use strict'; var $ = require('../internals/export'); // `URL.prototype.toJSON` method // https://url.spec.whatwg.org/#dom-url-tojson $({ target: 'URL', proto: true, enumerable: true }, { toJSON: function toJSON() { return URL.prototype.toString.call(this); } }); core-js-3.6.1/packages/core-js/package.json000066400000000000000000000020251360057567700205100ustar00rootroot00000000000000{ "name": "core-js", "description": "Standard library", "version": "3.6.1", "repository": { "type": "git", "url": "https://github.com/zloirock/core-js.git" }, "main": "index.js", "funding": { "type": "opencollective", "url": "https://opencollective.com/core-js" }, "license": "MIT", "keywords": [ "ES3", "ES5", "ES6", "ES7", "ES2015", "ES2016", "ES2017", "ES2018", "ES2019", "ES2020", "ECMAScript 3", "ECMAScript 5", "ECMAScript 6", "ECMAScript 7", "ECMAScript 2015", "ECMAScript 2016", "ECMAScript 2017", "ECMAScript 2018", "ECMAScript 2019", "ECMAScript 2020", "Harmony", "Strawman", "Map", "Set", "WeakMap", "WeakSet", "Promise", "Observable", "Symbol", "TypedArray", "URL", "URLSearchParams", "queueMicrotask", "setImmediate", "polyfill", "ponyfill", "shim" ], "scripts": { "postinstall": "node -e \"try{require('./postinstall')}catch(e){}\"" } } core-js-3.6.1/packages/core-js/postinstall.js000066400000000000000000000037651360057567700211500ustar00rootroot00000000000000/* eslint-disable max-len */ var fs = require('fs'); var os = require('os'); var path = require('path'); var env = process.env; var ADBLOCK = is(env.ADBLOCK); var COLOR = is(env.npm_config_color); var DISABLE_OPENCOLLECTIVE = is(env.DISABLE_OPENCOLLECTIVE); var SILENT = ['silent', 'error', 'warn'].indexOf(env.npm_config_loglevel) !== -1; var MINUTE = 60 * 1000; // you could add a PR with an env variable for your CI detection var CI = [ 'BUILD_NUMBER', 'CI', 'CONTINUOUS_INTEGRATION', 'RUN_ID' ].some(function (it) { return is(env[it]); }); var BANNER = '\u001B[96mThank you for using core-js (\u001B[94m https://github.com/zloirock/core-js \u001B[96m) for polyfilling JavaScript standard library!\u001B[0m\n\n' + '\u001B[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: \u001B[0m\n' + '\u001B[96m>\u001B[94m https://opencollective.com/core-js \u001B[0m\n' + '\u001B[96m>\u001B[94m https://www.patreon.com/zloirock \u001B[0m\n\n' + '\u001B[96mAlso, the author of core-js (\u001B[94m https://github.com/zloirock \u001B[96m) is looking for a good job -)\u001B[0m\n'; function is(it) { return !!it && it !== '0' && it !== 'false'; } function isBannerRequired() { if (ADBLOCK || CI || DISABLE_OPENCOLLECTIVE || SILENT) return false; var file = path.join(os.tmpdir(), 'core-js-banners'); var banners = []; try { var DELTA = Date.now() - fs.statSync(file).mtime; if (DELTA >= 0 && DELTA < MINUTE * 3) { banners = JSON.parse(fs.readFileSync(file, 'utf8')); if (banners.indexOf(BANNER) !== -1) return false; } } catch (error) { banners = []; } try { banners.push(BANNER); fs.writeFileSync(file, JSON.stringify(banners), 'utf8'); } catch (error) { /* empty */ } return true; } function showBanner() { // eslint-disable-next-line no-console,no-control-regex console.log(COLOR ? BANNER : BANNER.replace(/\u001B\[\d+m/g, '')); } if (isBannerRequired()) showBanner(); core-js-3.6.1/packages/core-js/proposals/000077500000000000000000000000001360057567700202455ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/proposals/array-is-template-object.js000066400000000000000000000000671360057567700254120ustar00rootroot00000000000000require('../modules/esnext.array.is-template-object'); core-js-3.6.1/packages/core-js/proposals/array-last.js000066400000000000000000000001351360057567700226610ustar00rootroot00000000000000require('../modules/esnext.array.last-index'); require('../modules/esnext.array.last-item'); core-js-3.6.1/packages/core-js/proposals/collection-methods.js000066400000000000000000000021601360057567700243760ustar00rootroot00000000000000require('../modules/esnext.map.group-by'); require('../modules/esnext.map.key-by'); require('../modules/esnext.map.delete-all'); require('../modules/esnext.map.every'); require('../modules/esnext.map.filter'); require('../modules/esnext.map.find'); require('../modules/esnext.map.find-key'); require('../modules/esnext.map.includes'); require('../modules/esnext.map.key-of'); require('../modules/esnext.map.map-keys'); require('../modules/esnext.map.map-values'); require('../modules/esnext.map.merge'); require('../modules/esnext.map.reduce'); require('../modules/esnext.map.some'); require('../modules/esnext.map.update'); require('../modules/esnext.set.add-all'); require('../modules/esnext.set.delete-all'); require('../modules/esnext.set.every'); require('../modules/esnext.set.filter'); require('../modules/esnext.set.find'); require('../modules/esnext.set.join'); require('../modules/esnext.set.map'); require('../modules/esnext.set.reduce'); require('../modules/esnext.set.some'); require('../modules/esnext.weak-map.delete-all'); require('../modules/esnext.weak-set.add-all'); require('../modules/esnext.weak-set.delete-all'); core-js-3.6.1/packages/core-js/proposals/collection-of-from.js000066400000000000000000000005041360057567700243000ustar00rootroot00000000000000require('../modules/esnext.map.from'); require('../modules/esnext.map.of'); require('../modules/esnext.set.from'); require('../modules/esnext.set.of'); require('../modules/esnext.weak-map.from'); require('../modules/esnext.weak-map.of'); require('../modules/esnext.weak-set.from'); require('../modules/esnext.weak-set.of'); core-js-3.6.1/packages/core-js/proposals/efficient-64-bit-arithmetic.js000066400000000000000000000002441360057567700256710ustar00rootroot00000000000000require('../modules/esnext.math.iaddh'); require('../modules/esnext.math.isubh'); require('../modules/esnext.math.imulh'); require('../modules/esnext.math.umulh'); core-js-3.6.1/packages/core-js/proposals/global-this.js000066400000000000000000000001611360057567700230060ustar00rootroot00000000000000require('../modules/esnext.global-this'); var global = require('../internals/global'); module.exports = global; core-js-3.6.1/packages/core-js/proposals/index.js000066400000000000000000000000251360057567700217070ustar00rootroot00000000000000require('../stage'); core-js-3.6.1/packages/core-js/proposals/iterator-helpers.js000066400000000000000000000025521360057567700241000ustar00rootroot00000000000000require('../modules/esnext.async-iterator.constructor'); require('../modules/esnext.async-iterator.as-indexed-pairs'); require('../modules/esnext.async-iterator.drop'); require('../modules/esnext.async-iterator.every'); require('../modules/esnext.async-iterator.filter'); require('../modules/esnext.async-iterator.find'); require('../modules/esnext.async-iterator.flat-map'); require('../modules/esnext.async-iterator.for-each'); require('../modules/esnext.async-iterator.from'); require('../modules/esnext.async-iterator.map'); require('../modules/esnext.async-iterator.reduce'); require('../modules/esnext.async-iterator.some'); require('../modules/esnext.async-iterator.take'); require('../modules/esnext.async-iterator.to-array'); require('../modules/esnext.iterator.constructor'); require('../modules/esnext.iterator.as-indexed-pairs'); require('../modules/esnext.iterator.drop'); require('../modules/esnext.iterator.every'); require('../modules/esnext.iterator.filter'); require('../modules/esnext.iterator.find'); require('../modules/esnext.iterator.flat-map'); require('../modules/esnext.iterator.for-each'); require('../modules/esnext.iterator.from'); require('../modules/esnext.iterator.map'); require('../modules/esnext.iterator.reduce'); require('../modules/esnext.iterator.some'); require('../modules/esnext.iterator.take'); require('../modules/esnext.iterator.to-array'); core-js-3.6.1/packages/core-js/proposals/keys-composition.js000066400000000000000000000001331360057567700241140ustar00rootroot00000000000000require('../modules/esnext.composite-key'); require('../modules/esnext.composite-symbol'); core-js-3.6.1/packages/core-js/proposals/map-update-or-insert.js000066400000000000000000000000721360057567700245570ustar00rootroot00000000000000// TODO: remove from `core-js@4` require('./map-upsert'); core-js-3.6.1/packages/core-js/proposals/map-upsert.js000066400000000000000000000003341360057567700227000ustar00rootroot00000000000000// https://github.com/thumbsupep/proposal-upsert // TODO: remove from `core-js@4` require('../modules/esnext.map.update-or-insert'); require('../modules/esnext.map.upsert'); require('../modules/esnext.weak-map.upsert'); core-js-3.6.1/packages/core-js/proposals/math-extensions.js000066400000000000000000000004601360057567700237310ustar00rootroot00000000000000require('../modules/esnext.math.clamp'); require('../modules/esnext.math.deg-per-rad'); require('../modules/esnext.math.degrees'); require('../modules/esnext.math.fscale'); require('../modules/esnext.math.rad-per-deg'); require('../modules/esnext.math.radians'); require('../modules/esnext.math.scale'); core-js-3.6.1/packages/core-js/proposals/math-signbit.js000066400000000000000000000000531360057567700231670ustar00rootroot00000000000000require('../modules/esnext.math.signbit'); core-js-3.6.1/packages/core-js/proposals/number-from-string.js000066400000000000000000000000611360057567700243350ustar00rootroot00000000000000require('../modules/esnext.number.from-string'); core-js-3.6.1/packages/core-js/proposals/object-iteration.js000066400000000000000000000002331360057567700240430ustar00rootroot00000000000000require('../modules/esnext.object.iterate-entries'); require('../modules/esnext.object.iterate-keys'); require('../modules/esnext.object.iterate-values'); core-js-3.6.1/packages/core-js/proposals/observable.js000066400000000000000000000001311360057567700227220ustar00rootroot00000000000000require('../modules/esnext.observable'); require('../modules/esnext.symbol.observable'); core-js-3.6.1/packages/core-js/proposals/pattern-matching.js000066400000000000000000000000631360057567700240470ustar00rootroot00000000000000require('../modules/esnext.symbol.pattern-match'); core-js-3.6.1/packages/core-js/proposals/promise-all-settled.js000066400000000000000000000001231360057567700244650ustar00rootroot00000000000000// TODO: Remove from `core-js@4` require('../modules/esnext.promise.all-settled'); core-js-3.6.1/packages/core-js/proposals/promise-any.js000066400000000000000000000001301360057567700230400ustar00rootroot00000000000000require('../modules/esnext.aggregate-error'); require('../modules/esnext.promise.any'); core-js-3.6.1/packages/core-js/proposals/promise-try.js000066400000000000000000000000521360057567700230720ustar00rootroot00000000000000require('../modules/esnext.promise.try'); core-js-3.6.1/packages/core-js/proposals/reflect-metadata.js000066400000000000000000000007431360057567700240110ustar00rootroot00000000000000require('../modules/esnext.reflect.define-metadata'); require('../modules/esnext.reflect.delete-metadata'); require('../modules/esnext.reflect.get-metadata'); require('../modules/esnext.reflect.get-metadata-keys'); require('../modules/esnext.reflect.get-own-metadata'); require('../modules/esnext.reflect.get-own-metadata-keys'); require('../modules/esnext.reflect.has-metadata'); require('../modules/esnext.reflect.has-own-metadata'); require('../modules/esnext.reflect.metadata'); core-js-3.6.1/packages/core-js/proposals/seeded-random.js000066400000000000000000000000571360057567700233140ustar00rootroot00000000000000require('../modules/esnext.math.seeded-prng'); core-js-3.6.1/packages/core-js/proposals/set-methods.js000066400000000000000000000005161360057567700230410ustar00rootroot00000000000000require('../modules/esnext.set.difference'); require('../modules/esnext.set.intersection'); require('../modules/esnext.set.is-disjoint-from'); require('../modules/esnext.set.is-subset-of'); require('../modules/esnext.set.is-superset-of'); require('../modules/esnext.set.union'); require('../modules/esnext.set.symmetric-difference'); core-js-3.6.1/packages/core-js/proposals/string-at.js000066400000000000000000000000501360057567700225060ustar00rootroot00000000000000require('../modules/esnext.string.at'); core-js-3.6.1/packages/core-js/proposals/string-code-points.js000066400000000000000000000000611360057567700243300ustar00rootroot00000000000000require('../modules/esnext.string.code-points'); core-js-3.6.1/packages/core-js/proposals/string-match-all.js000066400000000000000000000001201360057567700237420ustar00rootroot00000000000000// TODO: Remove from `core-js@4` require('../modules/esnext.string.match-all'); core-js-3.6.1/packages/core-js/proposals/string-replace-all.js000066400000000000000000000001421360057567700242650ustar00rootroot00000000000000require('../modules/esnext.string.replace-all'); require('../modules/esnext.symbol.replace-all'); core-js-3.6.1/packages/core-js/proposals/url.js000066400000000000000000000001631360057567700214050ustar00rootroot00000000000000require('../modules/web.url'); require('../modules/web.url.to-json'); require('../modules/web.url-search-params'); core-js-3.6.1/packages/core-js/proposals/using-statement.js000066400000000000000000000002241360057567700237300ustar00rootroot00000000000000// https://github.com/tc39/proposal-using-statement require('../modules/esnext.symbol.async-dispose'); require('../modules/esnext.symbol.dispose'); core-js-3.6.1/packages/core-js/stable/000077500000000000000000000000001360057567700174755ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/README.md000066400000000000000000000002221360057567700207500ustar00rootroot00000000000000This folder contains entry points for all stable `core-js` features with dependencies. It's the recommended way for usage only required features. core-js-3.6.1/packages/core-js/stable/array-buffer/000077500000000000000000000000001360057567700220625ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/array-buffer/constructor.js000066400000000000000000000001251360057567700250030ustar00rootroot00000000000000var parent = require('../../es/array-buffer/constructor'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array-buffer/index.js000066400000000000000000000001111360057567700235200ustar00rootroot00000000000000var parent = require('../../es/array-buffer'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array-buffer/is-view.js000066400000000000000000000001211360057567700237750ustar00rootroot00000000000000var parent = require('../../es/array-buffer/is-view'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array-buffer/slice.js000066400000000000000000000001171360057567700235160ustar00rootroot00000000000000var parent = require('../../es/array-buffer/slice'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/000077500000000000000000000000001360057567700206135ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/array/concat.js000066400000000000000000000001111360057567700224110ustar00rootroot00000000000000var parent = require('../../es/array/concat'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/copy-within.js000066400000000000000000000001161360057567700234210ustar00rootroot00000000000000var parent = require('../../es/array/copy-within'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/entries.js000066400000000000000000000001121360057567700226140ustar00rootroot00000000000000var parent = require('../../es/array/entries'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/every.js000066400000000000000000000001101360057567700222730ustar00rootroot00000000000000var parent = require('../../es/array/every'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/fill.js000066400000000000000000000001071360057567700220750ustar00rootroot00000000000000var parent = require('../../es/array/fill'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/filter.js000066400000000000000000000001111360057567700224270ustar00rootroot00000000000000var parent = require('../../es/array/filter'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/find-index.js000066400000000000000000000001151360057567700231730ustar00rootroot00000000000000var parent = require('../../es/array/find-index'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/find.js000066400000000000000000000001071360057567700220670ustar00rootroot00000000000000var parent = require('../../es/array/find'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/flat-map.js000066400000000000000000000001131360057567700226450ustar00rootroot00000000000000var parent = require('../../es/array/flat-map'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/flat.js000066400000000000000000000001071360057567700220750ustar00rootroot00000000000000var parent = require('../../es/array/flat'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/for-each.js000066400000000000000000000001131360057567700226300ustar00rootroot00000000000000var parent = require('../../es/array/for-each'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/from.js000066400000000000000000000001071360057567700221120ustar00rootroot00000000000000var parent = require('../../es/array/from'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/includes.js000066400000000000000000000001131360057567700227520ustar00rootroot00000000000000var parent = require('../../es/array/includes'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/index-of.js000066400000000000000000000001131360057567700226550ustar00rootroot00000000000000var parent = require('../../es/array/index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/index.js000066400000000000000000000001021360057567700222510ustar00rootroot00000000000000var parent = require('../../es/array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/is-array.js000066400000000000000000000001131360057567700226730ustar00rootroot00000000000000var parent = require('../../es/array/is-array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/iterator.js000066400000000000000000000001131360057567700227750ustar00rootroot00000000000000var parent = require('../../es/array/iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/join.js000066400000000000000000000001071360057567700221060ustar00rootroot00000000000000var parent = require('../../es/array/join'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/keys.js000066400000000000000000000001071360057567700221220ustar00rootroot00000000000000var parent = require('../../es/array/keys'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/last-index-of.js000066400000000000000000000001201360057567700236140ustar00rootroot00000000000000var parent = require('../../es/array/last-index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/map.js000066400000000000000000000001061360057567700217230ustar00rootroot00000000000000var parent = require('../../es/array/map'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/of.js000066400000000000000000000001051360057567700215510ustar00rootroot00000000000000var parent = require('../../es/array/of'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/reduce-right.js000066400000000000000000000001171360057567700235320ustar00rootroot00000000000000var parent = require('../../es/array/reduce-right'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/reduce.js000066400000000000000000000001111360057567700224110ustar00rootroot00000000000000var parent = require('../../es/array/reduce'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/reverse.js000066400000000000000000000001121360057567700226160ustar00rootroot00000000000000var parent = require('../../es/array/reverse'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/slice.js000066400000000000000000000001101360057567700222400ustar00rootroot00000000000000var parent = require('../../es/array/slice'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/some.js000066400000000000000000000001071360057567700221120ustar00rootroot00000000000000var parent = require('../../es/array/some'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/sort.js000066400000000000000000000001071360057567700221360ustar00rootroot00000000000000var parent = require('../../es/array/sort'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/splice.js000066400000000000000000000001111360057567700224210ustar00rootroot00000000000000var parent = require('../../es/array/splice'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/values.js000066400000000000000000000001111360057567700224410ustar00rootroot00000000000000var parent = require('../../es/array/values'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/000077500000000000000000000000001360057567700223015ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/array/virtual/concat.js000066400000000000000000000001241360057567700241030ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/concat'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/copy-within.js000066400000000000000000000001311360057567700251040ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/copy-within'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/entries.js000066400000000000000000000001251360057567700243060ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/entries'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/every.js000066400000000000000000000001231360057567700237650ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/every'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/fill.js000066400000000000000000000001221360057567700235600ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/fill'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/filter.js000066400000000000000000000001241360057567700241210ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/filter'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/find-index.js000066400000000000000000000001301360057567700246560ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/find-index'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/find.js000066400000000000000000000001221360057567700235520ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/find'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/flat-map.js000066400000000000000000000001261360057567700243370ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/flat-map'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/flat.js000066400000000000000000000001221360057567700235600ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/flat'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/for-each.js000066400000000000000000000001261360057567700243220ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/for-each'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/includes.js000066400000000000000000000001261360057567700244440ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/includes'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/index-of.js000066400000000000000000000001261360057567700243470ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/index.js000066400000000000000000000001151360057567700237430ustar00rootroot00000000000000var parent = require('../../../es/array/virtual'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/iterator.js000066400000000000000000000001261360057567700244670ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/join.js000066400000000000000000000001221360057567700235710ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/join'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/keys.js000066400000000000000000000001221360057567700236050ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/keys'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/last-index-of.js000066400000000000000000000001331360057567700253060ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/last-index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/map.js000066400000000000000000000001211360057567700234060ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/map'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/reduce-right.js000066400000000000000000000001321360057567700252150ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/reduce-right'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/reduce.js000066400000000000000000000001241360057567700241030ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/reduce'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/reverse.js000066400000000000000000000001251360057567700243100ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/reverse'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/slice.js000066400000000000000000000001231360057567700237320ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/slice'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/some.js000066400000000000000000000001221360057567700235750ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/some'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/sort.js000066400000000000000000000001221360057567700236210ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/sort'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/splice.js000066400000000000000000000001241360057567700241130ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/splice'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/array/virtual/values.js000066400000000000000000000001241360057567700241330ustar00rootroot00000000000000var parent = require('../../../es/array/virtual/values'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/clear-immediate.js000066400000000000000000000001651360057567700230570ustar00rootroot00000000000000require('../modules/web.immediate'); var path = require('../internals/path'); module.exports = path.clearImmediate; core-js-3.6.1/packages/core-js/stable/data-view/000077500000000000000000000000001360057567700213565ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/data-view/index.js000066400000000000000000000001061360057567700230200ustar00rootroot00000000000000var parent = require('../../es/data-view'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/date/000077500000000000000000000000001360057567700204125ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/date/index.js000066400000000000000000000001011360057567700220470ustar00rootroot00000000000000var parent = require('../../es/date'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/date/now.js000066400000000000000000000001051360057567700215470ustar00rootroot00000000000000var parent = require('../../es/date/now'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/date/to-iso-string.js000066400000000000000000000001171360057567700234650ustar00rootroot00000000000000var parent = require('../../es/date/to-iso-string'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/date/to-json.js000066400000000000000000000001111360057567700223320ustar00rootroot00000000000000var parent = require('../../es/date/to-json'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/date/to-primitive.js000066400000000000000000000001161360057567700233760ustar00rootroot00000000000000var parent = require('../../es/date/to-primitive'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/date/to-string.js000066400000000000000000000001131360057567700226710ustar00rootroot00000000000000var parent = require('../../es/date/to-string'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/dom-collections/000077500000000000000000000000001360057567700225705ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/dom-collections/for-each.js000066400000000000000000000002121360057567700246050ustar00rootroot00000000000000require('../../modules/web.dom-collections.for-each'); var parent = require('../../internals/array-for-each'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/dom-collections/index.js000066400000000000000000000006261360057567700242410ustar00rootroot00000000000000require('../../modules/web.dom-collections.for-each'); require('../../modules/web.dom-collections.iterator'); var ArrayIterators = require('../../modules/es.array.iterator'); var forEach = require('../../internals/array-for-each'); module.exports = { keys: ArrayIterators.keys, values: ArrayIterators.values, entries: ArrayIterators.entries, iterator: ArrayIterators.values, forEach: forEach }; core-js-3.6.1/packages/core-js/stable/dom-collections/iterator.js000066400000000000000000000002441360057567700247570ustar00rootroot00000000000000require('../../modules/web.dom-collections.iterator'); var entryUnbind = require('../../internals/entry-unbind'); module.exports = entryUnbind('Array', 'values'); core-js-3.6.1/packages/core-js/stable/function/000077500000000000000000000000001360057567700213225ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/function/bind.js000066400000000000000000000001121360057567700225660ustar00rootroot00000000000000var parent = require('../../es/function/bind'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/function/has-instance.js000066400000000000000000000001221360057567700242300ustar00rootroot00000000000000var parent = require('../../es/function/has-instance'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/function/index.js000066400000000000000000000001051360057567700227630ustar00rootroot00000000000000var parent = require('../../es/function'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/function/name.js000066400000000000000000000001121360057567700225720ustar00rootroot00000000000000var parent = require('../../es/function/name'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/function/virtual/000077500000000000000000000000001360057567700230105ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/function/virtual/bind.js000066400000000000000000000001251360057567700242600ustar00rootroot00000000000000var parent = require('../../../es/function/virtual/bind'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/function/virtual/index.js000066400000000000000000000001201360057567700244460ustar00rootroot00000000000000var parent = require('../../../es/function/virtual'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/global-this.js000066400000000000000000000001051360057567700222340ustar00rootroot00000000000000var parent = require('../es/global-this'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/index.js000066400000000000000000000001461360057567700211430ustar00rootroot00000000000000require('../es'); require('../web'); var path = require('../internals/path'); module.exports = path; core-js-3.6.1/packages/core-js/stable/instance/000077500000000000000000000000001360057567700213015ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/instance/bind.js000066400000000000000000000001121360057567700225450ustar00rootroot00000000000000var parent = require('../../es/instance/bind'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/code-point-at.js000066400000000000000000000001231360057567700242760ustar00rootroot00000000000000var parent = require('../../es/instance/code-point-at'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/concat.js000066400000000000000000000001141360057567700231020ustar00rootroot00000000000000var parent = require('../../es/instance/concat'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/copy-within.js000066400000000000000000000001211360057567700241030ustar00rootroot00000000000000var parent = require('../../es/instance/copy-within'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/ends-with.js000066400000000000000000000001171360057567700235400ustar00rootroot00000000000000var parent = require('../../es/instance/ends-with'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/entries.js000066400000000000000000000010201360057567700233010ustar00rootroot00000000000000require('../../modules/web.dom-collections.iterator'); var entries = require('../array/virtual/entries'); var classof = require('../../internals/classof'); var ArrayPrototype = Array.prototype; var DOMIterables = { DOMTokenList: true, NodeList: true }; module.exports = function (it) { var own = it.entries; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.entries) // eslint-disable-next-line no-prototype-builtins || DOMIterables.hasOwnProperty(classof(it)) ? entries : own; }; core-js-3.6.1/packages/core-js/stable/instance/every.js000066400000000000000000000001131360057567700227640ustar00rootroot00000000000000var parent = require('../../es/instance/every'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/fill.js000066400000000000000000000001121360057567700225570ustar00rootroot00000000000000var parent = require('../../es/instance/fill'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/filter.js000066400000000000000000000001141360057567700231200ustar00rootroot00000000000000var parent = require('../../es/instance/filter'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/find-index.js000066400000000000000000000001201360057567700236550ustar00rootroot00000000000000var parent = require('../../es/instance/find-index'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/find.js000066400000000000000000000001121360057567700225510ustar00rootroot00000000000000var parent = require('../../es/instance/find'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/flags.js000066400000000000000000000001131360057567700227260ustar00rootroot00000000000000var parent = require('../../es/instance/flags'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/flat-map.js000066400000000000000000000001161360057567700233360ustar00rootroot00000000000000var parent = require('../../es/instance/flat-map'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/flat.js000066400000000000000000000001121360057567700225570ustar00rootroot00000000000000var parent = require('../../es/instance/flat'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/for-each.js000066400000000000000000000010211360057567700233150ustar00rootroot00000000000000require('../../modules/web.dom-collections.iterator'); var forEach = require('../array/virtual/for-each'); var classof = require('../../internals/classof'); var ArrayPrototype = Array.prototype; var DOMIterables = { DOMTokenList: true, NodeList: true }; module.exports = function (it) { var own = it.forEach; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.forEach) // eslint-disable-next-line no-prototype-builtins || DOMIterables.hasOwnProperty(classof(it)) ? forEach : own; }; core-js-3.6.1/packages/core-js/stable/instance/includes.js000066400000000000000000000001161360057567700234430ustar00rootroot00000000000000var parent = require('../../es/instance/includes'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/index-of.js000066400000000000000000000001161360057567700233460ustar00rootroot00000000000000var parent = require('../../es/instance/index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/keys.js000066400000000000000000000010011360057567700226020ustar00rootroot00000000000000require('../../modules/web.dom-collections.iterator'); var keys = require('../array/virtual/keys'); var classof = require('../../internals/classof'); var ArrayPrototype = Array.prototype; var DOMIterables = { DOMTokenList: true, NodeList: true }; module.exports = function (it) { var own = it.keys; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.keys) // eslint-disable-next-line no-prototype-builtins || DOMIterables.hasOwnProperty(classof(it)) ? keys : own; }; core-js-3.6.1/packages/core-js/stable/instance/last-index-of.js000066400000000000000000000001231360057567700243050ustar00rootroot00000000000000var parent = require('../../es/instance/last-index-of'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/map.js000066400000000000000000000001111360057567700224050ustar00rootroot00000000000000var parent = require('../../es/instance/map'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/match-all.js000066400000000000000000000001171360057567700235000ustar00rootroot00000000000000var parent = require('../../es/instance/match-all'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/pad-end.js000066400000000000000000000001151360057567700231440ustar00rootroot00000000000000var parent = require('../../es/instance/pad-end'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/pad-start.js000066400000000000000000000001171360057567700235350ustar00rootroot00000000000000var parent = require('../../es/instance/pad-start'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/reduce-right.js000066400000000000000000000001221360057567700242140ustar00rootroot00000000000000var parent = require('../../es/instance/reduce-right'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/reduce.js000066400000000000000000000001141360057567700231020ustar00rootroot00000000000000var parent = require('../../es/instance/reduce'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/repeat.js000066400000000000000000000001141360057567700231130ustar00rootroot00000000000000var parent = require('../../es/instance/repeat'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/reverse.js000066400000000000000000000001151360057567700233070ustar00rootroot00000000000000var parent = require('../../es/instance/reverse'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/slice.js000066400000000000000000000001131360057567700227310ustar00rootroot00000000000000var parent = require('../../es/instance/slice'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/some.js000066400000000000000000000001121360057567700225740ustar00rootroot00000000000000var parent = require('../../es/instance/some'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/sort.js000066400000000000000000000001121360057567700226200ustar00rootroot00000000000000var parent = require('../../es/instance/sort'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/splice.js000066400000000000000000000001141360057567700231120ustar00rootroot00000000000000var parent = require('../../es/instance/splice'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/starts-with.js000066400000000000000000000001211360057567700241220ustar00rootroot00000000000000var parent = require('../../es/instance/starts-with'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/trim-end.js000066400000000000000000000001161360057567700233540ustar00rootroot00000000000000var parent = require('../../es/instance/trim-end'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/trim-left.js000066400000000000000000000001171360057567700235410ustar00rootroot00000000000000var parent = require('../../es/instance/trim-left'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/trim-right.js000066400000000000000000000001201360057567700237160ustar00rootroot00000000000000var parent = require('../../es/instance/trim-right'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/trim-start.js000066400000000000000000000001201360057567700237360ustar00rootroot00000000000000var parent = require('../../es/instance/trim-start'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/trim.js000066400000000000000000000001121360057567700226040ustar00rootroot00000000000000var parent = require('../../es/instance/trim'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/instance/values.js000066400000000000000000000010131360057567700231310ustar00rootroot00000000000000require('../../modules/web.dom-collections.iterator'); var values = require('../array/virtual/values'); var classof = require('../../internals/classof'); var ArrayPrototype = Array.prototype; var DOMIterables = { DOMTokenList: true, NodeList: true }; module.exports = function (it) { var own = it.values; return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.values) // eslint-disable-next-line no-prototype-builtins || DOMIterables.hasOwnProperty(classof(it)) ? values : own; }; core-js-3.6.1/packages/core-js/stable/json/000077500000000000000000000000001360057567700204465ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/json/index.js000066400000000000000000000001011360057567700221030ustar00rootroot00000000000000var parent = require('../../es/json'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/json/stringify.js000066400000000000000000000001131360057567700230150ustar00rootroot00000000000000var parent = require('../../es/json/stringify'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/json/to-string-tag.js000066400000000000000000000001171360057567700235020ustar00rootroot00000000000000var parent = require('../../es/json/to-string-tag'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/map/000077500000000000000000000000001360057567700202525ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/map/index.js000066400000000000000000000001001360057567700217060ustar00rootroot00000000000000var parent = require('../../es/map'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/000077500000000000000000000000001360057567700204265ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/math/acosh.js000066400000000000000000000001071360057567700220570ustar00rootroot00000000000000var parent = require('../../es/math/acosh'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/asinh.js000066400000000000000000000001071360057567700220640ustar00rootroot00000000000000var parent = require('../../es/math/asinh'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/atanh.js000066400000000000000000000001071360057567700220550ustar00rootroot00000000000000var parent = require('../../es/math/atanh'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/cbrt.js000066400000000000000000000001061360057567700217130ustar00rootroot00000000000000var parent = require('../../es/math/cbrt'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/clz32.js000066400000000000000000000001071360057567700217170ustar00rootroot00000000000000var parent = require('../../es/math/clz32'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/cosh.js000066400000000000000000000001061360057567700217150ustar00rootroot00000000000000var parent = require('../../es/math/cosh'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/expm1.js000066400000000000000000000001071360057567700220140ustar00rootroot00000000000000var parent = require('../../es/math/expm1'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/fround.js000066400000000000000000000001101360057567700222510ustar00rootroot00000000000000var parent = require('../../es/math/fround'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/hypot.js000066400000000000000000000001071360057567700221250ustar00rootroot00000000000000var parent = require('../../es/math/hypot'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/imul.js000066400000000000000000000001061360057567700217270ustar00rootroot00000000000000var parent = require('../../es/math/imul'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/index.js000066400000000000000000000001011360057567700220630ustar00rootroot00000000000000var parent = require('../../es/math'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/log10.js000066400000000000000000000001071360057567700217040ustar00rootroot00000000000000var parent = require('../../es/math/log10'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/log1p.js000066400000000000000000000001071360057567700220040ustar00rootroot00000000000000var parent = require('../../es/math/log1p'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/log2.js000066400000000000000000000001061360057567700216240ustar00rootroot00000000000000var parent = require('../../es/math/log2'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/sign.js000066400000000000000000000001061360057567700217210ustar00rootroot00000000000000var parent = require('../../es/math/sign'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/sinh.js000066400000000000000000000001061360057567700217220ustar00rootroot00000000000000var parent = require('../../es/math/sinh'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/tanh.js000066400000000000000000000001061360057567700217130ustar00rootroot00000000000000var parent = require('../../es/math/tanh'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/to-string-tag.js000066400000000000000000000001171360057567700234620ustar00rootroot00000000000000var parent = require('../../es/math/to-string-tag'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/math/trunc.js000066400000000000000000000001071360057567700221150ustar00rootroot00000000000000var parent = require('../../es/math/trunc'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/000077500000000000000000000000001360057567700207655ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/number/constructor.js000066400000000000000000000001171360057567700237070ustar00rootroot00000000000000var parent = require('../../es/number/constructor'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/epsilon.js000066400000000000000000000001131360057567700227670ustar00rootroot00000000000000var parent = require('../../es/number/epsilon'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/index.js000066400000000000000000000001031360057567700224240ustar00rootroot00000000000000var parent = require('../../es/number'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/is-finite.js000066400000000000000000000001151360057567700232070ustar00rootroot00000000000000var parent = require('../../es/number/is-finite'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/is-integer.js000066400000000000000000000001161360057567700233670ustar00rootroot00000000000000var parent = require('../../es/number/is-integer'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/is-nan.js000066400000000000000000000001121360057567700225020ustar00rootroot00000000000000var parent = require('../../es/number/is-nan'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/is-safe-integer.js000066400000000000000000000001231360057567700243010ustar00rootroot00000000000000var parent = require('../../es/number/is-safe-integer'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/max-safe-integer.js000066400000000000000000000001241360057567700244540ustar00rootroot00000000000000var parent = require('../../es/number/max-safe-integer'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/min-safe-integer.js000066400000000000000000000001241360057567700244520ustar00rootroot00000000000000var parent = require('../../es/number/min-safe-integer'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/parse-float.js000066400000000000000000000001171360057567700235370ustar00rootroot00000000000000var parent = require('../../es/number/parse-float'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/parse-int.js000066400000000000000000000001151360057567700232220ustar00rootroot00000000000000var parent = require('../../es/number/parse-int'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/to-fixed.js000066400000000000000000000001141360057567700230360ustar00rootroot00000000000000var parent = require('../../es/number/to-fixed'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/to-precision.js000066400000000000000000000001201360057567700237270ustar00rootroot00000000000000var parent = require('../../es/number/to-precision'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/virtual/000077500000000000000000000000001360057567700224535ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/number/virtual/index.js000066400000000000000000000001161360057567700241160ustar00rootroot00000000000000var parent = require('../../../es/number/virtual'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/virtual/to-fixed.js000066400000000000000000000001271360057567700245300ustar00rootroot00000000000000var parent = require('../../../es/number/virtual/to-fixed'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/number/virtual/to-precision.js000066400000000000000000000001331360057567700254210ustar00rootroot00000000000000var parent = require('../../../es/number/virtual/to-precision'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/000077500000000000000000000000001360057567700207435ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/object/assign.js000066400000000000000000000001121360057567700225570ustar00rootroot00000000000000var parent = require('../../es/object/assign'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/create.js000066400000000000000000000001121360057567700225360ustar00rootroot00000000000000var parent = require('../../es/object/create'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/define-getter.js000066400000000000000000000001211360057567700240150ustar00rootroot00000000000000var parent = require('../../es/object/define-getter'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/define-properties.js000066400000000000000000000001251360057567700247230ustar00rootroot00000000000000var parent = require('../../es/object/define-properties'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/define-property.js000066400000000000000000000001231360057567700244110ustar00rootroot00000000000000var parent = require('../../es/object/define-property'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/define-setter.js000066400000000000000000000001211360057567700240310ustar00rootroot00000000000000var parent = require('../../es/object/define-setter'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/entries.js000066400000000000000000000001131360057567700227450ustar00rootroot00000000000000var parent = require('../../es/object/entries'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/freeze.js000066400000000000000000000001121360057567700225530ustar00rootroot00000000000000var parent = require('../../es/object/freeze'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/from-entries.js000066400000000000000000000001201360057567700237040ustar00rootroot00000000000000var parent = require('../../es/object/from-entries'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/get-own-property-descriptor.js000066400000000000000000000001371360057567700267200ustar00rootroot00000000000000var parent = require('../../es/object/get-own-property-descriptor'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/get-own-property-descriptors.js000066400000000000000000000001401360057567700270750ustar00rootroot00000000000000var parent = require('../../es/object/get-own-property-descriptors'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/get-own-property-names.js000066400000000000000000000001321360057567700256400ustar00rootroot00000000000000var parent = require('../../es/object/get-own-property-names'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/get-own-property-symbols.js000066400000000000000000000001341360057567700262270ustar00rootroot00000000000000var parent = require('../../es/object/get-own-property-symbols'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/get-prototype-of.js000066400000000000000000000001241360057567700245220ustar00rootroot00000000000000var parent = require('../../es/object/get-prototype-of'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/index.js000066400000000000000000000001031360057567700224020ustar00rootroot00000000000000var parent = require('../../es/object'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/is-extensible.js000066400000000000000000000001211360057567700240460ustar00rootroot00000000000000var parent = require('../../es/object/is-extensible'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/is-frozen.js000066400000000000000000000001151360057567700232120ustar00rootroot00000000000000var parent = require('../../es/object/is-frozen'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/is-sealed.js000066400000000000000000000001151360057567700231440ustar00rootroot00000000000000var parent = require('../../es/object/is-sealed'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/is.js000066400000000000000000000001061360057567700217110ustar00rootroot00000000000000var parent = require('../../es/object/is'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/keys.js000066400000000000000000000001101360057567700222440ustar00rootroot00000000000000var parent = require('../../es/object/keys'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/lookup-getter.js000066400000000000000000000001211360057567700240740ustar00rootroot00000000000000var parent = require('../../es/object/lookup-getter'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/lookup-setter.js000066400000000000000000000001211360057567700241100ustar00rootroot00000000000000var parent = require('../../es/object/lookup-setter'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/prevent-extensions.js000066400000000000000000000001261360057567700251600ustar00rootroot00000000000000var parent = require('../../es/object/prevent-extensions'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/seal.js000066400000000000000000000001101360057567700222150ustar00rootroot00000000000000var parent = require('../../es/object/seal'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/set-prototype-of.js000066400000000000000000000001241360057567700245360ustar00rootroot00000000000000var parent = require('../../es/object/set-prototype-of'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/to-string.js000066400000000000000000000001151360057567700232240ustar00rootroot00000000000000var parent = require('../../es/object/to-string'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/object/values.js000066400000000000000000000001121360057567700225720ustar00rootroot00000000000000var parent = require('../../es/object/values'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/parse-float.js000066400000000000000000000001051360057567700222440ustar00rootroot00000000000000var parent = require('../es/parse-float'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/parse-int.js000066400000000000000000000001031360057567700217270ustar00rootroot00000000000000var parent = require('../es/parse-int'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/promise/000077500000000000000000000000001360057567700211535ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/promise/all-settled.js000066400000000000000000000001201360057567700237140ustar00rootroot00000000000000var parent = require('../../es/promise/all-settled'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/promise/finally.js000066400000000000000000000001141360057567700231430ustar00rootroot00000000000000var parent = require('../../es/promise/finally'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/promise/index.js000066400000000000000000000001041360057567700226130ustar00rootroot00000000000000var parent = require('../../es/promise'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/queue-microtask.js000066400000000000000000000001121360057567700231430ustar00rootroot00000000000000var parent = require('../web/queue-microtask'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/000077500000000000000000000000001360057567700211215ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/reflect/apply.js000066400000000000000000000001121360057567700225760ustar00rootroot00000000000000var parent = require('../../es/reflect/apply'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/construct.js000066400000000000000000000001161360057567700235010ustar00rootroot00000000000000var parent = require('../../es/reflect/construct'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/define-property.js000066400000000000000000000001241360057567700245700ustar00rootroot00000000000000var parent = require('../../es/reflect/define-property'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/delete-property.js000066400000000000000000000001241360057567700246000ustar00rootroot00000000000000var parent = require('../../es/reflect/delete-property'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/get-own-property-descriptor.js000066400000000000000000000001401360057567700270700ustar00rootroot00000000000000var parent = require('../../es/reflect/get-own-property-descriptor'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/get-prototype-of.js000066400000000000000000000001251360057567700247010ustar00rootroot00000000000000var parent = require('../../es/reflect/get-prototype-of'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/get.js000066400000000000000000000001101360057567700222260ustar00rootroot00000000000000var parent = require('../../es/reflect/get'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/has.js000066400000000000000000000001101360057567700222220ustar00rootroot00000000000000var parent = require('../../es/reflect/has'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/index.js000066400000000000000000000001041360057567700225610ustar00rootroot00000000000000var parent = require('../../es/reflect'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/is-extensible.js000066400000000000000000000001221360057567700242250ustar00rootroot00000000000000var parent = require('../../es/reflect/is-extensible'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/own-keys.js000066400000000000000000000001151360057567700232300ustar00rootroot00000000000000var parent = require('../../es/reflect/own-keys'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/prevent-extensions.js000066400000000000000000000001271360057567700253370ustar00rootroot00000000000000var parent = require('../../es/reflect/prevent-extensions'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/set-prototype-of.js000066400000000000000000000001251360057567700247150ustar00rootroot00000000000000var parent = require('../../es/reflect/set-prototype-of'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/reflect/set.js000066400000000000000000000001101360057567700222420ustar00rootroot00000000000000var parent = require('../../es/reflect/set'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/regexp/000077500000000000000000000000001360057567700207675ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/regexp/constructor.js000066400000000000000000000001171360057567700237110ustar00rootroot00000000000000var parent = require('../../es/regexp/constructor'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/regexp/flags.js000066400000000000000000000001111360057567700224120ustar00rootroot00000000000000var parent = require('../../es/regexp/flags'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/regexp/index.js000066400000000000000000000001031360057567700224260ustar00rootroot00000000000000var parent = require('../../es/regexp'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/regexp/match.js000066400000000000000000000001111360057567700224120ustar00rootroot00000000000000var parent = require('../../es/regexp/match'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/regexp/replace.js000066400000000000000000000001131360057567700227330ustar00rootroot00000000000000var parent = require('../../es/regexp/replace'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/regexp/search.js000066400000000000000000000001121360057567700225640ustar00rootroot00000000000000var parent = require('../../es/regexp/search'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/regexp/split.js000066400000000000000000000001111360057567700224510ustar00rootroot00000000000000var parent = require('../../es/regexp/split'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/regexp/sticky.js000066400000000000000000000001121360057567700226250ustar00rootroot00000000000000var parent = require('../../es/regexp/sticky'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/regexp/test.js000066400000000000000000000001101360057567700222740ustar00rootroot00000000000000var parent = require('../../es/regexp/test'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/regexp/to-string.js000066400000000000000000000001151360057567700232500ustar00rootroot00000000000000var parent = require('../../es/regexp/to-string'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/set-immediate.js000066400000000000000000000001631360057567700225620ustar00rootroot00000000000000require('../modules/web.immediate'); var path = require('../internals/path'); module.exports = path.setImmediate; core-js-3.6.1/packages/core-js/stable/set-interval.js000066400000000000000000000001571360057567700224530ustar00rootroot00000000000000require('../modules/web.timers'); var path = require('../internals/path'); module.exports = path.setInterval; core-js-3.6.1/packages/core-js/stable/set-timeout.js000066400000000000000000000001561360057567700223140ustar00rootroot00000000000000require('../modules/web.timers'); var path = require('../internals/path'); module.exports = path.setTimeout; core-js-3.6.1/packages/core-js/stable/set/000077500000000000000000000000001360057567700202705ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/set/index.js000066400000000000000000000001001360057567700217240ustar00rootroot00000000000000var parent = require('../../es/set'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/000077500000000000000000000000001360057567700210035ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/string/anchor.js000066400000000000000000000001121360057567700226050ustar00rootroot00000000000000var parent = require('../../es/string/anchor'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/big.js000066400000000000000000000001071360057567700221000ustar00rootroot00000000000000var parent = require('../../es/string/big'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/blink.js000066400000000000000000000001111360057567700224310ustar00rootroot00000000000000var parent = require('../../es/string/blink'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/bold.js000066400000000000000000000001101360057567700222510ustar00rootroot00000000000000var parent = require('../../es/string/bold'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/code-point-at.js000066400000000000000000000001211360057567700237760ustar00rootroot00000000000000var parent = require('../../es/string/code-point-at'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/ends-with.js000066400000000000000000000001151360057567700232400ustar00rootroot00000000000000var parent = require('../../es/string/ends-with'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/fixed.js000066400000000000000000000001111360057567700224310ustar00rootroot00000000000000var parent = require('../../es/string/fixed'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/fontcolor.js000066400000000000000000000001151360057567700233430ustar00rootroot00000000000000var parent = require('../../es/string/fontcolor'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/fontsize.js000066400000000000000000000001141360057567700231760ustar00rootroot00000000000000var parent = require('../../es/string/fontsize'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/from-code-point.js000066400000000000000000000001231360057567700243370ustar00rootroot00000000000000var parent = require('../../es/string/from-code-point'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/includes.js000066400000000000000000000001141360057567700231430ustar00rootroot00000000000000var parent = require('../../es/string/includes'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/index.js000066400000000000000000000001031360057567700224420ustar00rootroot00000000000000var parent = require('../../es/string'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/italics.js000066400000000000000000000001131360057567700227640ustar00rootroot00000000000000var parent = require('../../es/string/italics'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/iterator.js000066400000000000000000000001141360057567700231660ustar00rootroot00000000000000var parent = require('../../es/string/iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/link.js000066400000000000000000000001101360057567700222660ustar00rootroot00000000000000var parent = require('../../es/string/link'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/match-all.js000066400000000000000000000001151360057567700232000ustar00rootroot00000000000000var parent = require('../../es/string/match-all'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/match.js000066400000000000000000000001111360057567700224260ustar00rootroot00000000000000var parent = require('../../es/string/match'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/pad-end.js000066400000000000000000000001131360057567700226440ustar00rootroot00000000000000var parent = require('../../es/string/pad-end'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/pad-start.js000066400000000000000000000001151360057567700232350ustar00rootroot00000000000000var parent = require('../../es/string/pad-start'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/raw.js000066400000000000000000000001071360057567700221300ustar00rootroot00000000000000var parent = require('../../es/string/raw'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/repeat.js000066400000000000000000000001121360057567700226130ustar00rootroot00000000000000var parent = require('../../es/string/repeat'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/replace.js000066400000000000000000000001131360057567700227470ustar00rootroot00000000000000var parent = require('../../es/string/replace'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/search.js000066400000000000000000000001121360057567700226000ustar00rootroot00000000000000var parent = require('../../es/string/search'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/small.js000066400000000000000000000001111360057567700224420ustar00rootroot00000000000000var parent = require('../../es/string/small'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/split.js000066400000000000000000000001111360057567700224650ustar00rootroot00000000000000var parent = require('../../es/string/split'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/starts-with.js000066400000000000000000000001171360057567700236310ustar00rootroot00000000000000var parent = require('../../es/string/starts-with'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/strike.js000066400000000000000000000001121360057567700226340ustar00rootroot00000000000000var parent = require('../../es/string/strike'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/sub.js000066400000000000000000000001071360057567700221300ustar00rootroot00000000000000var parent = require('../../es/string/sub'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/sup.js000066400000000000000000000001071360057567700221460ustar00rootroot00000000000000var parent = require('../../es/string/sup'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/trim-end.js000066400000000000000000000001141360057567700230540ustar00rootroot00000000000000var parent = require('../../es/string/trim-end'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/trim-left.js000066400000000000000000000001151360057567700232410ustar00rootroot00000000000000var parent = require('../../es/string/trim-left'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/trim-right.js000066400000000000000000000001161360057567700234250ustar00rootroot00000000000000var parent = require('../../es/string/trim-right'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/trim-start.js000066400000000000000000000001161360057567700234450ustar00rootroot00000000000000var parent = require('../../es/string/trim-start'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/trim.js000066400000000000000000000001101360057567700223040ustar00rootroot00000000000000var parent = require('../../es/string/trim'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/000077500000000000000000000000001360057567700224715ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/string/virtual/anchor.js000066400000000000000000000001251360057567700242770ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/anchor'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/big.js000066400000000000000000000001221360057567700235630ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/big'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/blink.js000066400000000000000000000001241360057567700241230ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/blink'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/bold.js000066400000000000000000000001231360057567700237430ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/bold'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/code-point-at.js000066400000000000000000000001341360057567700254700ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/code-point-at'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/ends-with.js000066400000000000000000000001301360057567700247230ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/ends-with'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/fixed.js000066400000000000000000000001241360057567700241230ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/fixed'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/fontcolor.js000066400000000000000000000001301360057567700250260ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/fontcolor'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/fontsize.js000066400000000000000000000001271360057567700246700ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/fontsize'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/includes.js000066400000000000000000000001271360057567700246350ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/includes'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/index.js000066400000000000000000000001161360057567700241340ustar00rootroot00000000000000var parent = require('../../../es/string/virtual'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/italics.js000066400000000000000000000001261360057567700244560ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/italics'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/iterator.js000066400000000000000000000001271360057567700246600ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/link.js000066400000000000000000000001231360057567700237600ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/link'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/match-all.js000066400000000000000000000001301360057567700246630ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/match-all'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/pad-end.js000066400000000000000000000001261360057567700243360ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/pad-end'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/pad-start.js000066400000000000000000000001301360057567700247200ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/pad-start'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/repeat.js000066400000000000000000000001251360057567700243050ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/repeat'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/small.js000066400000000000000000000001241360057567700241340ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/small'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/starts-with.js000066400000000000000000000001321360057567700253140ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/starts-with'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/strike.js000066400000000000000000000001251360057567700243260ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/strike'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/sub.js000066400000000000000000000001221360057567700236130ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/sub'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/sup.js000066400000000000000000000001221360057567700236310ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/sup'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/trim-end.js000066400000000000000000000001271360057567700245460ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/trim-end'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/trim-left.js000066400000000000000000000001301360057567700247240ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/trim-left'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/trim-right.js000066400000000000000000000001311360057567700251100ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/trim-right'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/trim-start.js000066400000000000000000000001311360057567700251300ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/trim-start'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/string/virtual/trim.js000066400000000000000000000001231360057567700237760ustar00rootroot00000000000000var parent = require('../../../es/string/virtual/trim'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/000077500000000000000000000000001360057567700210025ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/symbol/async-iterator.js000066400000000000000000000001221360057567700242770ustar00rootroot00000000000000var parent = require('../../es/symbol/async-iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/description.js000066400000000000000000000000601360057567700236570ustar00rootroot00000000000000require('../../modules/es.symbol.description'); core-js-3.6.1/packages/core-js/stable/symbol/for.js000066400000000000000000000001071360057567700221240ustar00rootroot00000000000000var parent = require('../../es/symbol/for'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/has-instance.js000066400000000000000000000001201360057567700237060ustar00rootroot00000000000000var parent = require('../../es/symbol/has-instance'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/index.js000066400000000000000000000001031360057567700224410ustar00rootroot00000000000000var parent = require('../../es/symbol'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/is-concat-spreadable.js000066400000000000000000000001301360057567700253120ustar00rootroot00000000000000var parent = require('../../es/symbol/is-concat-spreadable'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/iterator.js000066400000000000000000000001141360057567700231650ustar00rootroot00000000000000var parent = require('../../es/symbol/iterator'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/key-for.js000066400000000000000000000001131360057567700227070ustar00rootroot00000000000000var parent = require('../../es/symbol/key-for'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/match-all.js000066400000000000000000000001151360057567700231770ustar00rootroot00000000000000var parent = require('../../es/symbol/match-all'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/match.js000066400000000000000000000001111360057567700224250ustar00rootroot00000000000000var parent = require('../../es/symbol/match'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/replace.js000066400000000000000000000001131360057567700227460ustar00rootroot00000000000000var parent = require('../../es/symbol/replace'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/search.js000066400000000000000000000001121360057567700225770ustar00rootroot00000000000000var parent = require('../../es/symbol/search'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/species.js000066400000000000000000000001131360057567700227660ustar00rootroot00000000000000var parent = require('../../es/symbol/species'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/split.js000066400000000000000000000001111360057567700224640ustar00rootroot00000000000000var parent = require('../../es/symbol/split'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/to-primitive.js000066400000000000000000000001201360057567700237610ustar00rootroot00000000000000var parent = require('../../es/symbol/to-primitive'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/to-string-tag.js000066400000000000000000000001211360057567700240310ustar00rootroot00000000000000var parent = require('../../es/symbol/to-string-tag'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/symbol/unscopables.js000066400000000000000000000001171360057567700236550ustar00rootroot00000000000000var parent = require('../../es/symbol/unscopables'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/typed-array/000077500000000000000000000000001360057567700217365ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/typed-array/copy-within.js000066400000000000000000000000651360057567700245470ustar00rootroot00000000000000require('../../modules/es.typed-array.copy-within'); core-js-3.6.1/packages/core-js/stable/typed-array/entries.js000066400000000000000000000000621360057567700237430ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/stable/typed-array/every.js000066400000000000000000000000571360057567700234300ustar00rootroot00000000000000require('../../modules/es.typed-array.every'); core-js-3.6.1/packages/core-js/stable/typed-array/fill.js000066400000000000000000000000561360057567700232230ustar00rootroot00000000000000require('../../modules/es.typed-array.fill'); core-js-3.6.1/packages/core-js/stable/typed-array/filter.js000066400000000000000000000000601360057567700235550ustar00rootroot00000000000000require('../../modules/es.typed-array.filter'); core-js-3.6.1/packages/core-js/stable/typed-array/find-index.js000066400000000000000000000000641360057567700243210ustar00rootroot00000000000000require('../../modules/es.typed-array.find-index'); core-js-3.6.1/packages/core-js/stable/typed-array/find.js000066400000000000000000000000561360057567700232150ustar00rootroot00000000000000require('../../modules/es.typed-array.find'); core-js-3.6.1/packages/core-js/stable/typed-array/float32-array.js000066400000000000000000000001261360057567700246610ustar00rootroot00000000000000var parent = require('../../es/typed-array/float32-array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/typed-array/float64-array.js000066400000000000000000000001261360057567700246660ustar00rootroot00000000000000var parent = require('../../es/typed-array/float64-array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/typed-array/for-each.js000066400000000000000000000000621360057567700237560ustar00rootroot00000000000000require('../../modules/es.typed-array.for-each'); core-js-3.6.1/packages/core-js/stable/typed-array/from.js000066400000000000000000000000561360057567700232400ustar00rootroot00000000000000require('../../modules/es.typed-array.from'); core-js-3.6.1/packages/core-js/stable/typed-array/includes.js000066400000000000000000000000621360057567700241000ustar00rootroot00000000000000require('../../modules/es.typed-array.includes'); core-js-3.6.1/packages/core-js/stable/typed-array/index-of.js000066400000000000000000000000621360057567700240030ustar00rootroot00000000000000require('../../modules/es.typed-array.index-of'); core-js-3.6.1/packages/core-js/stable/typed-array/index.js000066400000000000000000000001101360057567700233730ustar00rootroot00000000000000var parent = require('../../es/typed-array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/typed-array/int16-array.js000066400000000000000000000001241360057567700243460ustar00rootroot00000000000000var parent = require('../../es/typed-array/int16-array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/typed-array/int32-array.js000066400000000000000000000001241360057567700243440ustar00rootroot00000000000000var parent = require('../../es/typed-array/int32-array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/typed-array/int8-array.js000066400000000000000000000001231360057567700242660ustar00rootroot00000000000000var parent = require('../../es/typed-array/int8-array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/typed-array/iterator.js000066400000000000000000000000621360057567700241230ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/stable/typed-array/join.js000066400000000000000000000000561360057567700232340ustar00rootroot00000000000000require('../../modules/es.typed-array.join'); core-js-3.6.1/packages/core-js/stable/typed-array/keys.js000066400000000000000000000000621360057567700232450ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/stable/typed-array/last-index-of.js000066400000000000000000000000671360057567700247510ustar00rootroot00000000000000require('../../modules/es.typed-array.last-index-of'); core-js-3.6.1/packages/core-js/stable/typed-array/map.js000066400000000000000000000000551360057567700230510ustar00rootroot00000000000000require('../../modules/es.typed-array.map'); core-js-3.6.1/packages/core-js/stable/typed-array/of.js000066400000000000000000000000541360057567700226770ustar00rootroot00000000000000require('../../modules/es.typed-array.of'); core-js-3.6.1/packages/core-js/stable/typed-array/reduce-right.js000066400000000000000000000000661360057567700246600ustar00rootroot00000000000000require('../../modules/es.typed-array.reduce-right'); core-js-3.6.1/packages/core-js/stable/typed-array/reduce.js000066400000000000000000000000601360057567700235370ustar00rootroot00000000000000require('../../modules/es.typed-array.reduce'); core-js-3.6.1/packages/core-js/stable/typed-array/reverse.js000066400000000000000000000000611360057567700237440ustar00rootroot00000000000000require('../../modules/es.typed-array.reverse'); core-js-3.6.1/packages/core-js/stable/typed-array/set.js000066400000000000000000000000551360057567700230670ustar00rootroot00000000000000require('../../modules/es.typed-array.set'); core-js-3.6.1/packages/core-js/stable/typed-array/slice.js000066400000000000000000000000571360057567700233750ustar00rootroot00000000000000require('../../modules/es.typed-array.slice'); core-js-3.6.1/packages/core-js/stable/typed-array/some.js000066400000000000000000000000561360057567700232400ustar00rootroot00000000000000require('../../modules/es.typed-array.some'); core-js-3.6.1/packages/core-js/stable/typed-array/sort.js000066400000000000000000000000561360057567700232640ustar00rootroot00000000000000require('../../modules/es.typed-array.sort'); core-js-3.6.1/packages/core-js/stable/typed-array/subarray.js000066400000000000000000000000621360057567700241220ustar00rootroot00000000000000require('../../modules/es.typed-array.subarray'); core-js-3.6.1/packages/core-js/stable/typed-array/to-locale-string.js000066400000000000000000000000721360057567700254560ustar00rootroot00000000000000require('../../modules/es.typed-array.to-locale-string'); core-js-3.6.1/packages/core-js/stable/typed-array/to-string.js000066400000000000000000000000631360057567700242210ustar00rootroot00000000000000require('../../modules/es.typed-array.to-string'); core-js-3.6.1/packages/core-js/stable/typed-array/uint16-array.js000066400000000000000000000001251360057567700245340ustar00rootroot00000000000000var parent = require('../../es/typed-array/uint16-array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/typed-array/uint32-array.js000066400000000000000000000001251360057567700245320ustar00rootroot00000000000000var parent = require('../../es/typed-array/uint32-array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/typed-array/uint8-array.js000066400000000000000000000001241360057567700244540ustar00rootroot00000000000000var parent = require('../../es/typed-array/uint8-array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/typed-array/uint8-clamped-array.js000066400000000000000000000001341360057567700260600ustar00rootroot00000000000000var parent = require('../../es/typed-array/uint8-clamped-array'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/typed-array/values.js000066400000000000000000000000621360057567700235710ustar00rootroot00000000000000require('../../modules/es.typed-array.iterator'); core-js-3.6.1/packages/core-js/stable/url-search-params/000077500000000000000000000000001360057567700230235ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/url-search-params/index.js000066400000000000000000000001171360057567700244670ustar00rootroot00000000000000var parent = require('../../web/url-search-params'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/url/000077500000000000000000000000001360057567700202775ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/url/index.js000066400000000000000000000001011360057567700217340ustar00rootroot00000000000000var parent = require('../../web/url'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/url/to-json.js000066400000000000000000000000521360057567700222230ustar00rootroot00000000000000require('../../modules/web.url.to-json'); core-js-3.6.1/packages/core-js/stable/weak-map/000077500000000000000000000000001360057567700211775ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/weak-map/index.js000066400000000000000000000001051360057567700226400ustar00rootroot00000000000000var parent = require('../../es/weak-map'); module.exports = parent; core-js-3.6.1/packages/core-js/stable/weak-set/000077500000000000000000000000001360057567700212155ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stable/weak-set/index.js000066400000000000000000000001051360057567700226560ustar00rootroot00000000000000var parent = require('../../es/weak-set'); module.exports = parent; core-js-3.6.1/packages/core-js/stage/000077500000000000000000000000001360057567700173265ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/stage/0.js000066400000000000000000000002541360057567700200240ustar00rootroot00000000000000require('../proposals/efficient-64-bit-arithmetic'); require('../proposals/string-at'); require('../proposals/url'); var parent = require('./1'); module.exports = parent; core-js-3.6.1/packages/core-js/stage/1.js000066400000000000000000000011101360057567700200150ustar00rootroot00000000000000require('../proposals/array-last'); require('../proposals/collection-methods'); require('../proposals/collection-of-from'); require('../proposals/keys-composition'); require('../proposals/math-extensions'); require('../proposals/math-signbit'); require('../proposals/number-from-string'); require('../proposals/object-iteration'); require('../proposals/observable'); require('../proposals/pattern-matching'); require('../proposals/promise-try'); require('../proposals/seeded-random'); require('../proposals/string-code-points'); var parent = require('./2'); module.exports = parent; core-js-3.6.1/packages/core-js/stage/2.js000066400000000000000000000004051360057567700200240ustar00rootroot00000000000000require('../proposals/array-is-template-object'); require('../proposals/iterator-helpers'); require('../proposals/map-upsert'); require('../proposals/set-methods'); require('../proposals/using-statement'); var parent = require('./3'); module.exports = parent; core-js-3.6.1/packages/core-js/stage/3.js000066400000000000000000000002101360057567700200170ustar00rootroot00000000000000require('../proposals/promise-any'); require('../proposals/string-replace-all'); var parent = require('./4'); module.exports = parent; core-js-3.6.1/packages/core-js/stage/4.js000066400000000000000000000002751360057567700200330ustar00rootroot00000000000000require('../proposals/global-this'); require('../proposals/promise-all-settled'); require('../proposals/string-match-all'); var path = require('../internals/path'); module.exports = path; core-js-3.6.1/packages/core-js/stage/README.md000066400000000000000000000002221360057567700206010ustar00rootroot00000000000000This folder contains entry points for [ECMAScript proposals](https://github.com/zloirock/core-js/tree/v3#ecmascript-proposals) with dependencies. core-js-3.6.1/packages/core-js/stage/index.js000066400000000000000000000000771360057567700207770ustar00rootroot00000000000000var proposals = require('./pre'); module.exports = proposals; core-js-3.6.1/packages/core-js/stage/pre.js000066400000000000000000000001411360057567700204460ustar00rootroot00000000000000require('../proposals/reflect-metadata'); var parent = require('./0'); module.exports = parent; core-js-3.6.1/packages/core-js/web/000077500000000000000000000000001360057567700170005ustar00rootroot00000000000000core-js-3.6.1/packages/core-js/web/README.md000066400000000000000000000002211360057567700202520ustar00rootroot00000000000000This folder contains entry points for features from [WHATWG / W3C](https://github.com/zloirock/core-js/tree/v3#web-standards) with dependencies. core-js-3.6.1/packages/core-js/web/dom-collections.js000066400000000000000000000002511360057567700224270ustar00rootroot00000000000000require('../modules/web.dom-collections.for-each'); require('../modules/web.dom-collections.iterator'); var path = require('../internals/path'); module.exports = path; core-js-3.6.1/packages/core-js/web/immediate.js000066400000000000000000000001461360057567700212750ustar00rootroot00000000000000require('../modules/web.immediate'); var path = require('../internals/path'); module.exports = path; core-js-3.6.1/packages/core-js/web/index.js000066400000000000000000000006161360057567700204500ustar00rootroot00000000000000require('../modules/web.dom-collections.for-each'); require('../modules/web.dom-collections.iterator'); require('../modules/web.immediate'); require('../modules/web.queue-microtask'); require('../modules/web.timers'); require('../modules/web.url'); require('../modules/web.url.to-json'); require('../modules/web.url-search-params'); var path = require('../internals/path'); module.exports = path; core-js-3.6.1/packages/core-js/web/queue-microtask.js000066400000000000000000000001731360057567700224550ustar00rootroot00000000000000require('../modules/web.queue-microtask'); var path = require('../internals/path'); module.exports = path.queueMicrotask; core-js-3.6.1/packages/core-js/web/timers.js000066400000000000000000000001431360057567700206370ustar00rootroot00000000000000require('../modules/web.timers'); var path = require('../internals/path'); module.exports = path; core-js-3.6.1/packages/core-js/web/url-search-params.js000066400000000000000000000001761360057567700226700ustar00rootroot00000000000000require('../modules/web.url-search-params'); var path = require('../internals/path'); module.exports = path.URLSearchParams; core-js-3.6.1/packages/core-js/web/url.js000066400000000000000000000002701360057567700201370ustar00rootroot00000000000000require('../modules/web.url'); require('../modules/web.url.to-json'); require('../modules/web.url-search-params'); var path = require('../internals/path'); module.exports = path.URL; core-js-3.6.1/tests/000077500000000000000000000000001360057567700142455ustar00rootroot00000000000000core-js-3.6.1/tests/commonjs-entries-content.js000066400000000000000000000121711360057567700215510ustar00rootroot00000000000000'use strict'; const { deepStrictEqual, ok } = require('assert'); const allModules = require('../packages/core-js-compat/modules'); const entries = require('../packages/core-js-compat/entries'); function filter(regexp) { return allModules.filter(it => regexp.test(it)); } function equal(name, required) { const contains = new Set(entries[name]); const shouldContain = new Set(Array.isArray(required) ? required : filter(required)); deepStrictEqual(contains, shouldContain); } function superset(name, required) { const contains = new Set(entries[name]); const shouldContain = Array.isArray(required) ? required : filter(required); for (const module of shouldContain) { ok(contains.has(module), module); } } function subset(name, required) { const contains = entries[name]; const shouldContain = new Set(Array.isArray(required) ? required : filter(required)); for (const module of contains) { ok(shouldContain.has(module), module); } } equal('core-js', allModules); equal('core-js/es', /^es\./); superset('core-js/es/array', /^es\.array\./); superset('core-js/es/array-buffer', /^es\.array-buffer\./); superset('core-js/es/data-view', /^es\.data-view\./); superset('core-js/es/date', /^es\.date\./); superset('core-js/es/function', /^es\.function\./); superset('core-js/es/json', /^es\.json\./); superset('core-js/es/map', /^es\.map/); superset('core-js/es/math', /^es\.math\./); superset('core-js/es/number', /^es\.number\./); superset('core-js/es/object', /^es\.object\./); superset('core-js/es/promise', /^es\.promise/); superset('core-js/es/reflect', /^es\.reflect\./); superset('core-js/es/regexp', /^es\.regexp\./); superset('core-js/es/set', /^es\.set/); superset('core-js/es/string', /^es\.string\./); superset('core-js/es/symbol', /^es\.symbol/); superset('core-js/es/typed-array', /^es\.typed-array\./); superset('core-js/es/weak-map', /^es\.weak-map/); superset('core-js/es/weak-set', /^es\.weak-set/); equal('core-js/web', /^web\./); equal('core-js/stable', /^(es|web)\./); superset('core-js/stable/array', /^es\.array\./); superset('core-js/stable/array-buffer', /^es\.array-buffer\./); superset('core-js/stable/data-view', /^es\.data-view\./); superset('core-js/stable/date', /^es\.date\./); superset('core-js/stable/dom-collections', /^web\.dom-collections\./); superset('core-js/stable/function', /^es\.function\./); superset('core-js/stable/json', /^es\.json\./); superset('core-js/stable/map', /^es\.map/); superset('core-js/stable/math', /^es\.math\./); superset('core-js/stable/number', /^es\.number\./); superset('core-js/stable/object', /^es\.object\./); superset('core-js/stable/promise', /^es\.promise/); superset('core-js/stable/reflect', /^es\.reflect\./); superset('core-js/stable/regexp', /^es\.regexp\./); superset('core-js/stable/set', /^es\.set/); superset('core-js/stable/string', /^es\.string\./); superset('core-js/stable/symbol', /^es\.symbol/); superset('core-js/stable/typed-array', /^es\.typed-array\./); superset('core-js/stable/url', /^web\.url(\.|$)/); superset('core-js/stable/url-search-params', /^web\.url-search-params/); superset('core-js/stable/weak-map', /^es\.weak-map/); superset('core-js/stable/weak-set', /^es\.weak-set/); equal('core-js/features', allModules); superset('core-js/features/array', /^(es|esnext)\.array\./); superset('core-js/features/array-buffer', /^(es|esnext)\.array-buffer\./); superset('core-js/features/async-iterator', /^(es|esnext)\.async-iterator\./); superset('core-js/features/data-view', /^(es|esnext)\.data-view\./); superset('core-js/features/date', /^(es|esnext)\.date\./); superset('core-js/features/dom-collections', /^web\.dom-collections\./); superset('core-js/features/function', /^(es|esnext)\.function\./); superset('core-js/features/iterator', /^(es|esnext)\.iterator\./); superset('core-js/features/json', /^(es|esnext)\.json\./); superset('core-js/features/map', /^(es|esnext)\.map/); superset('core-js/features/math', /^(es|esnext)\.math\./); superset('core-js/features/number', /^(es|esnext)\.number\./); superset('core-js/features/object', /^(es|esnext)\.object\./); superset('core-js/features/observable', /^(es|esnext)\.observable/); superset('core-js/features/promise', /^(es|esnext)\.promise/); superset('core-js/features/reflect', /^(es|esnext)\.reflect\./); superset('core-js/features/regexp', /^(es|esnext)\.regexp\./); superset('core-js/features/set', /^(es|esnext)\.set/); superset('core-js/features/string', /^(es|esnext)\.string\./); superset('core-js/features/symbol', /^(es|esnext)\.symbol/); superset('core-js/features/typed-array', /^(es|esnext)\.typed-array\./); superset('core-js/features/url', /^web\.url(\.|$)/); superset('core-js/features/url-search-params', /^web\.url-search-params/); superset('core-js/features/weak-map', /^(es|esnext)\.weak-map/); superset('core-js/features/weak-set', /^(es|esnext)\.weak-set/); equal('core-js/proposals', /^(esnext\.|web\.url)/); equal('core-js/stage', /^(esnext\.|web\.url)/); equal('core-js/stage/pre', /^(esnext\.|web\.url)/); subset('core-js/stage/0', /^(esnext\.|web\.url)/); subset('core-js/stage/1', /^(esnext\.|web\.url)/); subset('core-js/stage/2', /^esnext\./); subset('core-js/stage/3', /^esnext\./); subset('core-js/stage/4', /^esnext\./); core-js-3.6.1/tests/commonjs.js000066400000000000000000002503241360057567700164360ustar00rootroot00000000000000/* eslint-disable import/no-dynamic-require */ 'use strict'; const { ok } = require('assert'); const compat = require('../packages/core-js-compat/data'); let tested = 0; let PATH; function load(module) { tested++; // eslint-disable-next-line global-require return require(`${ PATH }/${ module }`); } for (const _PATH of ['../packages/core-js-pure', '../packages/core-js']) { PATH = _PATH; ok(load('features/object/assign')({ q: 1 }, { w: 2 }).w === 2); ok(load('features/object/create')(Array.prototype) instanceof Array); ok(load('features/object/define-property')({}, 'a', { value: 42 }).a === 42); ok(load('features/object/define-properties')({}, { a: { value: 42 } }).a === 42); ok(load('features/object/freeze')({})); ok(load('features/object/get-own-property-descriptor')({ q: 1 }, 'q').enumerable); ok(load('features/object/get-own-property-names')({ q: 42 })[0] === 'q'); ok(load('features/object/get-own-property-symbols')({ [Symbol()]: 42 }).length === 1); ok(load('features/object/get-prototype-of')([]) === Array.prototype); ok(load('features/object/is')(NaN, NaN)); ok(load('features/object/is-extensible')({})); ok(!load('features/object/is-frozen')({})); ok(!load('features/object/is-sealed')({})); ok(typeof load('features/object/iterate-entries')({}).next === 'function'); ok(typeof load('features/object/iterate-keys')({}).next === 'function'); ok(typeof load('features/object/iterate-values')({}).next === 'function'); ok(load('features/object/keys')({ q: 0 })[0] === 'q'); ok(load('features/object/prevent-extensions')({})); ok(load('features/object/seal')({})); ok(load('features/object/set-prototype-of')({}, []) instanceof Array); ok(load('features/object/to-string')([]) === '[object Array]'); ok(load('features/object/entries')({ q: 2 })[0][0] === 'q'); ok(load('features/object/from-entries')([['a', 42]]).a === 42); ok(load('features/object/values')({ q: 2 })[0] === 2); ok(load('features/object/get-own-property-descriptors')({ q: 1 }).q.enumerable); ok(typeof load('features/object/define-getter') === 'function'); ok(typeof load('features/object/define-setter') === 'function'); ok(typeof load('features/object/lookup-getter') === 'function'); ok(typeof load('features/object/lookup-setter') === 'function'); ok('values' in load('features/object')); ok(load('features/function/bind')(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); ok(load('features/function/virtual/bind').call(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); ok(load('features/function/virtual').bind.call(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); load('features/function/name'); load('features/function/has-instance'); // eslint-disable-next-line prefer-arrow-callback ok(Function[load('features/symbol/has-instance')](function () { /* empty */ })); ok('bind' in load('features/function')); ok(load('features/array/is-array')([])); ok(typeof load('features/array/is-template-object') === 'function'); ok(Array.isArray(load('features/array/from')('qwe'))); ok(Array.isArray(load('features/array/of')('q', 'w', 'e'))); ok(load('features/array/join')('qwe', 1) === 'q1w1e'); ok(load('features/array/slice')('qwe', 1)[1] === 'e'); ok(load('features/array/sort')([1, 3, 2])[1] === 2); ok(typeof load('features/array/for-each') === 'function'); ok(typeof load('features/array/map') === 'function'); ok(typeof load('features/array/filter') === 'function'); ok(typeof load('features/array/flat') === 'function'); ok(typeof load('features/array/flat-map') === 'function'); ok(typeof load('features/array/some') === 'function'); ok(typeof load('features/array/every') === 'function'); ok(typeof load('features/array/reduce') === 'function'); ok(typeof load('features/array/reduce-right') === 'function'); ok(typeof load('features/array/reverse') === 'function'); ok(typeof load('features/array/index-of') === 'function'); ok(typeof load('features/array/last-index-of') === 'function'); ok(load('features/array/concat')([1, 2, 3], [4, 5, 6]).length === 6); ok(load('features/array/copy-within')([1, 2, 3, 4, 5], 0, 3)[0] === 4); ok('next' in load('features/array/entries')([])); load('features/array/last-item'); load('features/array/last-index'); ok(load('features/array/fill')(Array(5), 2)[0] === 2); ok(load('features/array/find')([2, 3, 4], it => it % 2) === 3); ok(load('features/array/find-index')([2, 3, 4], it => it % 2) === 1); ok('next' in load('features/array/keys')([])); ok('next' in load('features/array/values')([])); ok(load('features/array/includes')([1, 2, 3], 2)); ok('next' in load('features/array/iterator')([])); ok(load('features/array/virtual/join').call('qwe', 1) === 'q1w1e'); ok(load('features/array/virtual/slice').call('qwe', 1)[1] === 'e'); ok(load('features/array/virtual/splice').call([1, 2, 3], 1, 2)[0] === 2); ok(load('features/array/virtual/sort').call([1, 3, 2])[1] === 2); ok(typeof load('features/array/virtual/for-each') === 'function'); ok(typeof load('features/array/virtual/map') === 'function'); ok(typeof load('features/array/virtual/filter') === 'function'); ok(typeof load('features/array/virtual/flat') === 'function'); ok(typeof load('features/array/virtual/flat-map') === 'function'); ok(typeof load('features/array/virtual/some') === 'function'); ok(typeof load('features/array/virtual/every') === 'function'); ok(typeof load('features/array/virtual/reduce') === 'function'); ok(typeof load('features/array/virtual/reduce-right') === 'function'); ok(typeof load('features/array/virtual/reverse') === 'function'); ok(typeof load('features/array/virtual/index-of') === 'function'); ok(typeof load('features/array/virtual/last-index-of') === 'function'); ok(load('features/array/virtual/concat').call([1, 2, 3], [4, 5, 6]).length === 6); ok(load('features/array/virtual/copy-within').call([1, 2, 3, 4, 5], 0, 3)[0] === 4); ok('next' in load('features/array/virtual/entries').call([])); ok(load('features/array/virtual/fill').call(Array(5), 2)[0] === 2); ok(load('features/array/virtual/find').call([2, 3, 4], it => it % 2) === 3); ok(load('features/array/virtual/find-index').call([2, 3, 4], it => it % 2) === 1); ok('next' in load('features/array/virtual/keys').call([])); ok('next' in load('features/array/virtual/values').call([])); ok(load('features/array/virtual/includes').call([1, 2, 3], 2)); ok('next' in load('features/array/virtual/iterator').call([])); ok(load('features/array/virtual').includes.call([1, 2, 3], 2)); ok('from' in load('features/array')); ok(load('features/array/splice')([1, 2, 3], 1, 2)[0] === 2); ok(load('features/math/acosh')(1) === 0); ok(Object.is(load('features/math/asinh')(-0), -0)); ok(load('features/math/atanh')(1) === Infinity); ok(load('features/math/cbrt')(-8) === -2); ok(load('features/math/clz32')(0) === 32); ok(load('features/math/cosh')(0) === 1); ok(load('features/math/expm1')(-Infinity) === -1); ok(load('features/math/fround')(0) === 0); ok(load('features/math/hypot')(3, 4) === 5); ok(load('features/math/imul')(2, 2) === 4); ok(load('features/math/log10')(-0) === -Infinity); ok(load('features/math/log1p')(-1) === -Infinity); ok(load('features/math/log2')(1) === 0); ok(load('features/math/sign')(-2) === -1); ok(Object.is(load('features/math/sinh')(-0), -0)); ok(load('features/math/tanh')(Infinity) === 1); ok(load('features/math/to-string-tag') === 'Math'); ok(load('features/math/trunc')(1.5) === 1); ok(load('features/math/clamp')(6, 2, 4) === 4); ok(load('features/math/deg-per-rad') === Math.PI / 180); ok(load('features/math/degrees')(Math.PI) === 180); ok(load('features/math/fscale')(3, 1, 2, 1, 2) === 3); ok(load('features/math/iaddh')(3, 2, 0xFFFFFFFF, 4) === 7); ok(load('features/math/isubh')(3, 4, 0xFFFFFFFF, 2) === 1); ok(load('features/math/imulh')(0xFFFFFFFF, 7) === -1); ok(load('features/math/rad-per-deg') === 180 / Math.PI); ok(load('features/math/radians')(180) === Math.PI); ok(load('features/math/scale')(3, 1, 2, 1, 2) === 3); ok(load('features/math/umulh')(0xFFFFFFFF, 7) === 6); ok(load('features/math/signbit')(-2) === true); ok(typeof load('features/math/seeded-prng')({ seed: 42 }).next().value === 'number'); ok(load('features/number/constructor')('5') === 5); ok(load('features/number/epsilon') === 2 ** -52); ok(load('features/number/is-finite')(42.5)); ok(load('features/number/is-integer')(42.5) === false); ok(load('features/number/is-nan')(NaN)); ok(load('features/number/is-safe-integer')(42)); ok(load('features/number/max-safe-integer') === 0x1FFFFFFFFFFFFF); ok(load('features/number/min-safe-integer') === -0x1FFFFFFFFFFFFF); ok(load('features/number/parse-float')('1.5') === 1.5); ok(load('features/number/parse-int')('2.1') === 2); ok(load('features/number/to-fixed')(1, 1) === '1.0'); ok(load('features/number/to-precision')(1) === '1'); ok(load('features/number/from-string')('12', 3) === 5); ok(load('features/parse-float')('1.5') === 1.5); ok(load('features/parse-int')('2.1') === 2); ok(load('features/number/virtual/to-fixed').call(1, 1) === '1.0'); ok(load('features/number/virtual/to-precision').call(1) === '1'); ok(load('features/number/virtual').toFixed.call(42, 2) === '42.00'); ok('isNaN' in load('features/number')); ok(load('features/reflect/apply')((a, b) => a + b, null, [1, 2]) === 3); ok(load('features/reflect/construct')(function () { return this.a = 2; }, []).a === 2); let O; load('features/reflect/define-property')(O = {}, 'a', { value: 42 }); ok(O.a === 42); ok(load('features/reflect/delete-property')({ q: 1 }, 'q')); ok(load('features/reflect/get')({ q: 1 }, 'q') === 1); ok(load('features/reflect/get-own-property-descriptor')({ q: 1 }, 'q').enumerable); ok(load('features/reflect/get-prototype-of')([]) === Array.prototype); ok(load('features/reflect/has')({ q: 1 }, 'q')); ok(load('features/reflect/is-extensible')({})); ok(load('features/reflect/own-keys')({ q: 1 })[0] === 'q'); ok(load('features/reflect/prevent-extensions')({})); ok(load('features/reflect/set')({}, 'a', 42)); load('features/reflect/set-prototype-of')(O = {}, []); ok(O instanceof Array); ok(typeof load('features/reflect/define-metadata') === 'function'); ok(typeof load('features/reflect/delete-metadata') === 'function'); ok(typeof load('features/reflect/get-metadata') === 'function'); ok(typeof load('features/reflect/get-metadata-keys') === 'function'); ok(typeof load('features/reflect/get-own-metadata') === 'function'); ok(typeof load('features/reflect/get-own-metadata-keys') === 'function'); ok(typeof load('features/reflect/has-metadata') === 'function'); ok(typeof load('features/reflect/has-own-metadata') === 'function'); ok(typeof load('features/reflect/metadata') === 'function'); ok('has' in load('features/reflect')); ok(load('features/string/from-code-point')(97) === 'a'); ok(load('features/string/raw')({ raw: 'test' }, 0, 1, 2) === 't0e1s2t'); ok(load('features/string/trim')(' ab ') === 'ab'); ok(load('features/string/code-point-at')('a', 0) === 97); ok(load('features/string/ends-with')('qwe', 'we')); ok(load('features/string/includes')('qwe', 'w')); ok(load('features/string/repeat')('q', 3) === 'qqq'); ok(load('features/string/starts-with')('qwe', 'qw')); ok(typeof load('features/string/anchor') === 'function'); ok(typeof load('features/string/big') === 'function'); ok(typeof load('features/string/blink') === 'function'); ok(typeof load('features/string/bold') === 'function'); ok(typeof load('features/string/fixed') === 'function'); ok(typeof load('features/string/fontcolor') === 'function'); ok(typeof load('features/string/fontsize') === 'function'); ok(typeof load('features/string/italics') === 'function'); ok(typeof load('features/string/link') === 'function'); ok(typeof load('features/string/small') === 'function'); ok(typeof load('features/string/strike') === 'function'); ok(typeof load('features/string/sub') === 'function'); ok(typeof load('features/string/sup') === 'function'); ok(load('features/string/at')('a', 0) === 'a'); ok('next' in load('features/string/code-points')('a')); ok(load('features/string/pad-start')('a', 3) === ' a'); ok(load('features/string/pad-end')('a', 3) === 'a '); ok(load('features/string/trim-start')(' a ') === 'a '); ok(load('features/string/trim-end')(' a ') === ' a'); ok(load('features/string/trim-left')(' a ') === 'a '); ok(load('features/string/trim-right')(' a ') === ' a'); ok('next' in load('features/string/match-all')('a', /./g)); ok(typeof load('features/string/replace-all') === 'function'); ok('next' in load('features/string/iterator')('qwe')); ok(load('features/string/virtual/code-point-at').call('a', 0) === 97); ok(load('features/string/virtual/ends-with').call('qwe', 'we')); ok(load('features/string/virtual/includes').call('qwe', 'w')); ok(load('features/string/virtual/repeat').call('q', 3) === 'qqq'); ok(load('features/string/virtual/starts-with').call('qwe', 'qw')); ok(typeof load('features/string/virtual/anchor') === 'function'); ok(typeof load('features/string/virtual/big') === 'function'); ok(typeof load('features/string/virtual/blink') === 'function'); ok(typeof load('features/string/virtual/bold') === 'function'); ok(typeof load('features/string/virtual/fixed') === 'function'); ok(typeof load('features/string/virtual/fontcolor') === 'function'); ok(typeof load('features/string/virtual/fontsize') === 'function'); ok(typeof load('features/string/virtual/italics') === 'function'); ok(typeof load('features/string/virtual/link') === 'function'); ok(typeof load('features/string/virtual/small') === 'function'); ok(typeof load('features/string/virtual/strike') === 'function'); ok(typeof load('features/string/virtual/sub') === 'function'); ok(typeof load('features/string/virtual/sup') === 'function'); ok(load('features/string/virtual/at').call('a', 0) === 'a'); ok('next' in load('features/string/virtual/code-points').call('a')); ok(load('features/string/virtual/pad-start').call('a', 3) === ' a'); ok(load('features/string/virtual/pad-end').call('a', 3) === 'a '); ok(load('features/string/virtual/trim-start').call(' a ') === 'a '); ok(load('features/string/virtual/trim-end').call(' a ') === ' a'); ok(load('features/string/virtual/trim-left').call(' a ') === 'a '); ok(load('features/string/virtual/trim-right').call(' a ') === ' a'); ok('next' in load('features/string/virtual/match-all').call('a', /./g)); ok(typeof load('features/string/virtual/replace-all') === 'function'); ok(load('features/string/virtual').at.call('a', 0) === 'a'); ok('next' in load('features/string/virtual/iterator').call('qwe')); ok('raw' in load('features/string')); ok(String(load('features/regexp/constructor')('a', 'g')) === '/a/g'); ok(load('features/regexp/to-string')(/./g) === '/./g'); ok(load('features/regexp/flags')(/./g) === 'g'); ok(typeof load('features/regexp/match') === 'function'); ok(typeof load('features/regexp/replace') === 'function'); ok(typeof load('features/regexp/search') === 'function'); ok(typeof load('features/regexp/split') === 'function'); ok(typeof load('features/regexp/sticky') === 'function'); ok(typeof load('features/regexp/test') === 'function'); load('features/regexp'); ok(load('features/json').stringify([1]) === '[1]'); ok(load('features/json/stringify')([1]) === '[1]'); ok(load('features/json/to-string-tag') === 'JSON'); ok(typeof load('features/date/now')(new Date()) === 'number'); ok(typeof load('features/date/to-string')(new Date()) === 'string'); ok(typeof load('features/date/to-primitive')(new Date(), 'number') === 'number'); ok(typeof load('features/date/to-iso-string')(new Date()) === 'string'); ok(load('features/date/to-json')(Infinity) === null); ok(load('features/date')); load('features/symbol/description'); ok(load('features/symbol/has-instance')); ok(load('features/symbol/is-concat-spreadable')); ok(load('features/symbol/iterator')); ok(load('features/symbol/match')); ok(load('features/symbol/match-all')); ok(load('features/symbol/replace')); ok(load('features/symbol/search')); ok(load('features/symbol/species')); ok(load('features/symbol/split')); ok(load('features/symbol/to-primitive')); ok(load('features/symbol/to-string-tag')); ok(load('features/symbol/unscopables')); ok(load('features/symbol/async-iterator')); ok(load('features/symbol/observable')); ok(load('features/symbol/pattern-match')); ok(load('features/symbol/replace-all')); ok(load('features/symbol/async-dispose')); ok(load('features/symbol/dispose')); ok(typeof load('features/symbol/for') === 'function'); ok(typeof load('features/symbol/key-for') === 'function'); ok('iterator' in load('features/symbol')); let Map = load('features/map'); let Set = load('features/set'); let WeakMap = load('features/weak-map'); let WeakSet = load('features/weak-set'); ok(new Map([[1, 2], [3, 4]]).size === 2); ok(new Set([1, 2, 3, 2, 1]).size === 3); ok(new WeakMap([[O = {}, 42]]).get(O) === 42); ok(new WeakSet([O = {}]).has(O)); ok(load('features/map/of')([1, 2], [3, 4]) instanceof Map); ok(load('features/set/of')(1, 2, 3, 2, 1) instanceof Set); ok(load('features/weak-map/of')([{}, 1], [[], 2]) instanceof WeakMap); ok(load('features/weak-set/of')({}, []) instanceof WeakSet); ok(load('features/map/from')([[1, 2], [3, 4]]) instanceof Map); ok(load('features/set/from')([1, 2, 3, 2, 1]) instanceof Set); ok(load('features/weak-map/from')([[{}, 1], [[], 2]]) instanceof WeakMap); ok(load('features/weak-set/from')([{}, []]) instanceof WeakSet); ok(load('features/map/delete-all')(new Map(), 1, 2) === false); ok(load('features/map/every')(new Map([[1, 2], [2, 3], [3, 4]]), it => it % 2) === false); ok(load('features/map/filter')(new Map([[1, 2], [2, 3], [3, 4]]), it => it % 2).size === 1); ok(load('features/map/find')(new Map([[1, 2], [2, 3], [3, 4]]), it => it % 2) === 3); ok(load('features/map/find-key')(new Map([[1, 2], [2, 3], [3, 4]]), it => it % 2) === 2); ok(load('features/map/group-by')([], it => it) instanceof Map); ok(load('features/map/includes')(new Map([[1, 2]]), 2), true); ok(load('features/map/key-by')([], it => it) instanceof Map); ok(load('features/map/key-of')(new Map([[1, 2]]), 2), 1); ok(load('features/map/map-keys')(new Map([[1, 2], [2, 3], [3, 4]]), it => it).size === 3); ok(load('features/map/map-values')(new Map([[1, 2], [2, 3], [3, 4]]), it => it).size === 3); ok(load('features/map/merge')(new Map([[1, 2], [2, 3]]), [[2, 4], [4, 5]]).size === 3); ok(load('features/map/reduce')(new Map([[1, 2], [2, 3], [3, 4]]), (a, b) => a + b) === 9); ok(load('features/map/some')(new Map([[1, 2], [2, 3], [3, 4]]), it => it % 2) === true); ok(load('features/map/update')(new Map([[1, 2]]), 1, it => it * 2).get(1) === 4); ok(load('features/map/update-or-insert')(new Map([[1, 2]]), 1, it => it ** 2, () => 42) === 4); ok(load('features/map/upsert')(new Map([[1, 2]]), 1, it => it ** 2, () => 42) === 4); ok(load('features/set/add-all')(new Set([1, 2, 3]), 4, 5).size === 5); ok(load('features/set/delete-all')(new Set([1, 2, 3]), 4, 5) === false); ok(load('features/set/difference')(new Set([1, 2, 3]), [3, 4, 5]).size === 2); ok(load('features/set/every')(new Set([1, 2, 3]), it => typeof it == 'number')); ok(load('features/set/filter')(new Set([1, 2, 3]), it => it % 2).size === 2); ok(load('features/set/find')(new Set([2, 3, 4]), it => it % 2) === 3); ok(load('features/set/intersection')(new Set([1, 2, 3]), [1, 3, 4]).size === 2); ok(load('features/set/is-disjoint-from')(new Set([1, 2, 3]), [4, 5, 6])); ok(load('features/set/is-subset-of')(new Set([1, 2, 3]), [1, 2, 3, 4])); ok(load('features/set/is-superset-of')(new Set([1, 2, 3, 4]), [1, 2, 3])); ok(load('features/set/join')(new Set([1, 2, 3])) === '1,2,3'); ok(load('features/set/map')(new Set([1, 2, 3]), it => it % 2).size === 2); ok(load('features/set/reduce')(new Set([1, 2, 3]), (it, v) => it + v) === 6); ok(load('features/set/some')(new Set([1, 2, 3]), it => typeof it == 'number')); ok(load('features/set/symmetric-difference')(new Set([1, 2, 3]), [3, 4, 5]).size === 4); ok(load('features/set/union')(new Set([1, 2, 3]), [3, 4, 5]).size === 5); ok(load('features/weak-map/delete-all')(new WeakMap(), [], {}) === false); ok(load('features/weak-map/upsert')(new WeakMap(), {}, null, () => 42) === 42); ok(load('features/weak-set/add-all')(new WeakSet(), [], {}) instanceof WeakSet); ok(load('features/weak-set/delete-all')(new WeakSet(), [], {}) === false); let Promise = load('features/promise'); ok('all' in Promise); ok(load('features/promise/all-settled')([1, 2, 3]) instanceof Promise); ok(load('features/promise/any')([1, 2, 3]) instanceof Promise); ok(load('features/promise/try')(() => 42) instanceof load('features/promise')); ok(new (load('features/aggregate-error'))([42]).errors[0] === 42); ok('from' in load('features/observable')); ok(load('es/global-this').Math === Math); ok(load('stable/global-this').Math === Math); ok(load('features/global-this').Math === Math); ok(typeof load('features/dom-collections').iterator === 'function'); ok(typeof load('features/dom-collections/iterator') === 'function'); ok(typeof load('features/set-timeout') === 'function'); ok(typeof load('features/set-interval') === 'function'); ok(typeof load('features/set-immediate') === 'function'); ok(typeof load('features/clear-immediate') === 'function'); ok(typeof load('features/queue-microtask') === 'function'); ok(typeof load('features/composite-key')({}, 1, {}) === 'object'); ok(typeof load('features/composite-symbol')({}, 1, {}) === 'symbol'); ok(typeof load('features/async-iterator') === 'function'); ok(typeof load('features/async-iterator/as-indexed-pairs') === 'function'); ok(typeof load('features/async-iterator/drop') === 'function'); ok(typeof load('features/async-iterator/every') === 'function'); ok(typeof load('features/async-iterator/filter') === 'function'); ok(typeof load('features/async-iterator/find') === 'function'); ok(typeof load('features/async-iterator/flat-map') === 'function'); ok(typeof load('features/async-iterator/for-each') === 'function'); ok(typeof load('features/async-iterator/from') === 'function'); ok(typeof load('features/async-iterator/map') === 'function'); ok(typeof load('features/async-iterator/reduce') === 'function'); ok(typeof load('features/async-iterator/some') === 'function'); ok(typeof load('features/async-iterator/take') === 'function'); ok(typeof load('features/async-iterator/to-array') === 'function'); ok(typeof load('features/iterator') === 'function'); ok(typeof load('features/iterator/as-indexed-pairs') === 'function'); ok(typeof load('features/iterator/drop') === 'function'); ok(typeof load('features/iterator/every') === 'function'); ok(typeof load('features/iterator/filter') === 'function'); ok(typeof load('features/iterator/find') === 'function'); ok(typeof load('features/iterator/flat-map') === 'function'); ok(typeof load('features/iterator/for-each') === 'function'); ok(typeof load('features/iterator/from') === 'function'); ok(typeof load('features/iterator/map') === 'function'); ok(typeof load('features/iterator/reduce') === 'function'); ok(typeof load('features/iterator/some') === 'function'); ok(typeof load('features/iterator/take') === 'function'); ok(typeof load('features/iterator/to-array') === 'function'); ok(typeof load('features/url') === 'function'); load('features/url/to-json'); ok(typeof load('features/url-search-params') === 'function'); ok(load('features/is-iterable')([])); ok(typeof load('features/get-iterator-method')([]) === 'function'); ok('next' in load('features/get-iterator')([])); ok(load('features')); ok(load('stable/object/assign')({ q: 1 }, { w: 2 }).w === 2); ok(load('stable/object/create')(Array.prototype) instanceof Array); ok(load('stable/object/define-property')({}, 'a', { value: 42 }).a === 42); ok(load('stable/object/define-properties')({}, { a: { value: 42 } }).a === 42); ok(load('stable/object/freeze')({})); ok(load('stable/object/get-own-property-descriptor')({ q: 1 }, 'q').enumerable); ok(load('stable/object/get-own-property-names')({ q: 42 })[0] === 'q'); ok(load('stable/object/get-own-property-symbols')({ [Symbol()]: 42 }).length === 1); ok(load('stable/object/get-prototype-of')([]) === Array.prototype); ok(load('stable/object/is')(NaN, NaN)); ok(load('stable/object/is-extensible')({})); ok(!load('stable/object/is-frozen')({})); ok(!load('stable/object/is-sealed')({})); ok(load('stable/object/keys')({ q: 0 })[0] === 'q'); ok(load('stable/object/prevent-extensions')({})); ok(load('stable/object/seal')({})); ok(load('stable/object/set-prototype-of')({}, []) instanceof Array); ok(load('stable/object/to-string')([]) === '[object Array]'); ok(load('stable/object/entries')({ q: 2 })[0][0] === 'q'); ok(load('stable/object/from-entries')([['a', 42]]).a === 42); ok(load('stable/object/values')({ q: 2 })[0] === 2); ok(load('stable/object/get-own-property-descriptors')({ q: 1 }).q.enumerable); ok(typeof load('stable/object/define-getter') === 'function'); ok(typeof load('stable/object/define-setter') === 'function'); ok(typeof load('stable/object/lookup-getter') === 'function'); ok(typeof load('stable/object/lookup-setter') === 'function'); ok('values' in load('stable/object')); ok(load('stable/function/bind')(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); ok(load('stable/function/virtual/bind').call(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); ok(load('stable/function/virtual').bind.call(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); load('stable/function/name'); load('stable/function/has-instance'); // eslint-disable-next-line prefer-arrow-callback ok(Function[load('stable/symbol/has-instance')](function () { /* empty */ })); ok('bind' in load('stable/function')); ok(load('stable/array/is-array')([])); ok(Array.isArray(load('stable/array/from')('qwe'))); ok(Array.isArray(load('stable/array/of')('q', 'w', 'e'))); ok(load('stable/array/join')('qwe', 1) === 'q1w1e'); ok(load('stable/array/slice')('qwe', 1)[1] === 'e'); ok(load('stable/array/sort')([1, 3, 2])[1] === 2); ok(typeof load('stable/array/for-each') === 'function'); ok(typeof load('stable/array/map') === 'function'); ok(typeof load('stable/array/filter') === 'function'); ok(typeof load('stable/array/flat') === 'function'); ok(typeof load('stable/array/flat-map') === 'function'); ok(typeof load('stable/array/some') === 'function'); ok(typeof load('stable/array/every') === 'function'); ok(typeof load('stable/array/reduce') === 'function'); ok(typeof load('stable/array/reduce-right') === 'function'); ok(typeof load('stable/array/reverse') === 'function'); ok(typeof load('stable/array/index-of') === 'function'); ok(typeof load('stable/array/last-index-of') === 'function'); ok(load('stable/array/concat')([1, 2, 3], [4, 5, 6]).length === 6); ok(load('stable/array/copy-within')([1, 2, 3, 4, 5], 0, 3)[0] === 4); ok('next' in load('stable/array/entries')([])); ok(load('stable/array/fill')(Array(5), 2)[0] === 2); ok(load('stable/array/find')([2, 3, 4], it => it % 2) === 3); ok(load('stable/array/find-index')([2, 3, 4], it => it % 2) === 1); ok('next' in load('stable/array/keys')([])); ok('next' in load('stable/array/values')([])); ok(load('stable/array/includes')([1, 2, 3], 2)); ok('next' in load('stable/array/iterator')([])); ok(load('stable/array/virtual/join').call('qwe', 1) === 'q1w1e'); ok(load('stable/array/virtual/slice').call('qwe', 1)[1] === 'e'); ok(load('stable/array/virtual/splice').call([1, 2, 3], 1, 2)[0] === 2); ok(load('stable/array/virtual/sort').call([1, 3, 2])[1] === 2); ok(typeof load('stable/array/virtual/for-each') === 'function'); ok(typeof load('stable/array/virtual/map') === 'function'); ok(typeof load('stable/array/virtual/filter') === 'function'); ok(typeof load('stable/array/virtual/flat') === 'function'); ok(typeof load('stable/array/virtual/flat-map') === 'function'); ok(typeof load('stable/array/virtual/some') === 'function'); ok(typeof load('stable/array/virtual/every') === 'function'); ok(typeof load('stable/array/virtual/reduce') === 'function'); ok(typeof load('stable/array/virtual/reduce-right') === 'function'); ok(typeof load('stable/array/virtual/reverse') === 'function'); ok(typeof load('stable/array/virtual/index-of') === 'function'); ok(typeof load('stable/array/virtual/last-index-of') === 'function'); ok(load('stable/array/virtual/concat').call([1, 2, 3], [4, 5, 6]).length === 6); ok(load('stable/array/virtual/copy-within').call([1, 2, 3, 4, 5], 0, 3)[0] === 4); ok('next' in load('stable/array/virtual/entries').call([])); ok(load('stable/array/virtual/fill').call(Array(5), 2)[0] === 2); ok(load('stable/array/virtual/find').call([2, 3, 4], it => it % 2) === 3); ok(load('stable/array/virtual/find-index').call([2, 3, 4], it => it % 2) === 1); ok('next' in load('stable/array/virtual/keys').call([])); ok('next' in load('stable/array/virtual/values').call([])); ok(load('stable/array/virtual/includes').call([1, 2, 3], 2)); ok('next' in load('stable/array/virtual/iterator').call([])); ok(load('stable/array/virtual').includes.call([1, 2, 3], 2)); ok('from' in load('stable/array')); ok(load('stable/array/splice')([1, 2, 3], 1, 2)[0] === 2); ok(load('stable/math/acosh')(1) === 0); ok(Object.is(load('stable/math/asinh')(-0), -0)); ok(load('stable/math/atanh')(1) === Infinity); ok(load('stable/math/cbrt')(-8) === -2); ok(load('stable/math/clz32')(0) === 32); ok(load('stable/math/cosh')(0) === 1); ok(load('stable/math/expm1')(-Infinity) === -1); ok(load('stable/math/fround')(0) === 0); ok(load('stable/math/hypot')(3, 4) === 5); ok(load('stable/math/imul')(2, 2) === 4); ok(load('stable/math/log10')(-0) === -Infinity); ok(load('stable/math/log1p')(-1) === -Infinity); ok(load('stable/math/log2')(1) === 0); ok(load('stable/math/sign')(-2) === -1); ok(Object.is(load('stable/math/sinh')(-0), -0)); ok(load('stable/math/tanh')(Infinity) === 1); ok(load('stable/math/to-string-tag') === 'Math'); ok(load('stable/math/trunc')(1.5) === 1); ok(load('stable/number/constructor')('5') === 5); ok(load('stable/number/epsilon') === 2 ** -52); ok(load('stable/number/is-finite')(42.5)); ok(load('stable/number/is-integer')(42.5) === false); ok(load('stable/number/is-nan')(NaN)); ok(load('stable/number/is-safe-integer')(42)); ok(load('stable/number/max-safe-integer') === 0x1FFFFFFFFFFFFF); ok(load('stable/number/min-safe-integer') === -0x1FFFFFFFFFFFFF); ok(load('stable/number/parse-float')('1.5') === 1.5); ok(load('stable/number/parse-int')('2.1') === 2); ok(load('stable/number/to-fixed')(1, 1) === '1.0'); ok(load('stable/number/to-precision')(1) === '1'); ok(load('stable/parse-float')('1.5') === 1.5); ok(load('stable/parse-int')('2.1') === 2); ok(load('stable/number/virtual/to-fixed').call(1, 1) === '1.0'); ok(load('stable/number/virtual/to-precision').call(1) === '1'); ok(load('stable/number/virtual').toFixed.call(42, 2) === '42.00'); ok('isNaN' in load('stable/number')); ok(load('stable/reflect/apply')((a, b) => a + b, null, [1, 2]) === 3); ok(load('stable/reflect/construct')(function () { return this.a = 2; }, []).a === 2); load('stable/reflect/define-property')(O = {}, 'a', { value: 42 }); ok(O.a === 42); ok(load('stable/reflect/delete-property')({ q: 1 }, 'q')); ok(load('stable/reflect/get')({ q: 1 }, 'q') === 1); ok(load('stable/reflect/get-own-property-descriptor')({ q: 1 }, 'q').enumerable); ok(load('stable/reflect/get-prototype-of')([]) === Array.prototype); ok(load('stable/reflect/has')({ q: 1 }, 'q')); ok(load('stable/reflect/is-extensible')({})); ok(load('stable/reflect/own-keys')({ q: 1 })[0] === 'q'); ok(load('stable/reflect/prevent-extensions')({})); ok(load('stable/reflect/set')({}, 'a', 42)); load('stable/reflect/set-prototype-of')(O = {}, []); ok(O instanceof Array); ok('has' in load('stable/reflect')); ok(load('stable/string/from-code-point')(97) === 'a'); ok(load('stable/string/raw')({ raw: 'test' }, 0, 1, 2) === 't0e1s2t'); ok(load('stable/string/trim')(' ab ') === 'ab'); ok(load('stable/string/code-point-at')('a', 0) === 97); ok(load('stable/string/ends-with')('qwe', 'we')); ok(load('stable/string/includes')('qwe', 'w')); ok(load('stable/string/repeat')('q', 3) === 'qqq'); ok('next' in load('stable/string/match-all')('a', /./g)); ok(load('stable/string/starts-with')('qwe', 'qw')); ok(typeof load('stable/string/anchor') === 'function'); ok(typeof load('stable/string/big') === 'function'); ok(typeof load('stable/string/blink') === 'function'); ok(typeof load('stable/string/bold') === 'function'); ok(typeof load('stable/string/fixed') === 'function'); ok(typeof load('stable/string/fontcolor') === 'function'); ok(typeof load('stable/string/fontsize') === 'function'); ok(typeof load('stable/string/italics') === 'function'); ok(typeof load('stable/string/link') === 'function'); ok(typeof load('stable/string/small') === 'function'); ok(typeof load('stable/string/strike') === 'function'); ok(typeof load('stable/string/sub') === 'function'); ok(typeof load('stable/string/sup') === 'function'); ok(load('stable/string/pad-start')('a', 3) === ' a'); ok(load('stable/string/pad-end')('a', 3) === 'a '); ok(load('stable/string/trim-start')(' a ') === 'a '); ok(load('stable/string/trim-end')(' a ') === ' a'); ok(load('stable/string/trim-left')(' a ') === 'a '); ok(load('stable/string/trim-right')(' a ') === ' a'); ok('next' in load('stable/string/iterator')('qwe')); ok(load('stable/string/virtual/code-point-at').call('a', 0) === 97); ok(load('stable/string/virtual/ends-with').call('qwe', 'we')); ok(load('stable/string/virtual/includes').call('qwe', 'w')); ok(load('stable/string/virtual/repeat').call('q', 3) === 'qqq'); ok(load('stable/string/virtual/starts-with').call('qwe', 'qw')); ok(typeof load('stable/string/virtual/anchor') === 'function'); ok(typeof load('stable/string/virtual/big') === 'function'); ok(typeof load('stable/string/virtual/blink') === 'function'); ok(typeof load('stable/string/virtual/bold') === 'function'); ok(typeof load('stable/string/virtual/fixed') === 'function'); ok(typeof load('stable/string/virtual/fontcolor') === 'function'); ok(typeof load('stable/string/virtual/fontsize') === 'function'); ok(typeof load('stable/string/virtual/italics') === 'function'); ok(typeof load('stable/string/virtual/link') === 'function'); ok(typeof load('stable/string/virtual/small') === 'function'); ok(typeof load('stable/string/virtual/strike') === 'function'); ok(typeof load('stable/string/virtual/sub') === 'function'); ok(typeof load('stable/string/virtual/sup') === 'function'); ok(load('stable/string/virtual/pad-start').call('a', 3) === ' a'); ok(load('stable/string/virtual/pad-end').call('a', 3) === 'a '); ok(load('stable/string/virtual/trim-start').call(' a ') === 'a '); ok(load('stable/string/virtual/trim-end').call(' a ') === ' a'); ok(load('stable/string/virtual/trim-left').call(' a ') === 'a '); ok(load('stable/string/virtual/trim-right').call(' a ') === ' a'); ok(load('stable/string/virtual').at.call('a', 0) === 'a'); ok('next' in load('stable/string/virtual/iterator').call('qwe')); ok('raw' in load('stable/string')); ok(String(load('stable/regexp/constructor')('a', 'g')) === '/a/g'); ok(load('stable/regexp/to-string')(/./g) === '/./g'); ok(load('stable/regexp/flags')(/./g) === 'g'); ok(typeof load('stable/regexp/match') === 'function'); ok(typeof load('stable/regexp/replace') === 'function'); ok(typeof load('stable/regexp/search') === 'function'); ok(typeof load('stable/regexp/split') === 'function'); ok(typeof load('stable/regexp/sticky') === 'function'); ok(typeof load('stable/regexp/test') === 'function'); load('stable/regexp'); ok(load('stable/json').stringify([1]) === '[1]'); ok(load('stable/json/stringify')([1]) === '[1]'); ok(load('stable/json/to-string-tag') === 'JSON'); ok(typeof load('stable/date/now')(new Date()) === 'number'); ok(typeof load('stable/date/to-string')(new Date()) === 'string'); ok(typeof load('stable/date/to-primitive')(new Date(), 'number') === 'number'); ok(typeof load('stable/date/to-iso-string')(new Date()) === 'string'); ok(load('stable/date/to-json')(Infinity) === null); ok(load('stable/date')); load('stable/symbol/description'); ok(load('stable/symbol/has-instance')); ok(load('stable/symbol/is-concat-spreadable')); ok(load('stable/symbol/iterator')); ok(load('stable/symbol/match')); ok(load('stable/symbol/match-all')); ok(load('stable/symbol/replace')); ok(load('stable/symbol/search')); ok(load('stable/symbol/species')); ok(load('stable/symbol/split')); ok(load('stable/symbol/to-primitive')); ok(load('stable/symbol/to-string-tag')); ok(load('stable/symbol/unscopables')); ok(load('stable/symbol/async-iterator')); ok(typeof load('stable/symbol/for') === 'function'); ok(typeof load('stable/symbol/key-for') === 'function'); ok('iterator' in load('stable/symbol')); Map = load('stable/map'); Set = load('stable/set'); WeakMap = load('stable/weak-map'); WeakSet = load('stable/weak-set'); ok(new Map([[1, 2], [3, 4]]).size === 2); ok(new Set([1, 2, 3, 2, 1]).size === 3); ok(new WeakMap([[O = {}, 42]]).get(O) === 42); ok(new WeakSet([O = {}]).has(O)); Promise = load('stable/promise'); ok('all' in Promise); ok(load('stable/promise/all-settled')([1, 2, 3]) instanceof Promise); ok(typeof load('stable/dom-collections').iterator === 'function'); ok(typeof load('stable/dom-collections/iterator') === 'function'); ok(typeof load('stable/set-timeout') === 'function'); ok(typeof load('stable/set-interval') === 'function'); ok(typeof load('stable/set-immediate') === 'function'); ok(typeof load('stable/clear-immediate') === 'function'); ok(typeof load('stable/queue-microtask') === 'function'); ok(typeof load('stable/url') === 'function'); load('stable/url/to-json'); ok(typeof load('stable/url-search-params') === 'function'); ok(load('stable')); ok(load('es/object/assign')({ q: 1 }, { w: 2 }).w === 2); ok(load('es/object/create')(Array.prototype) instanceof Array); ok(load('es/object/define-property')({}, 'a', { value: 42 }).a === 42); ok(load('es/object/define-properties')({}, { a: { value: 42 } }).a === 42); ok(load('es/object/freeze')({})); ok(load('es/object/get-own-property-descriptor')({ q: 1 }, 'q').enumerable); ok(load('es/object/get-own-property-names')({ q: 42 })[0] === 'q'); ok(load('es/object/get-own-property-symbols')({ [Symbol()]: 42 }).length === 1); ok(load('es/object/get-prototype-of')([]) === Array.prototype); ok(load('es/object/is')(NaN, NaN)); ok(load('es/object/is-extensible')({})); ok(!load('es/object/is-frozen')({})); ok(!load('es/object/is-sealed')({})); ok(load('es/object/keys')({ q: 0 })[0] === 'q'); ok(load('es/object/prevent-extensions')({})); ok(load('es/object/seal')({})); ok(load('es/object/set-prototype-of')({}, []) instanceof Array); ok(load('es/object/to-string')([]) === '[object Array]'); ok(load('es/object/entries')({ q: 2 })[0][0] === 'q'); ok(load('es/object/from-entries')([['a', 42]]).a === 42); ok(load('es/object/values')({ q: 2 })[0] === 2); ok(load('es/object/get-own-property-descriptors')({ q: 1 }).q.enumerable); ok(typeof load('es/object/define-getter') === 'function'); ok(typeof load('es/object/define-setter') === 'function'); ok(typeof load('es/object/lookup-getter') === 'function'); ok(typeof load('es/object/lookup-setter') === 'function'); ok('values' in load('es/object')); ok(load('es/function/bind')(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); ok(load('es/function/virtual/bind').call(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); ok(load('es/function/virtual').bind.call(function (a, b) { return this + a + b; }, 1, 2)(3) === 6); load('es/function/name'); load('es/function/has-instance'); // eslint-disable-next-line prefer-arrow-callback ok(Function[load('es/symbol/has-instance')](function () { /* empty */ })); ok('bind' in load('es/function')); ok(load('es/array/is-array')([])); ok(Array.isArray(load('es/array/from')('qwe'))); ok(Array.isArray(load('es/array/of')('q', 'w', 'e'))); ok(load('es/array/join')('qwe', 1) === 'q1w1e'); ok(load('es/array/slice')('qwe', 1)[1] === 'e'); ok(load('es/array/sort')([1, 3, 2])[1] === 2); ok(typeof load('es/array/for-each') === 'function'); ok(typeof load('es/array/map') === 'function'); ok(typeof load('es/array/filter') === 'function'); ok(typeof load('es/array/flat') === 'function'); ok(typeof load('es/array/flat-map') === 'function'); ok(typeof load('es/array/some') === 'function'); ok(typeof load('es/array/every') === 'function'); ok(typeof load('es/array/reduce') === 'function'); ok(typeof load('es/array/reduce-right') === 'function'); ok(typeof load('es/array/reverse') === 'function'); ok(typeof load('es/array/index-of') === 'function'); ok(typeof load('es/array/last-index-of') === 'function'); ok(load('es/array/concat')([1, 2, 3], [4, 5, 6]).length === 6); ok(load('es/array/copy-within')([1, 2, 3, 4, 5], 0, 3)[0] === 4); ok('next' in load('es/array/entries')([])); ok(load('es/array/fill')(Array(5), 2)[0] === 2); ok(load('es/array/find')([2, 3, 4], it => it % 2) === 3); ok(load('es/array/find-index')([2, 3, 4], it => it % 2) === 1); ok('next' in load('es/array/keys')([])); ok('next' in load('es/array/values')([])); ok(load('es/array/includes')([1, 2, 3], 2)); ok('next' in load('es/array/iterator')([])); ok(load('es/array/virtual/join').call('qwe', 1) === 'q1w1e'); ok(load('es/array/virtual/slice').call('qwe', 1)[1] === 'e'); ok(load('es/array/virtual/splice').call([1, 2, 3], 1, 2)[0] === 2); ok(load('es/array/virtual/sort').call([1, 3, 2])[1] === 2); ok(typeof load('es/array/virtual/for-each') === 'function'); ok(typeof load('es/array/virtual/map') === 'function'); ok(typeof load('es/array/virtual/filter') === 'function'); ok(typeof load('es/array/virtual/flat') === 'function'); ok(typeof load('es/array/virtual/flat-map') === 'function'); ok(typeof load('es/array/virtual/some') === 'function'); ok(typeof load('es/array/virtual/every') === 'function'); ok(typeof load('es/array/virtual/reduce') === 'function'); ok(typeof load('es/array/virtual/reduce-right') === 'function'); ok(typeof load('es/array/virtual/reverse') === 'function'); ok(typeof load('es/array/virtual/index-of') === 'function'); ok(typeof load('es/array/virtual/last-index-of') === 'function'); ok(load('es/array/virtual/concat').call([1, 2, 3], [4, 5, 6]).length === 6); ok(load('es/array/virtual/copy-within').call([1, 2, 3, 4, 5], 0, 3)[0] === 4); ok('next' in load('es/array/virtual/entries').call([])); ok(load('es/array/virtual/fill').call(Array(5), 2)[0] === 2); ok(load('es/array/virtual/find').call([2, 3, 4], it => it % 2) === 3); ok(load('es/array/virtual/find-index').call([2, 3, 4], it => it % 2) === 1); ok('next' in load('es/array/virtual/keys').call([])); ok('next' in load('es/array/virtual/values').call([])); ok(load('es/array/virtual/includes').call([1, 2, 3], 2)); ok('next' in load('es/array/virtual/iterator').call([])); ok(load('es/array/virtual').includes.call([1, 2, 3], 2)); ok('from' in load('es/array')); ok(load('es/array/splice')([1, 2, 3], 1, 2)[0] === 2); ok(load('es/math/acosh')(1) === 0); ok(Object.is(load('es/math/asinh')(-0), -0)); ok(load('es/math/atanh')(1) === Infinity); ok(load('es/math/cbrt')(-8) === -2); ok(load('es/math/clz32')(0) === 32); ok(load('es/math/cosh')(0) === 1); ok(load('es/math/expm1')(-Infinity) === -1); ok(load('es/math/fround')(0) === 0); ok(load('es/math/hypot')(3, 4) === 5); ok(load('es/math/imul')(2, 2) === 4); ok(load('es/math/log10')(-0) === -Infinity); ok(load('es/math/log1p')(-1) === -Infinity); ok(load('es/math/log2')(1) === 0); ok(load('es/math/sign')(-2) === -1); ok(Object.is(load('es/math/sinh')(-0), -0)); ok(load('es/math/tanh')(Infinity) === 1); ok(load('es/math/to-string-tag') === 'Math'); ok(load('es/math/trunc')(1.5) === 1); ok(load('es/number/constructor')('5') === 5); ok(load('es/number/epsilon') === 2 ** -52); ok(load('es/number/is-finite')(42.5)); ok(load('es/number/is-integer')(42.5) === false); ok(load('es/number/is-nan')(NaN)); ok(load('es/number/is-safe-integer')(42)); ok(load('es/number/max-safe-integer') === 0x1FFFFFFFFFFFFF); ok(load('es/number/min-safe-integer') === -0x1FFFFFFFFFFFFF); ok(load('es/number/parse-float')('1.5') === 1.5); ok(load('es/number/parse-int')('2.1') === 2); ok(load('es/number/to-fixed')(1, 1) === '1.0'); ok(load('es/number/to-precision')(1) === '1'); ok(load('es/parse-float')('1.5') === 1.5); ok(load('es/parse-int')('2.1') === 2); ok(load('es/number/virtual/to-fixed').call(1, 1) === '1.0'); ok(load('es/number/virtual/to-precision').call(1) === '1'); ok(load('es/number/virtual').toFixed.call(42, 2) === '42.00'); ok('isNaN' in load('es/number')); ok(load('es/reflect/apply')((a, b) => a + b, null, [1, 2]) === 3); ok(load('es/reflect/construct')(function () { return this.a = 2; }, []).a === 2); load('es/reflect/define-property')(O = {}, 'a', { value: 42 }); ok(O.a === 42); ok(load('es/reflect/delete-property')({ q: 1 }, 'q')); ok(load('es/reflect/get')({ q: 1 }, 'q') === 1); ok(load('es/reflect/get-own-property-descriptor')({ q: 1 }, 'q').enumerable); ok(load('es/reflect/get-prototype-of')([]) === Array.prototype); ok(load('es/reflect/has')({ q: 1 }, 'q')); ok(load('es/reflect/is-extensible')({})); ok(load('es/reflect/own-keys')({ q: 1 })[0] === 'q'); ok(load('es/reflect/prevent-extensions')({})); ok(load('es/reflect/set')({}, 'a', 42)); load('es/reflect/set-prototype-of')(O = {}, []); ok(O instanceof Array); ok('has' in load('es/reflect')); ok(load('es/string/from-code-point')(97) === 'a'); ok(load('es/string/raw')({ raw: 'test' }, 0, 1, 2) === 't0e1s2t'); ok(load('es/string/trim')(' ab ') === 'ab'); ok(load('es/string/trim-start')(' a ') === 'a '); ok(load('es/string/trim-end')(' a ') === ' a'); ok(load('es/string/trim-left')(' a ') === 'a '); ok(load('es/string/trim-right')(' a ') === ' a'); ok(load('es/string/code-point-at')('a', 0) === 97); ok(load('es/string/ends-with')('qwe', 'we')); ok(load('es/string/includes')('qwe', 'w')); ok(load('es/string/repeat')('q', 3) === 'qqq'); ok(load('es/string/starts-with')('qwe', 'qw')); ok(typeof load('es/string/anchor') === 'function'); ok(typeof load('es/string/big') === 'function'); ok(typeof load('es/string/blink') === 'function'); ok(typeof load('es/string/bold') === 'function'); ok(typeof load('es/string/fixed') === 'function'); ok(typeof load('es/string/fontcolor') === 'function'); ok(typeof load('es/string/fontsize') === 'function'); ok(typeof load('es/string/italics') === 'function'); ok(typeof load('es/string/link') === 'function'); ok(typeof load('es/string/small') === 'function'); ok(typeof load('es/string/strike') === 'function'); ok(typeof load('es/string/sub') === 'function'); ok(typeof load('es/string/sup') === 'function'); ok(load('es/string/pad-start')('a', 3) === ' a'); ok(load('es/string/pad-end')('a', 3) === 'a '); ok('next' in load('es/string/iterator')('qwe')); ok(load('es/string/virtual/code-point-at').call('a', 0) === 97); ok(load('es/string/virtual/ends-with').call('qwe', 'we')); ok(load('es/string/virtual/includes').call('qwe', 'w')); ok(load('es/string/virtual/repeat').call('q', 3) === 'qqq'); ok(load('es/string/virtual/starts-with').call('qwe', 'qw')); ok(load('es/string/virtual/trim').call(' ab ') === 'ab'); ok(load('es/string/virtual/trim-start').call(' a ') === 'a '); ok(load('es/string/virtual/trim-end').call(' a ') === ' a'); ok(load('es/string/virtual/trim-left').call(' a ') === 'a '); ok(load('es/string/virtual/trim-right').call(' a ') === ' a'); ok(typeof load('es/string/virtual/anchor') === 'function'); ok(typeof load('es/string/virtual/big') === 'function'); ok(typeof load('es/string/virtual/blink') === 'function'); ok(typeof load('es/string/virtual/bold') === 'function'); ok(typeof load('es/string/virtual/fixed') === 'function'); ok(typeof load('es/string/virtual/fontcolor') === 'function'); ok(typeof load('es/string/virtual/fontsize') === 'function'); ok(typeof load('es/string/virtual/italics') === 'function'); ok(typeof load('es/string/virtual/link') === 'function'); ok(typeof load('es/string/virtual/small') === 'function'); ok(typeof load('es/string/virtual/strike') === 'function'); ok(typeof load('es/string/virtual/sub') === 'function'); ok(typeof load('es/string/virtual/sup') === 'function'); ok(load('es/string/virtual/pad-start').call('a', 3) === ' a'); ok(load('es/string/virtual/pad-end').call('a', 3) === 'a '); ok(load('es/string/virtual').trim.call(' a') === 'a'); ok('next' in load('es/string/virtual/iterator').call('qwe')); ok('raw' in load('es/string')); ok(String(load('es/regexp/constructor')('a', 'g')) === '/a/g'); ok(load('es/regexp/to-string')(/./g) === '/./g'); ok(load('es/regexp/flags')(/./g) === 'g'); ok(typeof load('es/regexp/match') === 'function'); ok(typeof load('es/regexp/replace') === 'function'); ok(typeof load('es/regexp/search') === 'function'); ok(typeof load('es/regexp/split') === 'function'); ok(typeof load('es/regexp/sticky') === 'function'); ok(typeof load('es/regexp/test') === 'function'); load('es/regexp'); ok(load('es/json').stringify([1]) === '[1]'); ok(load('es/json/stringify')([1]) === '[1]'); ok(load('es/json/to-string-tag') === 'JSON'); ok(typeof load('es/date/now')(new Date()) === 'number'); ok(typeof load('es/date/to-string')(new Date()) === 'string'); ok(typeof load('es/date/to-primitive')(new Date(), 'number') === 'number'); ok(typeof load('es/date/to-iso-string')(new Date()) === 'string'); ok(load('es/date/to-json')(Infinity) === null); ok(load('es/date')); ok(load('es/symbol/has-instance')); ok(load('es/symbol/is-concat-spreadable')); ok(load('es/symbol/iterator')); ok(load('es/symbol/match')); ok(load('es/symbol/match-all')); ok(load('es/symbol/replace')); ok(load('es/symbol/search')); ok(load('es/symbol/species')); ok(load('es/symbol/split')); ok(load('es/symbol/to-primitive')); ok(load('es/symbol/to-string-tag')); ok(load('es/symbol/unscopables')); ok(load('es/symbol/async-iterator')); load('es/symbol/description'); ok(typeof load('es/symbol/for') === 'function'); ok(typeof load('es/symbol/key-for') === 'function'); ok('iterator' in load('es/symbol')); Map = load('es/map'); Set = load('es/set'); WeakMap = load('es/weak-map'); WeakSet = load('es/weak-set'); ok(new Map([[1, 2], [3, 4]]).size === 2); ok(new Set([1, 2, 3, 2, 1]).size === 3); ok(new WeakMap([[O = {}, 42]]).get(O) === 42); ok(new WeakSet([O = {}]).has(O)); Promise = load('es/promise'); ok('all' in Promise); ok(load('es/promise/all-settled')([1, 2, 3]) instanceof Promise); ok('Map' in load('es')); ok('setTimeout' in load('web/timers')); ok('setImmediate' in load('web/immediate')); ok(typeof load('web/queue-microtask') === 'function'); load('web/dom-collections'); ok(typeof load('web/url') === 'function'); ok(typeof load('web/url-search-params') === 'function'); ok('setImmediate' in load('web')); load('proposals/array-is-template-object'); load('proposals/array-last'); load('proposals/collection-methods'); load('proposals/collection-of-from'); load('proposals/efficient-64-bit-arithmetic'); load('proposals/global-this'); load('proposals/iterator-helpers'); load('proposals/math-extensions'); load('proposals/math-signbit'); load('proposals/number-from-string'); load('proposals/object-iteration'); load('proposals/observable'); load('proposals/pattern-matching'); load('proposals/promise-all-settled'); load('proposals/promise-any'); load('proposals/promise-try'); load('proposals/reflect-metadata'); load('proposals/keys-composition'); load('proposals/seeded-random'); load('proposals/set-methods'); load('proposals/string-at'); load('proposals/string-code-points'); load('proposals/string-match-all'); load('proposals/string-replace-all'); load('proposals/using-statement'); load('proposals/url'); load('proposals'); ok(load('stage/4')); ok(load('stage/3')); ok(load('stage/2')); ok(load('stage/1')); ok(load('stage/0')); ok(load('stage/pre')); ok(load('stage')); ok(load('index')); const instanceAt = load('features/instance/at'); ok(typeof instanceAt === 'function'); ok(instanceAt({}) === undefined); ok(typeof instanceAt('') === 'function'); ok(instanceAt('').call('abc', 1) === 'b'); let instanceBind = load('features/instance/bind'); ok(typeof instanceBind === 'function'); ok(instanceBind({}) === undefined); ok(typeof instanceBind(it => it) === 'function'); ok(instanceBind(it => it).call(it => it, 1, 2)() === 2); instanceBind = load('stable/instance/bind'); ok(typeof instanceBind === 'function'); ok(instanceBind({}) === undefined); ok(typeof instanceBind(it => it) === 'function'); ok(instanceBind(it => it).call(it => it, 1, 2)() === 2); instanceBind = load('es/instance/bind'); ok(typeof instanceBind === 'function'); ok(instanceBind({}) === undefined); ok(typeof instanceBind(it => it) === 'function'); ok(instanceBind(it => it).call(it => it, 1, 2)() === 2); let instanceCodePointAt = load('features/instance/code-point-at'); ok(typeof instanceCodePointAt === 'function'); ok(instanceCodePointAt({}) === undefined); ok(typeof instanceCodePointAt('') === 'function'); ok(instanceCodePointAt('').call('a', 0) === 97); instanceCodePointAt = load('stable/instance/code-point-at'); ok(typeof instanceCodePointAt === 'function'); ok(instanceCodePointAt({}) === undefined); ok(typeof instanceCodePointAt('') === 'function'); ok(instanceCodePointAt('').call('a', 0) === 97); instanceCodePointAt = load('es/instance/code-point-at'); ok(typeof instanceCodePointAt === 'function'); ok(instanceCodePointAt({}) === undefined); ok(typeof instanceCodePointAt('') === 'function'); ok(instanceCodePointAt('').call('a', 0) === 97); const instanceCodePoints = load('features/instance/code-points'); ok(typeof instanceCodePoints === 'function'); ok(instanceCodePoints({}) === undefined); ok(typeof instanceCodePoints('') === 'function'); ok(instanceCodePoints('').call('abc').next().value.codePoint === 97); let instanceConcat = load('features/instance/concat'); ok(typeof instanceConcat === 'function'); ok(instanceConcat({}) === undefined); ok(typeof instanceConcat([]) === 'function'); ok(instanceConcat([]).call([1, 2, 3], [4, 5, 6]).length === 6); instanceConcat = load('stable/instance/concat'); ok(typeof instanceConcat === 'function'); ok(instanceConcat({}) === undefined); ok(typeof instanceConcat([]) === 'function'); ok(instanceConcat([]).call([1, 2, 3], [4, 5, 6]).length === 6); instanceConcat = load('es/instance/concat'); ok(typeof instanceConcat === 'function'); ok(instanceConcat({}) === undefined); ok(typeof instanceConcat([]) === 'function'); ok(instanceConcat([]).call([1, 2, 3], [4, 5, 6]).length === 6); let instanceCopyWithin = load('features/instance/copy-within'); ok(typeof instanceCopyWithin === 'function'); ok(instanceCopyWithin({}) === undefined); ok(typeof instanceCopyWithin([]) === 'function'); ok(instanceCopyWithin([]).call([1, 2, 3, 4, 5], 0, 3)[0] === 4); instanceCopyWithin = load('stable/instance/copy-within'); ok(typeof instanceCopyWithin === 'function'); ok(instanceCopyWithin({}) === undefined); ok(typeof instanceCopyWithin([]) === 'function'); ok(instanceCopyWithin([]).call([1, 2, 3, 4, 5], 0, 3)[0] === 4); instanceCopyWithin = load('es/instance/copy-within'); ok(typeof instanceCopyWithin === 'function'); ok(instanceCopyWithin({}) === undefined); ok(typeof instanceCopyWithin([]) === 'function'); ok(instanceCopyWithin([]).call([1, 2, 3, 4, 5], 0, 3)[0] === 4); let instanceEndsWith = load('features/instance/ends-with'); ok(typeof instanceEndsWith === 'function'); ok(instanceEndsWith({}) === undefined); ok(typeof instanceEndsWith('') === 'function'); ok(instanceEndsWith('').call('qwe', 'we')); instanceEndsWith = load('stable/instance/ends-with'); ok(typeof instanceEndsWith === 'function'); ok(instanceEndsWith({}) === undefined); ok(typeof instanceEndsWith('') === 'function'); ok(instanceEndsWith('').call('qwe', 'we')); instanceEndsWith = load('es/instance/ends-with'); ok(typeof instanceEndsWith === 'function'); ok(instanceEndsWith({}) === undefined); ok(typeof instanceEndsWith('') === 'function'); ok(instanceEndsWith('').call('qwe', 'we')); let instanceEntries = load('features/instance/entries'); ok(typeof instanceEntries === 'function'); ok(instanceEntries({}) === undefined); ok(typeof instanceEntries([]) === 'function'); ok(instanceEntries([]).call([1, 2, 3]).next().value[1] === 1); instanceEntries = load('stable/instance/entries'); ok(typeof instanceEntries === 'function'); ok(instanceEntries({}) === undefined); ok(typeof instanceEntries([]) === 'function'); ok(instanceEntries([]).call([1, 2, 3]).next().value[1] === 1); instanceEntries = load('es/instance/entries'); ok(typeof instanceEntries === 'function'); ok(instanceEntries({}) === undefined); ok(typeof instanceEntries([]) === 'function'); ok(instanceEntries([]).call([1, 2, 3]).next().value[1] === 1); let instanceEvery = load('features/instance/every'); ok(typeof instanceEvery === 'function'); ok(instanceEvery({}) === undefined); ok(typeof instanceEvery([]) === 'function'); ok(instanceEvery([]).call([1, 2, 3], it => typeof it === 'number')); instanceEvery = load('stable/instance/every'); ok(typeof instanceEvery === 'function'); ok(instanceEvery({}) === undefined); ok(typeof instanceEvery([]) === 'function'); ok(instanceEvery([]).call([1, 2, 3], it => typeof it === 'number')); instanceEvery = load('es/instance/every'); ok(typeof instanceEvery === 'function'); ok(instanceEvery({}) === undefined); ok(typeof instanceEvery([]) === 'function'); ok(instanceEvery([]).call([1, 2, 3], it => typeof it === 'number')); let instanceFill = load('features/instance/fill'); ok(typeof instanceFill === 'function'); ok(instanceFill({}) === undefined); ok(typeof instanceFill([]) === 'function'); ok(instanceFill([]).call(Array(5), 42)[3] === 42); instanceFill = load('stable/instance/fill'); ok(typeof instanceFill === 'function'); ok(instanceFill({}) === undefined); ok(typeof instanceFill([]) === 'function'); ok(instanceFill([]).call(Array(5), 42)[3] === 42); instanceFill = load('es/instance/fill'); ok(typeof instanceFill === 'function'); ok(instanceFill({}) === undefined); ok(typeof instanceFill([]) === 'function'); ok(instanceFill([]).call(Array(5), 42)[3] === 42); let instanceFilter = load('features/instance/filter'); ok(typeof instanceFilter === 'function'); ok(instanceFilter({}) === undefined); ok(typeof instanceFilter([]) === 'function'); ok(instanceFilter([]).call([1, 2, 3], it => it % 2).length === 2); instanceFilter = load('stable/instance/filter'); ok(typeof instanceFilter === 'function'); ok(instanceFilter({}) === undefined); ok(typeof instanceFilter([]) === 'function'); ok(instanceFilter([]).call([1, 2, 3], it => it % 2).length === 2); instanceFilter = load('es/instance/filter'); ok(typeof instanceFilter === 'function'); ok(instanceFilter({}) === undefined); ok(typeof instanceFilter([]) === 'function'); ok(instanceFilter([]).call([1, 2, 3], it => it % 2).length === 2); let instanceFindIndex = load('features/instance/find-index'); ok(typeof instanceFindIndex === 'function'); ok(instanceFindIndex({}) === undefined); ok(typeof instanceFindIndex([]) === 'function'); ok(instanceFindIndex([]).call([1, 2, 3], it => it % 2) === 0); instanceFindIndex = load('stable/instance/find-index'); ok(typeof instanceFindIndex === 'function'); ok(instanceFindIndex({}) === undefined); ok(typeof instanceFindIndex([]) === 'function'); ok(instanceFindIndex([]).call([1, 2, 3], it => it % 2) === 0); instanceFindIndex = load('es/instance/find-index'); ok(typeof instanceFindIndex === 'function'); ok(instanceFindIndex({}) === undefined); ok(typeof instanceFindIndex([]) === 'function'); ok(instanceFindIndex([]).call([1, 2, 3], it => it % 2) === 0); let instanceFind = load('features/instance/find'); ok(typeof instanceFind === 'function'); ok(instanceFind({}) === undefined); ok(typeof instanceFind([]) === 'function'); ok(instanceFind([]).call([1, 2, 3], it => it % 2) === 1); instanceFind = load('stable/instance/find'); ok(typeof instanceFind === 'function'); ok(instanceFind({}) === undefined); ok(typeof instanceFind([]) === 'function'); ok(instanceFind([]).call([1, 2, 3], it => it % 2) === 1); instanceFind = load('es/instance/find'); ok(typeof instanceFind === 'function'); ok(instanceFind({}) === undefined); ok(typeof instanceFind([]) === 'function'); ok(instanceFind([]).call([1, 2, 3], it => it % 2) === 1); let instanceFlags = load('features/instance/flags'); ok(typeof instanceFlags === 'function'); ok(instanceFlags({}) === undefined); ok(instanceFlags(/./g) === 'g'); instanceFlags = load('stable/instance/flags'); ok(typeof instanceFlags === 'function'); ok(instanceFlags({}) === undefined); ok(instanceFlags(/./g) === 'g'); instanceFlags = load('es/instance/flags'); ok(typeof instanceFlags === 'function'); ok(instanceFlags({}) === undefined); ok(instanceFlags(/./g) === 'g'); let instanceFlatMap = load('features/instance/flat-map'); ok(typeof instanceFlatMap === 'function'); ok(instanceFlatMap({}) === undefined); ok(typeof instanceFlatMap([]) === 'function'); ok(instanceFlatMap([]).call([1, 2, 3], (v, i) => [v, i]).length === 6); instanceFlatMap = load('stable/instance/flat-map'); ok(typeof instanceFlatMap === 'function'); ok(instanceFlatMap({}) === undefined); ok(typeof instanceFlatMap([]) === 'function'); ok(instanceFlatMap([]).call([1, 2, 3], (v, i) => [v, i]).length === 6); instanceFlatMap = load('es/instance/flat-map'); ok(typeof instanceFlatMap === 'function'); ok(instanceFlatMap({}) === undefined); ok(typeof instanceFlatMap([]) === 'function'); ok(instanceFlatMap([]).call([1, 2, 3], (v, i) => [v, i]).length === 6); let instanceFlat = load('features/instance/flat'); ok(typeof instanceFlat === 'function'); ok(instanceFlat({}) === undefined); ok(typeof instanceFlat([]) === 'function'); ok(instanceFlat([]).call([1, [2, 3], [4, [5, [6]]]]).length === 5); instanceFlat = load('stable/instance/flat'); ok(typeof instanceFlat === 'function'); ok(instanceFlat({}) === undefined); ok(typeof instanceFlat([]) === 'function'); ok(instanceFlat([]).call([1, [2, 3], [4, [5, [6]]]]).length === 5); instanceFlat = load('es/instance/flat'); ok(typeof instanceFlat === 'function'); ok(instanceFlat({}) === undefined); ok(typeof instanceFlat([]) === 'function'); ok(instanceFlat([]).call([1, [2, 3], [4, [5, [6]]]]).length === 5); let instanceForEach = load('features/instance/for-each'); ok(typeof instanceForEach === 'function'); ok(instanceForEach({}) === undefined); ok(typeof instanceForEach([]) === 'function'); instanceForEach = load('stable/instance/for-each'); ok(typeof instanceForEach === 'function'); ok(instanceForEach({}) === undefined); ok(typeof instanceForEach([]) === 'function'); instanceForEach = load('es/instance/for-each'); ok(typeof instanceForEach === 'function'); ok(instanceForEach({}) === undefined); ok(typeof instanceForEach([]) === 'function'); let instanceIncludes = load('features/instance/includes'); ok(typeof instanceIncludes === 'function'); ok(instanceIncludes({}) === undefined); ok(typeof instanceIncludes([]) === 'function'); ok(typeof instanceIncludes('') === 'function'); ok(instanceIncludes([]).call([1, 2, 3], 2)); ok(instanceIncludes('').call('123', '2')); instanceIncludes = load('stable/instance/includes'); ok(typeof instanceIncludes === 'function'); ok(instanceIncludes({}) === undefined); ok(typeof instanceIncludes([]) === 'function'); ok(typeof instanceIncludes('') === 'function'); ok(instanceIncludes([]).call([1, 2, 3], 2)); ok(instanceIncludes('').call('123', '2')); instanceIncludes = load('es/instance/includes'); ok(typeof instanceIncludes === 'function'); ok(instanceIncludes({}) === undefined); ok(typeof instanceIncludes([]) === 'function'); ok(typeof instanceIncludes('') === 'function'); ok(instanceIncludes([]).call([1, 2, 3], 2)); ok(instanceIncludes('').call('123', '2')); let instanceIndexOf = load('features/instance/index-of'); ok(typeof instanceIndexOf === 'function'); ok(instanceIndexOf({}) === undefined); ok(typeof instanceIndexOf([]) === 'function'); ok(instanceIndexOf([]).call([1, 2, 3], 2) === 1); instanceIndexOf = load('stable/instance/index-of'); ok(typeof instanceIndexOf === 'function'); ok(instanceIndexOf({}) === undefined); ok(typeof instanceIndexOf([]) === 'function'); ok(instanceIndexOf([]).call([1, 2, 3], 2) === 1); instanceIndexOf = load('es/instance/index-of'); ok(typeof instanceIndexOf === 'function'); ok(instanceIndexOf({}) === undefined); ok(typeof instanceIndexOf([]) === 'function'); ok(instanceIndexOf([]).call([1, 2, 3], 2) === 1); let instanceKeys = load('features/instance/keys'); ok(typeof instanceKeys === 'function'); ok(instanceKeys({}) === undefined); ok(typeof instanceKeys([]) === 'function'); ok(instanceKeys([]).call([1, 2, 3]).next().value === 0); instanceKeys = load('stable/instance/keys'); ok(typeof instanceKeys === 'function'); ok(instanceKeys({}) === undefined); ok(typeof instanceKeys([]) === 'function'); ok(instanceKeys([]).call([1, 2, 3]).next().value === 0); instanceKeys = load('es/instance/keys'); ok(typeof instanceKeys === 'function'); ok(instanceKeys({}) === undefined); ok(typeof instanceKeys([]) === 'function'); ok(instanceKeys([]).call([1, 2, 3]).next().value === 0); let instanceLastIndexOf = load('features/instance/last-index-of'); ok(typeof instanceLastIndexOf === 'function'); ok(instanceLastIndexOf({}) === undefined); ok(typeof instanceLastIndexOf([]) === 'function'); ok(instanceLastIndexOf([]).call([1, 2, 3], 2) === 1); instanceLastIndexOf = load('stable/instance/last-index-of'); ok(typeof instanceLastIndexOf === 'function'); ok(instanceLastIndexOf({}) === undefined); ok(typeof instanceLastIndexOf([]) === 'function'); ok(instanceLastIndexOf([]).call([1, 2, 3], 2) === 1); instanceLastIndexOf = load('es/instance/last-index-of'); ok(typeof instanceLastIndexOf === 'function'); ok(instanceLastIndexOf({}) === undefined); ok(typeof instanceLastIndexOf([]) === 'function'); ok(instanceLastIndexOf([]).call([1, 2, 3], 2) === 1); let instanceMap = load('features/instance/map'); ok(typeof instanceMap === 'function'); ok(instanceMap({}) === undefined); ok(typeof instanceMap([]) === 'function'); ok(instanceMap([]).call([1, 2, 3], it => it % 2)[1] === 0); instanceMap = load('stable/instance/map'); ok(typeof instanceMap === 'function'); ok(instanceMap({}) === undefined); ok(typeof instanceMap([]) === 'function'); ok(instanceMap([]).call([1, 2, 3], it => it % 2)[1] === 0); instanceMap = load('es/instance/map'); ok(typeof instanceMap === 'function'); ok(instanceMap({}) === undefined); ok(typeof instanceMap([]) === 'function'); ok(instanceMap([]).call([1, 2, 3], it => it % 2)[1] === 0); let instanceMatchAll = load('features/instance/match-all'); ok(typeof instanceMatchAll === 'function'); ok(instanceMatchAll({}) === undefined); ok(typeof instanceMatchAll('') === 'function'); ok(instanceMatchAll('').call('test1test2', /t(e)(st(\d?))/g).next().value[0] === 'test1'); instanceMatchAll = load('stable/instance/match-all'); ok(typeof instanceMatchAll === 'function'); ok(instanceMatchAll({}) === undefined); ok(typeof instanceMatchAll('') === 'function'); ok(instanceMatchAll('').call('test1test2', /t(e)(st(\d?))/g).next().value[0] === 'test1'); instanceMatchAll = load('es/instance/match-all'); ok(typeof instanceMatchAll === 'function'); ok(instanceMatchAll({}) === undefined); ok(typeof instanceMatchAll('') === 'function'); ok(instanceMatchAll('').call('test1test2', /t(e)(st(\d?))/g).next().value[0] === 'test1'); let instancePadEnd = load('features/instance/pad-end'); ok(typeof instancePadEnd === 'function'); ok(instancePadEnd({}) === undefined); ok(typeof instancePadEnd('') === 'function'); ok(instancePadEnd('').call('a', 3, 'b') === 'abb'); instancePadEnd = load('stable/instance/pad-end'); ok(typeof instancePadEnd === 'function'); ok(instancePadEnd({}) === undefined); ok(typeof instancePadEnd('') === 'function'); ok(instancePadEnd('').call('a', 3, 'b') === 'abb'); instancePadEnd = load('es/instance/pad-end'); ok(typeof instancePadEnd === 'function'); ok(instancePadEnd({}) === undefined); ok(typeof instancePadEnd('') === 'function'); ok(instancePadEnd('').call('a', 3, 'b') === 'abb'); let instancePadStart = load('features/instance/pad-start'); ok(typeof instancePadStart === 'function'); ok(instancePadStart({}) === undefined); ok(typeof instancePadStart('') === 'function'); ok(instancePadStart('').call('a', 3, 'b') === 'bba'); instancePadStart = load('stable/instance/pad-start'); ok(typeof instancePadStart === 'function'); ok(instancePadStart({}) === undefined); ok(typeof instancePadStart('') === 'function'); ok(instancePadStart('').call('a', 3, 'b') === 'bba'); instancePadStart = load('es/instance/pad-start'); ok(typeof instancePadStart === 'function'); ok(instancePadStart({}) === undefined); ok(typeof instancePadStart('') === 'function'); ok(instancePadStart('').call('a', 3, 'b') === 'bba'); let instanceReduceRight = load('features/instance/reduce-right'); ok(typeof instanceReduceRight === 'function'); ok(instanceReduceRight({}) === undefined); ok(typeof instanceReduceRight([]) === 'function'); ok(instanceReduceRight([]).call([1, 2, 3], (memo, it) => it + memo, '') === '123'); instanceReduceRight = load('stable/instance/reduce-right'); ok(typeof instanceReduceRight === 'function'); ok(instanceReduceRight({}) === undefined); ok(typeof instanceReduceRight([]) === 'function'); ok(instanceReduceRight([]).call([1, 2, 3], (memo, it) => it + memo, '') === '123'); instanceReduceRight = load('es/instance/reduce-right'); ok(typeof instanceReduceRight === 'function'); ok(instanceReduceRight({}) === undefined); ok(typeof instanceReduceRight([]) === 'function'); ok(instanceReduceRight([]).call([1, 2, 3], (memo, it) => it + memo, '') === '123'); let instanceReduce = load('features/instance/reduce'); ok(typeof instanceReduce === 'function'); ok(instanceReduce({}) === undefined); ok(typeof instanceReduce([]) === 'function'); ok(instanceReduce([]).call([1, 2, 3], (memo, it) => it + memo, '') === '321'); instanceReduce = load('stable/instance/reduce'); ok(typeof instanceReduce === 'function'); ok(instanceReduce({}) === undefined); ok(typeof instanceReduce([]) === 'function'); ok(instanceReduce([]).call([1, 2, 3], (memo, it) => it + memo, '') === '321'); instanceReduce = load('es/instance/reduce'); ok(typeof instanceReduce === 'function'); ok(instanceReduce({}) === undefined); ok(typeof instanceReduce([]) === 'function'); ok(instanceReduce([]).call([1, 2, 3], (memo, it) => it + memo, '') === '321'); let instanceRepeat = load('features/instance/repeat'); ok(typeof instanceRepeat === 'function'); ok(instanceRepeat({}) === undefined); ok(typeof instanceRepeat('') === 'function'); ok(instanceRepeat('').call('a', 3) === 'aaa'); instanceRepeat = load('stable/instance/repeat'); ok(typeof instanceRepeat === 'function'); ok(instanceRepeat({}) === undefined); ok(typeof instanceRepeat('') === 'function'); ok(instanceRepeat('').call('a', 3) === 'aaa'); instanceRepeat = load('es/instance/repeat'); ok(typeof instanceRepeat === 'function'); ok(instanceRepeat({}) === undefined); ok(typeof instanceRepeat('') === 'function'); ok(instanceRepeat('').call('a', 3) === 'aaa'); const instanceReplaceAll = load('features/instance/replace-all'); ok(typeof instanceReplaceAll === 'function'); ok(instanceReplaceAll({}) === undefined); ok(typeof instanceReplaceAll('') === 'function'); ok(instanceReplaceAll('').call('aba', 'a', 'c') === 'cbc'); let instanceReverse = load('features/instance/reverse'); ok(typeof instanceReverse === 'function'); ok(instanceReverse({}) === undefined); ok(typeof instanceReverse([]) === 'function'); instanceReverse = load('stable/instance/reverse'); ok(typeof instanceReverse === 'function'); ok(instanceReverse({}) === undefined); ok(typeof instanceReverse([]) === 'function'); instanceReverse = load('es/instance/reverse'); ok(typeof instanceReverse === 'function'); ok(instanceReverse({}) === undefined); ok(typeof instanceReverse([]) === 'function'); let instanceSlice = load('features/instance/slice'); ok(typeof instanceSlice === 'function'); ok(instanceSlice({}) === undefined); ok(typeof instanceSlice([]) === 'function'); instanceSlice = load('stable/instance/slice'); ok(typeof instanceSlice === 'function'); ok(instanceSlice({}) === undefined); ok(typeof instanceSlice([]) === 'function'); instanceSlice = load('es/instance/slice'); ok(typeof instanceSlice === 'function'); ok(instanceSlice({}) === undefined); ok(typeof instanceSlice([]) === 'function'); let instanceSome = load('features/instance/some'); ok(typeof instanceSome === 'function'); ok(instanceSome({}) === undefined); ok(typeof instanceSome([]) === 'function'); ok(instanceSome([]).call([1, 2, 3], it => typeof it === 'number')); instanceSome = load('stable/instance/some'); ok(typeof instanceSome === 'function'); ok(instanceSome({}) === undefined); ok(typeof instanceSome([]) === 'function'); ok(instanceSome([]).call([1, 2, 3], it => typeof it === 'number')); instanceSome = load('es/instance/some'); ok(typeof instanceSome === 'function'); ok(instanceSome({}) === undefined); ok(typeof instanceSome([]) === 'function'); ok(instanceSome([]).call([1, 2, 3], it => typeof it === 'number')); let instanceSort = load('features/instance/sort'); ok(typeof instanceSort === 'function'); ok(instanceSort({}) === undefined); ok(typeof instanceSort([]) === 'function'); instanceSort = load('stable/instance/sort'); ok(typeof instanceSort === 'function'); ok(instanceSort({}) === undefined); ok(typeof instanceSort([]) === 'function'); instanceSort = load('es/instance/sort'); ok(typeof instanceSort === 'function'); ok(instanceSort({}) === undefined); ok(typeof instanceSort([]) === 'function'); let instanceSplice = load('features/instance/splice'); ok(typeof instanceSplice === 'function'); ok(instanceSplice({}) === undefined); ok(typeof instanceSplice([]) === 'function'); instanceSplice = load('stable/instance/splice'); ok(typeof instanceSplice === 'function'); ok(instanceSplice({}) === undefined); ok(typeof instanceSplice([]) === 'function'); instanceSplice = load('es/instance/splice'); ok(typeof instanceSplice === 'function'); ok(instanceSplice({}) === undefined); ok(typeof instanceSplice([]) === 'function'); let instanceStartsWith = load('features/instance/starts-with'); ok(typeof instanceStartsWith === 'function'); ok(instanceStartsWith({}) === undefined); ok(typeof instanceStartsWith('') === 'function'); ok(instanceStartsWith('').call('qwe', 'qw')); instanceStartsWith = load('stable/instance/starts-with'); ok(typeof instanceStartsWith === 'function'); ok(instanceStartsWith({}) === undefined); ok(typeof instanceStartsWith('') === 'function'); ok(instanceStartsWith('').call('qwe', 'qw')); instanceStartsWith = load('es/instance/starts-with'); ok(typeof instanceStartsWith === 'function'); ok(instanceStartsWith({}) === undefined); ok(typeof instanceStartsWith('') === 'function'); ok(instanceStartsWith('').call('qwe', 'qw')); let instanceTrimEnd = load('features/instance/trim-end'); ok(typeof instanceTrimEnd === 'function'); ok(instanceTrimEnd({}) === undefined); ok(typeof instanceTrimEnd('') === 'function'); ok(instanceTrimEnd('').call(' 1 ') === ' 1'); instanceTrimEnd = load('stable/instance/trim-end'); ok(typeof instanceTrimEnd === 'function'); ok(instanceTrimEnd({}) === undefined); ok(typeof instanceTrimEnd('') === 'function'); ok(instanceTrimEnd('').call(' 1 ') === ' 1'); instanceTrimEnd = load('es/instance/trim-end'); ok(typeof instanceTrimEnd === 'function'); ok(instanceTrimEnd({}) === undefined); ok(typeof instanceTrimEnd('') === 'function'); ok(instanceTrimEnd('').call(' 1 ') === ' 1'); let instanceTrimLeft = load('features/instance/trim-left'); ok(typeof instanceTrimLeft === 'function'); ok(instanceTrimLeft({}) === undefined); ok(typeof instanceTrimLeft('') === 'function'); ok(instanceTrimLeft('').call(' 1 ') === '1 '); instanceTrimLeft = load('stable/instance/trim-left'); ok(typeof instanceTrimLeft === 'function'); ok(instanceTrimLeft({}) === undefined); ok(typeof instanceTrimLeft('') === 'function'); ok(instanceTrimLeft('').call(' 1 ') === '1 '); instanceTrimLeft = load('es/instance/trim-left'); ok(typeof instanceTrimLeft === 'function'); ok(instanceTrimLeft({}) === undefined); ok(typeof instanceTrimLeft('') === 'function'); ok(instanceTrimLeft('').call(' 1 ') === '1 '); let instanceTrimRight = load('features/instance/trim-right'); ok(typeof instanceTrimRight === 'function'); ok(instanceTrimRight({}) === undefined); ok(typeof instanceTrimRight('') === 'function'); ok(instanceTrimRight('').call(' 1 ') === ' 1'); instanceTrimRight = load('stable/instance/trim-right'); ok(typeof instanceTrimRight === 'function'); ok(instanceTrimRight({}) === undefined); ok(typeof instanceTrimRight('') === 'function'); ok(instanceTrimRight('').call(' 1 ') === ' 1'); instanceTrimRight = load('es/instance/trim-right'); ok(typeof instanceTrimRight === 'function'); ok(instanceTrimRight({}) === undefined); ok(typeof instanceTrimRight('') === 'function'); ok(instanceTrimRight('').call(' 1 ') === ' 1'); let instanceTrimStart = load('features/instance/trim-start'); ok(typeof instanceTrimStart === 'function'); ok(instanceTrimStart({}) === undefined); ok(typeof instanceTrimStart('') === 'function'); ok(instanceTrimStart('').call(' 1 ') === '1 '); instanceTrimStart = load('stable/instance/trim-start'); ok(typeof instanceTrimStart === 'function'); ok(instanceTrimStart({}) === undefined); ok(typeof instanceTrimStart('') === 'function'); ok(instanceTrimStart('').call(' 1 ') === '1 '); instanceTrimStart = load('es/instance/trim-start'); ok(typeof instanceTrimStart === 'function'); ok(instanceTrimStart({}) === undefined); ok(typeof instanceTrimStart('') === 'function'); ok(instanceTrimStart('').call(' 1 ') === '1 '); let instanceTrim = load('features/instance/trim'); ok(typeof instanceTrim === 'function'); ok(instanceTrim({}) === undefined); ok(typeof instanceTrim('') === 'function'); ok(instanceTrim('').call(' 1 ') === '1'); instanceTrim = load('stable/instance/trim'); ok(typeof instanceTrim === 'function'); ok(instanceTrim({}) === undefined); ok(typeof instanceTrim('') === 'function'); ok(instanceTrim('').call(' 1 ') === '1'); instanceTrim = load('es/instance/trim'); ok(typeof instanceTrim === 'function'); ok(instanceTrim({}) === undefined); ok(typeof instanceTrim('') === 'function'); ok(instanceTrim('').call(' 1 ') === '1'); let instanceValues = load('features/instance/values'); ok(typeof instanceValues === 'function'); ok(instanceValues({}) === undefined); ok(typeof instanceValues([]) === 'function'); ok(instanceValues([]).call([1, 2, 3]).next().value === 1); instanceValues = load('stable/instance/values'); ok(typeof instanceValues === 'function'); ok(instanceValues({}) === undefined); ok(typeof instanceValues([]) === 'function'); ok(instanceValues([]).call([1, 2, 3]).next().value === 1); instanceValues = load('es/instance/values'); ok(typeof instanceValues === 'function'); ok(instanceValues({}) === undefined); ok(typeof instanceValues([]) === 'function'); ok(instanceValues([]).call([1, 2, 3]).next().value === 1); for (const key in compat) load(`modules/${ key }`); } ok(typeof load('features/string/match') === 'function'); ok(typeof load('features/string/replace') === 'function'); ok(typeof load('features/string/search') === 'function'); ok(load('features/string/split')('a s d', ' ').length === 3); ok(typeof load('features/array-buffer') === 'function'); ok(typeof load('features/array-buffer/constructor') === 'function'); ok(typeof load('features/array-buffer/is-view') === 'function'); load('features/array-buffer/slice'); ok(typeof load('features/data-view') === 'function'); ok(typeof load('features/typed-array/int8-array') === 'function'); ok(typeof load('features/typed-array/uint8-array') === 'function'); ok(typeof load('features/typed-array/uint8-clamped-array') === 'function'); ok(typeof load('features/typed-array/int16-array') === 'function'); ok(typeof load('features/typed-array/uint16-array') === 'function'); ok(typeof load('features/typed-array/int32-array') === 'function'); ok(typeof load('features/typed-array/uint32-array') === 'function'); ok(typeof load('features/typed-array/float32-array') === 'function'); ok(typeof load('features/typed-array/float64-array') === 'function'); load('features/typed-array/copy-within'); load('features/typed-array/entries'); load('features/typed-array/every'); load('features/typed-array/fill'); load('features/typed-array/filter'); load('features/typed-array/find'); load('features/typed-array/find-index'); load('features/typed-array/for-each'); load('features/typed-array/from'); load('features/typed-array/includes'); load('features/typed-array/index-of'); load('features/typed-array/iterator'); load('features/typed-array/join'); load('features/typed-array/keys'); load('features/typed-array/last-index-of'); load('features/typed-array/map'); load('features/typed-array/of'); load('features/typed-array/reduce'); load('features/typed-array/reduce-right'); load('features/typed-array/reverse'); load('features/typed-array/set'); load('features/typed-array/slice'); load('features/typed-array/some'); load('features/typed-array/sort'); load('features/typed-array/subarray'); load('features/typed-array/to-locale-string'); load('features/typed-array/to-string'); load('features/typed-array/values'); ok(typeof load('features/typed-array').Uint32Array === 'function'); ok(typeof load('es/string/match') === 'function'); ok('next' in load('es/string/match-all')('a', /./g)); ok(typeof load('es/string/replace') === 'function'); ok(typeof load('es/string/search') === 'function'); ok(load('es/string/split')('a s d', ' ').length === 3); ok(typeof load('es/array-buffer') === 'function'); ok(typeof load('es/array-buffer/constructor') === 'function'); ok(typeof load('es/array-buffer/is-view') === 'function'); load('es/array-buffer/slice'); ok(typeof load('es/data-view') === 'function'); ok(typeof load('es/typed-array/int8-array') === 'function'); ok(typeof load('es/typed-array/uint8-array') === 'function'); ok(typeof load('es/typed-array/uint8-clamped-array') === 'function'); ok(typeof load('es/typed-array/int16-array') === 'function'); ok(typeof load('es/typed-array/uint16-array') === 'function'); ok(typeof load('es/typed-array/int32-array') === 'function'); ok(typeof load('es/typed-array/uint32-array') === 'function'); ok(typeof load('es/typed-array/float32-array') === 'function'); ok(typeof load('es/typed-array/float64-array') === 'function'); load('es/typed-array/copy-within'); load('es/typed-array/entries'); load('es/typed-array/every'); load('es/typed-array/fill'); load('es/typed-array/filter'); load('es/typed-array/find'); load('es/typed-array/find-index'); load('es/typed-array/for-each'); load('es/typed-array/from'); load('es/typed-array/includes'); load('es/typed-array/index-of'); load('es/typed-array/iterator'); load('es/typed-array/join'); load('es/typed-array/keys'); load('es/typed-array/last-index-of'); load('es/typed-array/map'); load('es/typed-array/of'); load('es/typed-array/reduce'); load('es/typed-array/reduce-right'); load('es/typed-array/reverse'); load('es/typed-array/set'); load('es/typed-array/slice'); load('es/typed-array/some'); load('es/typed-array/sort'); load('es/typed-array/subarray'); load('es/typed-array/to-locale-string'); load('es/typed-array/to-string'); load('es/typed-array/values'); ok(typeof load('es/typed-array').Uint32Array === 'function'); // eslint-disable-next-line no-console console.log(`Tested ${ tested } CommonJS entry points`); core-js-3.6.1/tests/compat/000077500000000000000000000000001360057567700155305ustar00rootroot00000000000000core-js-3.6.1/tests/compat/browsers-runner.js000066400000000000000000000012221360057567700212400ustar00rootroot00000000000000var table = document.getElementById('table'); for (var key in window.tests) { var test = window.tests[key]; var result = true; try { if (typeof test == 'function') { result = !!test(); } else { for (var i = 0; i < test.length; i++) result = result && !!test[i].call(undefined); } } catch (error) { result = false; } var tr = document.createElement('tr'); tr.className = result; var td1 = document.createElement('td'); td1.innerHTML = key; tr.appendChild(td1); var td2 = document.createElement('td'); td2.innerHTML = result ? 'not required' : 'required'; tr.appendChild(td2); table.appendChild(tr); } core-js-3.6.1/tests/compat/index.html000066400000000000000000000004331360057567700175250ustar00rootroot00000000000000 core-js-compat
core-js-3.6.1/tests/compat/node-runner.js000066400000000000000000000007031360057567700203220ustar00rootroot00000000000000require('./tests'); var tests = global.tests; var result = {}; for (var key in tests) { var test = tests[key]; try { if (typeof test == 'function') { result[key] = !!test(); } else result[key] = test.reduce(function (accumulator, $test) { return accumulator && !!$test(); }, true); } catch (error) { result[key] = false; } } // eslint-disable-next-line no-console console.log(JSON.stringify(result, null, ' ')); core-js-3.6.1/tests/compat/tests.js000066400000000000000000001270071360057567700172370ustar00rootroot00000000000000/* eslint-disable no-new, radix */ // eslint-disable-next-line no-new-func var GLOBAL = Function('return this')(); // eslint-disable-next-line max-len var WHITESPACES = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; var NOT_WHITESPACES = '\u200B\u0085\u180E'; var USERAGENT = GLOBAL.navigator && GLOBAL.navigator.userAgent || ''; // eslint-disable-next-line unicorn/no-unsafe-regex var WEBKIT_STRING_PAD_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(USERAGENT); var DESCRIPTORS_SUPPORT = function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a == 7; }; var PROMISES_SUPPORT = function () { var process = GLOBAL.process; var IS_NODE = Object.prototype.toString.call(process) == '[object process]'; var v8 = process && process.versions && process.versions.v8 || ''; var promise = Promise.resolve(1); var empty = function () { /* empty */ }; var FakePromise = (promise.constructor = {})[Symbol.species] = function (exec) { exec(empty, empty); }; return (IS_NODE || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise && v8.indexOf('6.6') !== 0 && USERAGENT.indexOf('Chrome/66') === -1; }; var SYMBOLS_SUPPORT = function () { return String(Symbol()); }; var URL_AND_URL_SEARCH_PARAMS_SUPPORT = function () { var url = new URL('b?a=1&b=2&c=3', 'http://a'); var searchParams = url.searchParams; var result = ''; url.pathname = 'c%20d'; searchParams.forEach(function (value, key) { searchParams['delete']('b'); result += key + value; }); return searchParams.sort && url.href === 'http://a/c%20d?a=1&c=3' && searchParams.get('c') === '3' && String(new URLSearchParams('?a=1')) === 'a=1' && searchParams[Symbol.iterator] && new URL('https://a@b').username === 'a' && new URLSearchParams(new URLSearchParams('a=b')).get('a') === 'b' && new URL('http://тест').host === 'xn--e1aybc' && new URL('http://a#б').hash === '#%D0%B1' && result === 'a1c3' && new URL('http://x', undefined).host === 'x'; }; var OBJECT_PROTOTYPE_ACCESSORS_SUPPORT = function () { try { Object.prototype.__defineSetter__.call(null, Math.random(), function () { /* empty */ }); } catch (error) { return Object.prototype.__defineSetter__; } }; var SAFE_ITERATION_CLOSING_SUPPORT = function () { var SAFE_CLOSING = false; try { var called = 0; var iteratorWithReturn = { next: function () { return { done: !!called++ }; }, 'return': function () { SAFE_CLOSING = true; } }; iteratorWithReturn[Symbol.iterator] = function () { return this; }; Array.from(iteratorWithReturn, function () { throw Error('close'); }); } catch (error) { return SAFE_CLOSING; } }; var ARRAY_BUFFER_SUPPORT = function () { return ArrayBuffer && DataView; }; var TYPED_ARRAY_CONSTRUCTORS_LIST = { Int8Array: 1, Uint8Array: 1, Uint8ClampedArray: 1, Int16Array: 2, Uint16Array: 2, Int32Array: 4, Uint32Array: 4, Float32Array: 4, Float64Array: 8 }; var ARRAY_BUFFER_VIEWS_SUPPORT = function () { for (var constructor in TYPED_ARRAY_CONSTRUCTORS_LIST) if (!GLOBAL[constructor]) return false; return ARRAY_BUFFER_SUPPORT(); }; var TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS = function () { try { return !Int8Array(1); } catch (error) { /* empty */ } try { return !new Int8Array(-1); } catch (error) { /* empty */ } new Int8Array(); new Int8Array(null); new Int8Array(1.5); var called = 0; var iterable = { next: function () { return { done: !!called++, value: 1 }; } }; iterable[Symbol.iterator] = function () { return this; }; return new Int8Array(iterable)[0] == 1 && new Int8Array(new ArrayBuffer(2), 1, undefined).length == 1; }; function createIsRegExpLogicTest(name) { return function () { var regexp = /./; try { '/./'[name](regexp); } catch (e) { try { regexp[Symbol.match] = false; return '/./'[name](regexp); } catch (f) { /* empty */ } } return false; }; } function createStringHTMLMethodTest(METHOD_NAME) { return function () { var test = ''[METHOD_NAME]('"'); return test == test.toLowerCase() && test.split('"').length <= 3; }; } function createStringTrimMethodTest(METHOD_NAME) { return function () { return !WHITESPACES[METHOD_NAME]() && NOT_WHITESPACES[METHOD_NAME]() === NOT_WHITESPACES && WHITESPACES[METHOD_NAME].name === METHOD_NAME; }; } GLOBAL.tests = { 'es.symbol': [SYMBOLS_SUPPORT, function () { return Object.getOwnPropertySymbols && Object.getOwnPropertySymbols('qwe') && Symbol['for'] && Symbol.keyFor && JSON.stringify([Symbol()]) == '[null]' && JSON.stringify({ a: Symbol() }) == '{}' && JSON.stringify(Object(Symbol())) == '{}' && Symbol.prototype[Symbol.toPrimitive] && Symbol.prototype[Symbol.toStringTag]; }], 'es.symbol.description': function () { return Symbol('foo').description == 'foo' && Symbol().description === undefined; }, 'es.symbol.async-iterator': function () { return Symbol.asyncIterator; }, 'es.symbol.has-instance': [SYMBOLS_SUPPORT, function () { return Symbol.hasInstance; }], 'es.symbol.is-concat-spreadable': [SYMBOLS_SUPPORT, function () { return Symbol.isConcatSpreadable; }], 'es.symbol.iterator': [SYMBOLS_SUPPORT, function () { return Symbol.iterator; }], 'es.symbol.match': [SYMBOLS_SUPPORT, function () { return Symbol.match; }], 'es.symbol.match-all': [SYMBOLS_SUPPORT, function () { return Symbol.matchAll; }], 'es.symbol.replace': [SYMBOLS_SUPPORT, function () { return Symbol.replace; }], 'es.symbol.search': [SYMBOLS_SUPPORT, function () { return Symbol.search; }], 'es.symbol.species': [SYMBOLS_SUPPORT, function () { return Symbol.species; }], 'es.symbol.split': [SYMBOLS_SUPPORT, function () { return Symbol.split; }], 'es.symbol.to-primitive': [SYMBOLS_SUPPORT, function () { return Symbol.toPrimitive; }], 'es.symbol.to-string-tag': [SYMBOLS_SUPPORT, function () { return Symbol.toStringTag; }], 'es.symbol.unscopables': [SYMBOLS_SUPPORT, function () { return Symbol.unscopables; }], 'es.array.concat': function () { var array1 = []; array1[Symbol.isConcatSpreadable] = false; var array2 = []; var constructor = array2.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array1.concat()[0] === array1 && array2.concat().foo === 1; }, 'es.array.copy-within': function () { return Array.prototype.copyWithin && Array.prototype[Symbol.unscopables].copyWithin; }, 'es.array.every': function () { try { Array.prototype.every.call(null, function () { /* empty */ }); return false; } catch (error) { /* empty */ } return Array.prototype.every; }, 'es.array.fill': function () { return Array.prototype.fill && Array.prototype[Symbol.unscopables].fill; }, 'es.array.filter': function () { [].filter.call({ length: -1, 0: 1 }, function (it) { throw it; }); var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.filter(Boolean).foo === 1; }, 'es.array.find': function () { var SKIPS_HOLES = true; Array(1).find(function () { return SKIPS_HOLES = false; }); return !SKIPS_HOLES && Array.prototype[Symbol.unscopables].find; }, 'es.array.find-index': function () { var SKIPS_HOLES = true; Array(1).findIndex(function () { return SKIPS_HOLES = false; }); return !SKIPS_HOLES && Array.prototype[Symbol.unscopables].findIndex; }, 'es.array.flat': function () { return Array.prototype.flat; }, 'es.array.flat-map': function () { return Array.prototype.flatMap; }, 'es.array.for-each': function () { try { Array.prototype.forEach.call(null, function () { /* empty */ }); return false; } catch (error) { /* empty */ } return Array.prototype.forEach; }, 'es.array.from': SAFE_ITERATION_CLOSING_SUPPORT, 'es.array.includes': function () { return Array.prototype.includes && Array.prototype[Symbol.unscopables].includes; }, 'es.array.index-of': function () { try { Array.prototype.indexOf.call(null); } catch (error) { return 1 / [1].indexOf(1, -0) > 0; } }, 'es.array.is-array': function () { return Array.isArray; }, 'es.array.iterator': [SYMBOLS_SUPPORT, function () { return [][Symbol.iterator] === [].values && [][Symbol.iterator].name === 'values' && [].entries()[Symbol.toStringTag] === 'Array Iterator' && [].keys().next() && [][Symbol.unscopables].keys && [][Symbol.unscopables].values && [][Symbol.unscopables].entries; }], 'es.array.join': function () { try { if (!Object.prototype.propertyIsEnumerable.call(Object('z'), 0)) return false; } catch (error) { return false; } try { Array.prototype.join.call(null); return false; } catch (error) { /* empty */ } return true; }, 'es.array.last-index-of': function () { try { Array.prototype.lastIndexOf.call(null); } catch (error) { return 1 / [1].lastIndexOf(1, -0) > 0; } }, 'es.array.map': function () { [].map.call({ length: -1, 0: 1 }, function (it) { throw it; }); var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.map(function () { return true; }).foo === 1; }, 'es.array.of': function () { function F() { /* empty */ } return Array.of.call(F) instanceof F; }, 'es.array.reduce': function () { try { Array.prototype.reduce.call(null, function () { /* empty */ }, 1); } catch (error) { return Array.prototype.reduce; } }, 'es.array.reduce-right': function () { try { Array.prototype.reduceRight.call(null, function () { /* empty */ }, 1); } catch (error) { return Array.prototype.reduceRight; } }, 'es.array.reverse': function () { var test = [1, 2]; return String(test) !== String(test.reverse()); }, 'es.array.slice': function () { var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.slice().foo === 1; }, 'es.array.some': function () { try { Array.prototype.some.call(null, function () { /* empty */ }); } catch (error) { return Array.prototype.some; } }, 'es.array.sort': function () { try { Array.prototype.sort.call(null); } catch (e) { try { [1, 2, 3].sort(null); } catch (f) { [1, 2, 3].sort(undefined); return true; } } }, 'es.array.species': [SYMBOLS_SUPPORT, function () { return Array[Symbol.species]; }], 'es.array.splice': function () { var array = []; var constructor = array.constructor = {}; constructor[Symbol.species] = function () { return { foo: 1 }; }; return array.splice().foo === 1; }, 'es.array.unscopables.flat': function () { return Array.prototype[Symbol.unscopables].flat; }, 'es.array.unscopables.flat-map': function () { return Array.prototype[Symbol.unscopables].flatMap; }, 'es.array-buffer.constructor': [ARRAY_BUFFER_SUPPORT, function () { try { return !ArrayBuffer(1); } catch (error) { /* empty */ } try { return !new ArrayBuffer(-1); } catch (error) { /* empty */ } new ArrayBuffer(); new ArrayBuffer(1.5); new ArrayBuffer(NaN); return ArrayBuffer.name == 'ArrayBuffer'; }], 'es.array-buffer.is-view': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return ArrayBuffer.isView; }], 'es.array-buffer.slice': [ARRAY_BUFFER_SUPPORT, function () { return new ArrayBuffer(2).slice(1, undefined).byteLength; }], 'es.data-view': ARRAY_BUFFER_SUPPORT, 'es.date.now': function () { return Date.now; }, 'es.date.to-iso-string': function () { try { new Date(NaN).toISOString(); } catch (error) { return new Date(-5e13 - 1).toISOString() == '0385-07-25T07:06:39.999Z'; } }, 'es.date.to-json': function () { return new Date(NaN).toJSON() === null && Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) === 1; }, 'es.date.to-primitive': [SYMBOLS_SUPPORT, function () { return Date.prototype[Symbol.toPrimitive]; }], 'es.date.to-string': function () { return new Date(NaN).toString() == 'Invalid Date'; }, 'es.function.bind': function () { return Function.prototype.bind; }, 'es.function.has-instance': [SYMBOLS_SUPPORT, function () { return Symbol.hasInstance in Function.prototype; }], 'es.function.name': function () { return 'name' in Function.prototype; }, 'es.global-this': function () { return globalThis; }, 'es.json.stringify': function () { return JSON.stringify('\uDF06\uD834') === '"\\udf06\\ud834"' && JSON.stringify('\uDEAD') === '"\\udead"'; }, 'es.json.to-string-tag': [SYMBOLS_SUPPORT, function () { return JSON[Symbol.toStringTag]; }], 'es.map': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var called = 0; var iterable = { next: function () { return { done: !!called++, value: [1, 2] }; } }; iterable[Symbol.iterator] = function () { return this; }; var map = new Map(iterable); return map.forEach && map[Symbol.iterator]().next() && map.get(1) == 2 && map.set(-0, 3) == map && map.has(0) && map[Symbol.toStringTag]; }], 'es.math.acosh': function () { // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 return Math.floor(Math.acosh(Number.MAX_VALUE)) == 710 // Tor Browser bug: Math.acosh(Infinity) -> NaN && Math.acosh(Infinity) == Infinity; }, 'es.math.asinh': function () { return 1 / Math.asinh(0) > 0; }, 'es.math.atanh': function () { return 1 / Math.atanh(-0) < 0; }, 'es.math.cbrt': function () { return Math.cbrt; }, 'es.math.clz32': function () { return Math.clz32; }, 'es.math.cosh': function () { return Math.cosh(710) !== Infinity; }, 'es.math.expm1': function () { // Old FF bug return Math.expm1(10) <= 22025.465794806719 && Math.expm1(10) >= 22025.4657948067165168 // Tor Browser bug && Math.expm1(-2e-17) == -2e-17; }, 'es.math.fround': function () { return Math.fround; }, 'es.math.hypot': function () { return Math.hypot && Math.hypot(Infinity, NaN) === Infinity; }, 'es.math.imul': function () { return Math.imul(0xFFFFFFFF, 5) == -5 && Math.imul.length == 2; }, 'es.math.log10': function () { return Math.log10; }, 'es.math.log1p': function () { return Math.log1p; }, 'es.math.log2': function () { return Math.log2; }, 'es.math.sign': function () { return Math.sign; }, 'es.math.sinh': function () { return Math.sinh(-2e-17) == -2e-17; }, 'es.math.tanh': function () { return Math.tanh; }, 'es.math.to-string-tag': function () { return Math[Symbol.toStringTag]; }, 'es.math.trunc': function () { return Math.trunc; }, 'es.number.constructor': function () { return Number(' 0o1') && Number('0b1') && !Number('+0x1'); }, 'es.number.epsilon': function () { return Number.EPSILON; }, 'es.number.is-finite': function () { return Number.isFinite; }, 'es.number.is-integer': function () { return Number.isInteger; }, 'es.number.is-nan': function () { return Number.isNaN; }, 'es.number.is-safe-integer': function () { return Number.isSafeInteger; }, 'es.number.max-safe-integer': function () { return Number.MAX_SAFE_INTEGER; }, 'es.number.min-safe-integer': function () { return Number.MIN_SAFE_INTEGER; }, 'es.number.parse-float': function () { return Number.parseFloat === parseFloat && 1 / Number.parseFloat(WHITESPACES + '-0') === -Infinity; }, 'es.number.parse-int': function () { return Number.parseInt === parseInt && Number.parseInt(WHITESPACES + '08') === 8 && Number.parseInt(WHITESPACES + '0x16') === 22; }, 'es.number.to-fixed': function () { try { Number.prototype.toFixed.call({}); } catch (error) { return 0.00008.toFixed(3) === '0.000' && 0.9.toFixed(0) === '1' && 1.255.toFixed(2) === '1.25' && 1000000000000000128.0.toFixed(0) === '1000000000000000128'; } }, 'es.number.to-precision': function () { try { Number.prototype.toPrecision.call({}); } catch (error) { return 1.0.toPrecision(undefined) === '1'; } }, 'es.object.assign': function () { if (DESCRIPTORS_SUPPORT && Object.assign({ b: 1 }, Object.assign(Object.defineProperty({}, 'a', { enumerable: true, get: function () { Object.defineProperty(this, 'b', { value: 3, enumerable: false }); } }), { b: 2 })).b !== 1) return false; var A = {}; var B = {}; var symbol = Symbol(); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); return Object.assign({}, A)[symbol] == 7 && Object.keys(Object.assign({}, B)).join('') == alphabet; }, 'es.object.create': function () { return Object.create; }, 'es.object.define-getter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.define-properties': [DESCRIPTORS_SUPPORT, function () { return Object.defineProperties; }], 'es.object.define-property': DESCRIPTORS_SUPPORT, 'es.object.define-setter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.entries': function () { return Object.entries; }, 'es.object.freeze': function () { return Object.freeze(true); }, 'es.object.from-entries': function () { return Object.fromEntries; }, 'es.object.get-own-property-descriptor': [DESCRIPTORS_SUPPORT, function () { return Object.getOwnPropertyDescriptor('qwe', '0'); }], 'es.object.get-own-property-descriptors': function () { return Object.getOwnPropertyDescriptors; }, 'es.object.get-own-property-names': function () { return Object.getOwnPropertyNames('qwe'); }, 'es.object.get-prototype-of': function () { return Object.getPrototypeOf('qwe'); }, 'es.object.is': function () { return Object.is; }, 'es.object.is-extensible': function () { return !Object.isExtensible('qwe'); }, 'es.object.is-frozen': function () { return Object.isFrozen('qwe'); }, 'es.object.is-sealed': function () { return Object.isSealed('qwe'); }, 'es.object.keys': function () { return Object.keys('qwe'); }, 'es.object.lookup-getter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.lookup-setter': OBJECT_PROTOTYPE_ACCESSORS_SUPPORT, 'es.object.prevent-extensions': function () { return Object.preventExtensions(true); }, 'es.object.seal': function () { return Object.seal(true); }, 'es.object.set-prototype-of': function () { return Object.setPrototypeOf; }, 'es.object.to-string': [SYMBOLS_SUPPORT, function () { var O = {}; O[Symbol.toStringTag] = 'foo'; return String(O) === '[object foo]'; }], 'es.object.values': function () { return Object.values; }, 'es.parse-float': function () { return 1 / parseFloat(WHITESPACES + '-0') === -Infinity; }, 'es.parse-int': function () { return parseInt(WHITESPACES + '08') === 8 && parseInt(WHITESPACES + '0x16') === 22; }, 'es.promise': PROMISES_SUPPORT, 'es.promise.all-settled': function () { return Promise.allSettled; }, 'es.promise.finally': [PROMISES_SUPPORT, function () { return Promise.prototype['finally'].call({ then: function () { return this; } }, function () { /* empty */ }); }], 'es.reflect.apply': function () { try { return Reflect.apply(function () { return false; }); } catch (error) { return Reflect.apply(function () { return true; }, null, []); } }, 'es.reflect.construct': function () { try { return !Reflect.construct(function () { /* empty */ }); } catch (error) { /* empty */ } function F() { /* empty */ } return Reflect.construct(function () { /* empty */ }, [], F) instanceof F; }, 'es.reflect.define-property': function () { return !Reflect.defineProperty(Object.defineProperty({}, 1, { value: 1 }), 1, { value: 2 }); }, 'es.reflect.delete-property': function () { return Reflect.deleteProperty; }, 'es.reflect.get': function () { return Reflect.get; }, 'es.reflect.get-own-property-descriptor': function () { return Reflect.getOwnPropertyDescriptor; }, 'es.reflect.get-prototype-of': function () { return Reflect.getPrototypeOf; }, 'es.reflect.has': function () { return Reflect.has; }, 'es.reflect.is-extensible': function () { return Reflect.isExtensible; }, 'es.reflect.own-keys': function () { return Reflect.ownKeys; }, 'es.reflect.prevent-extensions': function () { return Reflect.preventExtensions; }, 'es.reflect.set': function () { var object = Object.defineProperty({}, 'a', { configurable: true }); return Reflect.set(Object.getPrototypeOf(object), 'a', 1, object) === false; }, 'es.reflect.set-prototype-of': function () { return Reflect.setPrototypeOf; }, 'es.regexp.constructor': function () { var re1 = /a/g; var re2 = /a/g; re2[Symbol.match] = false; return new RegExp(re1) !== re1 && RegExp(re1) === re1 && RegExp(re2) !== re2 && RegExp(re1, 'i') == '/a/i' && new RegExp('a', 'y') // just check that it doesn't throw && RegExp[Symbol.species]; }, 'es.regexp.exec': function () { var re1 = /a/; var re2 = /b*/g; var reSticky = new RegExp('a', 'y'); var reStickyAnchored = new RegExp('^a', 'y'); re1.exec('a'); re2.exec('a'); return re1.lastIndex === 0 && re2.lastIndex === 0 && /()??/.exec('')[1] === undefined && reSticky.exec('abc')[0] === 'a' && reSticky.exec('abc') === null && (reSticky.lastIndex = 1, reSticky.exec('bac')[0] === 'a') && (reStickyAnchored.lastIndex = 2, reStickyAnchored.exec('cba') === null); }, 'es.regexp.flags': function () { return /./g.flags === 'g' && new RegExp('a', 'y').flags === 'y'; }, 'es.regexp.sticky': function () { return new RegExp('a', 'y').sticky === true; }, 'es.regexp.test': function () { var execCalled = false; var re = /[ac]/; re.exec = function () { execCalled = true; return /./.exec.apply(this, arguments); }; return re.test('abc') === true && execCalled; }, 'es.regexp.to-string': function () { return RegExp.prototype.toString.call({ source: 'a', flags: 'b' }) === '/a/b' && RegExp.prototype.toString.name === 'toString'; }, 'es.set': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var called = 0; var iterable = { next: function () { return { done: !!called++, value: 1 }; } }; iterable[Symbol.iterator] = function () { return this; }; var set = new Set(iterable); return set.forEach && set[Symbol.iterator]().next() && set.has(1) && set.add(-0) == set && set.has(0) && set[Symbol.toStringTag]; }], 'es.string.code-point-at': function () { return String.prototype.codePointAt; }, 'es.string.ends-with': createIsRegExpLogicTest('endsWith'), 'es.string.from-code-point': function () { return String.fromCodePoint; }, 'es.string.includes': createIsRegExpLogicTest('includes'), 'es.string.iterator': [SYMBOLS_SUPPORT, function () { return ''[Symbol.iterator]; }], 'es.string.match': function () { var O = {}; O[Symbol.match] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re[Symbol.match](''); return ''.match(O) == 7 && execCalled; }, 'es.string.match-all': function () { try { 'a'.matchAll(/./); } catch (error) { return 'a'.matchAll(/./g); } }, 'es.string.pad-end': function () { return String.prototype.padEnd && !WEBKIT_STRING_PAD_BUG; }, 'es.string.pad-start': function () { return String.prototype.padStart && !WEBKIT_STRING_PAD_BUG; }, 'es.string.raw': function () { return String.raw; }, 'es.string.repeat': function () { return String.prototype.repeat; }, 'es.string.replace': function () { var O = {}; O[Symbol.replace] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re[Symbol.replace](''); var re2 = /./; re2.exec = function () { var result = []; result.groups = { a: '7' }; return result; }; return ''.replace(O) == 7 && execCalled && ''.replace(re2, '$
') === '7'; }, 'es.string.search': function () { var O = {}; O[Symbol.search] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re[Symbol.search](''); return ''.search(O) == 7 && execCalled; }, 'es.string.split': function () { var O = {}; O[Symbol.split] = function () { return 7; }; var execCalled = false; var re = /a/; re.exec = function () { execCalled = true; return null; }; re.constructor = {}; re.constructor[Symbol.species] = function () { return re; }; re[Symbol.split](''); var re2 = /(?:)/; var originalExec = re2.exec; re2.exec = function () { return originalExec.apply(this, arguments); }; var result = 'ab'.split(re2); return ''.split(O) == 7 && execCalled && result.length === 2 && result[0] === 'a' && result[1] === 'b'; }, 'es.string.starts-with': createIsRegExpLogicTest('startsWith'), 'es.string.trim': createStringTrimMethodTest('trim'), 'es.string.trim-end': [createStringTrimMethodTest('trimEnd'), function () { return String.prototype.trimRight === String.prototype.trimEnd; }], 'es.string.trim-start': [createStringTrimMethodTest('trimStart'), function () { return String.prototype.trimLeft === String.prototype.trimStart; }], 'es.string.anchor': createStringHTMLMethodTest('anchor'), 'es.string.big': createStringHTMLMethodTest('big'), 'es.string.blink': createStringHTMLMethodTest('blink'), 'es.string.bold': createStringHTMLMethodTest('bold'), 'es.string.fixed': createStringHTMLMethodTest('fixed'), 'es.string.fontcolor': createStringHTMLMethodTest('fontcolor'), 'es.string.fontsize': createStringHTMLMethodTest('fontsize'), 'es.string.italics': createStringHTMLMethodTest('italics'), 'es.string.link': createStringHTMLMethodTest('link'), 'es.string.small': createStringHTMLMethodTest('small'), 'es.string.strike': createStringHTMLMethodTest('strike'), 'es.string.sub': createStringHTMLMethodTest('sub'), 'es.string.sup': createStringHTMLMethodTest('sup'), 'es.typed-array.float32-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.float64-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.int8-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.int16-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.int32-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint8-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint8-clamped-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint16-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.uint32-array': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS ], 'es.typed-array.copy-within': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.copyWithin; }], 'es.typed-array.every': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.every; }], 'es.typed-array.fill': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.fill; }], 'es.typed-array.filter': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.filter; }], 'es.typed-array.find': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.find; }], 'es.typed-array.find-index': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.findIndex; }], 'es.typed-array.for-each': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.forEach; }], 'es.typed-array.from': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS, function () { return Int8Array.from; } ], 'es.typed-array.includes': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.includes; }], 'es.typed-array.index-of': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.indexOf; }], 'es.typed-array.iterator': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype[Symbol.iterator].name === 'values' && Int8Array.prototype[Symbol.iterator] === Int8Array.prototype.values && Int8Array.prototype.keys && Int8Array.prototype.entries; }], 'es.typed-array.join': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.join; }], 'es.typed-array.last-index-of': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.lastIndexOf; }], 'es.typed-array.map': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.map; }], 'es.typed-array.of': [ ARRAY_BUFFER_VIEWS_SUPPORT, TYPED_ARRAY_CONSTRUCTORS_NOT_REQUIRES_WRAPPERS, function () { return Int8Array.of; } ], 'es.typed-array.reduce': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.reduce; }], 'es.typed-array.reduce-right': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.reduceRight; }], 'es.typed-array.reverse': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.reverse; }], 'es.typed-array.set': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { new Int8Array(1).set({}); return true; }], 'es.typed-array.slice': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return new Int8Array(1).slice(); }], 'es.typed-array.some': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.some; }], 'es.typed-array.sort': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.sort; }], 'es.typed-array.subarray': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.subarray; }], 'es.typed-array.to-locale-string': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { try { Int8Array.prototype.toLocaleString.call([1, 2]); } catch (error) { return [1, 2].toLocaleString() == new Int8Array([1, 2]).toLocaleString(); } }], 'es.typed-array.to-string': [ARRAY_BUFFER_VIEWS_SUPPORT, function () { return Int8Array.prototype.toString == Array.prototype.toString; }], 'es.weak-map': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var key = Object.freeze({}); var called = 0; var iterable = { next: function () { return { done: !!called++, value: [key, 1] }; } }; iterable[Symbol.iterator] = function () { return this; }; var map = new WeakMap(iterable); return map.get(key) == 1 && map.get(null) == undefined && map.set({}, 2) == map && map[Symbol.toStringTag]; }], 'es.weak-set': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var key = {}; var called = 0; var iterable = { next: function () { return { done: !!called++, value: key }; } }; iterable[Symbol.iterator] = function () { return this; }; var set = new WeakSet(iterable); return set.has(key) && !set.has(null) && set.add({}) == set && set[Symbol.toStringTag]; }], 'esnext.aggregate-error': function () { return typeof AggregateError === 'function'; }, 'esnext.array.last-index': function () { return [1, 2, 3].lastIndex && Array.prototype[Symbol.unscopables].lastIndex; }, 'esnext.array.last-item': function () { return [1, 2, 3].lastItem && Array.prototype[Symbol.unscopables].lastItem; }, 'esnext.async-iterator.constructor': function () { return typeof AsyncIterator == 'function'; }, 'esnext.async-iterator.as-indexed-pairs': function () { return AsyncIterator.prototype.asIndexedPairs; }, 'esnext.async-iterator.drop': function () { return AsyncIterator.prototype.drop; }, 'esnext.async-iterator.every': function () { return AsyncIterator.prototype.every; }, 'esnext.async-iterator.filter': function () { return AsyncIterator.prototype.filter; }, 'esnext.async-iterator.find': function () { return AsyncIterator.prototype.find; }, 'esnext.async-iterator.flat-map': function () { return AsyncIterator.prototype.flatMap; }, 'esnext.async-iterator.for-each': function () { return AsyncIterator.prototype.forEach; }, 'esnext.async-iterator.from': function () { return AsyncIterator.from; }, 'esnext.async-iterator.map': function () { return AsyncIterator.prototype.map; }, 'esnext.async-iterator.reduce': function () { return AsyncIterator.prototype.reduce; }, 'esnext.async-iterator.some': function () { return AsyncIterator.prototype.some; }, 'esnext.async-iterator.take': function () { return AsyncIterator.prototype.take; }, 'esnext.async-iterator.to-array': function () { return AsyncIterator.prototype.toArray; }, 'esnext.composite-key': function () { return compositeKey; }, 'esnext.composite-symbol': function () { return compositeSymbol; }, 'esnext.iterator.constructor': function () { return typeof Iterator == 'function' && Iterator.prototype === Object.getPrototypeOf(Object.getPrototypeOf([].values())); }, 'esnext.iterator.as-indexed-pairs': function () { return Iterator.prototype.asIndexedPairs; }, 'esnext.iterator.drop': function () { return Iterator.prototype.drop; }, 'esnext.iterator.every': function () { return Iterator.prototype.every; }, 'esnext.iterator.filter': function () { return Iterator.prototype.filter; }, 'esnext.iterator.find': function () { return Iterator.prototype.find; }, 'esnext.iterator.flat-map': function () { return Iterator.prototype.flatMap; }, 'esnext.iterator.for-each': function () { return Iterator.prototype.forEach; }, 'esnext.iterator.from': function () { return Iterator.from; }, 'esnext.iterator.map': function () { return Iterator.prototype.map; }, 'esnext.iterator.reduce': function () { return Iterator.prototype.reduce; }, 'esnext.iterator.some': function () { return Iterator.prototype.some; }, 'esnext.iterator.take': function () { return Iterator.prototype.take; }, 'esnext.iterator.to-array': function () { return Iterator.prototype.toArray; }, 'esnext.map.delete-all': function () { return Map.prototype.deleteAll; }, 'esnext.map.every': function () { return Map.prototype.every; }, 'esnext.map.filter': function () { return Map.prototype.filter; }, 'esnext.map.find': function () { return Map.prototype.find; }, 'esnext.map.find-key': function () { return Map.prototype.findKey; }, 'esnext.map.from': function () { return Map.from; }, 'esnext.map.group-by': function () { return Map.groupBy; }, 'esnext.map.includes': function () { return Map.prototype.includes; }, 'esnext.map.key-by': function () { return Map.keyBy; }, 'esnext.map.key-of': function () { return Map.prototype.keyOf; }, 'esnext.map.map-keys': function () { return Map.prototype.mapKeys; }, 'esnext.map.map-values': function () { return Map.prototype.mapValues; }, 'esnext.map.merge': function () { return Map.prototype.merge; }, 'esnext.map.of': function () { return Map.of; }, 'esnext.map.reduce': function () { return Map.prototype.reduce; }, 'esnext.map.some': function () { return Map.prototype.some; }, 'esnext.map.update': function () { return Map.prototype.update; }, // TODO: Remove from `core-js@4` 'esnext.map.update-or-insert': function () { return Map.prototype.updateOrInsert; }, 'esnext.map.upsert': function () { return Map.prototype.upsert; }, 'esnext.math.clamp': function () { return Math.clamp; }, 'esnext.math.deg-per-rad': function () { return Math.DEG_PER_RAD; }, 'esnext.math.degrees': function () { return Math.degrees; }, 'esnext.math.fscale': function () { return Math.fscale; }, // TODO: Remove from `core-js@4` 'esnext.math.iaddh': function () { return Math.iaddh; }, // TODO: Remove from `core-js@4` 'esnext.math.imulh': function () { return Math.imulh; }, // TODO: Remove from `core-js@4` 'esnext.math.isubh': function () { return Math.isubh; }, 'esnext.math.rad-per-deg': function () { return Math.RAD_PER_DEG; }, 'esnext.math.radians': function () { return Math.radians; }, 'esnext.math.scale': function () { return Math.scale; }, 'esnext.math.seeded-prng': function () { return Math.seededPRNG; }, 'esnext.math.signbit': function () { return Math.signbit; }, // TODO: Remove from `core-js@4` 'esnext.math.umulh': function () { return Math.umulh; }, 'esnext.number.from-string': function () { return Number.fromString; }, 'esnext.object.iterate-entries': function () { return Object.iterateEntries; }, 'esnext.object.iterate-keys': function () { return Object.iterateKeys; }, 'esnext.object.iterate-values': function () { return Object.iterateValues; }, 'esnext.observable': function () { return Observable; }, 'esnext.promise.any': function () { return Promise.any; }, 'esnext.promise.try': [PROMISES_SUPPORT, function () { return Promise['try']; }], 'esnext.reflect.define-metadata': function () { return Reflect.defineMetadata; }, 'esnext.reflect.delete-metadata': function () { return Reflect.deleteMetadata; }, 'esnext.reflect.get-metadata': function () { return Reflect.getMetadata; }, 'esnext.reflect.get-metadata-keys': function () { return Reflect.getMetadataKeys; }, 'esnext.reflect.get-own-metadata': function () { return Reflect.getOwnMetadata; }, 'esnext.reflect.get-own-metadata-keys': function () { return Reflect.getOwnMetadataKeys; }, 'esnext.reflect.has-metadata': function () { return Reflect.hasMetadata; }, 'esnext.reflect.has-own-metadata': function () { return Reflect.hasOwnMetadata; }, 'esnext.reflect.metadata': function () { return Reflect.metadata; }, 'esnext.set.add-all': function () { return Set.prototype.addAll; }, 'esnext.set.delete-all': function () { return Set.prototype.deleteAll; }, 'esnext.set.difference': function () { return Set.prototype.difference; }, 'esnext.set.every': function () { return Set.prototype.every; }, 'esnext.set.filter': function () { return Set.prototype.filter; }, 'esnext.set.find': function () { return Set.prototype.find; }, 'esnext.set.from': function () { return Set.from; }, 'esnext.set.intersection': function () { return Set.prototype.intersection; }, 'esnext.set.is-disjoint-from': function () { return Set.prototype.isDisjointFrom; }, 'esnext.set.is-subset-of': function () { return Set.prototype.isSubsetOf; }, 'esnext.set.is-superset-of': function () { return Set.prototype.isSupersetOf; }, 'esnext.set.join': function () { return Set.prototype.join; }, 'esnext.set.map': function () { return Set.prototype.map; }, 'esnext.set.of': function () { return Set.of; }, 'esnext.set.reduce': function () { return Set.prototype.reduce; }, 'esnext.set.some': function () { return Set.prototype.some; }, 'esnext.set.symmetric-difference': function () { return Set.prototype.symmetricDifference; }, 'esnext.set.union': function () { return Set.prototype.union; }, 'esnext.string.at': function () { return String.prototype.at; }, 'esnext.string.code-points': function () { return String.prototype.codePoints; }, 'esnext.string.replace-all': function () { return String.prototype.replaceAll; }, 'esnext.symbol.dispose': function () { return Symbol.dispose; }, 'esnext.symbol.observable': function () { return Symbol.observable; }, 'esnext.symbol.pattern-match': function () { return Symbol.patternMatch; }, // TODO: Remove from `core-js@4` 'esnext.symbol.replace-all': function () { return Symbol.replaceAll; }, 'esnext.weak-map.delete-all': function () { return WeakMap.prototype.deleteAll; }, 'esnext.weak-map.from': function () { return WeakMap.from; }, 'esnext.weak-map.of': function () { return WeakMap.of; }, 'esnext.weak-map.upsert': function () { return WeakMap.prototype.upsert; }, 'esnext.weak-set.add-all': function () { return WeakSet.prototype.addAll; }, 'esnext.weak-set.delete-all': function () { return WeakSet.prototype.deleteAll; }, 'esnext.weak-set.from': function () { return WeakSet.from; }, 'esnext.weak-set.of': function () { return WeakSet.of; }, 'web.dom-collections.for-each': function () { return (!GLOBAL.NodeList || (NodeList.prototype.forEach && NodeList.prototype.forEach === [].forEach)) && (!GLOBAL.DOMTokenList || (DOMTokenList.prototype.forEach && DOMTokenList.prototype.forEach === [].forEach)); }, 'web.dom-collections.iterator': function () { var DOMIterables = { CSSRuleList: 0, CSSStyleDeclaration: 0, CSSValueList: 0, ClientRectList: 0, DOMRectList: 0, DOMStringList: 0, DOMTokenList: 1, DataTransferItemList: 0, FileList: 0, HTMLAllCollection: 0, HTMLCollection: 0, HTMLFormElement: 0, HTMLSelectElement: 0, MediaList: 0, MimeTypeArray: 0, NamedNodeMap: 0, NodeList: 1, PaintRequestList: 0, Plugin: 0, PluginArray: 0, SVGLengthList: 0, SVGNumberList: 0, SVGPathSegList: 0, SVGPointList: 0, SVGStringList: 0, SVGTransformList: 0, SourceBufferList: 0, StyleSheetList: 0, TextTrackCueList: 0, TextTrackList: 0, TouchList: 0 }; for (var collection in DOMIterables) { if (GLOBAL[collection]) { if ( !GLOBAL[collection].prototype[Symbol.iterator] || GLOBAL[collection].prototype[Symbol.iterator] !== [].values ) return false; if (DOMIterables[collection] && ( !GLOBAL[collection].prototype.keys || !GLOBAL[collection].prototype.values || !GLOBAL[collection].prototype.entries )) return false; } } return true; }, 'web.immediate': function () { return setImmediate && clearImmediate; }, 'web.queue-microtask': function () { return Object.getOwnPropertyDescriptor(GLOBAL, 'queueMicrotask').value; }, 'web.timers': function () { return !/MSIE .\./.test(USERAGENT); }, 'web.url': URL_AND_URL_SEARCH_PARAMS_SUPPORT, 'web.url.to-json': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () { return URL.prototype.toJSON; }], 'web.url-search-params': URL_AND_URL_SEARCH_PARAMS_SUPPORT }; core-js-3.6.1/tests/helpers/000077500000000000000000000000001360057567700157075ustar00rootroot00000000000000core-js-3.6.1/tests/helpers/constants.js000066400000000000000000000025741360057567700202710ustar00rootroot00000000000000export const DESCRIPTORS = !!(() => { try { return Object.defineProperty({}, 'a', { get() { return 7; }, }).a === 7; } catch { /* empty */ } })(); export const GLOBAL = Function('return this')(); export const NATIVE = GLOBAL.NATIVE || false; export const TYPED_ARRAYS = { Float32Array: 4, Float64Array: 8, Int8Array: 1, Int16Array: 2, Int32Array: 4, Uint8Array: 1, Uint16Array: 2, Uint32Array: 4, Uint8ClampedArray: 1, }; export const LITTLE_ENDIAN = (() => { try { return new GLOBAL.Uint8Array(new GLOBAL.Uint16Array([1]).buffer)[0] === 1; } catch { return true; } })(); export const PROTO = !!Object.setPrototypeOf || '__proto__' in Object.prototype; export const STRICT = !function () { return this; }(); export const STRICT_THIS = (function () { return this; })(); export const FREEZING = !function () { try { return Object.isExtensible(Object.preventExtensions({})); } catch { return true; } }(); export const CORRECT_PROTOTYPE_GETTER = !function () { try { function F() { /* empty */ } F.prototype.constructor = null; return Object.getPrototypeOf(new F()) !== F.prototype; } catch { return true; } }(); export const WHITESPACES = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; core-js-3.6.1/tests/helpers/helpers.js000066400000000000000000000046351360057567700177170ustar00rootroot00000000000000import Promise from 'core-js-pure/es/promise'; import ITERATOR from 'core-js-pure/features/symbol/iterator'; export function createIterator(elements, methods) { let index = 0; const iterator = { called: false, next() { iterator.called = true; return { value: elements[index++], done: index > elements.length, }; }, }; if (methods) for (const key in methods) iterator[key] = methods[key]; return iterator; } export function createIterable(elements, methods) { const iterable = { called: false, received: false, [ITERATOR]() { iterable.received = true; let index = 0; const iterator = { next() { iterable.called = true; return { value: elements[index++], done: index > elements.length, }; }, }; if (methods) for (const key in methods) iterator[key] = methods[key]; return iterator; }, }; return iterable; } export function includes(target, wanted) { for (const element of target) if (wanted === element) return true; return false; } export function is(a, b) { // eslint-disable-next-line no-self-compare return a === b ? a !== 0 || 1 / a === 1 / b : a != a && b != b; } export const nativeSubclass = (() => { try { if (Function(` 'use strict'; class Subclass extends Object { /* empty */ }; return new Subclass() instanceof Subclass; `)()) return Function('Parent', ` 'use strict'; return class extends Parent { /* empty */ }; `); } catch { /* empty */ } })(); export function timeLimitedPromise(time, fn) { return Promise.race([ new Promise(fn), new Promise((resolve, reject) => { setTimeout(reject, time); }), ]); } // This function is used to force RegExp.prototype[Symbol.*] methods // to not use the native implementation. export function patchRegExp$exec(run) { return assert => { const originalExec = RegExp.prototype.exec; // eslint-disable-next-line no-extend-native RegExp.prototype.exec = function () { return originalExec.apply(this, arguments); }; try { return run(assert); // In very old IE try / finally does not work without catch. // eslint-disable-next-line no-useless-catch } catch (error) { throw error; } finally { // eslint-disable-next-line no-extend-native RegExp.prototype.exec = originalExec; } }; } core-js-3.6.1/tests/helpers/qunit-helpers.js000066400000000000000000000100331360057567700210420ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL } from './constants'; import isIterable from 'core-js-pure/features/is-iterable'; import ASYNC_ITERATOR from 'core-js-pure/es/symbol/async-iterator'; import { is } from './helpers'; const { toString, propertyIsEnumerable } = Object.prototype.propertyIsEnumerable; GLOBAL.USE_FUNCTION_CONSTRUCTOR = true; QUnit.assert.arity = function (fn, length, message) { this.pushResult({ result: fn.length === length, actual: fn.length, expected: length, message: message || `arity is ${ length }`, }); }; QUnit.assert.arrayEqual = function (a, b, message) { let result = true; if (a.length !== b.length) { result = false; } else { for (let i = 0, { length } = a; i < length; ++i) { if (!is(a[i], b[i])) { result = false; break; } } } this.pushResult({ result, actual: [].slice.call(a), expected: [].slice.call(b), message, }); }; QUnit.assert.epsilon = function (a, b, E, message) { this.pushResult({ result: Math.abs(a - b) <= (E != null ? E : 1e-11), actual: a, expected: b, message, }); }; QUnit.assert.isFunction = function (fn, message) { this.pushResult({ result: typeof fn === 'function' || toString.call(fn).slice(8, -1) === 'Function', actual: false, expected: true, message: message || 'is function', }); }; QUnit.assert.isAsyncIterable = function (it, message) { this.pushResult({ result: typeof it == 'object' && typeof it[ASYNC_ITERATOR] == 'function', actual: false, expected: true, message: message || 'is async iterable', }); }; QUnit.assert.isIterable = function (it, message) { this.pushResult({ result: isIterable(it), actual: false, expected: true, message: message || 'is iterable', }); }; QUnit.assert.isIterator = function (it, message) { this.pushResult({ result: typeof it === 'object' && typeof it.next === 'function', actual: false, expected: true, message: message || 'is iterator', }); }; QUnit.assert.looksNative = function (fn, message) { this.pushResult({ result: /native code/.test(Function.prototype.toString.call(fn)), actual: false, expected: true, message: message || 'looks native', }); }; QUnit.assert.name = function (fn, name, message) { if (typeof fn == 'function' && 'name' in fn) { this.pushResult({ result: fn.name === name, actual: fn.name, expected: name, message: message || `name is '${ name }'`, }); } else { this.pushResult({ result: true, actual: true, expected: true, message: 'Function#name property test makes no sense', }); } }; QUnit.assert.enumerable = function (O, key, message) { if (DESCRIPTORS) { this.pushResult({ result: propertyIsEnumerable.call(O, key), actual: false, expected: true, message: message || `${ typeof key === 'symbol' ? 'method' : `'${ key }'` } is enumerable`, }); } else { this.pushResult({ result: true, actual: true, expected: true, message: 'Enumerability is not applicable', }); } }; QUnit.assert.nonEnumerable = function (O, key, message) { if (DESCRIPTORS) { this.pushResult({ result: !propertyIsEnumerable.call(O, key), actual: false, expected: true, message: message || `${ typeof key === 'symbol' ? 'method' : `'${ key }'` } is non-enumerable`, }); } else { this.pushResult({ result: true, actual: true, expected: true, message: 'Enumerability is not applicable', }); } }; QUnit.assert.notThrows = function (fn, message) { let throws, result, error; try { result = fn(); throws = false; } catch (err) { throws = true; error = err; } this.pushResult({ result: !throws && result, actual: throws ? error : result, expected: throws ? undefined : true, message: message || 'does not throw', }); }; QUnit.assert.same = function (a, b, message) { this.pushResult({ result: is(a, b), actual: a, expected: b, message, }); }; core-js-3.6.1/tests/observables/000077500000000000000000000000001360057567700165545ustar00rootroot00000000000000core-js-3.6.1/tests/observables/adapter-pure.js000066400000000000000000000003731360057567700215060ustar00rootroot00000000000000'use strict'; const core = require('../../packages/core-js-pure'); global.Promise = core.Promise; global.Symbol = core.Symbol; // eslint-disable-next-line import/no-unresolved require('../bundles/observables-tests/default').runTests(core.Observable); core-js-3.6.1/tests/observables/adapter.js000066400000000000000000000003111360057567700205250ustar00rootroot00000000000000'use strict'; delete global.Observable; require('../../packages/core-js'); // eslint-disable-next-line import/no-unresolved require('../bundles/observables-tests/default').runTests(global.Observable); core-js-3.6.1/tests/promises-aplus-native.html000066400000000000000000000016061360057567700214050ustar00rootroot00000000000000 Promises/A+ Tests, Against Your Browser!
core-js-3.6.1/tests/promises-aplus.html000066400000000000000000000017041360057567700201200ustar00rootroot00000000000000 Promises/A+ Tests, Against Your Browser!
core-js-3.6.1/tests/promises-aplus/000077500000000000000000000000001360057567700172305ustar00rootroot00000000000000core-js-3.6.1/tests/promises-aplus/adapter.js000066400000000000000000000012321360057567700212040ustar00rootroot00000000000000delete global.Promise; var Promise = require('../../packages/core-js').Promise; var assert = require('assert'); module.exports = { deferred: function () { var deferred = {}; deferred.promise = new Promise(function (resolve, reject) { deferred.resolve = resolve; deferred.reject = reject; }); return deferred; }, resolved: function (value) { return Promise.resolve(value); }, rejected: function (reason) { return Promise.reject(reason); }, defineGlobalPromise: function (global) { global.Promise = Promise; global.assert = assert; }, removeGlobalPromise: function () { delete global.Promise; } }; core-js-3.6.1/tests/pure.html000066400000000000000000000004561360057567700161130ustar00rootroot00000000000000 Core
core-js-3.6.1/tests/pure/000077500000000000000000000000001360057567700152205ustar00rootroot00000000000000core-js-3.6.1/tests/pure/es.array.concat.js000066400000000000000000000027401360057567700205530ustar00rootroot00000000000000import Symbol from 'core-js-pure/features/symbol'; import concat from 'core-js-pure/features/array/concat'; /* eslint-disable no-sparse-arrays */ QUnit.test('Array#concat', assert => { assert.isFunction(concat); let array = [1, 2]; const sparseArray = [1, , 2]; const nonSpreadableArray = [1, 2]; nonSpreadableArray[Symbol.isConcatSpreadable] = false; const arrayLike = { 0: 1, 1: 2, length: 2 }; const spreadableArrayLike = { 0: 1, 1: 2, length: 2, [Symbol.isConcatSpreadable]: true }; assert.deepEqual(concat(array), [1, 2], '#1'); assert.deepEqual(concat(sparseArray), [1, , 2], '#2'); assert.deepEqual(concat(nonSpreadableArray), [[1, 2]], '#3'); assert.deepEqual(concat(arrayLike), [{ 0: 1, 1: 2, length: 2 }], '#4'); assert.deepEqual(concat(spreadableArrayLike), [1, 2], '#5'); assert.deepEqual(concat([], array), [1, 2], '#6'); assert.deepEqual(concat([], sparseArray), [1, , 2], '#7'); assert.deepEqual(concat([], nonSpreadableArray), [[1, 2]], '#8'); assert.deepEqual(concat([], arrayLike), [{ 0: 1, 1: 2, length: 2 }], '#9'); assert.deepEqual(concat([], spreadableArrayLike), [1, 2], '#10'); assert.deepEqual(concat(array, sparseArray, nonSpreadableArray, arrayLike, spreadableArrayLike), [ 1, 2, 1, , 2, [1, 2], { 0: 1, 1: 2, length: 2 }, 1, 2, ], '#11'); array = []; array.constructor = { [Symbol.species]: function () { // eslint-disable-line object-shorthand return { foo: 1 }; } }; assert.same(concat(array).foo, 1, '@@species'); }); core-js-3.6.1/tests/pure/es.array.copy-within.js000066400000000000000000000024231360057567700215540ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import copyWithin from 'core-js-pure/features/array/copy-within'; QUnit.test('Array#copyWithin', assert => { assert.isFunction(copyWithin); const array = [1]; assert.strictEqual(copyWithin(array, 0), array); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, 3), [4, 5, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 3), [1, 4, 5, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 2), [1, 3, 4, 5, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 2, 2), [1, 2, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, 3, 4), [4, 2, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 3, 4), [1, 4, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 2, 4), [1, 3, 4, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, -2), [4, 5, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, -2, -1), [4, 2, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], -4, -3, -2), [1, 3, 3, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], -4, -3, -1), [1, 3, 4, 4, 5]); assert.deepEqual(copyWithin([1, 2, 3, 4, 5], -4, -3), [1, 3, 4, 5, 5]); if (STRICT) { assert.throws(() => copyWithin(null, 0), TypeError); assert.throws(() => copyWithin(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.array.every.js000066400000000000000000000023161360057567700204350ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import every from 'core-js-pure/features/array/every'; QUnit.test('Array#every', assert => { assert.isFunction(every); const array = [1]; const context = {}; every(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(every([1, 2, 3], it => typeof it === 'number')); assert.ok(every([1, 2, 3], it => it < 4)); assert.ok(!every([1, 2, 3], it => it < 3)); assert.ok(!every([1, 2, 3], it => typeof it === 'string')); assert.ok(every([1, 2, 3], function () { return +this === 1; }, 1)); let rez = ''; every([1, 2, 3], (value, key) => rez += key); assert.ok(rez === '012'); const arr = [1, 2, 3]; assert.ok(every(arr, (value, key, that) => that === arr)); if (STRICT) { assert.throws(() => every(null, () => { /* empty */ }), TypeError); assert.throws(() => every(undefined, () => { /* empty */ }), TypeError); } }); core-js-3.6.1/tests/pure/es.array.fill.js000066400000000000000000000014641360057567700202340ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import fill from 'core-js-pure/features/array/fill'; QUnit.test('Array#fill', assert => { assert.isFunction(fill); const array = fill(Array(5), 5); assert.strictEqual(array, array); assert.deepEqual(fill(Array(5), 5), [5, 5, 5, 5, 5]); assert.deepEqual(fill(Array(5), 5, 1), [undefined, 5, 5, 5, 5]); assert.deepEqual(fill(Array(5), 5, 1, 4), [undefined, 5, 5, 5, undefined]); assert.deepEqual(fill(Array(5), 5, 6, 1), [undefined, undefined, undefined, undefined, undefined]); assert.deepEqual(fill(Array(5), 5, -3, 4), [undefined, undefined, 5, 5, undefined]); assert.arrayEqual(fill({ length: 5 }, 5), [5, 5, 5, 5, 5]); if (STRICT) { assert.throws(() => fill(null, 0), TypeError); assert.throws(() => fill(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.array.filter.js000066400000000000000000000021431360057567700205660ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import Symbol from 'core-js-pure/features/symbol'; import filter from 'core-js-pure/features/array/filter'; QUnit.test('Array#filter', assert => { assert.isFunction(filter); let array = [1]; const context = {}; filter(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([1, 2, 3, 4, 5], filter([1, 2, 3, 'q', {}, 4, true, 5], it => typeof it === 'number')); if (STRICT) { assert.throws(() => filter(null, () => { /* empty */ }), TypeError); assert.throws(() => filter(undefined, () => { /* empty */ }), TypeError); } array = []; array.constructor = { [Symbol.species]: function () { // eslint-disable-line object-shorthand return { foo: 1 }; } }; assert.same(filter(array, Boolean).foo, 1, '@@species'); }); core-js-3.6.1/tests/pure/es.array.find-index.js000066400000000000000000000012131360057567700213230ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import findIndex from 'core-js-pure/features/array/find-index'; QUnit.test('Array#findIndex', assert => { assert.isFunction(findIndex); const array = [1]; const context = {}; findIndex(array, function (value, key, that) { assert.strictEqual(this, context); assert.strictEqual(value, 1); assert.strictEqual(key, 0); assert.strictEqual(that, array); }, context); assert.strictEqual(findIndex([1, 3, NaN, 42, {}], it => it === 42), 3); if (STRICT) { assert.throws(() => findIndex(null, 0), TypeError); assert.throws(() => findIndex(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.array.find.js000066400000000000000000000012601360057567700202200ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import find from 'core-js-pure/features/array/find'; QUnit.test('Array#find', assert => { assert.isFunction(find); const array = [1]; const context = {}; find(array, function (value, key, that) { assert.strictEqual(this, context); assert.strictEqual(value, 1); assert.strictEqual(key, 0); assert.strictEqual(that, array); }, context); assert.strictEqual(find([1, 3, NaN, 42, {}], it => it === 42), 42); assert.strictEqual(find([1, 3, NaN, 42, {}], it => it === 43), undefined); if (STRICT) { assert.throws(() => find(null, 0), TypeError); assert.throws(() => find(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.array.flat-map.js000066400000000000000000000017551360057567700210120ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import flatMap from 'core-js-pure/features/array/flat-map'; QUnit.test('Array#flatMap', assert => { assert.isFunction(flatMap); assert.deepEqual(flatMap([], it => it), []); assert.deepEqual(flatMap([1, 2, 3], it => it), [1, 2, 3]); assert.deepEqual(flatMap([1, 2, 3], it => [it, it]), [1, 1, 2, 2, 3, 3]); assert.deepEqual(flatMap([1, 2, 3], it => [[it], [it]]), [[1], [1], [2], [2], [3], [3]]); assert.deepEqual(flatMap([1, [2, 3]], () => 1), [1, 1]); const array = [1]; const context = {}; flatMap(array, function (value, index, that) { assert.same(value, 1); assert.same(index, 0); assert.same(that, array); assert.same(this, context); }, context); if (STRICT) { assert.throws(() => flatMap(null, it => it), TypeError); assert.throws(() => flatMap(undefined, it => it), TypeError); } assert.notThrows(() => flatMap({ length: -1 }, () => { throw new Error(); }).length === 0, 'uses ToLength'); }); core-js-3.6.1/tests/pure/es.array.flat.js000066400000000000000000000017651360057567700202400ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants'; import flat from 'core-js-pure/features/array/flat'; import defineProperty from 'core-js-pure/features/object/define-property'; QUnit.test('Array#flat', assert => { assert.isFunction(flat); assert.deepEqual(flat([]), []); const array = [1, [2, 3], [4, [5, 6]]]; assert.deepEqual(flat(array, 0), array); assert.deepEqual(flat(array, 1), [1, 2, 3, 4, [5, 6]]); assert.deepEqual(flat(array), [1, 2, 3, 4, [5, 6]]); assert.deepEqual(flat(array, 2), [1, 2, 3, 4, 5, 6]); assert.deepEqual(flat(array, 3), [1, 2, 3, 4, 5, 6]); assert.deepEqual(flat(array, -1), array); assert.deepEqual(flat(array, Infinity), [1, 2, 3, 4, 5, 6]); if (STRICT) { assert.throws(() => flat(null), TypeError); assert.throws(() => flat(undefined), TypeError); } if (DESCRIPTORS) { assert.notThrows(() => flat(defineProperty({ length: -1 }, 0, { get() { throw new Error(); }, })).length === 0, 'uses ToLength'); } }); core-js-3.6.1/tests/pure/es.array.for-each.js000066400000000000000000000025211360057567700207650ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import forEach from 'core-js-pure/features/array/for-each'; QUnit.test('Array#forEach', assert => { assert.isFunction(forEach); let array = [1]; const context = {}; forEach(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); let result = ''; forEach([1, 2, 3], it => { result += it; }); assert.ok(result === '123'); result = ''; forEach([1, 2, 3], (value, key) => { result += key; }); assert.ok(result === '012'); result = ''; forEach([1, 2, 3], (value, key, that) => { result += that; }); assert.ok(result === '1,2,31,2,31,2,3'); result = ''; forEach([1, 2, 3], function () { result += this; }, 1); assert.ok(result === '111'); result = ''; array = []; array[5] = ''; forEach(array, (value, key) => { result += key; }); assert.ok(result === '5'); if (STRICT) { assert.throws(() => forEach(null, () => { /* empty */ }), TypeError); assert.throws(() => forEach(undefined, () => { /* empty */ }), TypeError); } }); core-js-3.6.1/tests/pure/es.array.from.js000066400000000000000000000103441360057567700202460ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import { createIterable } from '../helpers/helpers'; import Symbol from 'core-js-pure/features/symbol'; import getIteratorMethod from 'core-js-pure/features/get-iterator-method'; import from from 'core-js-pure/features/array/from'; import defineProperty from 'core-js-pure/features/object/define-property'; QUnit.test('Array.from', assert => { assert.isFunction(from); assert.arity(from, 1); let types = { 'array-like': { length: '3', 0: '1', 1: '2', 2: '3', }, arguments: function () { return arguments; }('1', '2', '3'), array: ['1', '2', '3'], iterable: createIterable(['1', '2', '3']), string: '123', }; for (const type in types) { const data = types[type]; assert.arrayEqual(from(data), ['1', '2', '3'], `Works with ${ type }`); assert.arrayEqual(from(data, it => it ** 2), [1, 4, 9], `Works with ${ type } + mapFn`); } types = { 'array-like': { length: 1, 0: 1, }, arguments: function () { return arguments; }(1), array: [1], iterable: createIterable([1]), string: '1', }; for (const type in types) { const data = types[type]; const context = {}; assert.arrayEqual(from(data, function (value, key) { assert.same(this, context, `Works with ${ type }, correct callback context`); assert.same(value, type === 'string' ? '1' : 1, `Works with ${ type }, correct callback key`); assert.same(key, 0, `Works with ${ type }, correct callback value`); assert.same(arguments.length, 2, `Works with ${ type }, correct callback arguments number`); return 42; }, context), [42], `Works with ${ type }, correct result`); } const primitives = [false, true, 0]; for (const primitive of primitives) { assert.arrayEqual(from(primitive), [], `Works with ${ primitive }`); } assert.throws(() => from(null), TypeError, 'Throws on null'); assert.throws(() => from(undefined), TypeError, 'Throws on undefined'); assert.arrayEqual(from('𠮷𠮷𠮷'), ['𠮷', '𠮷', '𠮷'], 'Uses correct string iterator'); let done = true; from(createIterable([1, 2, 3], { return() { return done = false; }, }), () => false); assert.ok(done, '.return #default'); done = false; try { from(createIterable([1, 2, 3], { return() { return done = true; }, }), () => { throw new Error(); }); } catch { /* empty */ } assert.ok(done, '.return #throw'); class C { /* empty */ } let instance = from.call(C, createIterable([1, 2])); assert.ok(instance instanceof C, 'generic, iterable case, instanceof'); assert.arrayEqual(instance, [1, 2], 'generic, iterable case, elements'); instance = from.call(C, { 0: 1, 1: 2, length: 2, }); assert.ok(instance instanceof C, 'generic, array-like case, instanceof'); assert.arrayEqual(instance, [1, 2], 'generic, array-like case, elements'); let array = [1, 2, 3]; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; assert.arrayEqual(from(array), [1, 2, 3], 'Array with custom iterator, elements'); assert.ok(done, 'call @@iterator in Array with custom iterator'); array = [1, 2, 3]; delete array[1]; assert.arrayEqual(from(array, String), ['1', 'undefined', '3'], 'Ignores holes'); assert.notThrows(() => from({ length: -1, 0: 1, }, () => { throw new Error(); }), 'Uses ToLength'); assert.arrayEqual(from([], undefined), [], 'Works with undefined as asecond argument'); assert.throws(() => from([], null), TypeError, 'Throws with null as second argument'); assert.throws(() => from([], 0), TypeError, 'Throws with 0 as second argument'); assert.throws(() => from([], ''), TypeError, 'Throws with "" as second argument'); assert.throws(() => from([], false), TypeError, 'Throws with false as second argument'); assert.throws(() => from([], {}), TypeError, 'Throws with {} as second argument'); if (DESCRIPTORS) { let called = false; defineProperty(C.prototype, 0, { set() { called = true; }, }); from.call(C, [1, 2, 3]); assert.ok(!called, 'Should not call prototype accessors'); } }); core-js-3.6.1/tests/pure/es.array.includes.js000066400000000000000000000013001360057567700211010ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import includes from 'core-js-pure/features/array/includes'; QUnit.test('Array#includes', assert => { assert.isFunction(includes); const object = {}; const array = [1, 2, 3, -0, object]; assert.ok(includes(array, 1)); assert.ok(includes(array, -0)); assert.ok(includes(array, 0)); assert.ok(includes(array, object)); assert.ok(!includes(array, 4)); assert.ok(!includes(array, -0.5)); assert.ok(!includes(array, {})); assert.ok(includes(Array(1), undefined)); assert.ok(includes([NaN], NaN)); if (STRICT) { assert.throws(() => includes(null, 0), TypeError); assert.throws(() => includes(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.array.index-of.js000066400000000000000000000013651360057567700210170ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import indexOf from 'core-js-pure/features/array/index-of'; QUnit.test('Array#indexOf', assert => { assert.isFunction(indexOf); assert.same(0, indexOf([1, 1, 1], 1)); assert.same(-1, indexOf([1, 2, 3], 1, 1)); assert.same(1, indexOf([1, 2, 3], 2, 1)); assert.same(-1, indexOf([1, 2, 3], 2, -1)); assert.same(1, indexOf([1, 2, 3], 2, -2)); assert.same(-1, indexOf([NaN], NaN)); assert.same(3, indexOf(Array(2).concat([1, 2, 3]), 2)); assert.same(-1, indexOf(Array(1), undefined)); assert.same(0, indexOf([1], 1, -0), "shouldn't return negative zero"); if (STRICT) { assert.throws(() => indexOf(null, 0), TypeError); assert.throws(() => indexOf(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.array.is-array.js000066400000000000000000000003761360057567700210360ustar00rootroot00000000000000import isArray from 'core-js-pure/features/array/is-array'; QUnit.test('Array.isArray', assert => { assert.isFunction(isArray); assert.ok(!isArray({})); assert.ok(!isArray(function () { return arguments; }())); assert.ok(isArray([])); }); core-js-3.6.1/tests/pure/es.array.iterator.js000066400000000000000000000047201360057567700211350ustar00rootroot00000000000000import { keys, values, entries } from 'core-js-pure/features/array'; import Symbol from 'core-js-pure/features/symbol'; import getIterator from 'core-js-pure/features/get-iterator'; QUnit.test('Array#@@iterator', assert => { assert.isFunction(values); const iterator = getIterator(['q', 'w', 'e']); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.strictEqual(String(iterator), '[object Array Iterator]'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Array#keys', assert => { assert.isFunction(keys); const iterator = keys(['q', 'w', 'e']); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 0, done: false, }); assert.deepEqual(iterator.next(), { value: 1, done: false, }); assert.deepEqual(iterator.next(), { value: 2, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Array#values', assert => { assert.isFunction(values); const iterator = values(['q', 'w', 'e']); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Array#entries', assert => { assert.isFunction(entries); const iterator = entries(['q', 'w', 'e']); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: [0, 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: [1, 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: [2, 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/pure/es.array.join.js000066400000000000000000000006731360057567700202460ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import join from 'core-js-pure/features/array/join'; QUnit.test('Array#join', assert => { assert.isFunction(join); assert.strictEqual(join([1, 2, 3], undefined), '1,2,3'); assert.strictEqual(join('123'), '1,2,3'); assert.strictEqual(join('123', '|'), '1|2|3'); if (STRICT) { assert.throws(() => join(null), TypeError); assert.throws(() => join(undefined), TypeError); } }); core-js-3.6.1/tests/pure/es.array.last-index-of.js000066400000000000000000000014571360057567700217620ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import lastIndexOf from 'core-js-pure/features/array/last-index-of'; QUnit.test('Array#lastIndexOf', assert => { assert.isFunction(lastIndexOf); assert.same(2, lastIndexOf([1, 1, 1], 1)); assert.same(-1, lastIndexOf([1, 2, 3], 3, 1)); assert.same(1, lastIndexOf([1, 2, 3], 2, 1)); assert.same(-1, lastIndexOf([1, 2, 3], 2, -3)); assert.same(-1, lastIndexOf([1, 2, 3], 1, -4)); assert.same(1, lastIndexOf([1, 2, 3], 2, -2)); assert.same(-1, lastIndexOf([NaN], NaN)); assert.same(1, lastIndexOf([1, 2, 3].concat(Array(2)), 2)); assert.same(0, lastIndexOf([1], 1, -0), "shouldn't return negative zero"); if (STRICT) { assert.throws(() => lastIndexOf(null, 0), TypeError); assert.throws(() => lastIndexOf(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.array.map.js000066400000000000000000000023001360057567700200510ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import Symbol from 'core-js-pure/features/symbol'; import map from 'core-js-pure/features/array/map'; QUnit.test('Array#map', assert => { assert.isFunction(map); let array = [1]; const context = {}; map(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([2, 3, 4], map([1, 2, 3], it => it + 1)); assert.deepEqual([1, 3, 5], map([1, 2, 3], (value, key) => value + key)); assert.deepEqual([2, 2, 2], map([1, 2, 3], function () { return +this; }, 2)); if (STRICT) { assert.throws(() => map(null, () => { /* empty */ }), TypeError); assert.throws(() => map(undefined, () => { /* empty */ }), TypeError); } array = []; array.constructor = { [Symbol.species]: function () { // eslint-disable-line object-shorthand return { foo: 1 }; } }; assert.same(map(array, Boolean).foo, 1, '@@species'); }); core-js-3.6.1/tests/pure/es.array.of.js000066400000000000000000000014221360057567700177040ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import of from 'core-js-pure/features/array/of'; import defineProperty from 'core-js-pure/features/object/define-property'; QUnit.test('Array.of', assert => { assert.isFunction(of); assert.arity(of, 0); assert.deepEqual(of(1), [1]); assert.deepEqual(of(1, 2, 3), [1, 2, 3]); class C { /* empty */ } const instance = of.call(C, 1, 2); assert.ok(instance instanceof C); assert.strictEqual(instance[0], 1); assert.strictEqual(instance[1], 2); assert.strictEqual(instance.length, 2); if (DESCRIPTORS) { let called = false; defineProperty(C.prototype, 0, { set() { called = true; }, }); of.call(C, 1, 2, 3); assert.ok(!called, 'Should not call prototype accessors'); } }); core-js-3.6.1/tests/pure/es.array.reduce-right.js000066400000000000000000000031241360057567700216630ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import reduceRight from 'core-js-pure/features/array/reduce-right'; QUnit.test('Array#reduceRight', assert => { assert.isFunction(reduceRight); const array = [1]; const accumulator = {}; reduceRight(array, function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same(reduceRight([1, 2, 3], ((a, b) => a + b), 1), 7, 'works with initial accumulator'); reduceRight([1, 2], (memo, value, key) => { assert.same(memo, 2, 'correct default accumulator'); assert.same(value, 1, 'correct start value without initial accumulator'); assert.same(key, 0, 'correct start index without initial accumulator'); }); assert.same(reduceRight([1, 2, 3], (a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; reduceRight([1, 2, 3], (memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '321', 'correct order #1'); assert.same(keys, '210', 'correct order #2'); assert.same(reduceRight({ 0: 1, 1: 2, length: 2, }, (a, b) => a + b), 3, 'generic'); if (STRICT) { assert.throws(() => reduceRight(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduceRight(undefined, () => { /* empty */ }, 1), TypeError); } }); core-js-3.6.1/tests/pure/es.array.reduce.js000066400000000000000000000030271360057567700205520ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import reduce from 'core-js-pure/features/array/reduce'; QUnit.test('Array#reduce', assert => { assert.isFunction(reduce); const array = [1]; const accumulator = {}; reduce(array, function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same(reduce([1, 2, 3], ((a, b) => a + b), 1), 7, 'works with initial accumulator'); reduce([1, 2], (memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 1, 'correct start index without initial accumulator'); }); assert.same(reduce([1, 2, 3], (a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; reduce([1, 2, 3], (memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '123', 'correct order #1'); assert.same(keys, '012', 'correct order #2'); assert.same(reduce({ 0: 1, 1: 2, length: 2, }, (a, b) => a + b), 3, 'generic'); if (STRICT) { assert.throws(() => reduce(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce(undefined, () => { /* empty */ }, 1), TypeError); } }); core-js-3.6.1/tests/pure/es.array.reverse.js000066400000000000000000000007411360057567700207560ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import reverse from 'core-js-pure/features/array/reverse'; QUnit.test('Array#reverse', assert => { assert.isFunction(reverse); const a = [1, 2.2, 3.3]; function fn() { +a; reverse(a); } fn(); assert.arrayEqual(a, [3.3, 2.2, 1]); if (STRICT) { assert.throws(() => reverse(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reverse(undefined, () => { /* empty */ }, 1), TypeError); } }); core-js-3.6.1/tests/pure/es.array.slice.js000066400000000000000000000024161360057567700204030ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants'; import { slice, isArray } from 'core-js-pure/features/array'; import Symbol from 'core-js-pure/features/symbol'; QUnit.test('Array#slice', assert => { assert.isFunction(slice); let array = ['1', '2', '3', '4', '5']; assert.deepEqual(slice(array), array); assert.deepEqual(slice(array, 1, 3), ['2', '3']); assert.deepEqual(slice(array, 1, undefined), ['2', '3', '4', '5']); assert.deepEqual(slice(array, 1, -1), ['2', '3', '4']); assert.deepEqual(slice(array, -2, -1), ['4']); assert.deepEqual(slice(array, -2, -3), []); const string = '12345'; assert.deepEqual(slice(string), array); assert.deepEqual(slice(string, 1, 3), ['2', '3']); assert.deepEqual(slice(string, 1, undefined), ['2', '3', '4', '5']); assert.deepEqual(slice(string, 1, -1), ['2', '3', '4']); assert.deepEqual(slice(string, -2, -1), ['4']); assert.deepEqual(slice(string, -2, -3), []); const list = GLOBAL.document && document.body && document.body.childNodes; if (list) { assert.notThrows(() => isArray(slice(list)), 'works with NodeList'); } array = []; array.constructor = { [Symbol.species]: function () { // eslint-disable-line object-shorthand return { foo: 1 }; } }; assert.same(slice(array).foo, 1, '@@species'); }); core-js-3.6.1/tests/pure/es.array.some.js000066400000000000000000000023501360057567700202440ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import some from 'core-js-pure/features/array/some'; QUnit.test('Array#some', assert => { assert.isFunction(some); let array = [1]; const context = {}; some(array, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(some([1, '2', 3], it => typeof it === 'number')); assert.ok(some([1, 2, 3], it => it < 3)); assert.ok(!some([1, 2, 3], it => it < 0)); assert.ok(!some([1, 2, 3], it => typeof it === 'string')); assert.ok(!some([1, 2, 3], function () { return +this !== 1; }, 1)); let result = ''; some([1, 2, 3], (value, key) => { result += key; return false; }); assert.ok(result === '012'); array = [1, 2, 3]; assert.ok(!some(array, (value, key, that) => that !== array)); if (STRICT) { assert.throws(() => some(null, () => { /* empty */ }), TypeError); assert.throws(() => some(undefined, () => { /* empty */ }), TypeError); } }); core-js-3.6.1/tests/pure/es.array.sort.js000066400000000000000000000010211360057567700202620ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import sort from 'core-js-pure/features/array/sort'; QUnit.test('Array#sort', assert => { assert.isFunction(sort); assert.notThrows(() => sort([1, 2, 3], undefined), 'works with undefined'); assert.throws(() => sort([1, 2, 3], null), 'throws on null'); assert.throws(() => sort([1, 2, 3], {}), 'throws on {}'); if (STRICT) { assert.throws(() => sort(null), TypeError, 'ToObject(this)'); assert.throws(() => sort(undefined), TypeError, 'ToObject(this)'); } }); core-js-3.6.1/tests/pure/es.array.splice.js000066400000000000000000000022721360057567700205630ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import splice from 'core-js-pure/features/array/splice'; import Symbol from 'core-js-pure/features/symbol'; QUnit.test('Array#splice', assert => { assert.isFunction(splice); let array = [1, 2, 3, 4, 5]; assert.deepEqual(splice(array, 2), [3, 4, 5]); assert.deepEqual(array, [1, 2]); array = [1, 2, 3, 4, 5]; assert.deepEqual(splice(array, -2), [4, 5]); assert.deepEqual(array, [1, 2, 3]); array = [1, 2, 3, 4, 5]; assert.deepEqual(splice(array, 2, 2), [3, 4]); assert.deepEqual(array, [1, 2, 5]); array = [1, 2, 3, 4, 5]; assert.deepEqual(splice(array, 2, -2), []); assert.deepEqual(array, [1, 2, 3, 4, 5]); array = [1, 2, 3, 4, 5]; assert.deepEqual(splice(array, 2, 2, 6, 7), [3, 4]); assert.deepEqual(array, [1, 2, 6, 7, 5]); if (STRICT) { assert.throws(() => splice(null), TypeError); assert.throws(() => splice(undefined), TypeError); } assert.deepEqual(splice({ length: -1, 0: 1, }), [], 'uses ToLength'); array = []; array.constructor = { [Symbol.species]: function () { // eslint-disable-line object-shorthand return { foo: 1 }; } }; assert.same(splice(array).foo, 1, '@@species'); }); core-js-3.6.1/tests/pure/es.date.now.js000066400000000000000000000002651360057567700177060ustar00rootroot00000000000000import now from 'core-js-pure/features/date/now'; QUnit.test('Date.now', assert => { assert.isFunction(now); assert.ok(+new Date() - now() < 10, 'Date.now() ~ +new Date'); }); core-js-3.6.1/tests/pure/es.date.to-iso-string.js000066400000000000000000000013771360057567700216260ustar00rootroot00000000000000import toISOString from 'core-js-pure/features/date/to-iso-string'; QUnit.test('Date#toISOString', assert => { assert.isFunction(toISOString); assert.strictEqual(toISOString(new Date(0)), '1970-01-01T00:00:00.000Z'); assert.strictEqual(toISOString(new Date(1e12 + 1)), '2001-09-09T01:46:40.001Z'); assert.strictEqual(toISOString(new Date(-5e13 - 1)), '0385-07-25T07:06:39.999Z'); const future = toISOString(new Date(1e15 + 1)); assert.ok(future === '+033658-09-27T01:46:40.001Z' || future === '33658-09-27T01:46:40.001Z'); const prehistoric = toISOString(new Date(-1e15 + 1)); assert.ok(prehistoric === '-029719-04-05T22:13:20.001Z' || prehistoric === '-29719-04-05T22:13:20.001Z'); assert.throws(() => toISOString(new Date(NaN)), RangeError); }); core-js-3.6.1/tests/pure/es.date.to-json.js000066400000000000000000000006341360057567700204740ustar00rootroot00000000000000import { toJSON, toISOString } from 'core-js-pure/features/date'; QUnit.test('Date#toJSON', assert => { assert.isFunction(toJSON); if (Date.prototype.toISOString) { const date = new Date(); assert.same(toJSON(date), toISOString(date), 'base'); } assert.same(toJSON(new Date(NaN)), null, 'not finite'); assert.same(toJSON({ toISOString() { return 42; }, }), 42, 'generic'); }); core-js-3.6.1/tests/pure/es.function.bind.js000066400000000000000000000015261360057567700207300ustar00rootroot00000000000000import bind from 'core-js-pure/features/function/bind'; QUnit.test('Function#bind', assert => { assert.isFunction(bind); const object = { a: 42 }; assert.ok(bind(function () { return this.a; }, object)() === 42); assert.ok(new (bind(() => { /* empty */ }, object))().a === undefined); function C(a, b) { this.a = a; this.b = b; } const instance = new (bind(C, null, 1))(2); assert.ok(instance instanceof C); assert.strictEqual(instance.a, 1); assert.strictEqual(instance.b, 2); assert.ok(bind((it => it), null, 42)() === 42); const regExpTest = bind(RegExp.prototype.test, /a/); assert.ok(regExpTest('a')); const Date2017 = bind(Date, null, 2017); const date = new Date2017(11); assert.ok(date instanceof Date); assert.strictEqual(date.getFullYear(), 2017); assert.strictEqual(date.getMonth(), 11); }); core-js-3.6.1/tests/pure/es.function.has-instance.js000066400000000000000000000004231360057567700223640ustar00rootroot00000000000000import HAS_INSTANCE from 'core-js-pure/features/symbol/has-instance'; QUnit.test('Function#@@hasInstance', assert => { assert.ok(HAS_INSTANCE in Function.prototype); assert.ok(Function[HAS_INSTANCE](() => { /* empty */ })); assert.ok(!Function[HAS_INSTANCE]({})); }); core-js-3.6.1/tests/pure/es.global-this.js000066400000000000000000000003341360057567700203710ustar00rootroot00000000000000import globalThis from 'core-js-pure/features/global-this'; QUnit.test('globalThis', assert => { assert.same(globalThis, Object(globalThis), 'is object'); assert.same(globalThis.Math, Math, 'contains globals'); }); core-js-3.6.1/tests/pure/es.json.stringify.js000066400000000000000000000016231360057567700211540ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants'; import stringify from 'core-js/es/json/stringify'; if (GLOBAL.JSON) { QUnit.test('Well‑formed JSON.stringify', assert => { assert.isFunction(stringify); assert.arity(stringify, 3); assert.name(stringify, 'stringify'); assert.same(stringify({ foo: 'bar' }), '{"foo":"bar"}', 'basic'); assert.same(stringify('\uDEAD'), '"\\udead"', 'r1'); assert.same(stringify('\uDF06\uD834'), '"\\udf06\\ud834"', 'r2'); assert.same(stringify('\uDF06ab\uD834'), '"\\udf06ab\\ud834"', 'r3'); assert.same(stringify('𠮷'), '"𠮷"', 'r4'); assert.same(stringify('\uD834\uDF06'), '"𝌆"', 'r5'); assert.same(stringify('\uD834\uD834\uDF06'), '"\\ud834𝌆"', 'r6'); assert.same(stringify('\uD834\uDF06\uDF06'), '"𝌆\\udf06"', 'r7'); assert.same(stringify({ '𠮷': ['\uDF06\uD834'] }), '{"𠮷":["\\udf06\\ud834"]}', 'r8'); }); } core-js-3.6.1/tests/pure/es.map.js000066400000000000000000000257541360057567700167560ustar00rootroot00000000000000/* eslint-disable sonarjs/no-element-overwrite */ import { createIterable, is, nativeSubclass } from '../helpers/helpers'; import { DESCRIPTORS } from '../helpers/constants'; import { Set, Map, Symbol } from 'core-js-pure'; import getIterator from 'core-js-pure/features/get-iterator'; import getIteratorMethod from 'core-js-pure/features/get-iterator-method'; import { freeze, getOwnPropertyDescriptor, keys, getOwnPropertyNames, getOwnPropertySymbols } from 'core-js-pure/features/object'; import ownKeys from 'core-js-pure/features/reflect/own-keys'; QUnit.test('Map', assert => { assert.isFunction(Map); assert.ok('clear' in Map.prototype, 'clear in Map.prototype'); assert.ok('delete' in Map.prototype, 'delete in Map.prototype'); assert.ok('forEach' in Map.prototype, 'forEach in Map.prototype'); assert.ok('get' in Map.prototype, 'get in Map.prototype'); assert.ok('has' in Map.prototype, 'has in Map.prototype'); assert.ok('set' in Map.prototype, 'set in Map.prototype'); assert.ok(new Map() instanceof Map, 'new Map instanceof Map'); assert.strictEqual(new Map(createIterable([[1, 1], [2, 2], [3, 3]])).size, 3, 'Init from iterable'); assert.strictEqual(new Map([[freeze({}), 1], [2, 3]]).size, 2, 'Support frozen objects'); let done = false; try { new Map(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.ok(done, '.return #throw'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; new Map(array); assert.ok(done); const object = {}; new Map().set(object, 1); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(Map); assert.ok(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.ok(new Subclass() instanceof Map, 'correct subclassing with native classes #2'); assert.strictEqual(new Subclass().set(1, 2).get(1), 2, 'correct subclassing with native classes #3'); } }); QUnit.test('Map#clear', assert => { assert.isFunction(Map.prototype.clear); let map = new Map(); map.clear(); assert.strictEqual(map.size, 0); map = new Map().set(1, 2).set(2, 3).set(1, 4); map.clear(); assert.strictEqual(map.size, 0); assert.ok(!map.has(1)); assert.ok(!map.has(2)); const frozen = freeze({}); map = new Map().set(1, 2).set(frozen, 3); map.clear(); assert.strictEqual(map.size, 0, 'Support frozen objects'); assert.ok(!map.has(1)); assert.ok(!map.has(frozen)); }); QUnit.test('Map#delete', assert => { assert.isFunction(Map.prototype.delete); const object = {}; const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 7); map.set(2, 5); map.set(1, 4); map.set(object, 9); assert.strictEqual(map.size, 5); assert.ok(map.delete(NaN)); assert.strictEqual(map.size, 4); assert.ok(!map.delete(4)); assert.strictEqual(map.size, 4); map.delete([]); assert.strictEqual(map.size, 4); map.delete(object); assert.strictEqual(map.size, 3); const frozen = freeze({}); map.set(frozen, 42); assert.strictEqual(map.size, 4); map.delete(frozen); assert.strictEqual(map.size, 3); }); QUnit.test('Map#forEach', assert => { assert.isFunction(Map.prototype.forEach); let result = {}; let count = 0; const object = {}; let map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 7); map.set(2, 5); map.set(1, 4); map.set(object, 9); map.forEach((value, key) => { count++; result[value] = key; }); assert.strictEqual(count, 5); assert.deepEqual(result, { 1: NaN, 7: 3, 5: 2, 4: 1, 9: object, }); map = new Map(); map.set('0', 9); map.set('1', 9); map.set('2', 9); map.set('3', 9); result = ''; map.forEach((value, key) => { result += key; if (key === '2') { map.delete('2'); map.delete('3'); map.delete('1'); map.set('4', 9); } }); assert.strictEqual(result, '0124'); map = new Map([['0', 1]]); result = ''; map.forEach(it => { map.delete('0'); if (result !== '') throw new Error(); result += it; }); assert.strictEqual(result, '1'); assert.throws(() => Map.prototype.forEach.call(new Set(), () => { /* empty */ }), 'non-generic'); }); QUnit.test('Map#get', assert => { assert.isFunction(Map.prototype.get); const object = {}; const frozen = freeze({}); const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(frozen, 42); map.set(object, object); assert.strictEqual(map.get(NaN), 1); assert.strictEqual(map.get(4), undefined); assert.strictEqual(map.get({}), undefined); assert.strictEqual(map.get(object), object); assert.strictEqual(map.get(frozen), 42); assert.strictEqual(map.get(2), 5); }); QUnit.test('Map#has', assert => { assert.isFunction(Map.prototype.has); const object = {}; const frozen = freeze({}); const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(frozen, 42); map.set(object, object); assert.ok(map.has(NaN)); assert.ok(map.has(object)); assert.ok(map.has(2)); assert.ok(map.has(frozen)); assert.ok(!map.has(4)); assert.ok(!map.has({})); }); QUnit.test('Map#set', assert => { assert.isFunction(Map.prototype.set); const object = {}; let map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(object, object); assert.ok(map.size === 5); const chain = map.set(7, 2); assert.strictEqual(chain, map); map.set(7, 2); assert.strictEqual(map.size, 6); assert.strictEqual(map.get(7), 2); assert.strictEqual(map.get(NaN), 1); map.set(NaN, 42); assert.strictEqual(map.size, 6); assert.strictEqual(map.get(NaN), 42); map.set({}, 11); assert.strictEqual(map.size, 7); assert.strictEqual(map.get(object), object); map.set(object, 27); assert.strictEqual(map.size, 7); assert.strictEqual(map.get(object), 27); map = new Map(); map.set(NaN, 2); map.set(NaN, 3); map.set(NaN, 4); assert.strictEqual(map.size, 1); const frozen = freeze({}); map = new Map().set(frozen, 42); assert.strictEqual(map.get(frozen), 42); }); QUnit.test('Map#size', assert => { const map = new Map(); map.set(2, 1); const { size } = map; assert.strictEqual(typeof size, 'number', 'size is number'); assert.strictEqual(size, 1, 'size is correct'); if (DESCRIPTORS) { const sizeDescriptor = getOwnPropertyDescriptor(Map.prototype, 'size'); assert.ok(sizeDescriptor && sizeDescriptor.get, 'size is getter'); assert.ok(sizeDescriptor && !sizeDescriptor.set, 'size isnt setter'); assert.throws(() => Map.prototype.size, TypeError); } }); QUnit.test('Map & -0', assert => { let map = new Map(); map.set(-0, 1); assert.strictEqual(map.size, 1); assert.ok(map.has(0)); assert.ok(map.has(-0)); assert.strictEqual(map.get(0), 1); assert.strictEqual(map.get(-0), 1); map.forEach((val, key) => { assert.ok(!is(key, -0)); }); map.delete(-0); assert.strictEqual(map.size, 0); map = new Map([[-0, 1]]); map.forEach((val, key) => { assert.ok(!is(key, -0)); }); map = new Map(); map.set(4, 4); map.set(3, 3); map.set(2, 2); map.set(1, 1); map.set(0, 0); assert.ok(map.has(-0)); }); QUnit.test('Map#@@toStringTag', assert => { assert.strictEqual(Map.prototype[Symbol.toStringTag], 'Map', 'Map::@@toStringTag is `Map`'); assert.strictEqual(String(new Map()), '[object Map]', 'correct stringification'); }); QUnit.test('Map Iterator', assert => { const map = new Map(); map.set('a', 1); map.set('b', 2); map.set('c', 3); map.set('d', 4); const results = []; const iterator = map.keys(); results.push(iterator.next().value); assert.ok(map.delete('a')); assert.ok(map.delete('b')); assert.ok(map.delete('c')); map.set('e'); results.push(iterator.next().value); results.push(iterator.next().value); assert.ok(iterator.next().done); map.set('f'); assert.ok(iterator.next().done); assert.deepEqual(results, ['a', 'd', 'e']); }); QUnit.test('Map#keys', assert => { assert.isFunction(Map.prototype.keys); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: 'a', done: false, }); assert.deepEqual(iterator.next(), { value: 's', done: false, }); assert.deepEqual(iterator.next(), { value: 'd', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#values', assert => { assert.isFunction(Map.prototype.values); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#entries', assert => { assert.isFunction(Map.prototype.entries); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: ['a', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['s', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['d', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#@@iterator', assert => { const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = getIterator(map); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Map Iterator'); assert.strictEqual(String(iterator), '[object Map Iterator]'); assert.deepEqual(iterator.next(), { value: ['a', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['s', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['d', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/pure/es.math.acosh.js000066400000000000000000000012331360057567700202100ustar00rootroot00000000000000import acosh from 'core-js-pure/features/math/acosh'; import EPSILON from 'core-js-pure/features/number/epsilon'; QUnit.test('Math.acosh', assert => { assert.isFunction(acosh); assert.same(acosh(NaN), NaN); assert.same(acosh(0.5), NaN); assert.same(acosh(-1), NaN); assert.same(acosh(-1e300), NaN); assert.same(acosh(1), 0); assert.strictEqual(acosh(Infinity), Infinity); assert.epsilon(acosh(1234), 7.811163220849231); assert.epsilon(acosh(8.88), 2.8737631531629235); assert.epsilon(acosh(1e+160), 369.10676205960726); assert.epsilon(acosh(Number.MAX_VALUE), 710.475860073944); assert.epsilon(acosh(1 + EPSILON), 2.1073424255447017e-8); }); core-js-3.6.1/tests/pure/es.math.asinh.js000066400000000000000000000010671360057567700202220ustar00rootroot00000000000000import asinh from 'core-js-pure/features/math/asinh'; QUnit.test('Math.asinh', assert => { assert.isFunction(asinh); assert.same(asinh(NaN), NaN); assert.same(asinh(0), 0); assert.same(asinh(-0), -0); assert.strictEqual(asinh(Infinity), Infinity); assert.strictEqual(asinh(-Infinity), -Infinity); assert.epsilon(asinh(1234), 7.811163549201245); assert.epsilon(asinh(9.99), 2.997227420191335); assert.epsilon(asinh(1e150), 346.0809111296668); assert.epsilon(asinh(1e7), 16.811242831518268); assert.epsilon(asinh(-1e7), -16.811242831518268); }); core-js-3.6.1/tests/pure/es.math.atanh.js000066400000000000000000000012121360057567700202030ustar00rootroot00000000000000import atanh from 'core-js-pure/features/math/atanh'; QUnit.test('Math.atanh', assert => { assert.isFunction(atanh); assert.same(atanh(NaN), NaN); assert.same(atanh(-2), NaN); assert.same(atanh(-1.5), NaN); assert.same(atanh(2), NaN); assert.same(atanh(1.5), NaN); assert.strictEqual(atanh(-1), -Infinity); assert.strictEqual(atanh(1), Infinity); assert.same(atanh(0), 0); assert.same(atanh(-0), -0); assert.same(atanh(-1e300), NaN); assert.same(atanh(1e300), NaN); assert.epsilon(atanh(0.5), 0.5493061443340549); assert.epsilon(atanh(-0.5), -0.5493061443340549); assert.epsilon(atanh(0.444), 0.47720201260109457); }); core-js-3.6.1/tests/pure/es.math.cbrt.js000066400000000000000000000006751360057567700200560ustar00rootroot00000000000000import cbrt from 'core-js-pure/features/math/cbrt'; QUnit.test('Math.cbrt', assert => { assert.isFunction(cbrt); assert.same(cbrt(NaN), NaN); assert.same(cbrt(0), 0); assert.same(cbrt(-0), -0); assert.strictEqual(cbrt(Infinity), Infinity); assert.strictEqual(cbrt(-Infinity), -Infinity); assert.strictEqual(cbrt(-8), -2); assert.strictEqual(cbrt(8), 2); assert.epsilon(cbrt(-1000), -10); assert.epsilon(cbrt(1000), 10); }); core-js-3.6.1/tests/pure/es.math.clz32.js000066400000000000000000000005271360057567700200550ustar00rootroot00000000000000import clz32 from 'core-js-pure/features/math/clz32'; QUnit.test('Math.clz32', assert => { assert.isFunction(clz32); assert.strictEqual(clz32(0), 32); assert.strictEqual(clz32(1), 31); assert.same(clz32(-1), 0); assert.strictEqual(clz32(0.6), 32); assert.same(clz32(2 ** 32 - 1), 0); assert.strictEqual(clz32(2 ** 32), 32); }); core-js-3.6.1/tests/pure/es.math.cosh.js000066400000000000000000000011421360057567700200460ustar00rootroot00000000000000import cosh from 'core-js-pure/features/math/cosh'; QUnit.test('Math.cosh', assert => { assert.isFunction(cosh); assert.same(cosh(NaN), NaN); assert.strictEqual(cosh(0), 1); assert.strictEqual(cosh(-0), 1); assert.strictEqual(cosh(Infinity), Infinity); assert.strictEqual(cosh(-Infinity), Infinity); assert.epsilon(cosh(12), 81377.395712574, 1e-9); assert.epsilon(cosh(22), 1792456423.065795780980053377, 1e-5); assert.epsilon(cosh(-10), 11013.23292010332313972137); assert.epsilon(cosh(-23), 4872401723.1244513000, 1e-5); assert.epsilon(cosh(710), 1.1169973830808557e+308, 1e+295); }); core-js-3.6.1/tests/pure/es.math.expm1.js000066400000000000000000000006271360057567700201530ustar00rootroot00000000000000import expm1 from 'core-js-pure/features/math/expm1'; QUnit.test('Math.expm1', assert => { assert.isFunction(expm1); assert.same(expm1(NaN), NaN); assert.same(expm1(0), 0); assert.same(expm1(-0), -0); assert.strictEqual(expm1(Infinity), Infinity); assert.strictEqual(expm1(-Infinity), -1); assert.epsilon(expm1(10), 22025.465794806718); assert.epsilon(expm1(-10), -0.9999546000702375); }); core-js-3.6.1/tests/pure/es.math.fround.js000066400000000000000000000024541360057567700204160ustar00rootroot00000000000000import fround from 'core-js-pure/features/math/fround'; QUnit.test('Math.fround', assert => { assert.isFunction(fround); assert.same(fround(undefined), NaN); assert.same(fround(NaN), NaN); assert.same(fround(0), 0); assert.same(fround(-0), -0); assert.same(fround(Number.MIN_VALUE), 0); assert.same(fround(-Number.MIN_VALUE), -0); assert.strictEqual(fround(Infinity), Infinity); assert.strictEqual(fround(-Infinity), -Infinity); assert.strictEqual(fround(1.7976931348623157e+308), Infinity); assert.strictEqual(fround(-1.7976931348623157e+308), -Infinity); assert.strictEqual(fround(3.4028235677973366e+38), Infinity); assert.strictEqual(fround(3), 3); assert.strictEqual(fround(-3), -3); const maxFloat32 = 3.4028234663852886e+38; const minFloat32 = 1.401298464324817e-45; assert.strictEqual(fround(maxFloat32), maxFloat32); assert.strictEqual(fround(-maxFloat32), -maxFloat32); assert.strictEqual(fround(maxFloat32 + 2 ** 102), maxFloat32); assert.strictEqual(fround(minFloat32), minFloat32); assert.strictEqual(fround(-minFloat32), -minFloat32); assert.same(fround(minFloat32 / 2), 0); assert.same(fround(-minFloat32 / 2), -0); assert.strictEqual(fround(minFloat32 / 2 + 2 ** -202), minFloat32); assert.strictEqual(fround(-minFloat32 / 2 - 2 ** -202), -minFloat32); }); core-js-3.6.1/tests/pure/es.math.hypot.js000066400000000000000000000034641360057567700202660ustar00rootroot00000000000000import hypot from 'core-js-pure/features/math/hypot'; QUnit.test('Math.hypot', assert => { const { sqrt } = Math; assert.isFunction(hypot); assert.strictEqual(hypot(), 0); assert.strictEqual(hypot(1), 1); assert.same(hypot('', 0), 0); assert.same(hypot(0, ''), 0); assert.strictEqual(hypot(Infinity, 0), Infinity, 'Infinity, 0'); assert.strictEqual(hypot(-Infinity, 0), Infinity, '-Infinity, 0'); assert.strictEqual(hypot(0, Infinity), Infinity, '0, Infinity'); assert.strictEqual(hypot(0, -Infinity), Infinity, '0, -Infinity'); assert.strictEqual(hypot(Infinity, NaN), Infinity, 'Infinity, NaN'); assert.strictEqual(hypot(NaN, -Infinity), Infinity, 'NaN, -Infinity'); assert.same(hypot(NaN, 0), NaN, 'NaN, 0'); assert.same(hypot(0, NaN), NaN, '0, NaN'); assert.same(hypot(0, -0), 0); assert.same(hypot(0, 0), 0); assert.same(hypot(-0, -0), 0); assert.same(hypot(-0, 0), 0); assert.strictEqual(hypot(0, 1), 1); assert.strictEqual(hypot(0, -1), 1); assert.strictEqual(hypot(-0, 1), 1); assert.strictEqual(hypot(-0, -1), 1); assert.same(hypot(0), 0); assert.strictEqual(hypot(1), 1); assert.strictEqual(hypot(2), 2); assert.strictEqual(hypot(0, 0, 1), 1); assert.strictEqual(hypot(0, 1, 0), 1); assert.strictEqual(hypot(1, 0, 0), 1); assert.strictEqual(hypot(2, 3, 4), sqrt(2 * 2 + 3 * 3 + 4 * 4)); assert.strictEqual(hypot(2, 3, 4, 5), sqrt(2 * 2 + 3 * 3 + 4 * 4 + 5 * 5)); assert.epsilon(hypot(66, 66), 93.33809511662427); assert.epsilon(hypot(0.1, 100), 100.0000499999875); assert.strictEqual(hypot(1e+300, 1e+300), 1.4142135623730952e+300); assert.strictEqual(Math.floor(hypot(1e-300, 1e-300) * 1e308), 141421356); assert.strictEqual(hypot(1e+300, 1e+300, 2, 3), 1.4142135623730952e+300); assert.strictEqual(hypot(-3, 4), 5); assert.strictEqual(hypot(3, -4), 5); }); core-js-3.6.1/tests/pure/es.math.imul.js000066400000000000000000000026511360057567700200660ustar00rootroot00000000000000import imul from 'core-js-pure/features/math/imul'; QUnit.test('Math.imul', assert => { assert.isFunction(imul); assert.same(imul(0, 0), 0); assert.strictEqual(imul(123, 456), 56088); assert.strictEqual(imul(-123, 456), -56088); assert.strictEqual(imul(123, -456), -56088); assert.strictEqual(imul(19088743, 4275878552), 602016552); assert.same(imul(false, 7), 0); assert.same(imul(7, false), 0); assert.same(imul(false, false), 0); assert.strictEqual(imul(true, 7), 7); assert.strictEqual(imul(7, true), 7); assert.strictEqual(imul(true, true), 1); assert.same(imul(undefined, 7), 0); assert.same(imul(7, undefined), 0); assert.same(imul(undefined, undefined), 0); assert.same(imul('str', 7), 0); assert.same(imul(7, 'str'), 0); assert.same(imul({}, 7), 0); assert.same(imul(7, {}), 0); assert.same(imul([], 7), 0); assert.same(imul(7, []), 0); assert.strictEqual(imul(0xFFFFFFFF, 5), -5); assert.strictEqual(imul(0xFFFFFFFE, 5), -10); assert.strictEqual(imul(2, 4), 8); assert.strictEqual(imul(-1, 8), -8); assert.strictEqual(imul(-2, -2), 4); assert.same(imul(-0, 7), 0); assert.same(imul(7, -0), 0); assert.same(imul(0.1, 7), 0); assert.same(imul(7, 0.1), 0); assert.same(imul(0.9, 7), 0); assert.same(imul(7, 0.9), 0); assert.strictEqual(imul(1.1, 7), 7); assert.strictEqual(imul(7, 1.1), 7); assert.strictEqual(imul(1.9, 7), 7); assert.strictEqual(imul(7, 1.9), 7); }); core-js-3.6.1/tests/pure/es.math.log10.js000066400000000000000000000011711360057567700200360ustar00rootroot00000000000000import log10 from 'core-js-pure/features/math/log10'; QUnit.test('Math.log10', assert => { assert.isFunction(log10); assert.same(log10(''), log10(0)); assert.same(log10(NaN), NaN); assert.same(log10(-1), NaN); assert.same(log10(0), -Infinity); assert.same(log10(-0), -Infinity); assert.same(log10(1), 0); assert.same(log10(Infinity), Infinity); assert.epsilon(log10(0.1), -1); assert.epsilon(log10(0.5), -0.3010299956639812); assert.epsilon(log10(1.5), 0.17609125905568124); assert.epsilon(log10(5), 0.6989700043360189); assert.epsilon(log10(50), 1.6989700043360187); assert.epsilon(log10(1000), 3); }); core-js-3.6.1/tests/pure/es.math.log1p.js000066400000000000000000000007101360057567700201340ustar00rootroot00000000000000import log1p from 'core-js-pure/features/math/log1p'; QUnit.test('Math.log1p', assert => { assert.isFunction(log1p); assert.same(log1p(''), log1p(0)); assert.same(log1p(NaN), NaN); assert.same(log1p(-2), NaN); assert.same(log1p(-1), -Infinity); assert.same(log1p(0), 0); assert.same(log1p(-0), -0); assert.same(log1p(Infinity), Infinity); assert.epsilon(log1p(5), 1.791759469228055); assert.epsilon(log1p(50), 3.9318256327243257); }); core-js-3.6.1/tests/pure/es.math.log2.js000066400000000000000000000007121360057567700177570ustar00rootroot00000000000000import log2 from 'core-js-pure/features/math/log2'; QUnit.test('Math.log2', assert => { assert.isFunction(log2); assert.same(log2(''), log2(0)); assert.same(log2(NaN), NaN); assert.same(log2(-1), NaN); assert.same(log2(0), -Infinity); assert.same(log2(-0), -Infinity); assert.same(log2(1), 0); assert.same(log2(Infinity), Infinity); assert.same(log2(0.5), -1); assert.same(log2(32), 5); assert.epsilon(log2(5), 2.321928094887362); }); core-js-3.6.1/tests/pure/es.math.sign.js000066400000000000000000000007611360057567700200600ustar00rootroot00000000000000import sign from 'core-js-pure/features/math/sign'; QUnit.test('Math.sign', assert => { assert.isFunction(sign); assert.same(sign(NaN), NaN); assert.same(sign(), NaN); assert.same(sign(-0), -0); assert.same(sign(0), 0); assert.strictEqual(sign(Infinity), 1); assert.strictEqual(sign(-Infinity), -1); assert.strictEqual(sign(13510798882111488), 1); assert.strictEqual(sign(-13510798882111488), -1); assert.strictEqual(sign(42.5), 1); assert.strictEqual(sign(-42.5), -1); }); core-js-3.6.1/tests/pure/es.math.sinh.js000066400000000000000000000006741360057567700200640ustar00rootroot00000000000000import sinh from 'core-js-pure/features/math/sinh'; QUnit.test('Math.sinh', assert => { assert.isFunction(sinh); assert.same(sinh(NaN), NaN); assert.same(sinh(0), 0); assert.same(sinh(-0), -0); assert.strictEqual(sinh(Infinity), Infinity); assert.strictEqual(sinh(-Infinity), -Infinity); assert.epsilon(sinh(-5), -74.20321057778875); assert.epsilon(sinh(2), 3.6268604078470186); assert.strictEqual(sinh(-2e-17), -2e-17); }); core-js-3.6.1/tests/pure/es.math.tanh.js000066400000000000000000000005131360057567700200450ustar00rootroot00000000000000import tanh from 'core-js-pure/features/math/tanh'; QUnit.test('Math.tanh', assert => { assert.isFunction(tanh); assert.same(tanh(NaN), NaN); assert.same(tanh(0), 0); assert.same(tanh(-0), -0); assert.strictEqual(tanh(Infinity), 1); assert.strictEqual(tanh(90), 1); assert.epsilon(tanh(10), 0.9999999958776927); }); core-js-3.6.1/tests/pure/es.math.trunc.js000066400000000000000000000017561360057567700202600ustar00rootroot00000000000000import trunc from 'core-js-pure/features/math/trunc'; QUnit.test('Math.trunc', assert => { assert.isFunction(trunc); assert.same(trunc(NaN), NaN, 'NaN -> NaN'); assert.same(trunc(-0), -0, '-0 -> -0'); assert.same(trunc(0), 0, '0 -> 0'); assert.same(trunc(Infinity), Infinity, 'Infinity -> Infinity'); assert.same(trunc(-Infinity), -Infinity, '-Infinity -> -Infinity'); assert.same(trunc(null), 0, 'null -> 0'); assert.same(trunc({}), NaN, '{} -> NaN'); assert.strictEqual(trunc([]), 0, '[] -> 0'); assert.strictEqual(trunc(1.01), 1, '1.01 -> 0'); assert.strictEqual(trunc(1.99), 1, '1.99 -> 0'); assert.strictEqual(trunc(-1), -1, '-1 -> -1'); assert.strictEqual(trunc(-1.99), -1, '-1.99 -> -1'); assert.strictEqual(trunc(-555.555), -555, '-555.555 -> -555'); assert.strictEqual(trunc(0x20000000000001), 0x20000000000001, '0x20000000000001 -> 0x20000000000001'); assert.strictEqual(trunc(-0x20000000000001), -0x20000000000001, '-0x20000000000001 -> -0x20000000000001'); }); core-js-3.6.1/tests/pure/es.number.epsilon.js000066400000000000000000000004271360057567700211270ustar00rootroot00000000000000import EPSILON from 'core-js-pure/features/number/epsilon'; QUnit.test('Number.EPSILON', assert => { assert.strictEqual(EPSILON, 2 ** -52, 'Is 2^-52'); assert.ok(1 !== 1 + EPSILON, '1 isnt 1 + EPSILON'); assert.strictEqual(1, 1 + EPSILON / 2, '1 is 1 + EPSILON / 2'); }); core-js-3.6.1/tests/pure/es.number.is-finite.js000066400000000000000000000015741360057567700213510ustar00rootroot00000000000000import isFinite from 'core-js-pure/features/number/is-finite'; import create from 'core-js-pure/features/object/create'; QUnit.test('Number.isFinite', assert => { assert.isFunction(isFinite); const finite = [ 1, 0.1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, ]; for (const value of finite) { assert.ok(isFinite(value), `isFinite ${ typeof value } ${ value }`); } const notFinite = [ NaN, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notFinite) { assert.ok(!isFinite(value), `not isFinite ${ typeof value } ${ value }`); } assert.ok(!isFinite(create(null)), 'Number.isFinite(Object.create(null)) -> false'); }); core-js-3.6.1/tests/pure/es.number.is-integer.js000066400000000000000000000016161360057567700215250ustar00rootroot00000000000000import isInteger from 'core-js-pure/features/number/is-integer'; import create from 'core-js-pure/features/object/create'; QUnit.test('Number.isInteger', assert => { assert.isFunction(isInteger); const integers = [ 1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, ]; for (const value of integers) { assert.ok(isInteger(value), `isInteger ${ typeof value } ${ value }`); } const notIntegers = [ NaN, 0.1, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notIntegers) { assert.ok(!isInteger(value), `not isInteger ${ typeof value } ${ value }`); } assert.ok(!isInteger(create(null)), 'Number.isInteger(Object.create(null)) -> false'); }); core-js-3.6.1/tests/pure/es.number.is-nan.js000066400000000000000000000014061360057567700206410ustar00rootroot00000000000000import isNaN from 'core-js-pure/features/number/is-nan'; import create from 'core-js-pure/features/object/create'; QUnit.test('Number.isNaN', assert => { assert.isFunction(isNaN); assert.ok(isNaN(NaN), 'Number.isNaN NaN'); const notNaNs = [ 1, 0.1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notNaNs) { assert.ok(!isNaN(value), `not Number.isNaN ${ typeof value } ${ value }`); } assert.ok(!isNaN(create(null)), 'Number.isNaN(Object.create(null)) -> false'); }); core-js-3.6.1/tests/pure/es.number.is-safe-integer.js000066400000000000000000000020411360057567700224320ustar00rootroot00000000000000import isSafeInteger from 'core-js-pure/features/number/is-safe-integer'; import create from 'core-js-pure/features/object/create'; QUnit.test('Number.isSafeInteger', assert => { assert.isFunction(isSafeInteger); const safeIntegers = [ 1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, 9007199254740991, -9007199254740991, ]; for (const value of safeIntegers) { assert.ok(isSafeInteger(value), `isSafeInteger ${ typeof value } ${ value }`); } const notSafeIntegers = [ 9007199254740992, -9007199254740992, NaN, 0.1, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notSafeIntegers) { assert.ok(!isSafeInteger(value), `not isSafeInteger ${ typeof value } ${ value }`); } assert.ok(!isSafeInteger(create(null)), 'Number.isSafeInteger(Object.create(null)) -> false'); }); core-js-3.6.1/tests/pure/es.number.max-safe-integer.js000066400000000000000000000003111360057567700226020ustar00rootroot00000000000000import MAX_SAFE_INTEGER from 'core-js-pure/features/number/max-safe-integer'; QUnit.test('Number.MAX_SAFE_INTEGER', assert => { assert.strictEqual(MAX_SAFE_INTEGER, 2 ** 53 - 1, 'Is 2^53 - 1'); }); core-js-3.6.1/tests/pure/es.number.min-safe-integer.js000066400000000000000000000003151360057567700226040ustar00rootroot00000000000000import MIN_SAFE_INTEGER from 'core-js-pure/features/number/min-safe-integer'; QUnit.test('Number.MIN_SAFE_INTEGER', assert => { assert.strictEqual(MIN_SAFE_INTEGER, -(2 ** 53) + 1, 'Is -2^53 + 1'); }); core-js-3.6.1/tests/pure/es.number.parse-float.js000066400000000000000000000011761360057567700216750ustar00rootroot00000000000000import { WHITESPACES } from '../helpers/constants'; import parseFloat from 'core-js-pure/features/number/parse-float'; QUnit.test('Number.parseFloat', assert => { assert.isFunction(parseFloat); assert.arity(parseFloat, 1); assert.same(parseFloat('0'), 0); assert.same(parseFloat(' 0'), 0); assert.same(parseFloat('+0'), 0); assert.same(parseFloat(' +0'), 0); assert.same(parseFloat('-0'), -0); assert.same(parseFloat(' -0'), -0); assert.same(parseFloat(`${ WHITESPACES }+0`), 0); assert.same(parseFloat(`${ WHITESPACES }-0`), -0); assert.same(parseFloat(null), NaN); assert.same(parseFloat(undefined), NaN); }); core-js-3.6.1/tests/pure/es.number.parse-int.js000066400000000000000000000031711360057567700213570ustar00rootroot00000000000000import { WHITESPACES } from '../helpers/constants'; import parseInt from 'core-js-pure/features/number/parse-int'; QUnit.test('Number.parseInt', assert => { assert.isFunction(parseInt); assert.arity(parseInt, 2); for (let radix = 2; radix <= 36; ++radix) { assert.same(parseInt('10', radix), radix, `radix ${ radix }`); } const strings = ['01', '08', '10', '42']; for (const string of strings) { assert.same(parseInt(string), parseInt(string, 10), `default radix is 10: ${ string }`); } assert.same(parseInt('0x16'), parseInt('0x16', 16), 'default radix is 16: 0x16'); assert.same(parseInt(' 0x16'), parseInt('0x16', 16), 'ignores leading whitespace #1'); assert.same(parseInt(' 42'), parseInt('42', 10), 'ignores leading whitespace #2'); assert.same(parseInt(' 08'), parseInt('08', 10), 'ignores leading whitespace #3'); assert.same(parseInt(`${ WHITESPACES }08`), parseInt('08', 10), 'ignores leading whitespace #4'); assert.same(parseInt(`${ WHITESPACES }0x16`), parseInt('0x16', 16), 'ignores leading whitespace #5'); const fakeZero = { valueOf() { return 0; }, }; assert.same(parseInt('08', fakeZero), parseInt('08', 10), 'valueOf #1'); assert.same(parseInt('0x16', fakeZero), parseInt('0x16', 16), 'valueOf #2'); assert.same(parseInt('-0xF'), -15, 'signed hex #1'); assert.same(parseInt('-0xF', 16), -15, 'signed hex #2'); assert.same(parseInt('+0xF'), 15, 'signed hex #3'); assert.same(parseInt('+0xF', 16), 15, 'signed hex #4'); assert.same(parseInt('10', -4294967294), 2, 'radix uses ToUint32'); assert.same(parseInt(null), NaN); assert.same(parseInt(undefined), NaN); }); core-js-3.6.1/tests/pure/es.number.to-fixed.js000066400000000000000000000063601360057567700211770ustar00rootroot00000000000000import toFixed from 'core-js-pure/features/number/to-fixed'; QUnit.test('Number#toFixed', assert => { assert.isFunction(toFixed); assert.same(toFixed(0.00008, 3), '0.000'); assert.same(toFixed(0.9, 0), '1'); assert.same(toFixed(1.255, 2), '1.25'); assert.same(toFixed(1843654265.0774949, 5), '1843654265.07749'); assert.same(toFixed(1000000000000000128, 0), '1000000000000000128'); assert.same(toFixed(1), '1'); assert.same(toFixed(1, 0), '1'); assert.same(toFixed(1, 1), '1.0'); assert.same(toFixed(1, 1.1), '1.0'); assert.same(toFixed(1, 0.9), '1'); assert.same(toFixed(1, '0'), '1'); assert.same(toFixed(1, '1'), '1.0'); assert.same(toFixed(1, '1.1'), '1.0'); assert.same(toFixed(1, '0.9'), '1'); assert.same(toFixed(1, NaN), '1'); assert.same(toFixed(1, 'some string'), '1'); assert.notThrows(() => toFixed(1, -0.1) === '1'); assert.same(toFixed(Object(1)), '1'); assert.same(toFixed(Object(1), 0), '1'); assert.same(toFixed(Object(1), 1), '1.0'); assert.same(toFixed(Object(1), 1.1), '1.0'); assert.same(toFixed(Object(1), 0.9), '1'); assert.same(toFixed(Object(1), '0'), '1'); assert.same(toFixed(Object(1), '1'), '1.0'); assert.same(toFixed(Object(1), '1.1'), '1.0'); assert.same(toFixed(Object(1), '0.9'), '1'); assert.same(toFixed(Object(1), NaN), '1'); assert.same(toFixed(Object(1), 'some string'), '1'); assert.notThrows(() => toFixed(Object(1), -0.1) === '1'); assert.same(toFixed(NaN), 'NaN'); assert.same(toFixed(NaN, 0), 'NaN'); assert.same(toFixed(NaN, 1), 'NaN'); assert.same(toFixed(NaN, 1.1), 'NaN'); assert.same(toFixed(NaN, 0.9), 'NaN'); assert.same(toFixed(NaN, '0'), 'NaN'); assert.same(toFixed(NaN, '1'), 'NaN'); assert.same(toFixed(NaN, '1.1'), 'NaN'); assert.same(toFixed(NaN, '0.9'), 'NaN'); assert.same(toFixed(NaN, NaN), 'NaN'); assert.same(toFixed(NaN, 'some string'), 'NaN'); assert.notThrows(() => toFixed(NaN, -0.1) === 'NaN'); assert.same(toFixed(1e21), String(1e21)); assert.same(toFixed(1e21, 0), String(1e21)); assert.same(toFixed(1e21, 1), String(1e21)); assert.same(toFixed(1e21, 1.1), String(1e21)); assert.same(toFixed(1e21, 0.9), String(1e21)); assert.same(toFixed(1e21, '0'), String(1e21)); assert.same(toFixed(1e21, '1'), String(1e21)); assert.same(toFixed(1e21, '1.1'), String(1e21)); assert.same(toFixed(1e21, '0.9'), String(1e21)); assert.same(toFixed(1e21, NaN), String(1e21)); assert.same(toFixed(1e21, 'some string'), String(1e21)); assert.notThrows(() => toFixed(1e21, -0.1) === String(1e21)); assert.throws(() => toFixed(1, -101), RangeError, 'If f < 0 or f > 20, throw a RangeError exception.'); assert.throws(() => toFixed(1, 101), RangeError, 'If f < 0 or f > 20, throw a RangeError exception.'); assert.throws(() => toFixed(NaN, Infinity), RangeError, 'If f < 0 or f > 20, throw a RangeError exception.'); assert.throws(() => toFixed({}, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed('123', 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed(false, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed(null, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed(undefined, 1), TypeError, '? thisNumberValue(this value)'); }); core-js-3.6.1/tests/pure/es.number.to-precision.js000066400000000000000000000025361360057567700220740ustar00rootroot00000000000000import toPrecision from 'core-js-pure/features/number/to-precision'; QUnit.test('Number#toPrecision', assert => { assert.isFunction(toPrecision); assert.same(toPrecision(0.00008, 3), '0.0000800', '0.00008.toPrecision(3)'); assert.same(toPrecision(1.255, 2), '1.3', '1.255.toPrecision(2)'); assert.same(toPrecision(1843654265.0774949, 13), '1843654265.077', '1843654265.0774949.toPrecision(13)'); assert.same(toPrecision(NaN, 1), 'NaN', 'If x is NaN, return the String "NaN".'); assert.same(toPrecision(123.456), '123.456', 'If precision is undefined, return ! ToString(x).'); assert.same(toPrecision(123.456, undefined), '123.456', 'If precision is undefined, return ! ToString(x).'); assert.throws(() => toPrecision(0.9, 0), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(() => toPrecision(0.9, 101), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(() => toPrecision({}, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision('123', 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision(false, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision(null, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision(undefined, 1), TypeError, '? thisNumberValue(this value)'); }); core-js-3.6.1/tests/pure/es.object.assign.js000066400000000000000000000044071360057567700207220ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import Symbol from 'core-js-pure/features/symbol'; import { assign, keys, defineProperty } from 'core-js-pure/features/object'; QUnit.test('Object.assign', assert => { assert.isFunction(assign); let object = { q: 1 }; assert.strictEqual(object, assign(object, { bar: 2 }), 'assign return target'); assert.strictEqual(object.bar, 2, 'assign define properties'); assert.deepEqual(assign({}, { q: 1 }, { w: 2 }), { q: 1, w: 2 }); assert.deepEqual(assign({}, 'qwe'), { 0: 'q', 1: 'w', 2: 'e' }); assert.throws(() => assign(null, { q: 1 }), TypeError); assert.throws(() => assign(undefined, { q: 1 }), TypeError); let string = assign('qwe', { q: 1 }); assert.strictEqual(typeof string, 'object'); assert.strictEqual(String(string), 'qwe'); assert.strictEqual(string.q, 1); assert.same(assign({}, { valueOf: 42 }).valueOf, 42, 'IE enum keys bug'); if (DESCRIPTORS) { object = { baz: 1 }; assign(object, defineProperty({}, 'bar', { get() { return this.baz + 1; }, })); assert.ok(object.bar === undefined, "assign don't copy descriptors"); object = { a: 'a' }; const c = Symbol('c'); const d = Symbol('d'); object[c] = 'c'; defineProperty(object, 'b', { value: 'b' }); defineProperty(object, d, { value: 'd' }); const object2 = assign({}, object); assert.strictEqual(object2.a, 'a', 'a'); assert.strictEqual(object2.b, undefined, 'b'); assert.strictEqual(object2[c], 'c', 'c'); assert.strictEqual(object2[d], undefined, 'd'); try { assert.strictEqual(Function('assign', ` return assign({ b: 1 }, { get a() { delete this.b; }, b: 2 }); `)(assign).b, 1); } catch { /* empty */ } try { assert.strictEqual(Function('assign', ` return assign({ b: 1 }, { get a() { Object.defineProperty(this, "b", { value: 4, enumerable: false }); }, b: 2 }); `)(assign).b, 1); } catch { /* empty */ } } string = 'abcdefghijklmnopqrst'; const result = {}; for (let i = 0, { length } = string; i < length; ++i) { const char = string.charAt(i); result[char] = char; } assert.strictEqual(keys(assign({}, result)).join(''), string); }); core-js-3.6.1/tests/pure/es.object.create.js000066400000000000000000000021731360057567700206770ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import { create, getPrototypeOf, getOwnPropertyNames } from 'core-js-pure/features/object'; QUnit.test('Object.create', assert => { function getPropertyNames(object) { let result = []; do { result = result.concat(getOwnPropertyNames(object)); } while (object = getPrototypeOf(object)); return result; } assert.isFunction(create); assert.arity(create, 2); let object = { q: 1 }; assert.ok({}.isPrototypeOf.call(object, create(object))); assert.ok(create(object).q === 1); function C() { return this.a = 1; } assert.ok(create(new C()) instanceof C); assert.ok(C.prototype === getPrototypeOf(getPrototypeOf(create(new C())))); assert.ok(create(new C()).a === 1); assert.ok(create({}, { a: { value: 42 } }).a === 42); object = create(null, { w: { value: 2 } }); assert.same(object, Object(object)); assert.ok(!('toString' in object)); assert.ok(object.w === 2); assert.deepEqual(getPropertyNames(create(null)), []); }); QUnit.test('Object.create.sham flag', assert => { assert.same(create.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/pure/es.object.define-getter.js000066400000000000000000000015231360057567700221540ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants'; import { __defineGetter__, __defineSetter__ } from 'core-js-pure/features/object'; if (DESCRIPTORS) { QUnit.test('Object#__defineGetter__', assert => { assert.isFunction(__defineGetter__); const object = {}; assert.same(__defineGetter__(object, 'key', () => 42), undefined, 'void'); assert.same(object.key, 42, 'works'); __defineSetter__(object, 'key', function () { this.foo = 43; }); object.key = 44; assert.ok(object.key === 42 && object.foo === 43, 'works with setter'); if (STRICT) { assert.throws(() => __defineGetter__(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __defineGetter__(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.6.1/tests/pure/es.object.define-properties.js000066400000000000000000000011171360057567700230550ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import defineProperties from 'core-js-pure/features/object/define-properties'; QUnit.test('Object.defineProperties', assert => { assert.isFunction(defineProperties); assert.arity(defineProperties, 2); const source = {}; const result = defineProperties(source, { q: { value: 42 }, w: { value: 33 } }); assert.same(result, source); assert.same(result.q, 42); assert.same(result.w, 33); }); QUnit.test('Object.defineProperties.sham flag', assert => { assert.same(defineProperties.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/pure/es.object.define-property.js000066400000000000000000000012611360057567700225450ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import { defineProperty, create } from 'core-js-pure/features/object'; QUnit.test('Object.defineProperty', assert => { assert.isFunction(defineProperty); assert.arity(defineProperty, 3); const source = {}; const result = defineProperty(source, 'q', { value: 42, }); assert.same(result, source); assert.same(result.q, 42); assert.throws(() => defineProperty(42, 1, {})); assert.throws(() => defineProperty({}, create(null), {})); assert.throws(() => defineProperty({}, 1, 1)); }); QUnit.test('Object.defineProperty.sham flag', assert => { assert.same(defineProperty.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/pure/es.object.define-setter.js000066400000000000000000000017061360057567700221730ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants'; import { __defineGetter__, __defineSetter__ } from 'core-js-pure/features/object'; if (DESCRIPTORS) { QUnit.test('Object#__defineSetter__', assert => { assert.isFunction(__defineSetter__); let object = {}; assert.same(__defineSetter__(object, 'key', function () { this.foo = 43; }), undefined, 'void'); object.key = 44; assert.same(object.foo, 43, 'works'); object = {}; __defineSetter__(object, 'key', function () { this.foo = 43; }); __defineGetter__(object, 'key', () => 42); object.key = 44; assert.ok(object.key === 42 && object.foo === 43, 'works with getter'); if (STRICT) { assert.throws(() => __defineSetter__(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __defineSetter__(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.6.1/tests/pure/es.object.entries.js000066400000000000000000000021071360057567700211020ustar00rootroot00000000000000import { entries, create, assign } from 'core-js-pure/features/object'; QUnit.test('Object.entries', assert => { assert.isFunction(entries); assert.arity(entries, 1); assert.name(entries, 'entries'); assert.deepEqual(entries({ q: 1, w: 2, e: 3 }), [['q', 1], ['w', 2], ['e', 3]]); assert.deepEqual(entries(new String('qwe')), [['0', 'q'], ['1', 'w'], ['2', 'e']]); assert.deepEqual(entries(assign(create({ q: 1, w: 2, e: 3 }), { a: 4, s: 5, d: 6 })), [['a', 4], ['s', 5], ['d', 6]]); assert.deepEqual(entries({ valueOf: 42 }), [['valueOf', 42]], 'IE enum keys bug'); try { assert.deepEqual(Function('entries', ` return entries({ a: 1, get b() { delete this.c; return 2; }, c: 3 }); `)(entries), [['a', 1], ['b', 2]]); } catch { /* empty */ } try { assert.deepEqual(Function('entries', ` return entries({ a: 1, get b() { Object.defineProperty(this, "c", { value: 4, enumerable: false }); return 2 }, c: 3 }); `)(entries), [['a', 1], ['b', 2]]); } catch { /* empty */ } }); core-js-3.6.1/tests/pure/es.object.freeze.js000066400000000000000000000015551360057567700207170ustar00rootroot00000000000000import { freeze, keys, getOwnPropertyNames, getOwnPropertySymbols } from 'core-js-pure/features/object'; import ownKeys from 'core-js-pure/features/reflect/own-keys'; QUnit.test('Object.freeze', assert => { assert.isFunction(freeze); assert.arity(freeze, 1); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => freeze(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(freeze(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } const results = []; for (const key in freeze({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(freeze({})), []); assert.arrayEqual(getOwnPropertyNames(freeze({})), []); assert.arrayEqual(getOwnPropertySymbols(freeze({})), []); assert.arrayEqual(ownKeys(freeze({})), []); }); core-js-3.6.1/tests/pure/es.object.from-entries.js000066400000000000000000000015221360057567700220430ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import fromEntries from 'core-js-pure/features/object/from-entries'; import Set from 'core-js-pure/features/set'; QUnit.test('Object.fromEntries', assert => { assert.isFunction(fromEntries); assert.arity(fromEntries, 1); assert.name(fromEntries, 'fromEntries'); assert.ok(fromEntries([]) instanceof Object); assert.same(fromEntries([['foo', 1]]).foo, 1); assert.same(fromEntries(createIterable([['bar', 2]])).bar, 2); class Unit { constructor(id) { this.id = id; } toString() { return `unit${ this.id }`; } } const units = new Set([new Unit(101), new Unit(102), new Unit(103)]); const object = fromEntries(units.entries()); assert.same(object.unit101.id, 101); assert.same(object.unit102.id, 102); assert.same(object.unit103.id, 103); }); core-js-3.6.1/tests/pure/es.object.get-own-property-descriptor.js000066400000000000000000000020071360057567700250460ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import getOwnPropertyDescriptor from 'core-js-pure/features/object/get-own-property-descriptor'; QUnit.test('Object.getOwnPropertyDescriptor', assert => { assert.isFunction(getOwnPropertyDescriptor); assert.arity(getOwnPropertyDescriptor, 2); assert.deepEqual(getOwnPropertyDescriptor({ q: 42 }, 'q'), { writable: true, enumerable: true, configurable: true, value: 42, }); assert.ok(getOwnPropertyDescriptor({}, 'toString') === undefined); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertyDescriptor(value) || true, `accept ${ typeof value }`); } assert.throws(() => getOwnPropertyDescriptor(null), TypeError, 'throws on null'); assert.throws(() => getOwnPropertyDescriptor(undefined), TypeError, 'throws on undefined'); }); QUnit.test('Object.getOwnPropertyDescriptor.sham flag', assert => { assert.same(getOwnPropertyDescriptor.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/pure/es.object.get-own-property-descriptors.js000066400000000000000000000022111360057567700252260ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import Symbol from 'core-js-pure/features/symbol'; import { create, getOwnPropertyDescriptors } from 'core-js-pure/features/object'; QUnit.test('Object.getOwnPropertyDescriptors', assert => { assert.isFunction(getOwnPropertyDescriptors); const object = create({ q: 1 }, { e: { value: 3 } }); object.w = 2; const symbol = Symbol('4'); object[symbol] = 4; const descriptors = getOwnPropertyDescriptors(object); assert.strictEqual(descriptors.q, undefined); assert.deepEqual(descriptors.w, { enumerable: true, configurable: true, writable: true, value: 2, }); if (DESCRIPTORS) { assert.deepEqual(descriptors.e, { enumerable: false, configurable: false, writable: false, value: 3, }); } else { assert.deepEqual(descriptors.e, { enumerable: true, configurable: true, writable: true, value: 3, }); } assert.strictEqual(descriptors[symbol].value, 4); }); QUnit.test('Object.getOwnPropertyDescriptors.sham flag', assert => { assert.same(getOwnPropertyDescriptors.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/pure/es.object.get-own-property-names.js000066400000000000000000000033161360057567700237770ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants'; import { includes } from '../helpers/helpers'; import getOwnPropertyNames from 'core-js-pure/features/object/get-own-property-names'; QUnit.test('Object.getOwnPropertyNames', assert => { assert.isFunction(getOwnPropertyNames); assert.arity(getOwnPropertyNames, 1); function F1() { this.w = 1; } function F2() { this.toString = 1; } F1.prototype.q = F2.prototype.q = 1; const names = getOwnPropertyNames([1, 2, 3]); assert.strictEqual(names.length, 4); assert.ok(includes(names, '0')); assert.ok(includes(names, '1')); assert.ok(includes(names, '2')); assert.ok(includes(names, 'length')); assert.deepEqual(getOwnPropertyNames(new F1()), ['w']); assert.deepEqual(getOwnPropertyNames(new F2()), ['toString']); assert.ok(includes(getOwnPropertyNames(Array.prototype), 'toString')); assert.ok(includes(getOwnPropertyNames(Object.prototype), 'toString')); assert.ok(includes(getOwnPropertyNames(Object.prototype), 'constructor')); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertyNames(value), `accept ${ typeof value }`); } assert.throws(() => getOwnPropertyNames(null), TypeError, 'throws on null'); assert.throws(() => getOwnPropertyNames(undefined), TypeError, 'throws on undefined'); if (GLOBAL.document) { assert.notThrows(() => { const iframe = document.createElement('iframe'); iframe.src = 'http://example.com'; document.documentElement.appendChild(iframe); const window = iframe.contentWindow; document.documentElement.removeChild(iframe); return getOwnPropertyNames(window); }, 'IE11 bug with iframe and window'); } }); core-js-3.6.1/tests/pure/es.object.get-prototype-of.js000066400000000000000000000025771360057567700226700ustar00rootroot00000000000000import { CORRECT_PROTOTYPE_GETTER } from '../helpers/constants'; import { create, getPrototypeOf } from 'core-js-pure/features/object'; QUnit.test('Object.getPrototypeOf', assert => { assert.isFunction(getPrototypeOf); assert.arity(getPrototypeOf, 1); assert.ok(getPrototypeOf({}) === Object.prototype); assert.ok(getPrototypeOf([]) === Array.prototype); function F() { /* empty */ } assert.ok(getPrototypeOf(new F()) === F.prototype); const object = { q: 1 }; assert.ok(getPrototypeOf(create(object)) === object); assert.ok(getPrototypeOf(create(null)) === null); assert.ok(getPrototypeOf(getPrototypeOf({})) === null); function Foo() { /* empty */ } Foo.prototype.foo = 'foo'; function Bar() { /* empty */ } Bar.prototype = create(Foo.prototype); Bar.prototype.constructor = Bar; assert.strictEqual(getPrototypeOf(Bar.prototype).foo, 'foo'); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getPrototypeOf(value), `accept ${ typeof value }`); } assert.throws(() => getPrototypeOf(null), TypeError, 'throws on null'); assert.throws(() => getPrototypeOf(undefined), TypeError, 'throws on undefined'); assert.strictEqual(getPrototypeOf('foo'), String.prototype); }); QUnit.test('Object.getPrototypeOf.sham flag', assert => { assert.same(getPrototypeOf.sham, CORRECT_PROTOTYPE_GETTER ? undefined : true); }); core-js-3.6.1/tests/pure/es.object.is-extensible.js000066400000000000000000000007441360057567700222110ustar00rootroot00000000000000import isExtensible from 'core-js-pure/features/object/is-extensible'; QUnit.test('Object.isExtensible', assert => { assert.isFunction(isExtensible); assert.arity(isExtensible, 1); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isExtensible(value) || true, `accept ${ value }`); assert.same(isExtensible(value), false, `returns false on ${ value }`); } assert.same(isExtensible({}), true); }); core-js-3.6.1/tests/pure/es.object.is-frozen.js000066400000000000000000000007031360057567700213450ustar00rootroot00000000000000import isFrozen from 'core-js-pure/features/object/is-frozen'; QUnit.test('Object.isFrozen', assert => { assert.isFunction(isFrozen); assert.arity(isFrozen, 1); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isFrozen(value) || true, `accept ${ value }`); assert.same(isFrozen(value), true, `returns true on ${ value }`); } assert.same(isFrozen({}), false); }); core-js-3.6.1/tests/pure/es.object.is-sealed.js000066400000000000000000000007031360057567700212770ustar00rootroot00000000000000import isSealed from 'core-js-pure/features/object/is-sealed'; QUnit.test('Object.isSealed', assert => { assert.isFunction(isSealed); assert.arity(isSealed, 1); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isSealed(value) || true, `accept ${ value }`); assert.same(isSealed(value), true, `returns true on ${ value }`); } assert.same(isSealed({}), false); }); core-js-3.6.1/tests/pure/es.object.is.js000066400000000000000000000004101360057567700200370ustar00rootroot00000000000000import is from 'core-js-pure/features/object/is'; QUnit.test('Object.is', assert => { assert.isFunction(is); assert.ok(is(1, 1), '1 is 1'); assert.ok(is(NaN, NaN), '1 is 1'); assert.ok(!is(0, -0), '0 isnt -0'); assert.ok(!is({}, {}), '{} isnt {}'); }); core-js-3.6.1/tests/pure/es.object.keys.js000066400000000000000000000014511360057567700204050ustar00rootroot00000000000000import { includes } from '../helpers/helpers'; import keys from 'core-js-pure/features/object/keys'; QUnit.test('Object.keys', assert => { assert.isFunction(keys); assert.arity(keys, 1); function F1() { this.w = 1; } function F2() { this.toString = 1; } F1.prototype.q = F2.prototype.q = 1; assert.deepEqual(keys([1, 2, 3]), ['0', '1', '2']); assert.deepEqual(keys(new F1()), ['w']); assert.deepEqual(keys(new F2()), ['toString']); assert.ok(!includes(keys(Array.prototype), 'push')); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => keys(value), `accept ${ typeof value }`); } assert.throws(() => keys(null), TypeError, 'throws on null'); assert.throws(() => keys(undefined), TypeError, 'throws on undefined'); }); core-js-3.6.1/tests/pure/es.object.lookup-getter.js000066400000000000000000000020211360057567700222250ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants'; import { __lookupGetter__, __defineGetter__, create } from 'core-js-pure/features/object'; if (DESCRIPTORS) { QUnit.test('Object#__lookupGetter__', assert => { assert.isFunction(__lookupGetter__); assert.same(__lookupGetter__({}, 'key'), undefined, 'empty object'); assert.same(__lookupGetter__({ key: 42 }, 'key'), undefined, 'data descriptor'); const object = {}; function getter() { /* empty */ } __defineGetter__(object, 'key', getter); assert.same(__lookupGetter__(object, 'key'), getter, 'own getter'); assert.same(__lookupGetter__(create(object), 'key'), getter, 'proto getter'); assert.same(__lookupGetter__(create(object), 'foo'), undefined, 'empty proto'); if (STRICT) { assert.throws(() => __lookupGetter__(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __lookupGetter__(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.6.1/tests/pure/es.object.lookup-setter.js000066400000000000000000000020211360057567700222410ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants'; import { __lookupSetter__, __defineSetter__, create } from 'core-js-pure/features/object'; if (DESCRIPTORS) { QUnit.test('Object#__lookupSetter__', assert => { assert.isFunction(__lookupSetter__); assert.same(__lookupSetter__({}, 'key'), undefined, 'empty object'); assert.same(__lookupSetter__({ key: 42 }, 'key'), undefined, 'data descriptor'); const object = {}; function setter() { /* empty */ } __defineSetter__(object, 'key', setter); assert.same(__lookupSetter__(object, 'key'), setter, 'own getter'); assert.same(__lookupSetter__(create(object), 'key'), setter, 'proto getter'); assert.same(__lookupSetter__(create(object), 'foo'), undefined, 'empty proto'); if (STRICT) { assert.throws(() => __lookupSetter__(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __lookupSetter__(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.6.1/tests/pure/es.object.prevent-extensions.js000066400000000000000000000017461360057567700233210ustar00rootroot00000000000000import { preventExtensions, keys, getOwnPropertyNames, getOwnPropertySymbols } from 'core-js-pure/features/object'; import ownKeys from 'core-js-pure/features/reflect/own-keys'; QUnit.test('Object.preventExtensions', assert => { assert.isFunction(preventExtensions); assert.arity(preventExtensions, 1); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => preventExtensions(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(preventExtensions(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } const results = []; for (const key in preventExtensions({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(preventExtensions({})), []); assert.arrayEqual(getOwnPropertyNames(preventExtensions({})), []); assert.arrayEqual(getOwnPropertySymbols(preventExtensions({})), []); assert.arrayEqual(ownKeys(preventExtensions({})), []); }); core-js-3.6.1/tests/pure/es.object.seal.js000066400000000000000000000015271360057567700203620ustar00rootroot00000000000000import { seal, keys, getOwnPropertyNames, getOwnPropertySymbols } from 'core-js-pure/features/object'; import ownKeys from 'core-js-pure/features/reflect/own-keys'; QUnit.test('Object.seal', assert => { assert.isFunction(seal); assert.arity(seal, 1); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => seal(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(seal(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } const results = []; for (const key in seal({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(seal({})), []); assert.arrayEqual(getOwnPropertyNames(seal({})), []); assert.arrayEqual(getOwnPropertySymbols(seal({})), []); assert.arrayEqual(ownKeys(seal({})), []); }); core-js-3.6.1/tests/pure/es.object.set-prototype-of.js000066400000000000000000000012331360057567700226700ustar00rootroot00000000000000import { PROTO } from '../helpers/constants'; import setPrototypeOf from 'core-js-pure/features/object/set-prototype-of'; if (PROTO) QUnit.test('Object.setPrototypeOf', assert => { assert.isFunction(setPrototypeOf); assert.ok('apply' in setPrototypeOf({}, Function.prototype), 'Parent properties in target'); assert.strictEqual(setPrototypeOf({ a: 2 }, { b() { return this.a ** 2; }, }).b(), 4, 'Child and parent properties in target'); const object = {}; assert.strictEqual(setPrototypeOf(object, { a: 1 }), object, 'setPrototypeOf return target'); assert.ok(!('toString' in setPrototypeOf({}, null)), 'Can set null as prototype'); }); core-js-3.6.1/tests/pure/es.object.values.js000066400000000000000000000017171360057567700207360ustar00rootroot00000000000000import { values, create, assign } from 'core-js-pure/features/object'; QUnit.test('Object.values', assert => { assert.isFunction(values); assert.arity(values, 1); assert.name(values, 'values'); assert.deepEqual(values({ q: 1, w: 2, e: 3 }), [1, 2, 3]); assert.deepEqual(values(new String('qwe')), ['q', 'w', 'e']); assert.deepEqual(values(assign(create({ q: 1, w: 2, e: 3 }), { a: 4, s: 5, d: 6 })), [4, 5, 6]); assert.deepEqual(values({ valueOf: 42 }), [42], 'IE enum keys bug'); try { assert.deepEqual(Function('values', ` return values({ a: 1, get b() { delete this.c; return 2; }, c: 3 }); `)(values), [1, 2]); } catch { /* empty */ } try { assert.deepEqual(Function('values', ` return values({ a: 1, get b() { Object.defineProperty(this, "c", { value: 4, enumerable: false }); return 2; }, c: 3 }); `)(values), [1, 2]); } catch { /* empty */ } }); core-js-3.6.1/tests/pure/es.parse-float.js000066400000000000000000000011571360057567700204050ustar00rootroot00000000000000import { WHITESPACES } from '../helpers/constants'; import parseFloat from 'core-js-pure/features/parse-float'; QUnit.test('parseFloat', assert => { assert.isFunction(parseFloat); assert.arity(parseFloat, 1); assert.same(parseFloat('0'), 0); assert.same(parseFloat(' 0'), 0); assert.same(parseFloat('+0'), 0); assert.same(parseFloat(' +0'), 0); assert.same(parseFloat('-0'), -0); assert.same(parseFloat(' -0'), -0); assert.same(parseFloat(`${ WHITESPACES }+0`), 0); assert.same(parseFloat(`${ WHITESPACES }-0`), -0); assert.same(parseFloat(null), NaN); assert.same(parseFloat(undefined), NaN); }); core-js-3.6.1/tests/pure/es.parse-int.js000066400000000000000000000031521360057567700200670ustar00rootroot00000000000000import { WHITESPACES } from '../helpers/constants'; import parseInt from 'core-js-pure/features/parse-int'; QUnit.test('parseInt', assert => { assert.isFunction(parseInt); assert.arity(parseInt, 2); for (let radix = 2; radix <= 36; ++radix) { assert.same(parseInt('10', radix), radix, `radix ${ radix }`); } const strings = ['01', '08', '10', '42']; for (const string of strings) { assert.same(parseInt(string), parseInt(string, 10), `default radix is 10: ${ string }`); } assert.same(parseInt('0x16'), parseInt('0x16', 16), 'default radix is 16: 0x16'); assert.same(parseInt(' 0x16'), parseInt('0x16', 16), 'ignores leading whitespace #1'); assert.same(parseInt(' 42'), parseInt('42', 10), 'ignores leading whitespace #2'); assert.same(parseInt(' 08'), parseInt('08', 10), 'ignores leading whitespace #3'); assert.same(parseInt(`${ WHITESPACES }08`), parseInt('08', 10), 'ignores leading whitespace #4'); assert.same(parseInt(`${ WHITESPACES }0x16`), parseInt('0x16', 16), 'ignores leading whitespace #5'); const fakeZero = { valueOf() { return 0; }, }; assert.same(parseInt('08', fakeZero), parseInt('08', 10), 'valueOf #1'); assert.same(parseInt('0x16', fakeZero), parseInt('0x16', 16), 'valueOf #2'); assert.same(parseInt('-0xF'), -15, 'signed hex #1'); assert.same(parseInt('-0xF', 16), -15, 'signed hex #2'); assert.same(parseInt('+0xF'), 15, 'signed hex #3'); assert.same(parseInt('+0xF', 16), 15, 'signed hex #4'); assert.same(parseInt('10', -4294967294), 2, 'radix uses ToUint32'); assert.same(parseInt(null), NaN); assert.same(parseInt(undefined), NaN); }); core-js-3.6.1/tests/pure/es.promise.all-settled.js000066400000000000000000000016141360057567700220550ustar00rootroot00000000000000import Promise from 'core-js-pure/es/promise'; QUnit.test('Promise.allSettled', assert => { assert.isFunction(Promise.allSettled); assert.arity(Promise.allSettled, 1); assert.ok(Promise.allSettled([1, 2, 3]) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.allSettled, resolved', assert => { assert.expect(1); const async = assert.async(); Promise.allSettled([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(it => { assert.deepEqual(it, [ { value: 1, status: 'fulfilled' }, { reason: 2, status: 'rejected' }, { value: 3, status: 'fulfilled' }, ], 'resolved with a correct value'); async(); }); }); QUnit.test('Promise.allSettled, rejected', assert => { assert.expect(1); const async = assert.async(); Promise.allSettled().catch(() => { assert.ok(true, 'rejected as expected'); async(); }); }); core-js-3.6.1/tests/pure/es.promise.finally.js000066400000000000000000000023311360057567700212760ustar00rootroot00000000000000import Promise from 'core-js-pure/features/promise'; QUnit.test('Promise#finally', assert => { assert.isFunction(Promise.prototype.finally); assert.arity(Promise.prototype.finally, 1); assert.nonEnumerable(Promise.prototype, 'finally'); assert.ok(Promise.resolve(42).finally(() => { /* empty */ }) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise#finally, resolved', assert => { assert.expect(3); const async = assert.async(); let called = 0; let argument = null; Promise.resolve(42).finally(it => { called++; argument = it; }).then(it => { assert.same(it, 42, 'resolved with a correct value'); assert.same(called, 1, 'onFinally function called one time'); assert.same(argument, undefined, 'onFinally function called with a correct argument'); async(); }); }); QUnit.test('Promise#finally, rejected', assert => { assert.expect(2); const async = assert.async(); let called = 0; let argument = null; Promise.reject(42).finally(it => { called++; argument = it; }).catch(() => { assert.same(called, 1, 'onFinally function called one time'); assert.same(argument, undefined, 'onFinally function called with a correct argument'); async(); }); }); core-js-3.6.1/tests/pure/es.promise.js000066400000000000000000000355331360057567700176530ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, PROTO, STRICT } from '../helpers/constants'; import { createIterable } from '../helpers/helpers'; import { Promise, Symbol } from 'core-js-pure'; import getIteratorMethod from 'core-js-pure/features/get-iterator-method'; import { setPrototypeOf, create } from 'core-js-pure/features/object'; import bind from 'core-js-pure/features/function/bind'; QUnit.test('Promise', assert => { assert.isFunction(Promise); assert.throws(() => { Promise(); }, 'throws w/o `new`'); new Promise(function (resolve, reject) { assert.isFunction(resolve, 'resolver is function'); assert.isFunction(reject, 'rejector is function'); if (STRICT) assert.same(this, undefined, 'correct executor context'); }); }); if (DESCRIPTORS) QUnit.test('Promise operations order', assert => { let resolve, resolve2; assert.expect(1); const EXPECTED_ORDER = 'DEHAFGBC'; const async = assert.async(); let result = ''; const promise1 = new Promise(r => { resolve = r; }); resolve({ then() { result += 'A'; throw Error(); }, }); promise1.catch(() => { result += 'B'; }); promise1.catch(() => { result += 'C'; assert.same(result, EXPECTED_ORDER); async(); }); const promise2 = new Promise(r => { resolve2 = r; }); resolve2(Object.defineProperty({}, 'then', { get() { result += 'D'; throw Error(); }, })); result += 'E'; promise2.catch(() => { result += 'F'; }); promise2.catch(() => { result += 'G'; }); result += 'H'; setTimeout(() => { if (!~result.indexOf('C')) { assert.same(result, EXPECTED_ORDER); async(); } }, 1e3); }); QUnit.test('Promise#then', assert => { assert.isFunction(Promise.prototype.then); assert.nonEnumerable(Promise.prototype, 'then'); let promise = new Promise(resolve => { resolve(42); }); let FakePromise1 = promise.constructor = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; const FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(promise.then(() => { /* empty */ }) instanceof FakePromise2, 'subclassing, @@species pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(promise.then(() => { /* empty */ }) instanceof Promise, 'subclassing, incorrect `this` pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1[Symbol.species] = function () { /* empty */ }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #1'); FakePromise1[Symbol.species] = function (executor) { executor(null, () => { /* empty */ }); }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #2'); FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, null); }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #3'); }); QUnit.test('Promise#catch', assert => { assert.isFunction(Promise.prototype.catch); assert.nonEnumerable(Promise.prototype, 'catch'); let promise = new Promise(resolve => { resolve(42); }); let FakePromise1 = promise.constructor = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; const FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(promise.catch(() => { /* empty */ }) instanceof FakePromise2, 'subclassing, @@species pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(promise.catch(() => { /* empty */ }) instanceof Promise, 'subclassing, incorrect `this` pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1[Symbol.species] = function () { /* empty */ }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #1'); FakePromise1[Symbol.species] = function (executor) { executor(null, () => { /* empty */ }); }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #2'); FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, null); }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #3'); assert.same(Promise.prototype.catch.call({ then(x, y) { return y; }, }, 42), 42, 'calling `.then`'); }); QUnit.test('Promise#@@toStringTag', assert => { assert.ok(Promise.prototype[Symbol.toStringTag] === 'Promise', 'Promise::@@toStringTag is `Promise`'); assert.strictEqual(String(new Promise(() => { /* empty */ })), '[object Promise]', 'correct stringification'); }); QUnit.test('Promise.all', assert => { const { all, resolve } = Promise; assert.isFunction(all); assert.arity(all, 1); const iterable = createIterable([1, 2, 3]); Promise.all(iterable).catch(() => { /* empty */ }); assert.ok(iterable.received, 'works with iterables: iterator received'); assert.ok(iterable.called, 'works with iterables: next called'); const array = []; let done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; Promise.all(array); assert.ok(done); assert.throws(() => { all.call(null, []).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); done = false; try { Promise.resolve = function () { throw new Error(); }; Promise.all(createIterable([1, 2, 3], { return() { done = true; }, })).catch(() => { /* empty */ }); } catch (error) { /* empty */ } Promise.resolve = resolve; assert.ok(done, 'iteration closing'); let FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; let FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1.resolve = FakePromise2.resolve = bind(Promise.resolve, Promise); assert.ok(all.call(FakePromise1, [1, 2, 3]) instanceof FakePromise1, 'subclassing, `this` pattern'); FakePromise1 = function () { /* empty */ }; FakePromise2 = function (executor) { executor(null, () => { /* empty */ }); }; const FakePromise3 = function (executor) { executor(() => { /* empty */ }, null); }; FakePromise1.resolve = FakePromise2.resolve = FakePromise3.resolve = bind(Promise.resolve, Promise); assert.throws(() => { all.call(FakePromise1, [1, 2, 3]); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { all.call(FakePromise2, [1, 2, 3]); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { all.call(FakePromise3, [1, 2, 3]); }, 'NewPromiseCapability validations, #3'); }); QUnit.test('Promise.race', assert => { const { race, resolve } = Promise; assert.isFunction(race); assert.arity(race, 1); const iterable = createIterable([1, 2, 3]); Promise.race(iterable).catch(() => { /* empty */ }); assert.ok(iterable.received, 'works with iterables: iterator received'); assert.ok(iterable.called, 'works with iterables: next called'); const array = []; let done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; Promise.race(array); assert.ok(done); assert.throws(() => { race.call(null, []).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); done = false; try { Promise.resolve = function () { throw new Error(); }; Promise.race(createIterable([1, 2, 3], { return() { done = true; }, })).catch(() => { /* empty */ }); } catch (error) { /* empty */ } Promise.resolve = resolve; assert.ok(done, 'iteration closing'); let FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; let FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1.resolve = FakePromise2.resolve = bind(Promise.resolve, Promise); assert.ok(race.call(FakePromise1, [1, 2, 3]) instanceof FakePromise1, 'subclassing, `this` pattern'); FakePromise1 = function () { /* empty */ }; FakePromise2 = function (executor) { executor(null, () => { /* empty */ }); }; const FakePromise3 = function (executor) { executor(() => { /* empty */ }, null); }; FakePromise1.resolve = FakePromise2.resolve = FakePromise3.resolve = bind(Promise.resolve, Promise); assert.throws(() => { race.call(FakePromise1, [1, 2, 3]); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { race.call(FakePromise2, [1, 2, 3]); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { race.call(FakePromise3, [1, 2, 3]); }, 'NewPromiseCapability validations, #3'); }); QUnit.test('Promise.resolve', assert => { const { resolve } = Promise; assert.isFunction(resolve); assert.throws(() => { resolve.call(null, 1).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); function FakePromise1(executor) { executor(() => { /* empty */ }, () => { /* empty */ }); } FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(resolve.call(FakePromise1, 42) instanceof FakePromise1, 'subclassing, `this` pattern'); assert.throws(() => { resolve.call(() => { /* empty */ }, 42); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { resolve.call(executor => { executor(null, () => { /* empty */ }); }, 42); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { resolve.call(executor => { executor(() => { /* empty */ }, null); }, 42); }, 'NewPromiseCapability validations, #3'); }); QUnit.test('Promise.reject', assert => { const { reject } = Promise; assert.isFunction(reject); assert.throws(() => { reject.call(null, 1).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); function FakePromise1(executor) { executor(() => { /* empty */ }, () => { /* empty */ }); } FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(reject.call(FakePromise1, 42) instanceof FakePromise1, 'subclassing, `this` pattern'); assert.throws(() => { reject.call(() => { /* empty */ }, 42); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { reject.call(executor => { executor(null, () => { /* empty */ }); }, 42); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { reject.call(executor => { executor(() => { /* empty */ }, null); }, 42); }, 'NewPromiseCapability validations, #3'); }); if (PROTO) QUnit.test('Promise subclassing', assert => { function SubPromise(executor) { const self = new Promise(executor); setPrototypeOf(self, SubPromise.prototype); self.mine = 'subclass'; return self; } setPrototypeOf(SubPromise, Promise); SubPromise.prototype = create(Promise.prototype); SubPromise.prototype.constructor = SubPromise; let promise1 = SubPromise.resolve(5); assert.strictEqual(promise1.mine, 'subclass'); promise1 = promise1.then(it => { assert.strictEqual(it, 5); }); assert.strictEqual(promise1.mine, 'subclass'); let promise2 = new SubPromise(resolve => { resolve(6); }); assert.strictEqual(promise2.mine, 'subclass'); promise2 = promise2.then(it => { assert.strictEqual(it, 6); }); assert.strictEqual(promise2.mine, 'subclass'); const promise3 = SubPromise.all([promise1, promise2]); assert.strictEqual(promise3.mine, 'subclass'); assert.ok(promise3 instanceof Promise); assert.ok(promise3 instanceof SubPromise); promise3.then(assert.async(), it => { assert.ok(it, false); }); }); // qunit@2.5 strange bug QUnit.skip('Unhandled rejection tracking', assert => { let done = false; const resume = assert.async(); if (GLOBAL.process) { assert.expect(3); function onunhandledrejection(reason, promise) { process.removeListener('unhandledRejection', onunhandledrejection); assert.same(promise, $promise, 'unhandledRejection, promise'); assert.same(reason, 42, 'unhandledRejection, reason'); $promise.catch(() => { // empty }); } function onrejectionhandled(promise) { process.removeListener('rejectionHandled', onrejectionhandled); assert.same(promise, $promise, 'rejectionHandled, promise'); done || resume(); done = true; } process.on('unhandledRejection', onunhandledrejection); process.on('rejectionHandled', onrejectionhandled); } else { if (GLOBAL.addEventListener) { assert.expect(8); function onunhandledrejection(it) { assert.same(it.promise, $promise, 'addEventListener(unhandledrejection), promise'); assert.same(it.reason, 42, 'addEventListener(unhandledrejection), reason'); GLOBAL.removeEventListener('unhandledrejection', onunhandledrejection); } GLOBAL.addEventListener('rejectionhandled', onunhandledrejection); function onrejectionhandled(it) { assert.same(it.promise, $promise, 'addEventListener(rejectionhandled), promise'); assert.same(it.reason, 42, 'addEventListener(rejectionhandled), reason'); GLOBAL.removeEventListener('rejectionhandled', onrejectionhandled); } GLOBAL.addEventListener('rejectionhandled', onrejectionhandled); } else assert.expect(4); GLOBAL.onunhandledrejection = function (it) { assert.same(it.promise, $promise, 'onunhandledrejection, promise'); assert.same(it.reason, 42, 'onunhandledrejection, reason'); setTimeout(() => { $promise.catch(() => { // empty }); }, 1); GLOBAL.onunhandledrejection = null; }; GLOBAL.onrejectionhandled = function (it) { assert.same(it.promise, $promise, 'onrejectionhandled, promise'); assert.same(it.reason, 42, 'onrejectionhandled, reason'); GLOBAL.onrejectionhandled = null; done || resume(); done = true; }; } Promise.reject(43).catch(() => { // empty }); const $promise = Promise.reject(42); setTimeout(() => { done || resume(); done = true; }, 3e3); }); core-js-3.6.1/tests/pure/es.reflect.apply.js000066400000000000000000000013701360057567700207350ustar00rootroot00000000000000import apply from 'core-js-pure/features/reflect/apply'; QUnit.test('Reflect.apply', assert => { assert.isFunction(apply); assert.arity(apply, 3); if ('name' in apply) { assert.name(apply, 'apply'); } assert.strictEqual(apply(Array.prototype.push, [1, 2], [3, 4, 5]), 5); function F(a, b, c) { return a + b + c; } F.apply = 42; assert.strictEqual(apply(F, null, ['foo', 'bar', 'baz']), 'foobarbaz', 'works with redefined apply'); assert.throws(() => apply(42, null, []), TypeError, 'throws on primitive'); assert.throws(() => apply(() => { /* empty */ }, null), TypeError, 'throws without third argument'); assert.throws(() => apply(() => { /* empty */ }, null, '123'), TypeError, 'throws on primitive as third argument'); }); core-js-3.6.1/tests/pure/es.reflect.construct.js000066400000000000000000000023351360057567700216360ustar00rootroot00000000000000import construct from 'core-js-pure/features/reflect/construct'; import getPrototypeOf from 'core-js-pure/features/object/get-prototype-of'; QUnit.test('Reflect.construct', assert => { assert.isFunction(construct); assert.arity(construct, 2); if ('name' in construct) { assert.name(construct, 'construct'); } function A(a, b, c) { this.qux = a + b + c; } assert.strictEqual(construct(A, ['foo', 'bar', 'baz']).qux, 'foobarbaz', 'basic'); A.apply = 42; assert.strictEqual(construct(A, ['foo', 'bar', 'baz']).qux, 'foobarbaz', 'works with redefined apply'); const instance = construct(function () { this.x = 42; }, [], Array); assert.strictEqual(instance.x, 42, 'constructor with newTarget'); assert.ok(instance instanceof Array, 'prototype with newTarget'); assert.throws(() => construct(42, []), TypeError, 'throws on primitive'); function B() { /* empty */ } B.prototype = 42; assert.notThrows(() => getPrototypeOf(construct(B, [])) === Object.prototype); assert.notThrows(() => typeof construct(Date, []).getTime() === 'number', 'works with native constructors with 2 arguments'); assert.throws(() => construct(() => { /* empty */ }), 'throws when the second argument is not an object'); }); core-js-3.6.1/tests/pure/es.reflect.define-property.js000066400000000000000000000024701360057567700227260ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import defineProperty from 'core-js-pure/features/reflect/define-property'; import { getOwnPropertyDescriptor, create } from 'core-js-pure/features/object'; QUnit.test('Reflect.defineProperty', assert => { assert.isFunction(defineProperty); assert.arity(defineProperty, 3); if ('name' in defineProperty) { assert.name(defineProperty, 'defineProperty'); } let object = {}; assert.strictEqual(defineProperty(object, 'foo', { value: 123 }), true); assert.strictEqual(object.foo, 123); if (DESCRIPTORS) { object = {}; defineProperty(object, 'foo', { value: 123, enumerable: true, }); assert.deepEqual(getOwnPropertyDescriptor(object, 'foo'), { value: 123, enumerable: true, configurable: false, writable: false, }); assert.strictEqual(defineProperty(object, 'foo', { value: 42, }), false); } assert.throws(() => defineProperty(42, 'foo', { value: 42, }), TypeError, 'throws on primitive'); assert.throws(() => defineProperty(42, 1, {})); assert.throws(() => defineProperty({}, create(null), {})); assert.throws(() => defineProperty({}, 1, 1)); }); QUnit.test('Reflect.defineProperty.sham flag', assert => { assert.same(defineProperty.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/pure/es.reflect.delete-property.js000066400000000000000000000013671360057567700227420ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import deleteProperty from 'core-js-pure/features/reflect/delete-property'; import { defineProperty, keys } from 'core-js-pure/features/object'; QUnit.test('Reflect.deleteProperty', assert => { assert.isFunction(deleteProperty); assert.arity(deleteProperty, 2); if ('name' in deleteProperty) { assert.name(deleteProperty, 'deleteProperty'); } const object = { bar: 456 }; assert.strictEqual(deleteProperty(object, 'bar'), true); assert.ok(keys(object).length === 0); if (DESCRIPTORS) { assert.strictEqual(deleteProperty(defineProperty({}, 'foo', { value: 42, }), 'foo'), false); } assert.throws(() => deleteProperty(42, 'foo'), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/pure/es.reflect.get-own-property-descriptor.js000066400000000000000000000014621360057567700252300ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import getOwnPropertyDescriptor from 'core-js-pure/features/reflect/get-own-property-descriptor'; QUnit.test('Reflect.getOwnPropertyDescriptor', assert => { assert.isFunction(getOwnPropertyDescriptor); assert.arity(getOwnPropertyDescriptor, 2); if ('name' in getOwnPropertyDescriptor) { assert.name(getOwnPropertyDescriptor, 'getOwnPropertyDescriptor'); } const object = { baz: 789 }; const descriptor = getOwnPropertyDescriptor(object, 'baz'); assert.strictEqual(descriptor.value, 789); assert.throws(() => getOwnPropertyDescriptor(42, 'constructor'), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.getOwnPropertyDescriptor.sham flag', assert => { assert.same(getOwnPropertyDescriptor.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/pure/es.reflect.get-prototype-of.js000066400000000000000000000011771360057567700230410ustar00rootroot00000000000000import { CORRECT_PROTOTYPE_GETTER } from '../helpers/constants'; import getPrototypeOf from 'core-js-pure/features/reflect/get-prototype-of'; QUnit.test('Reflect.getPrototypeOf', assert => { assert.isFunction(getPrototypeOf); assert.arity(getPrototypeOf, 1); if ('name' in getPrototypeOf) { assert.name(getPrototypeOf, 'getPrototypeOf'); } assert.strictEqual(getPrototypeOf([]), Array.prototype); assert.throws(() => getPrototypeOf(42), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.getPrototypeOf.sham flag', assert => { assert.same(getPrototypeOf.sham, CORRECT_PROTOTYPE_GETTER ? undefined : true); }); core-js-3.6.1/tests/pure/es.reflect.get.js000066400000000000000000000020401360057567700203620ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import get from 'core-js-pure/features/reflect/get'; import { defineProperty, create } from 'core-js-pure/features/object'; QUnit.test('Reflect.get', assert => { assert.isFunction(get); if ('name' in get) { assert.name(get, 'get'); } assert.strictEqual(get({ qux: 987 }, 'qux'), 987); if (DESCRIPTORS) { const target = create(defineProperty({ z: 3 }, 'w', { get() { return this; }, }), { x: { value: 1, }, y: { get() { return this; }, }, }); const receiver = {}; assert.strictEqual(get(target, 'x', receiver), 1, 'get x'); assert.strictEqual(get(target, 'y', receiver), receiver, 'get y'); assert.strictEqual(get(target, 'z', receiver), 3, 'get z'); assert.strictEqual(get(target, 'w', receiver), receiver, 'get w'); assert.strictEqual(get(target, 'u', receiver), undefined, 'get u'); } assert.throws(() => get(42, 'constructor'), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/pure/es.reflect.has.js000066400000000000000000000007201360057567700203610ustar00rootroot00000000000000import has from 'core-js-pure/features/reflect/has'; QUnit.test('Reflect.has', assert => { assert.isFunction(has); assert.arity(has, 2); if ('name' in has) { assert.name(has, 'has'); } const object = { qux: 987 }; assert.strictEqual(has(object, 'qux'), true); assert.strictEqual(has(object, 'qwe'), false); assert.strictEqual(has(object, 'toString'), true); assert.throws(() => has(42, 'constructor'), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/pure/es.reflect.is-extensible.js000066400000000000000000000011211360057567700223550ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import isExtensible from 'core-js-pure/features/reflect/is-extensible'; import preventExtensions from 'core-js-pure/features/object/prevent-extensions'; QUnit.test('Reflect.isExtensible', assert => { assert.isFunction(isExtensible); assert.arity(isExtensible, 1); if ('name' in isExtensible) { assert.name(isExtensible, 'isExtensible'); } assert.ok(isExtensible({})); if (DESCRIPTORS) { assert.ok(!isExtensible(preventExtensions({}))); } assert.throws(() => isExtensible(42), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/pure/es.reflect.own-keys.js000066400000000000000000000017631360057567700213720ustar00rootroot00000000000000import { includes } from '../helpers/helpers'; import Symbol from 'core-js-pure/features/symbol'; import ownKeys from 'core-js-pure/features/reflect/own-keys'; import { defineProperty, create } from 'core-js-pure/features/object'; QUnit.test('Reflect.ownKeys', assert => { assert.isFunction(ownKeys); assert.arity(ownKeys, 1); if ('name' in ownKeys) { assert.name(ownKeys, 'ownKeys'); } const object = { a: 1 }; defineProperty(object, 'b', { value: 2, }); object[Symbol('c')] = 3; let keys = ownKeys(object); assert.strictEqual(keys.length, 3, 'ownKeys return all own keys'); assert.ok(includes(keys, 'a'), 'ownKeys return all own keys: simple'); assert.ok(includes(keys, 'b'), 'ownKeys return all own keys: hidden'); assert.strictEqual(object[keys[2]], 3, 'ownKeys return all own keys: symbol'); keys = ownKeys(create(object)); assert.strictEqual(keys.length, 0, 'ownKeys return only own keys'); assert.throws(() => ownKeys(42), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/pure/es.reflect.prevent-extensions.js000066400000000000000000000014321360057567700234670ustar00rootroot00000000000000import { DESCRIPTORS, FREEZING } from '../helpers/constants'; import preventExtensions from 'core-js-pure/features/reflect/prevent-extensions'; import isExtensible from 'core-js-pure/features/object/is-extensible'; QUnit.test('Reflect.preventExtensions', assert => { assert.isFunction(preventExtensions); assert.arity(preventExtensions, 1); if ('name' in preventExtensions) { assert.name(preventExtensions, 'preventExtensions'); } const object = {}; assert.ok(preventExtensions(object), true); if (DESCRIPTORS) { assert.ok(!isExtensible(object)); } assert.throws(() => preventExtensions(42), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.preventExtensions.sham flag', assert => { assert.same(preventExtensions.sham, FREEZING ? undefined : true); }); core-js-3.6.1/tests/pure/es.reflect.set-prototype-of.js000066400000000000000000000012411360057567700230450ustar00rootroot00000000000000import { PROTO } from '../helpers/constants'; import setPrototypeOf from 'core-js-pure/features/reflect/set-prototype-of'; if (PROTO) QUnit.test('Reflect.setPrototypeOf', assert => { assert.isFunction(setPrototypeOf); if ('name' in setPrototypeOf) { assert.name(setPrototypeOf, 'setPrototypeOf'); } let object = {}; assert.ok(setPrototypeOf(object, Array.prototype), true); assert.ok(object instanceof Array); assert.throws(() => setPrototypeOf({}, 42), TypeError); assert.throws(() => setPrototypeOf(42, {}), TypeError, 'throws on primitive'); object = {}; assert.ok(setPrototypeOf(object, object) === false, 'false on recursive __proto__'); }); core-js-3.6.1/tests/pure/es.reflect.set.js000066400000000000000000000053761360057567700204150ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import set from 'core-js-pure/features/reflect/set'; import { defineProperty, getOwnPropertyDescriptor, create, getPrototypeOf } from 'core-js-pure/features/object'; QUnit.test('Reflect.set', assert => { assert.isFunction(set); if ('name' in set) { assert.name(set, 'set'); } const object = {}; assert.ok(set(object, 'quux', 654), true); assert.strictEqual(object.quux, 654); let target = {}; const receiver = {}; set(target, 'foo', 1, receiver); assert.strictEqual(target.foo, undefined, 'target.foo === undefined'); assert.strictEqual(receiver.foo, 1, 'receiver.foo === 1'); if (DESCRIPTORS) { defineProperty(receiver, 'bar', { value: 0, writable: true, enumerable: false, configurable: true, }); set(target, 'bar', 1, receiver); assert.strictEqual(receiver.bar, 1, 'receiver.bar === 1'); assert.strictEqual(getOwnPropertyDescriptor(receiver, 'bar').enumerable, false, 'enumerability not overridden'); let out = null; target = create(defineProperty({ z: 3 }, 'w', { set() { out = this; }, }), { x: { value: 1, writable: true, configurable: true, }, y: { set() { out = this; }, }, c: { value: 1, writable: false, configurable: false, }, }); assert.strictEqual(set(target, 'x', 2, target), true, 'set x'); assert.strictEqual(target.x, 2, 'set x'); out = null; assert.strictEqual(set(target, 'y', 2, target), true, 'set y'); assert.strictEqual(out, target, 'set y'); assert.strictEqual(set(target, 'z', 4, target), true); assert.strictEqual(target.z, 4, 'set z'); out = null; assert.strictEqual(set(target, 'w', 1, target), true, 'set w'); assert.strictEqual(out, target, 'set w'); assert.strictEqual(set(target, 'u', 0, target), true, 'set u'); assert.strictEqual(target.u, 0, 'set u'); assert.strictEqual(set(target, 'c', 2, target), false, 'set c'); assert.strictEqual(target.c, 1, 'set c'); // https://github.com/zloirock/core-js/issues/392 let o = defineProperty({}, 'test', { writable: false, configurable: true, }); assert.strictEqual(set(getPrototypeOf(o), 'test', 1, o), false); // https://github.com/zloirock/core-js/issues/393 o = defineProperty({}, 'test', { get() { /* empty */ }, }); assert.notThrows(() => !set(getPrototypeOf(o), 'test', 1, o)); o = defineProperty({}, 'test', { // eslint-disable-next-line no-unused-vars set(v) { /* empty */ }, }); assert.notThrows(() => !set(getPrototypeOf(o), 'test', 1, o)); } assert.throws(() => set(42, 'q', 42), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/pure/es.set.js000066400000000000000000000244401360057567700167630ustar00rootroot00000000000000/* eslint-disable sonarjs/no-element-overwrite */ import { createIterable, is, nativeSubclass } from '../helpers/helpers'; import { DESCRIPTORS } from '../helpers/constants'; import { Set, Map, Symbol } from 'core-js-pure'; import getIterator from 'core-js-pure/features/get-iterator'; import getIteratorMethod from 'core-js-pure/features/get-iterator-method'; import { freeze, getOwnPropertyDescriptor, keys, getOwnPropertyNames, getOwnPropertySymbols } from 'core-js-pure/features/object'; import ownKeys from 'core-js-pure/features/reflect/own-keys'; import from from 'core-js-pure/features/array/from'; QUnit.test('Set', assert => { assert.isFunction(Set); assert.ok('add' in Set.prototype, 'add in Set.prototype'); assert.ok('clear' in Set.prototype, 'clear in Set.prototype'); assert.ok('delete' in Set.prototype, 'delete in Set.prototype'); assert.ok('forEach' in Set.prototype, 'forEach in Set.prototype'); assert.ok('has' in Set.prototype, 'has in Set.prototype'); assert.ok(new Set() instanceof Set, 'new Set instanceof Set'); const set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); assert.strictEqual(set.size, 3); const result = []; set.forEach(val => { result.push(val); }); assert.deepEqual(result, [1, 2, 3]); assert.strictEqual(new Set(createIterable([1, 2, 3])).size, 3, 'Init from iterable'); assert.strictEqual(new Set([freeze({}), 1]).size, 2, 'Support frozen objects'); assert.strictEqual(new Set([NaN, NaN, NaN]).size, 1); assert.deepEqual(from(new Set([3, 4]).add(2).add(1)), [3, 4, 2, 1]); let done = false; const { add } = Set.prototype; Set.prototype.add = function () { throw new Error(); }; try { new Set(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } Set.prototype.add = add; assert.ok(done, '.return #throw'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; new Set(array); assert.ok(done); const object = {}; new Set().add(object); if (DESCRIPTORS) { const results = []; for (const key in results) keys.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(Set); assert.ok(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.ok(new Subclass() instanceof Set, 'correct subclassing with native classes #2'); assert.ok(new Subclass().add(2).has(2), 'correct subclassing with native classes #3'); } }); QUnit.test('Set#add', assert => { assert.isFunction(Set.prototype.add); const array = []; let set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(array); assert.strictEqual(set.size, 5); const chain = set.add(NaN); assert.strictEqual(chain, set); assert.strictEqual(set.size, 5); set.add(2); assert.strictEqual(set.size, 5); set.add(array); assert.strictEqual(set.size, 5); set.add([]); assert.strictEqual(set.size, 6); set.add(4); assert.strictEqual(set.size, 7); const frozen = freeze({}); set = new Set(); set.add(frozen); assert.ok(set.has(frozen)); }); QUnit.test('Set#clear', assert => { assert.isFunction(Set.prototype.clear); let set = new Set(); set.clear(); assert.strictEqual(set.size, 0); set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); set.clear(); assert.strictEqual(set.size, 0); assert.ok(!set.has(1)); assert.ok(!set.has(2)); assert.ok(!set.has(3)); const frozen = freeze({}); set = new Set(); set.add(1); set.add(frozen); set.clear(); assert.strictEqual(set.size, 0, 'Support frozen objects'); assert.ok(!set.has(1)); assert.ok(!set.has(frozen)); }); QUnit.test('Set#delete', assert => { assert.isFunction(Set.prototype.delete); const array = []; const set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(array); assert.strictEqual(set.size, 5); assert.strictEqual(set.delete(NaN), true); assert.strictEqual(set.size, 4); assert.strictEqual(set.delete(4), false); assert.strictEqual(set.size, 4); set.delete([]); assert.strictEqual(set.size, 4); set.delete(array); assert.strictEqual(set.size, 3); const frozen = freeze({}); set.add(frozen); assert.strictEqual(set.size, 4); set.delete(frozen); assert.strictEqual(set.size, 3); }); QUnit.test('Set#forEach', assert => { assert.isFunction(Set.prototype.forEach); let result = []; let count = 0; let set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); set.forEach(value => { count++; result.push(value); }); assert.strictEqual(count, 3); assert.deepEqual(result, [1, 2, 3]); set = new Set(); set.add('0'); set.add('1'); set.add('2'); set.add('3'); result = ''; set.forEach(it => { result += it; if (it === '2') { set.delete('2'); set.delete('3'); set.delete('1'); set.add('4'); } }); assert.strictEqual(result, '0124'); set = new Set(); set.add('0'); result = ''; set.forEach(it => { set.delete('0'); if (result !== '') throw new Error(); result += it; }); assert.strictEqual(result, '0'); assert.throws(() => { Set.prototype.forEach.call(new Map(), () => { /* empty */ }); }, 'non-generic'); }); QUnit.test('Set#has', assert => { assert.isFunction(Set.prototype.has); const array = []; const frozen = freeze({}); const set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(frozen); set.add(array); assert.ok(set.has(NaN)); assert.ok(set.has(array)); assert.ok(set.has(frozen)); assert.ok(set.has(2)); assert.ok(!set.has(4)); assert.ok(!set.has([])); }); QUnit.test('Set#size', assert => { const set = new Set(); set.add(1); const { size } = set; assert.strictEqual(typeof size, 'number', 'size is number'); assert.strictEqual(size, 1, 'size is correct'); if (DESCRIPTORS) { const sizeDescriptor = getOwnPropertyDescriptor(Set.prototype, 'size'); assert.ok(sizeDescriptor && sizeDescriptor.get, 'size is getter'); assert.ok(sizeDescriptor && !sizeDescriptor.set, 'size isnt setter'); assert.throws(() => { Set.prototype.size; }, TypeError); } }); QUnit.test('Set & -0', assert => { let set = new Set(); set.add(-0); assert.strictEqual(set.size, 1); assert.ok(set.has(0)); assert.ok(set.has(-0)); set.forEach(it => { assert.ok(!is(it, -0)); }); set.delete(-0); assert.strictEqual(set.size, 0); set = new Set([-0]); set.forEach(key => { assert.ok(!is(key, -0)); }); set = new Set(); set.add(4); set.add(3); set.add(2); set.add(1); set.add(0); assert.ok(set.has(-0)); }); QUnit.test('Set#@@toStringTag', assert => { assert.strictEqual(Set.prototype[Symbol.toStringTag], 'Set', 'Set::@@toStringTag is `Set`'); assert.strictEqual(String(new Set()), '[object Set]', 'correct stringification'); }); QUnit.test('Set Iterator', assert => { const set = new Set(); set.add('a'); set.add('b'); set.add('c'); set.add('d'); const results = []; const iterator = set.keys(); results.push(iterator.next().value); assert.ok(set.delete('a')); assert.ok(set.delete('b')); assert.ok(set.delete('c')); set.add('e'); results.push(iterator.next().value); results.push(iterator.next().value); assert.ok(iterator.next().done); set.add('f'); assert.ok(iterator.next().done); assert.deepEqual(results, ['a', 'd', 'e']); }); QUnit.test('Set#keys', assert => { assert.isFunction(Set.prototype.keys); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#values', assert => { assert.isFunction(Set.prototype.values); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#entries', assert => { assert.isFunction(Set.prototype.entries); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: ['q', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['w', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['e', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#@@iterator', assert => { const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = getIterator(set); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Set Iterator'); assert.strictEqual(String(iterator), '[object Set Iterator]'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/pure/es.string.anchor.js000066400000000000000000000004241360057567700207430ustar00rootroot00000000000000import anchor from 'core-js-pure/features/string/anchor'; QUnit.test('String#anchor', assert => { assert.isFunction(anchor); assert.same(anchor('a', 'b'), '
a', 'lower case'); assert.same(anchor('a', '"'), 'a', 'escape quotes'); }); core-js-3.6.1/tests/pure/es.string.big.js000066400000000000000000000002571360057567700202360ustar00rootroot00000000000000import big from 'core-js-pure/features/string/big'; QUnit.test('String#big', assert => { assert.isFunction(big); assert.same(big('a'), 'a', 'lower case'); }); core-js-3.6.1/tests/pure/es.string.blink.js000066400000000000000000000002751360057567700205740ustar00rootroot00000000000000import blink from 'core-js-pure/features/string/blink'; QUnit.test('String#blink', assert => { assert.isFunction(blink); assert.same(blink('a'), 'a', 'lower case'); }); core-js-3.6.1/tests/pure/es.string.bold.js000066400000000000000000000002601360057567700204070ustar00rootroot00000000000000import bold from 'core-js-pure/features/string/bold'; QUnit.test('String#bold', assert => { assert.isFunction(bold); assert.same(bold('a'), 'a', 'lower case'); }); core-js-3.6.1/tests/pure/es.string.code-point-at.js000066400000000000000000000067671360057567700221540ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import codePointAt from 'core-js-pure/features/string/code-point-at'; QUnit.test('String#codePointAt', assert => { assert.isFunction(codePointAt); assert.strictEqual(codePointAt('abc\uD834\uDF06def', ''), 0x61); assert.strictEqual(codePointAt('abc\uD834\uDF06def', '_'), 0x61); assert.strictEqual(codePointAt('abc\uD834\uDF06def'), 0x61); assert.strictEqual(codePointAt('abc\uD834\uDF06def', -Infinity), undefined); assert.strictEqual(codePointAt('abc\uD834\uDF06def', -1), undefined); assert.strictEqual(codePointAt('abc\uD834\uDF06def', -0), 0x61); assert.strictEqual(codePointAt('abc\uD834\uDF06def', 0), 0x61); assert.strictEqual(codePointAt('abc\uD834\uDF06def', 3), 0x1D306); assert.strictEqual(codePointAt('abc\uD834\uDF06def', 4), 0xDF06); assert.strictEqual(codePointAt('abc\uD834\uDF06def', 5), 0x64); assert.strictEqual(codePointAt('abc\uD834\uDF06def', 42), undefined); assert.strictEqual(codePointAt('abc\uD834\uDF06def', Infinity), undefined); assert.strictEqual(codePointAt('abc\uD834\uDF06def', Infinity), undefined); assert.strictEqual(codePointAt('abc\uD834\uDF06def', NaN), 0x61); assert.strictEqual(codePointAt('abc\uD834\uDF06def', false), 0x61); assert.strictEqual(codePointAt('abc\uD834\uDF06def', null), 0x61); assert.strictEqual(codePointAt('abc\uD834\uDF06def', undefined), 0x61); assert.strictEqual(codePointAt('\uD834\uDF06def', ''), 0x1D306); assert.strictEqual(codePointAt('\uD834\uDF06def', '1'), 0xDF06); assert.strictEqual(codePointAt('\uD834\uDF06def', '_'), 0x1D306); assert.strictEqual(codePointAt('\uD834\uDF06def'), 0x1D306); assert.strictEqual(codePointAt('\uD834\uDF06def', -1), undefined); assert.strictEqual(codePointAt('\uD834\uDF06def', -0), 0x1D306); assert.strictEqual(codePointAt('\uD834\uDF06def', 0), 0x1D306); assert.strictEqual(codePointAt('\uD834\uDF06def', 1), 0xDF06); assert.strictEqual(codePointAt('\uD834\uDF06def', 42), undefined); assert.strictEqual(codePointAt('\uD834\uDF06def', false), 0x1D306); assert.strictEqual(codePointAt('\uD834\uDF06def', null), 0x1D306); assert.strictEqual(codePointAt('\uD834\uDF06def', undefined), 0x1D306); assert.strictEqual(codePointAt('\uD834abc', ''), 0xD834); assert.strictEqual(codePointAt('\uD834abc', '_'), 0xD834); assert.strictEqual(codePointAt('\uD834abc'), 0xD834); assert.strictEqual(codePointAt('\uD834abc', -1), undefined); assert.strictEqual(codePointAt('\uD834abc', -0), 0xD834); assert.strictEqual(codePointAt('\uD834abc', 0), 0xD834); assert.strictEqual(codePointAt('\uD834abc', false), 0xD834); assert.strictEqual(codePointAt('\uD834abc', NaN), 0xD834); assert.strictEqual(codePointAt('\uD834abc', null), 0xD834); assert.strictEqual(codePointAt('\uD834abc', undefined), 0xD834); assert.strictEqual(codePointAt('\uDF06abc', ''), 0xDF06); assert.strictEqual(codePointAt('\uDF06abc', '_'), 0xDF06); assert.strictEqual(codePointAt('\uDF06abc'), 0xDF06); assert.strictEqual(codePointAt('\uDF06abc', -1), undefined); assert.strictEqual(codePointAt('\uDF06abc', -0), 0xDF06); assert.strictEqual(codePointAt('\uDF06abc', 0), 0xDF06); assert.strictEqual(codePointAt('\uDF06abc', false), 0xDF06); assert.strictEqual(codePointAt('\uDF06abc', NaN), 0xDF06); assert.strictEqual(codePointAt('\uDF06abc', null), 0xDF06); assert.strictEqual(codePointAt('\uDF06abc', undefined), 0xDF06); if (STRICT) { assert.throws(() => codePointAt(null, 0), TypeError); assert.throws(() => codePointAt(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.string.ends-with.js000066400000000000000000000023231360057567700213730ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import Symbol from 'core-js-pure/features/symbol'; import endsWith from 'core-js-pure/features/string/ends-with'; QUnit.test('String#endsWith', assert => { assert.isFunction(endsWith); assert.ok(endsWith('undefined')); assert.ok(!endsWith('undefined', null)); assert.ok(endsWith('abc', '')); assert.ok(endsWith('abc', 'c')); assert.ok(endsWith('abc', 'bc')); assert.ok(!endsWith('abc', 'ab')); assert.ok(endsWith('abc', '', NaN)); assert.ok(!endsWith('abc', 'c', -1)); assert.ok(endsWith('abc', 'a', 1)); assert.ok(endsWith('abc', 'c', Infinity)); assert.ok(endsWith('abc', 'a', true)); assert.ok(!endsWith('abc', 'c', 'x')); assert.ok(!endsWith('abc', 'a', 'x')); if (STRICT) { assert.throws(() => endsWith(null, '.'), TypeError); assert.throws(() => endsWith(undefined, '.'), TypeError); } const regexp = /./; assert.throws(() => endsWith('/./', regexp), TypeError); regexp[Symbol.match] = false; assert.notThrows(() => endsWith('/./', regexp)); const object = {}; assert.notThrows(() => endsWith('[object Object]', object)); object[Symbol.match] = true; assert.throws(() => endsWith('[object Object]', object), TypeError); }); core-js-3.6.1/tests/pure/es.string.fixed.js000066400000000000000000000002671360057567700205750ustar00rootroot00000000000000import fixed from 'core-js-pure/features/string/fixed'; QUnit.test('String#fixed', assert => { assert.isFunction(fixed); assert.same(fixed('a'), 'a', 'lower case'); }); core-js-3.6.1/tests/pure/es.string.fontcolor.js000066400000000000000000000004641360057567700215020ustar00rootroot00000000000000import fontcolor from 'core-js-pure/features/string/fontcolor'; QUnit.test('String#fontcolor', assert => { assert.isFunction(fontcolor); assert.same(fontcolor('a', 'b'), 'a', 'lower case'); assert.same(fontcolor('a', '"'), 'a', 'escape quotes'); }); core-js-3.6.1/tests/pure/es.string.fontsize.js000066400000000000000000000004541360057567700213350ustar00rootroot00000000000000import fontsize from 'core-js-pure/features/string/fontsize'; QUnit.test('String#fontsize', assert => { assert.isFunction(fontsize); assert.same(fontsize('a', 'b'), 'a', 'lower case'); assert.same(fontsize('a', '"'), 'a', 'escape quotes'); }); core-js-3.6.1/tests/pure/es.string.from-code-point.js000066400000000000000000000037641360057567700225050ustar00rootroot00000000000000import fromCodePoint from 'core-js-pure/features/string/from-code-point'; QUnit.test('String.fromCodePoint', assert => { assert.isFunction(fromCodePoint); assert.arity(fromCodePoint, 1); if ('name' in fromCodePoint) { assert.name(fromCodePoint, 'fromCodePoint'); } assert.strictEqual(fromCodePoint(''), '\0'); assert.strictEqual(fromCodePoint(), ''); assert.strictEqual(fromCodePoint(-0), '\0'); assert.strictEqual(fromCodePoint(0), '\0'); assert.strictEqual(fromCodePoint(0x1D306), '\uD834\uDF06'); assert.strictEqual(fromCodePoint(0x1D306, 0x61, 0x1D307), '\uD834\uDF06a\uD834\uDF07'); assert.strictEqual(fromCodePoint(0x61, 0x62, 0x1D307), 'ab\uD834\uDF07'); assert.strictEqual(fromCodePoint(false), '\0'); assert.strictEqual(fromCodePoint(null), '\0'); assert.throws(() => fromCodePoint('_'), RangeError); assert.throws(() => fromCodePoint('+Infinity'), RangeError); assert.throws(() => fromCodePoint('-Infinity'), RangeError); assert.throws(() => fromCodePoint(-1), RangeError); assert.throws(() => fromCodePoint(0x10FFFF + 1), RangeError); assert.throws(() => fromCodePoint(3.14), RangeError); assert.throws(() => fromCodePoint(3e-2), RangeError); assert.throws(() => fromCodePoint(-Infinity), RangeError); assert.throws(() => fromCodePoint(Infinity), RangeError); assert.throws(() => fromCodePoint(NaN), RangeError); assert.throws(() => fromCodePoint(undefined), RangeError); assert.throws(() => fromCodePoint({}), RangeError); assert.throws(() => fromCodePoint(/./), RangeError); let number = 0x60; assert.strictEqual(fromCodePoint({ valueOf() { return ++number; }, }), 'a'); assert.strictEqual(number, 0x61); // one code unit per symbol let counter = 2 ** 15 * 3 / 2; let result = []; while (--counter >= 0) result.push(0); // should not throw fromCodePoint.apply(null, result); counter = 2 ** 15 * 3 / 2; result = []; while (--counter >= 0) result.push(0xFFFF + 1); // should not throw fromCodePoint.apply(null, result); }); core-js-3.6.1/tests/pure/es.string.includes.js000066400000000000000000000015101360057567700212740ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import Symbol from 'core-js-pure/features/symbol'; import includes from 'core-js-pure/features/string/includes'; QUnit.test('String#includes', assert => { assert.isFunction(includes); assert.ok(!includes('abc')); assert.ok(includes('aundefinedb')); assert.ok(includes('abcd', 'b', 1)); assert.ok(!includes('abcd', 'b', 2)); if (STRICT) { assert.throws(() => includes(null, '.'), TypeError); assert.throws(() => includes(undefined, '.'), TypeError); } const re = /./; assert.throws(() => includes('/./', re), TypeError); re[Symbol.match] = false; assert.notThrows(() => includes('/./', re)); const O = {}; assert.notThrows(() => includes('[object Object]', O)); O[Symbol.match] = true; assert.throws(() => includes('[object Object]', O), TypeError); }); core-js-3.6.1/tests/pure/es.string.italics.js000066400000000000000000000002771360057567700211270ustar00rootroot00000000000000import italics from 'core-js-pure/features/string/italics'; QUnit.test('String#italics', assert => { assert.isFunction(italics); assert.same(italics('a'), 'a', 'lower case'); }); core-js-3.6.1/tests/pure/es.string.iterator.js000066400000000000000000000022011360057567700213150ustar00rootroot00000000000000import Symbol from 'core-js-pure/features/symbol'; import getIterator from 'core-js-pure/features/get-iterator'; import from from 'core-js-pure/features/array/from'; QUnit.test('String#@@iterator', assert => { let iterator = getIterator('qwe'); assert.isIterator(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'String Iterator'); assert.strictEqual(String(iterator), '[object String Iterator]'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.strictEqual(from('𠮷𠮷𠮷').length, 3); iterator = getIterator('𠮷𠮷𠮷'); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/pure/es.string.link.js000066400000000000000000000004101360057567700204210ustar00rootroot00000000000000import link from 'core-js-pure/features/string/link'; QUnit.test('String#link', assert => { assert.isFunction(link); assert.same(link('a', 'b'), 'a', 'lower case'); assert.same(link('a', '"'), 'a', 'escape quotes'); }); core-js-3.6.1/tests/pure/es.string.match-all.js000066400000000000000000000065151360057567700213420ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import matchAll from 'core-js-pure/es/string/match-all'; import Symbol from 'core-js-pure/es/symbol'; import assign from 'core-js-pure/es/object/assign'; QUnit.test('String#matchAll', assert => { assert.isFunction(matchAll); let data = ['aabc', { toString() { return 'aabc'; } }]; for (const target of data) { const iterator = matchAll(target, /[ac]/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign(['a'], { input: 'aabc', index: 0, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['a'], { input: 'aabc', index: 1, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['c'], { input: 'aabc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); } let iterator = matchAll('1111a2b3cccc', /(\d)(\D)/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'RegExp String Iterator'); assert.strictEqual(String(iterator), '[object RegExp String Iterator]'); assert.deepEqual(iterator.next(), { value: assign(['1a', '1', 'a'], { input: '1111a2b3cccc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['2b', '2', 'b'], { input: '1111a2b3cccc', index: 5, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['3c', '3', 'c'], { input: '1111a2b3cccc', index: 7, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.throws(() => matchAll('1111a2b3cccc', /(\d)(\D)/), TypeError); iterator = matchAll('1111a2b3cccc', '(\\d)(\\D)'); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign(['1a', '1', 'a'], { input: '1111a2b3cccc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['2b', '2', 'b'], { input: '1111a2b3cccc', index: 5, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['3c', '3', 'c'], { input: '1111a2b3cccc', index: 7, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); /* IE8- issue iterator = matchAll('abc', /\B/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign([''], { input: 'abc', index: 1, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign([''], { input: 'abc', index: 2, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); */ data = [null, undefined, NaN, 42, {}, []]; for (const target of data) { assert.notThrows(() => matchAll('', target), `Not throws on ${ target } as the first argument`); } if (STRICT) { assert.throws(() => matchAll(null, /./g), TypeError, 'Throws on null as `this`'); assert.throws(() => matchAll(undefined, /./g), TypeError, 'Throws on undefined as `this`'); } }); core-js-3.6.1/tests/pure/es.string.pad-end.js000066400000000000000000000012141360057567700207770ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import padEnd from 'core-js-pure/features/string/pad-end'; QUnit.test('String#padEnd', assert => { assert.isFunction(padEnd); assert.strictEqual(padEnd('abc', 5), 'abc '); assert.strictEqual(padEnd('abc', 4, 'de'), 'abcd'); assert.strictEqual(padEnd('abc'), 'abc'); assert.strictEqual(padEnd('abc', 5, '_'), 'abc__'); assert.strictEqual(padEnd('', 0), ''); assert.strictEqual(padEnd('foo', 1), 'foo'); assert.strictEqual(padEnd('foo', 5, ''), 'foo'); if (STRICT) { assert.throws(() => padEnd(null, 0), TypeError); assert.throws(() => padEnd(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.string.pad-start.js000066400000000000000000000012461360057567700213730ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import padStart from 'core-js-pure/features/string/pad-start'; QUnit.test('String#padStart', assert => { assert.isFunction(padStart); assert.strictEqual(padStart('abc', 5), ' abc'); assert.strictEqual(padStart('abc', 4, 'de'), 'dabc'); assert.strictEqual(padStart('abc'), 'abc'); assert.strictEqual(padStart('abc', 5, '_'), '__abc'); assert.strictEqual(padStart('', 0), ''); assert.strictEqual(padStart('foo', 1), 'foo'); assert.strictEqual(padStart('foo', 5, ''), 'foo'); if (STRICT) { assert.throws(() => padStart(null, 0), TypeError); assert.throws(() => padStart(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.string.raw.js000066400000000000000000000010401360057567700202550ustar00rootroot00000000000000import raw from 'core-js-pure/features/string/raw'; QUnit.test('String.raw', assert => { assert.isFunction(raw); assert.arity(raw, 1); if ('name' in raw) { assert.name(raw, 'raw'); } assert.strictEqual(raw({ raw: ['Hi\\n', '!'] }, 'Bob'), 'Hi\\nBob!', 'raw is array'); assert.strictEqual(raw({ raw: 'test' }, 0, 1, 2), 't0e1s2t', 'raw is string'); assert.strictEqual(raw({ raw: 'test' }, 0), 't0est', 'lacks substituting'); assert.throws(() => raw({}), TypeError); assert.throws(() => raw({ raw: null }), TypeError); }); core-js-3.6.1/tests/pure/es.string.repeat.js000066400000000000000000000010221360057567700207440ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import repeat from 'core-js-pure/features/string/repeat'; QUnit.test('String#repeat', assert => { assert.isFunction(repeat); assert.strictEqual(repeat('qwe', 3), 'qweqweqwe'); assert.strictEqual(repeat('qwe', 2.5), 'qweqwe'); assert.throws(() => repeat('qwe', -1), RangeError); assert.throws(() => repeat('qwe', Infinity), RangeError); if (STRICT) { assert.throws(() => repeat(null, 1), TypeError); assert.throws(() => repeat(undefined, 1), TypeError); } }); core-js-3.6.1/tests/pure/es.string.small.js000066400000000000000000000002751360057567700206050ustar00rootroot00000000000000import small from 'core-js-pure/features/string/small'; QUnit.test('String#small', assert => { assert.isFunction(small); assert.same(small('a'), 'a', 'lower case'); }); core-js-3.6.1/tests/pure/es.string.starts-with.js000066400000000000000000000023261360057567700217650ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import Symbol from 'core-js-pure/features/symbol'; import startsWith from 'core-js-pure/features/string/starts-with'; QUnit.test('String#startsWith', assert => { assert.isFunction(startsWith); assert.ok(startsWith('undefined')); assert.ok(!startsWith('undefined', null)); assert.ok(startsWith('abc', '')); assert.ok(startsWith('abc', 'a')); assert.ok(startsWith('abc', 'ab')); assert.ok(!startsWith('abc', 'bc')); assert.ok(startsWith('abc', '', NaN)); assert.ok(startsWith('abc', 'a', -1)); assert.ok(!startsWith('abc', 'a', 1)); assert.ok(!startsWith('abc', 'a', Infinity)); assert.ok(startsWith('abc', 'b', true)); assert.ok(startsWith('abc', 'a', 'x')); if (STRICT) { assert.throws(() => startsWith(null, '.'), TypeError); assert.throws(() => startsWith(undefined, '.'), TypeError); } const regexp = /./; assert.throws(() => startsWith('/./', regexp), TypeError); regexp[Symbol.match] = false; assert.notThrows(() => startsWith('/./', regexp)); const object = {}; assert.notThrows(() => startsWith('[object Object]', object)); object[Symbol.match] = true; assert.throws(() => startsWith('[object Object]', object), TypeError); }); core-js-3.6.1/tests/pure/es.string.strike.js000066400000000000000000000003041360057567700207670ustar00rootroot00000000000000import strike from 'core-js-pure/features/string/strike'; QUnit.test('String#strike', assert => { assert.isFunction(strike); assert.same(strike('a'), 'a', 'lower case'); }); core-js-3.6.1/tests/pure/es.string.sub.js000066400000000000000000000002571360057567700202660ustar00rootroot00000000000000import sub from 'core-js-pure/features/string/sub'; QUnit.test('String#sub', assert => { assert.isFunction(sub); assert.same(sub('a'), 'a', 'lower case'); }); core-js-3.6.1/tests/pure/es.string.sup.js000066400000000000000000000002571360057567700203040ustar00rootroot00000000000000import sup from 'core-js-pure/features/string/sup'; QUnit.test('String#sup', assert => { assert.isFunction(sup); assert.same(sup('a'), 'a', 'lower case'); }); core-js-3.6.1/tests/pure/es.string.trim-end.js000066400000000000000000000021441360057567700212110ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants'; import { trimRight, trimEnd } from 'core-js-pure/features/string'; QUnit.test('String#trimRight', assert => { assert.isFunction(trimRight); assert.strictEqual(trimRight(' \n q w e \n '), ' \n q w e', 'removes whitespaces at right side of string'); assert.strictEqual(trimRight(WHITESPACES), '', 'removes all whitespaces'); assert.strictEqual(trimRight('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); if (STRICT) { assert.throws(() => trimRight(null, 0), TypeError); assert.throws(() => trimRight(undefined, 0), TypeError); } }); QUnit.test('String#trimEnd', assert => { assert.isFunction(trimEnd); assert.strictEqual(trimEnd(' \n q w e \n '), ' \n q w e', 'removes whitespaces at right side of string'); assert.strictEqual(trimEnd(WHITESPACES), '', 'removes all whitespaces'); assert.strictEqual(trimEnd('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); if (STRICT) { assert.throws(() => trimEnd(null, 0), TypeError); assert.throws(() => trimEnd(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.string.trim-start.js000066400000000000000000000021521360057567700215770ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants'; import { trimLeft, trimStart } from 'core-js-pure/features/string'; QUnit.test('String#trimLeft', assert => { assert.isFunction(trimLeft); assert.strictEqual(trimLeft(' \n q w e \n '), 'q w e \n ', 'removes whitespaces at left side of string'); assert.strictEqual(trimLeft(WHITESPACES), '', 'removes all whitespaces'); assert.strictEqual(trimLeft('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); if (STRICT) { assert.throws(() => trimLeft(null, 0), TypeError); assert.throws(() => trimLeft(undefined, 0), TypeError); } }); QUnit.test('String#trimStart', assert => { assert.isFunction(trimStart); assert.strictEqual(trimStart(' \n q w e \n '), 'q w e \n ', 'removes whitespaces at left side of string'); assert.strictEqual(trimStart(WHITESPACES), '', 'removes all whitespaces'); assert.strictEqual(trimStart('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); if (STRICT) { assert.throws(() => trimStart(null, 0), TypeError); assert.throws(() => trimStart(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.string.trim.js000066400000000000000000000011131360057567700204400ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants'; import trim from 'core-js-pure/features/string/trim'; QUnit.test('String#trim', assert => { assert.isFunction(trim); assert.strictEqual(trim(' \n q w e \n '), 'q w e', 'removes whitespaces at left & right side of string'); assert.strictEqual(trim(WHITESPACES), '', 'removes all whitespaces'); assert.strictEqual(trim('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); if (STRICT) { assert.throws(() => trim(null, 0), TypeError); assert.throws(() => trim(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/es.symbol.async-iterator.js000066400000000000000000000004201360057567700224300ustar00rootroot00000000000000import Symbol from 'core-js-pure/features/symbol'; QUnit.test('Symbol.asyncIterator', assert => { assert.ok('asyncIterator' in Symbol, 'Symbol.asyncIterator available'); assert.ok(Object(Symbol.asyncIterator) instanceof Symbol, 'Symbol.asyncIterator is symbol'); }); core-js-3.6.1/tests/pure/es.symbol.js000066400000000000000000000222071360057567700174740ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import core from 'core-js-pure'; import { defineProperty, defineProperties, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, keys, create, } from 'core-js-pure/features/object'; import ownKeys from 'core-js-pure/features/reflect/own-keys'; const { Symbol, JSON } = core; QUnit.test('Symbol', assert => { assert.isFunction(Symbol); const symbol1 = Symbol('symbol'); const symbol2 = Symbol('symbol'); assert.ok(symbol1 !== symbol2, 'Symbol("symbol") !== Symbol("symbol")'); const object = {}; object[symbol1] = 42; assert.ok(object[symbol1] === 42, 'Symbol() work as key'); assert.ok(object[symbol2] !== 42, 'Various symbols from one description are various keys'); if (DESCRIPTORS) { let count = 0; // eslint-disable-next-line no-unused-vars for (const key in object) count++; assert.ok(count === 0, 'object[Symbol()] is not enumerable'); } }); QUnit.test('Well-known Symbols', assert => { const wks = [ 'hasInstance', 'isConcatSpreadable', 'iterator', 'match', 'matchAll', 'replace', 'search', 'species', 'split', 'toPrimitive', 'toStringTag', 'unscopables', ]; for (const name of wks) { assert.ok(name in Symbol, `Symbol.${ name } available`); assert.ok(Object(Symbol[name]) instanceof Symbol, `Symbol.${ name } is symbol`); } }); QUnit.test('Global symbol registry', assert => { assert.isFunction(Symbol.for, 'Symbol.for is function'); assert.isFunction(Symbol.keyFor, 'Symbol.keyFor is function'); const symbol = Symbol.for('foo'); assert.strictEqual(Symbol.for('foo'), symbol); assert.strictEqual(Symbol.keyFor(symbol), 'foo'); assert.throws(() => Symbol.keyFor('foo'), 'throws on non-symbol'); }); QUnit.test('Symbol#@@toPrimitive', assert => { const symbol = Symbol(); assert.isFunction(Symbol.prototype[Symbol.toPrimitive]); assert.same(symbol, symbol[Symbol.toPrimitive](), 'works'); }); QUnit.test('Symbol#@@toStringTag', assert => { assert.ok(Symbol.prototype[Symbol.toStringTag] === 'Symbol', 'Symbol::@@toStringTag is `Symbol`'); }); QUnit.test('Object.getOwnPropertySymbols', assert => { assert.isFunction(getOwnPropertySymbols); const prototype = { q: 1, w: 2, e: 3 }; prototype[Symbol()] = 42; prototype[Symbol()] = 43; assert.deepEqual(getOwnPropertyNames(prototype).sort(), ['e', 'q', 'w']); assert.strictEqual(getOwnPropertySymbols(prototype).length, 2); const object = create(prototype); object.a = 1; object.s = 2; object.d = 3; object[Symbol()] = 44; assert.deepEqual(getOwnPropertyNames(object).sort(), ['a', 'd', 's']); assert.strictEqual(getOwnPropertySymbols(object).length, 1); assert.strictEqual(getOwnPropertySymbols(Object.prototype).length, 0); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertySymbols(value), `accept ${ typeof value }`); } }); if (JSON) { QUnit.test('Symbols & JSON.stringify', assert => { assert.strictEqual(JSON.stringify([ 1, Symbol('foo'), false, Symbol('bar'), {}, ]), '[1,null,false,null,{}]', 'array value'); assert.strictEqual(JSON.stringify({ symbol: Symbol('symbol'), }), '{}', 'object value'); if (DESCRIPTORS) { const object = { bar: 2 }; object[Symbol('symbol')] = 1; assert.strictEqual(JSON.stringify(object), '{"bar":2}', 'object key'); } assert.strictEqual(JSON.stringify(Symbol('symbol')), undefined, 'symbol value'); if (typeof Symbol() === 'symbol') { assert.strictEqual(JSON.stringify(Object(Symbol('symbol'))), '{}', 'boxed symbol'); } assert.strictEqual(JSON.stringify(undefined, () => 42), '42', 'replacer works with top-level undefined'); }); } if (DESCRIPTORS) { QUnit.test('Symbols & descriptors', assert => { const d = Symbol('d'); const e = Symbol('e'); const f = Symbol('f'); const i = Symbol('i'); const j = Symbol('j'); const prototype = { g: 'g' }; prototype[i] = 'i'; defineProperty(prototype, 'h', { value: 'h', }); defineProperty(prototype, 'j', { value: 'j', }); const object = create(prototype); object.a = 'a'; object[d] = 'd'; defineProperty(object, 'b', { value: 'b', }); defineProperty(object, 'c', { value: 'c', enumerable: true, }); defineProperty(object, e, { configurable: true, writable: true, value: 'e', }); const descriptor = { value: 'f', enumerable: true, }; defineProperty(object, f, descriptor); assert.strictEqual(descriptor.enumerable, true, 'defineProperty not changes descriptor object'); assert.deepEqual(getOwnPropertyDescriptor(object, 'a'), { configurable: true, writable: true, enumerable: true, value: 'a', }, 'getOwnPropertyDescriptor a'); assert.deepEqual(getOwnPropertyDescriptor(object, 'b'), { configurable: false, writable: false, enumerable: false, value: 'b', }, 'getOwnPropertyDescriptor b'); assert.deepEqual(getOwnPropertyDescriptor(object, 'c'), { configurable: false, writable: false, enumerable: true, value: 'c', }, 'getOwnPropertyDescriptor c'); assert.deepEqual(getOwnPropertyDescriptor(object, d), { configurable: true, writable: true, enumerable: true, value: 'd', }, 'getOwnPropertyDescriptor d'); assert.deepEqual(getOwnPropertyDescriptor(object, e), { configurable: true, writable: true, enumerable: false, value: 'e', }, 'getOwnPropertyDescriptor e'); assert.deepEqual(getOwnPropertyDescriptor(object, f), { configurable: false, writable: false, enumerable: true, value: 'f', }, 'getOwnPropertyDescriptor f'); assert.strictEqual(getOwnPropertyDescriptor(object, 'g'), undefined, 'getOwnPropertyDescriptor g'); assert.strictEqual(getOwnPropertyDescriptor(object, 'h'), undefined, 'getOwnPropertyDescriptor h'); assert.strictEqual(getOwnPropertyDescriptor(object, i), undefined, 'getOwnPropertyDescriptor i'); assert.strictEqual(getOwnPropertyDescriptor(object, j), undefined, 'getOwnPropertyDescriptor j'); assert.strictEqual(getOwnPropertyDescriptor(object, 'k'), undefined, 'getOwnPropertyDescriptor k'); assert.strictEqual(getOwnPropertyDescriptor(Object.prototype, 'toString').enumerable, false, 'getOwnPropertyDescriptor on Object.prototype'); assert.strictEqual(getOwnPropertyDescriptor(Object.prototype, d), undefined, 'getOwnPropertyDescriptor on Object.prototype missed symbol'); assert.strictEqual(keys(object).length, 2, 'Object.keys'); assert.strictEqual(getOwnPropertyNames(object).length, 3, 'Object.getOwnPropertyNames'); assert.strictEqual(getOwnPropertySymbols(object).length, 3, 'Object.getOwnPropertySymbols'); assert.strictEqual(ownKeys(object).length, 6, 'Reflect.ownKeys'); delete object[e]; object[e] = 'e'; assert.deepEqual(getOwnPropertyDescriptor(object, e), { configurable: true, writable: true, enumerable: true, value: 'e', }, 'redefined non-enum key'); }); QUnit.test('Symbols & Object.defineProperties', assert => { const c = Symbol('c'); const d = Symbol('d'); const descriptors = { a: { value: 'a', }, }; descriptors[c] = { value: 'c', }; defineProperty(descriptors, 'b', { value: { value: 'b', }, }); defineProperty(descriptors, d, { value: { value: 'd', }, }); const object = defineProperties({}, descriptors); assert.strictEqual(object.a, 'a', 'a'); assert.strictEqual(object.b, undefined, 'b'); assert.strictEqual(object[c], 'c', 'c'); assert.strictEqual(object[d], undefined, 'd'); }); QUnit.test('Symbols & Object.create', assert => { const c = Symbol('c'); const d = Symbol('d'); const descriptors = { a: { value: 'a', }, }; descriptors[c] = { value: 'c', }; defineProperty(descriptors, 'b', { value: { value: 'b', }, }); defineProperty(descriptors, d, { value: { value: 'd', }, }); const object = create(null, descriptors); assert.strictEqual(object.a, 'a', 'a'); assert.strictEqual(object.b, undefined, 'b'); assert.strictEqual(object[c], 'c', 'c'); assert.strictEqual(object[d], undefined, 'd'); }); const constructors = ['Map', 'Set', 'Promise']; for (const name of constructors) { QUnit.test(`${ name }@@species`, assert => { assert.strictEqual(core[name][Symbol.species], core[name], `${ name }@@species === ${ name }`); const Subclass = create(core[name]); assert.strictEqual(Subclass[Symbol.species], Subclass, `${ name } subclass`); }); } QUnit.test('Array@@species', assert => { assert.strictEqual(Array[Symbol.species], Array, 'Array@@species === Array'); const Subclass = create(Array); assert.strictEqual(Subclass[Symbol.species], Subclass, 'Array subclass'); }); QUnit.test('Symbol.sham flag', assert => { assert.same(Symbol.sham, typeof Symbol() === 'symbol' ? undefined : true); }); } core-js-3.6.1/tests/pure/es.weak-map.js000066400000000000000000000140341360057567700176700ustar00rootroot00000000000000import { createIterable, nativeSubclass } from '../helpers/helpers'; import { DESCRIPTORS } from '../helpers/constants'; import { Symbol, WeakMap } from 'core-js-pure'; import getIteratorMethod from 'core-js-pure/features/get-iterator-method'; import { freeze, keys, getOwnPropertyNames, getOwnPropertySymbols } from 'core-js-pure/features/object'; import ownKeys from 'core-js-pure/features/reflect/own-keys'; QUnit.test('WeakMap', assert => { assert.isFunction(WeakMap); assert.ok('delete' in WeakMap.prototype, 'delete in WeakMap.prototype'); assert.ok('get' in WeakMap.prototype, 'get in WeakMap.prototype'); assert.ok('has' in WeakMap.prototype, 'has in WeakMap.prototype'); assert.ok('set' in WeakMap.prototype, 'set in WeakMap.prototype'); assert.ok(new WeakMap() instanceof WeakMap, 'new WeakMap instanceof WeakMap'); let object = {}; assert.strictEqual(new WeakMap(createIterable([[object, 42]])).get(object), 42, 'Init from iterable'); let weakmap = new WeakMap(); const frozen = freeze({}); weakmap.set(frozen, 42); assert.strictEqual(weakmap.get(frozen), 42, 'Support frozen objects'); weakmap = new WeakMap(); weakmap.set(frozen, 42); assert.strictEqual(weakmap.has(frozen), true, 'works with frozen objects, #1'); assert.strictEqual(weakmap.get(frozen), 42, 'works with frozen objects, #2'); weakmap.delete(frozen); assert.strictEqual(weakmap.has(frozen), false, 'works with frozen objects, #3'); assert.strictEqual(weakmap.get(frozen), undefined, 'works with frozen objects, #4'); let done = false; try { new WeakMap(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.ok(done, '.return #throw'); assert.ok(!('clear' in WeakMap.prototype), 'should not contains `.clear` method'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; new WeakMap(array); assert.ok(done); object = {}; new WeakMap().set(object, 1); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(WeakMap); assert.ok(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.ok(new Subclass() instanceof WeakMap, 'correct subclassing with native classes #2'); object = {}; assert.same(new Subclass().set(object, 2).get(object), 2, 'correct subclassing with native classes #3'); } }); QUnit.test('WeakMap#delete', assert => { assert.isFunction(WeakMap.prototype.delete); const a = {}; const b = {}; const weakmap = new WeakMap(); weakmap.set(a, 42); weakmap.set(b, 21); assert.ok(weakmap.has(a) && weakmap.has(b), 'WeakMap has values before .delete()'); weakmap.delete(a); assert.ok(!weakmap.has(a) && weakmap.has(b), 'WeakMap hasn`t value after .delete()'); assert.notThrows(() => !weakmap.delete(1), 'return false on primitive'); const object = {}; weakmap.set(object, 42); freeze(object); assert.ok(weakmap.has(object), 'works with frozen objects #1'); weakmap.delete(object); assert.ok(!weakmap.has(object), 'works with frozen objects #2'); }); QUnit.test('WeakMap#get', assert => { assert.isFunction(WeakMap.prototype.get); const weakmap = new WeakMap(); assert.strictEqual(weakmap.get({}), undefined, 'WeakMap .get() before .set() return undefined'); let object = {}; weakmap.set(object, 42); assert.strictEqual(weakmap.get(object), 42, 'WeakMap .get() return value'); weakmap.delete(object); assert.strictEqual(weakmap.get(object), undefined, 'WeakMap .get() after .delete() return undefined'); assert.notThrows(() => weakmap.get(1) === undefined, 'return undefined on primitive'); object = {}; weakmap.set(object, 42); freeze(object); assert.same(weakmap.get(object), 42, 'works with frozen objects #1'); weakmap.delete(object); assert.same(weakmap.get(object), undefined, 'works with frozen objects #2'); }); QUnit.test('WeakMap#has', assert => { assert.isFunction(WeakMap.prototype.has); const weakmap = new WeakMap(); assert.ok(!weakmap.has({}), 'WeakMap .has() before .set() return false'); let object = {}; weakmap.set(object, 42); assert.ok(weakmap.has(object), 'WeakMap .has() return true'); weakmap.delete(object); assert.ok(!weakmap.has(object), 'WeakMap .has() after .delete() return false'); assert.notThrows(() => !weakmap.has(1), 'return false on primitive'); object = {}; weakmap.set(object, 42); freeze(object); assert.ok(weakmap.has(object), 'works with frozen objects #1'); weakmap.delete(object); assert.ok(!weakmap.has(object), 'works with frozen objects #2'); }); QUnit.test('WeakMap#set', assert => { assert.isFunction(WeakMap.prototype.set); const weakmap = new WeakMap(); const object = {}; weakmap.set(object, 33); assert.same(weakmap.get(object), 33, 'works with object as keys'); assert.ok(weakmap.set({}, 42) === weakmap, 'chaining'); assert.throws(() => new WeakMap().set(42, 42), 'throws with primitive keys'); const object1 = freeze({}); const object2 = {}; weakmap.set(object1, 42); weakmap.set(object2, 42); freeze(object); assert.same(weakmap.get(object1), 42, 'works with frozen objects #1'); assert.same(weakmap.get(object2), 42, 'works with frozen objects #2'); weakmap.delete(object1); weakmap.delete(object2); assert.same(weakmap.get(object1), undefined, 'works with frozen objects #3'); assert.same(weakmap.get(object2), undefined, 'works with frozen objects #4'); }); QUnit.test('WeakMap#@@toStringTag', assert => { assert.strictEqual(WeakMap.prototype[Symbol.toStringTag], 'WeakMap', 'WeakMap::@@toStringTag is `WeakMap`'); assert.strictEqual(String(new WeakMap()), '[object WeakMap]', 'correct stringification'); }); core-js-3.6.1/tests/pure/es.weak-set.js000066400000000000000000000074331360057567700177130ustar00rootroot00000000000000import { createIterable, nativeSubclass } from '../helpers/helpers'; import { DESCRIPTORS } from '../helpers/constants'; import { Symbol, WeakSet } from 'core-js-pure'; import getIteratorMethod from 'core-js-pure/features/get-iterator-method'; import { freeze, keys, getOwnPropertyNames, getOwnPropertySymbols } from 'core-js-pure/features/object'; import ownKeys from 'core-js-pure/features/reflect/own-keys'; QUnit.test('WeakSet', assert => { assert.isFunction(WeakSet); assert.ok('add' in WeakSet.prototype, 'add in WeakSet.prototype'); assert.ok('delete' in WeakSet.prototype, 'delete in WeakSet.prototype'); assert.ok('has' in WeakSet.prototype, 'has in WeakSet.prototype'); assert.ok(new WeakSet() instanceof WeakSet, 'new WeakSet instanceof WeakSet'); let object = {}; assert.ok(new WeakSet(createIterable([object])).has(object), 'Init from iterable'); const weakset = new WeakSet(); const frozen = freeze({}); weakset.add(frozen); assert.strictEqual(weakset.has(frozen), true, 'works with frozen objects, #1'); weakset.delete(frozen); assert.strictEqual(weakset.has(frozen), false, 'works with frozen objects, #2'); let done = false; try { new WeakSet(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.ok(done, '.return #throw'); assert.ok(!('clear' in WeakSet.prototype), 'should not contains `.clear` method'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return getIteratorMethod([]).call(this); }; new WeakSet(array); assert.ok(done); object = {}; new WeakSet().add(object); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(WeakSet); assert.ok(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.ok(new Subclass() instanceof WeakSet, 'correct subclassing with native classes #2'); object = {}; assert.ok(new Subclass().add(object).has(object), 'correct subclassing with native classes #3'); } }); QUnit.test('WeakSet#add', assert => { assert.isFunction(WeakSet.prototype.add); const weakset = new WeakSet(); assert.ok(weakset.add({}) === weakset, 'chaining'); assert.throws(() => new WeakSet().add(42), 'throws with primitive keys'); }); QUnit.test('WeakSet#delete', assert => { assert.isFunction(WeakSet.prototype.delete); const a = {}; const b = {}; const weakset = new WeakSet().add(a).add(b); assert.ok(weakset.has(a) && weakset.has(b), 'WeakSet has values before .delete()'); weakset.delete(a); assert.ok(!weakset.has(a) && weakset.has(b), 'WeakSet has`nt value after .delete()'); assert.notThrows(() => !weakset.delete(1), 'return false on primitive'); }); QUnit.test('WeakSet#has', assert => { assert.isFunction(WeakSet.prototype.has); const weakset = new WeakSet(); assert.ok(!weakset.has({}), 'WeakSet has`nt value'); const object = {}; weakset.add(object); assert.ok(weakset.has(object), 'WeakSet has value after .add()'); weakset.delete(object); assert.ok(!weakset.has(object), 'WeakSet hasn`t value after .delete()'); assert.notThrows(() => !weakset.has(1), 'return false on primitive'); }); QUnit.test('WeakSet::@@toStringTag', assert => { assert.strictEqual(WeakSet.prototype[Symbol.toStringTag], 'WeakSet', 'WeakSet::@@toStringTag is `WeakSet`'); assert.strictEqual(String(new WeakSet()), '[object WeakSet]', 'correct stringification'); }); core-js-3.6.1/tests/pure/esnext.aggregate-error.js000066400000000000000000000011141360057567700221350ustar00rootroot00000000000000import AggregateError from 'core-js-pure/features/aggregate-error'; QUnit.test('AggregateError', assert => { assert.isFunction(AggregateError); assert.arity(AggregateError, 2); assert.name(AggregateError, 'AggregateError'); assert.ok(new AggregateError([1]) instanceof AggregateError); assert.ok(new AggregateError([1]) instanceof Error); assert.ok(AggregateError([1]) instanceof AggregateError); assert.ok(AggregateError([1]) instanceof Error); assert.same(AggregateError([1], 'foo').message, 'foo'); assert.deepEqual(AggregateError([1, 2, 3]).errors, [1, 2, 3]); }); core-js-3.6.1/tests/pure/esnext.array.is-template-object.js000066400000000000000000000015201360057567700236660ustar00rootroot00000000000000import isTemplateObject from 'core-js-pure/features/array/is-template-object'; import freeze from 'core-js-pure/features/object/freeze'; QUnit.test('Array.isTemplateObject', assert => { assert.isFunction(isTemplateObject); assert.arity(isTemplateObject, 1); assert.name(isTemplateObject, 'isTemplateObject'); assert.ok(!isTemplateObject(undefined)); assert.ok(!isTemplateObject(null)); assert.ok(!isTemplateObject({})); assert.ok(!isTemplateObject(function () { return arguments; }())); assert.ok(!isTemplateObject([])); assert.ok(!isTemplateObject(freeze([]))); const template = (() => { try { // eslint-disable-next-line no-template-curly-in-string return Function('return (it => it)`qwe${ 123 }asd`')(); } catch { /* empty */ } })(); if (template) assert.ok(isTemplateObject(template)); }); core-js-3.6.1/tests/pure/esnext.async-iterator.as-indexed-pairs.js000066400000000000000000000016441360057567700251700ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator } from '../helpers/helpers'; QUnit.test('AsyncIterator#asIndexedPairs', assert => { assert.expect(8); const async = assert.async(); const { asIndexedPairs } = AsyncIterator.prototype; assert.isFunction(asIndexedPairs); assert.arity(asIndexedPairs, 0); assert.nonEnumerable(AsyncIterator.prototype, 'asIndexedPairs'); asIndexedPairs.call(createIterator(['a', 'b', 'c'])).toArray().then(it => { assert.same(it.toString(), '0,a,1,b,2,c', 'basic functionality'); async(); }); assert.throws(() => asIndexedPairs.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => asIndexedPairs.call(null, () => { /* empty */ }), TypeError); assert.throws(() => asIndexedPairs.call({}, () => { /* empty */ }), TypeError); assert.throws(() => asIndexedPairs.call([], () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.async-iterator.constructor.js000066400000000000000000000016351360057567700244200ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import Symbol from 'core-js-pure/features/symbol'; QUnit.test('AsyncIterator', assert => { assert.isFunction(AsyncIterator); assert.arity(AsyncIterator, 0); assert.ok(AsyncIterator.from([1, 2, 3]) instanceof AsyncIterator, 'Async From Proxy'); assert.ok(AsyncIterator.from([1, 2, 3]).drop(1) instanceof AsyncIterator, 'Async Drop Proxy'); assert.ok(new AsyncIterator() instanceof AsyncIterator, 'constructor'); assert.throws(() => AsyncIterator(), 'throws w/o `new`'); }); QUnit.test('AsyncIterator#constructor', assert => { assert.strictEqual(AsyncIterator.prototype.constructor, AsyncIterator, 'AsyncIterator#constructor is AsyncIterator'); }); QUnit.test('AsyncIterator#@@toStringTag', assert => { assert.strictEqual(AsyncIterator.prototype[Symbol.toStringTag], 'AsyncIterator', 'AsyncIterator::@@toStringTag is `AsyncIterator`'); }); core-js-3.6.1/tests/pure/esnext.async-iterator.drop.js000066400000000000000000000022641360057567700227760ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator } from '../helpers/helpers'; QUnit.test('AsyncIterator#drop', assert => { assert.expect(12); const async = assert.async(); const { drop } = AsyncIterator.prototype; assert.isFunction(drop); assert.arity(drop, 1); assert.nonEnumerable(AsyncIterator.prototype, 'drop'); drop.call(createIterator([1, 2, 3]), 1).toArray().then(it => { assert.arrayEqual(it, [2, 3], 'basic functionality'); return drop.call(createIterator([1, 2, 3]), 1.5).toArray(); }).then(it => { assert.arrayEqual(it, [2, 3], 'float'); return drop.call(createIterator([1, 2, 3]), 4).toArray(); }).then(it => { assert.arrayEqual(it, [], 'big'); return drop.call(createIterator([1, 2, 3]), 0).toArray(); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'zero'); }).then(() => async()); assert.throws(() => drop.call(undefined, 1), TypeError); assert.throws(() => drop.call(null, 1), TypeError); assert.throws(() => drop.call({}, 1), TypeError); assert.throws(() => drop.call([], 1), TypeError); assert.throws(() => drop.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); }); core-js-3.6.1/tests/pure/esnext.async-iterator.every.js000066400000000000000000000031461360057567700231640ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#every', assert => { assert.expect(16); const async = assert.async(); const { every } = AsyncIterator.prototype; assert.isFunction(every); assert.arity(every, 1); assert.nonEnumerable(AsyncIterator.prototype, 'every'); every.call(createIterator([1, 2, 3]), it => typeof it === 'number').then(result => { assert.ok(result, 'basic functionality, +'); return every.call(createIterator([1, 2, 3]), it => it === 2); }).then(result => { assert.ok(!result, 'basic functionality, -'); return every.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); }).then(() => { return every.call(createIterator([1]), () => { throw 42; }); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call([], () => { /* empty */ }), TypeError); assert.throws(() => every.call(createIterator([1]), undefined), TypeError); assert.throws(() => every.call(createIterator([1]), null), TypeError); assert.throws(() => every.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.async-iterator.filter.js000066400000000000000000000027761360057567700233270ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#filter', assert => { assert.expect(15); const async = assert.async(); const { filter } = AsyncIterator.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.nonEnumerable(AsyncIterator.prototype, 'filter'); filter.call(createIterator([1, 2, 3]), it => it % 2).toArray().then(it => { assert.arrayEqual(it, [1, 3], 'basic functionality'); return filter.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }).toArray(); }).then(() => { return filter.call(createIterator([1]), () => { throw 42; }).toArray(); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call([], () => { /* empty */ }), TypeError); assert.throws(() => filter.call(createIterator([1]), undefined), TypeError); assert.throws(() => filter.call(createIterator([1]), null), TypeError); assert.throws(() => filter.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.async-iterator.find.js000066400000000000000000000031271360057567700227510ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#find', assert => { assert.expect(16); const async = assert.async(); const { find } = AsyncIterator.prototype; assert.isFunction(find); assert.arity(find, 1); assert.nonEnumerable(AsyncIterator.prototype, 'find'); find.call(createIterator([2, 3, 4]), it => it % 2).then(result => { assert.same(result, 3, 'basic functionality, +'); return find.call(createIterator([1, 2, 3]), it => it === 4); }).then(result => { assert.same(result, undefined, 'basic functionality, -'); return find.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); }).then(() => { return find.call(createIterator([1]), () => { throw 42; }); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call([], () => { /* empty */ }), TypeError); assert.throws(() => find.call(createIterator([1]), undefined), TypeError); assert.throws(() => find.call(createIterator([1]), null), TypeError); assert.throws(() => find.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.async-iterator.flat-map.js000066400000000000000000000032141360057567700235270ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator, createIterable } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#flatMap', assert => { assert.expect(15); const async = assert.async(); const { flatMap } = AsyncIterator.prototype; assert.isFunction(flatMap); assert.arity(flatMap, 1); assert.nonEnumerable(AsyncIterator.prototype, 'flatMap'); flatMap.call(createIterator([1, [], 2, createIterable([3, 4]), [5, 6], 'ab']), it => typeof it == 'number' ? [-it] : it).toArray().then(it => { assert.arrayEqual(it, [-1, -2, 3, 4, 5, 6, 'a', 'b'], 'basic functionality'); return flatMap.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); return [arg]; }).toArray(); }).then(() => { return flatMap.call(createIterator([1]), () => { throw 42; }).toArray(); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => flatMap.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(null, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call({}, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call([], () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(createIterator([1]), undefined), TypeError); assert.throws(() => flatMap.call(createIterator([1]), null), TypeError); assert.throws(() => flatMap.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.async-iterator.for-each.js000066400000000000000000000030221360057567700235070ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#forEach', assert => { assert.expect(15); const async = assert.async(); const { forEach } = AsyncIterator.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.nonEnumerable(AsyncIterator.prototype, 'forEach'); const array = []; forEach.call(createIterator([1, 2, 3]), it => array.push(it)).then(() => { assert.arrayEqual(array, [1, 2, 3], 'basic functionality'); return forEach.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); }).then(() => { return forEach.call(createIterator([1]), () => { throw 42; }); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => forEach.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(null, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call({}, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call([], () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(createIterator([1]), undefined), TypeError); assert.throws(() => forEach.call(createIterator([1]), null), TypeError); assert.throws(() => forEach.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.async-iterator.from.js000066400000000000000000000017761360057567700230040ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import assign from 'core-js-pure/features/object/assign'; import values from 'core-js-pure/features/array/values'; QUnit.test('AsyncIterator.from', assert => { assert.expect(9); const async = assert.async(); const { from } = AsyncIterator; assert.isFunction(from); assert.arity(from, 1); assert.ok(AsyncIterator.from(values([])) instanceof AsyncIterator, 'proxy, iterator'); assert.ok(AsyncIterator.from([]) instanceof AsyncIterator, 'proxy, iterable'); AsyncIterator.from([1, 2, 3]).toArray().then(result => { assert.arrayEqual(result, [1, 2, 3], 'just a proxy'); async(); }); const asyncIterator = assign(new AsyncIterator(), { next: () => { /* empty */ }, }); assert.same(AsyncIterator.from(asyncIterator), asyncIterator, 'does not wrap AsyncIterator instanses'); assert.throws(() => from(undefined), TypeError); assert.throws(() => from(null), TypeError); assert.throws(() => from({}), TypeError); }); core-js-3.6.1/tests/pure/esnext.async-iterator.map.js000066400000000000000000000027251360057567700226110ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#map', assert => { assert.expect(15); const async = assert.async(); const { map } = AsyncIterator.prototype; assert.isFunction(map); assert.arity(map, 1); assert.nonEnumerable(AsyncIterator.prototype, 'map'); map.call(createIterator([1, 2, 3]), it => it ** 2).toArray().then(it => { assert.arrayEqual(it, [1, 4, 9], 'basic functionality'); return map.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }).toArray(); }).then(() => { return map.call(createIterator([1]), () => { throw 42; }).toArray(); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); assert.throws(() => map.call({}, () => { /* empty */ }), TypeError); assert.throws(() => map.call([], () => { /* empty */ }), TypeError); assert.throws(() => map.call(createIterator([1]), undefined), TypeError); assert.throws(() => map.call(createIterator([1]), null), TypeError); assert.throws(() => map.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.async-iterator.reduce.js000066400000000000000000000035111360057567700232750ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#reduce', assert => { assert.expect(18); const async = assert.async(); const { reduce } = AsyncIterator.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.nonEnumerable(AsyncIterator.prototype, 'reduce'); reduce.call(createIterator([1, 2, 3]), (a, b) => a + b, 1).then(it => { assert.same(it, 7, 'basic functionality, initial'); return reduce.call(createIterator([2]), function (a, b) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(a, 1, 'argument 1'); assert.same(b, 2, 'argument 2'); }, 1); }).then(() => { return reduce.call(createIterator([1, 2, 3]), (a, b) => a + b); }).then(it => { assert.same(it, 6, 'basic functionality, no initial'); return reduce.call(createIterator([]), (a, b) => a + b); }).catch(() => { assert.ok(true, 'reduce an empty interble with no initial'); return reduce.call(createIterator([1]), () => { throw 42; }, 1); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call({}, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call([], () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), undefined, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), null, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), {}, 1), TypeError); }); core-js-3.6.1/tests/pure/esnext.async-iterator.some.js000066400000000000000000000031101360057567700227640ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#some', assert => { assert.expect(16); const async = assert.async(); const { some } = AsyncIterator.prototype; assert.isFunction(some); assert.arity(some, 1); assert.nonEnumerable(AsyncIterator.prototype, 'some'); some.call(createIterator([1, 2, 3]), it => it === 2).then(result => { assert.ok(result, 'basic functionality, +'); return some.call(createIterator([1, 2, 3]), it => it === 4); }).then(result => { assert.ok(!result, 'basic functionality, -'); return some.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); }).then(() => { return some.call(createIterator([1]), () => { throw 42; }); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call([], () => { /* empty */ }), TypeError); assert.throws(() => some.call(createIterator([1]), undefined), TypeError); assert.throws(() => some.call(createIterator([1]), null), TypeError); assert.throws(() => some.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.async-iterator.take.js000066400000000000000000000022611360057567700227530ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator } from '../helpers/helpers'; QUnit.test('AsyncIterator#take', assert => { assert.expect(12); const async = assert.async(); const { take } = AsyncIterator.prototype; assert.isFunction(take); assert.arity(take, 1); assert.nonEnumerable(AsyncIterator.prototype, 'take'); take.call(createIterator([1, 2, 3]), 2).toArray().then(it => { assert.arrayEqual(it, [1, 2], 'basic functionality'); return take.call(createIterator([1, 2, 3]), 1.5).toArray(); }).then(it => { assert.arrayEqual(it, [1], 'float'); return take.call(createIterator([1, 2, 3]), 4).toArray(); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'big'); return take.call(createIterator([1, 2, 3]), 0).toArray(); }).then(it => { assert.arrayEqual(it, [], 'zero'); }).then(() => async()); assert.throws(() => take.call(undefined, 1), TypeError); assert.throws(() => take.call(null, 1), TypeError); assert.throws(() => take.call({}, 1), TypeError); assert.throws(() => take.call([], 1), TypeError); assert.throws(() => take.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); }); core-js-3.6.1/tests/pure/esnext.async-iterator.to-array.js000066400000000000000000000013221360057567700235620ustar00rootroot00000000000000import AsyncIterator from 'core-js-pure/features/async-iterator'; import { createIterator } from '../helpers/helpers'; QUnit.test('AsyncIterator#toArray', assert => { assert.expect(8); const async = assert.async(); const { toArray } = AsyncIterator.prototype; assert.isFunction(toArray); assert.arity(toArray, 0); assert.nonEnumerable(AsyncIterator.prototype, 'toArray'); toArray.call(createIterator([1, 2, 3])).then(it => { assert.arrayEqual(it, [1, 2, 3]); async(); }); assert.throws(() => toArray.call(undefined), TypeError); assert.throws(() => toArray.call(null), TypeError); assert.throws(() => toArray.call({}), TypeError); assert.throws(() => toArray.call([]), TypeError); }); core-js-3.6.1/tests/pure/esnext.composite-key.js000066400000000000000000000040221360057567700216510ustar00rootroot00000000000000/* eslint-disable no-self-compare */ import { FREEZING } from '../helpers/constants'; import compositeKey from 'core-js-pure/features/composite-key'; import { getPrototypeOf, isFrozen } from 'core-js-pure/features/object'; QUnit.test('compositeKey', assert => { assert.isFunction(compositeKey); if (compositeKey.name) assert.name(compositeKey, 'compositeKey'); const key = compositeKey({}); assert.same(typeof key, 'object'); assert.same({}.toString.call(key), '[object Object]'); assert.same(getPrototypeOf(key), null); if (FREEZING) assert.ok(isFrozen(key)); const a = ['a']; const b = ['b']; const c = ['c']; assert.ok(compositeKey(a) === compositeKey(a)); assert.ok(compositeKey(a) !== compositeKey(['a'])); assert.ok(compositeKey(a) !== compositeKey(a, 1)); assert.ok(compositeKey(a) !== compositeKey(a, b)); assert.ok(compositeKey(a, 1) === compositeKey(a, 1)); assert.ok(compositeKey(a, b) === compositeKey(a, b)); assert.ok(compositeKey(a, b) !== compositeKey(b, a)); assert.ok(compositeKey(a, b, c) === compositeKey(a, b, c)); assert.ok(compositeKey(a, b, c) !== compositeKey(c, b, a)); assert.ok(compositeKey(a, b, c) !== compositeKey(a, c, b)); assert.ok(compositeKey(a, b, c, 1) !== compositeKey(a, b, c)); assert.ok(compositeKey(a, b, c, 1) === compositeKey(a, b, c, 1)); assert.ok(compositeKey(1, a) === compositeKey(1, a)); assert.ok(compositeKey(1, a) !== compositeKey(a, 1)); assert.ok(compositeKey(1, a, 2, b) === compositeKey(1, a, 2, b)); assert.ok(compositeKey(1, a, 2, b) !== compositeKey(1, a, b, 2)); assert.ok(compositeKey(1, 2, a, b) === compositeKey(1, 2, a, b)); assert.ok(compositeKey(1, 2, a, b) !== compositeKey(1, a, b, 2)); assert.ok(compositeKey(a, a) === compositeKey(a, a)); assert.ok(compositeKey(a, a) !== compositeKey(a, ['a'])); assert.ok(compositeKey(a, a) !== compositeKey(a, b)); assert.throws(() => compositeKey(), TypeError); assert.throws(() => compositeKey(1, 2), TypeError); assert.throws(() => compositeKey('foo', null, true), TypeError); }); core-js-3.6.1/tests/pure/esnext.composite-symbol.js000066400000000000000000000041461360057567700223750ustar00rootroot00000000000000/* eslint-disable no-self-compare */ import compositeSymbol from 'core-js-pure/features/composite-symbol'; import Symbol from 'core-js-pure/features/symbol'; QUnit.test('compositeSymbol', assert => { assert.isFunction(compositeSymbol); if (compositeSymbol.name) assert.name(compositeSymbol, 'compositeSymbol'); assert.ok(Object(compositeSymbol({})) instanceof Symbol); const a = ['a']; const b = ['b']; const c = ['c']; assert.ok(compositeSymbol(a) === compositeSymbol(a)); assert.ok(compositeSymbol(a) !== compositeSymbol(['a'])); assert.ok(compositeSymbol(a) !== compositeSymbol(a, 1)); assert.ok(compositeSymbol(a) !== compositeSymbol(a, b)); assert.ok(compositeSymbol(a, 1) === compositeSymbol(a, 1)); assert.ok(compositeSymbol(a, b) === compositeSymbol(a, b)); assert.ok(compositeSymbol(a, b) !== compositeSymbol(b, a)); assert.ok(compositeSymbol(a, b, c) === compositeSymbol(a, b, c)); assert.ok(compositeSymbol(a, b, c) !== compositeSymbol(c, b, a)); assert.ok(compositeSymbol(a, b, c) !== compositeSymbol(a, c, b)); assert.ok(compositeSymbol(a, b, c, 1) !== compositeSymbol(a, b, c)); assert.ok(compositeSymbol(a, b, c, 1) === compositeSymbol(a, b, c, 1)); assert.ok(compositeSymbol(1, a) === compositeSymbol(1, a)); assert.ok(compositeSymbol(1, a) !== compositeSymbol(a, 1)); assert.ok(compositeSymbol(1, a, 2, b) === compositeSymbol(1, a, 2, b)); assert.ok(compositeSymbol(1, a, 2, b) !== compositeSymbol(1, a, b, 2)); assert.ok(compositeSymbol(1, 2, a, b) === compositeSymbol(1, 2, a, b)); assert.ok(compositeSymbol(1, 2, a, b) !== compositeSymbol(1, a, b, 2)); assert.ok(compositeSymbol(a, a) === compositeSymbol(a, a)); assert.ok(compositeSymbol(a, a) !== compositeSymbol(a, ['a'])); assert.ok(compositeSymbol(a, a) !== compositeSymbol(a, b)); assert.ok(compositeSymbol() === compositeSymbol()); assert.ok(compositeSymbol(1, 2) === compositeSymbol(1, 2)); assert.ok(compositeSymbol(1, 2) !== compositeSymbol(2, 1)); assert.ok(compositeSymbol('foo', null, true) === compositeSymbol('foo', null, true)); assert.ok(compositeSymbol('string') === Symbol.for('string')); }); core-js-3.6.1/tests/pure/esnext.iterator.as-indexed-pairs.js000066400000000000000000000013311360057567700240460ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterator } from '../helpers/helpers'; QUnit.test('Iterator#asIndexedPairs', assert => { const { asIndexedPairs } = Iterator.prototype; assert.isFunction(asIndexedPairs); assert.arity(asIndexedPairs, 0); assert.nonEnumerable(Iterator.prototype, 'asIndexedPairs'); assert.arrayEqual(asIndexedPairs.call(createIterator(['a', 'b', 'c'])).toArray().toString(), '0,a,1,b,2,c', 'basic functionality'); assert.throws(() => asIndexedPairs.call(undefined, TypeError)); assert.throws(() => asIndexedPairs.call(null, TypeError)); assert.throws(() => asIndexedPairs.call({}, TypeError)); assert.throws(() => asIndexedPairs.call([], TypeError)); }); core-js-3.6.1/tests/pure/esnext.iterator.constructor.js000066400000000000000000000014271360057567700233040ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import Symbol from 'core-js-pure/features/symbol'; import { createIterator } from '../helpers/helpers'; QUnit.test('Iterator', assert => { assert.isFunction(Iterator); assert.arity(Iterator, 0); assert.ok(Iterator.from(createIterator([1, 2, 3])) instanceof Iterator, 'From Proxy'); assert.ok(new Iterator() instanceof Iterator, 'constructor'); assert.throws(() => Iterator(), 'throws w/o `new`'); }); QUnit.test('Iterator#constructor', assert => { assert.strictEqual(Iterator.prototype.constructor, Iterator, 'Iterator#constructor is Iterator'); }); QUnit.test('Iterator#@@toStringTag', assert => { assert.strictEqual(Iterator.prototype[Symbol.toStringTag], 'Iterator', 'Iterator::@@toStringTag is `Iterator`'); }); core-js-3.6.1/tests/pure/esnext.iterator.drop.js000066400000000000000000000017161360057567700216640ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterator } from '../helpers/helpers'; QUnit.test('Iterator#drop', assert => { const { drop } = Iterator.prototype; assert.isFunction(drop); assert.arity(drop, 1); assert.nonEnumerable(Iterator.prototype, 'drop'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 1).toArray(), [2, 3], 'basic functionality'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 1.5).toArray(), [2, 3], 'float'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 4).toArray(), [], 'big'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 0).toArray(), [1, 2, 3], 'zero'); assert.throws(() => drop.call(undefined, 1), TypeError); assert.throws(() => drop.call(null, 1), TypeError); assert.throws(() => drop.call({}, 1), TypeError); assert.throws(() => drop.call([], 1), TypeError); assert.throws(() => drop.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); }); core-js-3.6.1/tests/pure/esnext.iterator.every.js000066400000000000000000000023741360057567700220530ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#every', assert => { const { every } = Iterator.prototype; assert.isFunction(every); assert.arity(every, 1); assert.nonEnumerable(Iterator.prototype, 'every'); assert.ok(every.call(createIterator([1, 2, 3]), it => typeof it == 'number'), 'basic functionality #1'); assert.ok(!every.call(createIterator([1, 2, 3]), it => it % 2), 'basic functionality #2'); every.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call([], () => { /* empty */ }), TypeError); assert.throws(() => every.call(createIterator([1]), undefined), TypeError); assert.throws(() => every.call(createIterator([1]), null), TypeError); assert.throws(() => every.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.iterator.filter.js000066400000000000000000000022771360057567700222100ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#filter', assert => { const { filter } = Iterator.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.nonEnumerable(Iterator.prototype, 'filter'); assert.arrayEqual(filter.call(createIterator([1, 2, 3]), it => it % 2).toArray(), [1, 3], 'basic functionality'); filter.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }).toArray(); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call([], () => { /* empty */ }), TypeError); assert.throws(() => filter.call(createIterator([1]), undefined), TypeError); assert.throws(() => filter.call(createIterator([1]), null), TypeError); assert.throws(() => filter.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.iterator.find.js000066400000000000000000000022071360057567700216340ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#find', assert => { const { find } = Iterator.prototype; assert.isFunction(find); assert.arity(find, 1); assert.nonEnumerable(Iterator.prototype, 'find'); assert.same(find.call(createIterator([1, 2, 3]), it => !(it % 2)), 2, 'basic functionality'); find.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call([], () => { /* empty */ }), TypeError); assert.throws(() => find.call(createIterator([1]), undefined), TypeError); assert.throws(() => find.call(createIterator([1]), null), TypeError); assert.throws(() => find.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.iterator.flat-map.js000066400000000000000000000026611360057567700224210ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterator, createIterable } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#flatMap', assert => { const { flatMap } = Iterator.prototype; assert.isFunction(flatMap); assert.arity(flatMap, 1); assert.nonEnumerable(Iterator.prototype, 'flatMap'); assert.arrayEqual( flatMap.call(createIterator([1, [], 2, createIterable([3, 4]), [5, 6], 'ab']), it => typeof it == 'number' ? [-it] : it).toArray(), [-1, -2, 3, 4, 5, 6, 'a', 'b'], 'basic functionality', ); flatMap.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); return [arg]; }).toArray(); assert.throws(() => flatMap.call(createIterator([1]), it => it).next(), TypeError); assert.throws(() => flatMap.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(null, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call({}, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call([], () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(createIterator([1]), undefined), TypeError); assert.throws(() => flatMap.call(createIterator([1]), null), TypeError); assert.throws(() => flatMap.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.iterator.for-each.js000066400000000000000000000023441360057567700224020ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#forEach', assert => { const { forEach } = Iterator.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.nonEnumerable(Iterator.prototype, 'forEach'); const array = []; forEach.call(createIterator([1, 2, 3]), it => array.push(it)); assert.arrayEqual(array, [1, 2, 3], 'basic functionality'); forEach.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); assert.throws(() => forEach.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(null, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call({}, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call([], () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(createIterator([1]), undefined), TypeError); assert.throws(() => forEach.call(createIterator([1]), null), TypeError); assert.throws(() => forEach.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.iterator.from.js000066400000000000000000000012551360057567700216610ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterable, createIterator } from '../helpers/helpers'; QUnit.test('Iterator.from', assert => { const { from } = Iterator; assert.isFunction(from); assert.arity(from, 1); assert.ok(Iterator.from(createIterator([1, 2, 3])) instanceof Iterator, 'proxy, iterator'); assert.ok(Iterator.from(createIterable([1, 2, 3])) instanceof Iterator, 'proxy, iterable'); assert.arrayEqual(Iterator.from(createIterable([1, 2, 3])).toArray(), [1, 2, 3], 'just a proxy'); assert.throws(() => from(undefined), TypeError); assert.throws(() => from(null), TypeError); assert.throws(() => from({}), TypeError); }); core-js-3.6.1/tests/pure/esnext.iterator.map.js000066400000000000000000000022311360057567700214660ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#map', assert => { const { map } = Iterator.prototype; assert.isFunction(map); assert.arity(map, 1); assert.nonEnumerable(Iterator.prototype, 'map'); assert.arrayEqual(map.call(createIterator([1, 2, 3]), it => it ** 2).toArray(), [1, 4, 9], 'basic functionality'); map.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }).toArray(); assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); assert.throws(() => map.call({}, () => { /* empty */ }), TypeError); assert.throws(() => map.call([], () => { /* empty */ }), TypeError); assert.throws(() => map.call(createIterator([1]), undefined), TypeError); assert.throws(() => map.call(createIterator([1]), null), TypeError); assert.throws(() => map.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.iterator.reduce.js000066400000000000000000000024671360057567700221730ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#reduce', assert => { const { reduce } = Iterator.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.nonEnumerable(Iterator.prototype, 'reduce'); assert.same(reduce.call(createIterator([1, 2, 3]), (a, b) => a + b, 1), 7, 'basic functionality'); assert.same(reduce.call(createIterator([1, 2, 3]), (a, b) => a + b), 6, 'basic functionality, no init'); reduce.call(createIterator([2]), function (a, b) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(a, 1, 'argument 1'); assert.same(b, 2, 'argument 2'); }, 1); assert.throws(() => reduce.call(undefined, (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call(null, (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call({}, (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call([], (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call(createIterator([1]), undefined, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), null, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), {}, 1), TypeError); }); core-js-3.6.1/tests/pure/esnext.iterator.some.js000066400000000000000000000023551360057567700216630ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#some', assert => { const { some } = Iterator.prototype; assert.isFunction(some); assert.arity(some, 1); assert.nonEnumerable(Iterator.prototype, 'some'); assert.ok(some.call(createIterator([1, 2, 3]), it => it % 2), 'basic functionality #1'); assert.ok(!some.call(createIterator([1, 2, 3]), it => typeof it == 'string'), 'basic functionality #2'); some.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call([], () => { /* empty */ }), TypeError); assert.throws(() => some.call(createIterator([1]), undefined), TypeError); assert.throws(() => some.call(createIterator([1]), null), TypeError); assert.throws(() => some.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/pure/esnext.iterator.take.js000066400000000000000000000017131360057567700216410ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterator } from '../helpers/helpers'; QUnit.test('Iterator#take', assert => { const { take } = Iterator.prototype; assert.isFunction(take); assert.arity(take, 1); assert.nonEnumerable(Iterator.prototype, 'take'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 2).toArray(), [1, 2], 'basic functionality'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 1.5).toArray(), [1], 'float'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 4).toArray(), [1, 2, 3], 'big'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 0).toArray(), [], 'zero'); assert.throws(() => take.call(undefined, 1), TypeError); assert.throws(() => take.call(null, 1), TypeError); assert.throws(() => take.call({}, 1), TypeError); assert.throws(() => take.call([], 1), TypeError); assert.throws(() => take.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); }); core-js-3.6.1/tests/pure/esnext.iterator.to-array.js000066400000000000000000000014101360057567700224450ustar00rootroot00000000000000import Iterator from 'core-js-pure/features/iterator'; import { createIterable, createIterator } from '../helpers/helpers'; QUnit.test('Iterator#toArray', assert => { const { toArray } = Iterator.prototype; assert.isFunction(toArray); assert.arity(toArray, 0); assert.nonEnumerable(Iterator.prototype, 'toArray'); assert.arrayEqual(Iterator.from('123').toArray(), ['1', '2', '3']); assert.arrayEqual(Iterator.from(createIterable([1, 2, 3])).toArray(), [1, 2, 3]); assert.arrayEqual(toArray.call(createIterator([1, 2, 3])), [1, 2, 3]); assert.throws(() => toArray.call(undefined), TypeError); assert.throws(() => toArray.call(null), TypeError); assert.throws(() => toArray.call({}), TypeError); assert.throws(() => toArray.call([]), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.delete-all.js000066400000000000000000000021501360057567700216450ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; import from from 'core-js-pure/features/array/from'; QUnit.test('Map#deleteAll', assert => { const { deleteAll } = Map.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.nonEnumerable(Map.prototype, 'deleteAll'); let set = new Map([[1, 2], [2, 3], [3, 4]]); assert.same(set.deleteAll(1, 2), true); assert.deepEqual(from(set), [[3, 4]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.same(set.deleteAll(3, 4), false); assert.deepEqual(from(set), [[1, 2], [2, 3]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.same(set.deleteAll(4, 5), false); assert.deepEqual(from(set), [[1, 2], [2, 3], [3, 4]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.same(set.deleteAll(), true); assert.deepEqual(from(set), [[1, 2], [2, 3], [3, 4]]); assert.notThrows(() => !deleteAll.call({ delete() { /* empty */ } }, 1, 2, 3)); assert.throws(() => deleteAll.call({}, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(null, 1, 2, 3), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.every.js000066400000000000000000000025161360057567700207750ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; QUnit.test('Map#every', assert => { const { every } = Map.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.nonEnumerable(Map.prototype, 'every'); let map = new Map([[9, 1]]); const context = {}; map.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 9, 'correct index in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); map = new Map([[0, 1], [1, 2], [2, 3]]); assert.ok(map.every(it => typeof it === 'number')); assert.ok(map.every(it => it < 4)); assert.ok(!map.every(it => it < 3)); assert.ok(!map.every(it => typeof it === 'string')); assert.ok(map.every(function () { return +this === 1; }, 1)); let result = ''; map.every((value, key) => result += key); assert.ok(result === '012'); assert.ok(map.every((value, key, that) => that === map)); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.filter.js000066400000000000000000000024101360057567700211210ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; import from from 'core-js-pure/features/array/from'; QUnit.test('Map#filter', assert => { const { filter } = Map.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.nonEnumerable(Map.prototype, 'filter'); const map = new Map([[1, 2]]); const context = {}; map.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).filter(it => typeof it === 'number')), [ ['a', 1], [1, 2], ['b', 3], [3, 4], [4, 5], ]); assert.ok(new Map().filter(it => it) instanceof Map); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.find-key.js000066400000000000000000000020071360057567700213440ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; QUnit.test('Map#findKey', assert => { const { findKey } = Map.prototype; assert.isFunction(findKey); assert.arity(findKey, 1); assert.nonEnumerable(Map.prototype, 'findKey'); const set = new Map([[1, 2]]); const context = {}; set.findKey(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Map([[1, 2], [2, 3], [3, 4]]).findKey(it => it % 2), 2); assert.same(new Map().findKey(it => it === 42), undefined); assert.throws(() => findKey.call({}, () => { /* empty */ }), TypeError); assert.throws(() => findKey.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => findKey.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.find.js000066400000000000000000000017461360057567700205670ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; QUnit.test('Map#find', assert => { const { find } = Map.prototype; assert.isFunction(find); assert.arity(find, 1); assert.nonEnumerable(Map.prototype, 'find'); const set = new Map([[1, 2]]); const context = {}; set.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Map([[1, 2], [2, 3], [3, 4]]).find(it => it % 2), 3); assert.same(new Map().find(it => it === 42), undefined); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.from.js000066400000000000000000000017621360057567700206100ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import Map from 'core-js-pure/features/map'; import toArray from 'core-js-pure/features/array/from'; QUnit.test('Map.from', assert => { const { from } = Map; assert.isFunction(from); assert.arity(from, 1); assert.ok(Map.from() instanceof Map); assert.deepEqual(toArray(Map.from([])), []); assert.deepEqual(toArray(Map.from([[1, 2]])), [[1, 2]]); assert.deepEqual(toArray(Map.from([[1, 2], [2, 3], [1, 4]])), [[1, 4], [2, 3]]); assert.deepEqual(toArray(Map.from(createIterable([[1, 2], [2, 3], [1, 4]]))), [[1, 4], [2, 3]]); const pair = [1, 2]; const context = {}; Map.from([pair], function (element, index) { assert.same(element, pair); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from([1, 2])); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.6.1/tests/pure/esnext.map.group-by.js000066400000000000000000000015231360057567700214040ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import Map from 'core-js-pure/features/map'; import toArray from 'core-js-pure/features/array/from'; QUnit.test('Map.groupBy', assert => { const { groupBy } = Map; assert.isFunction(groupBy); assert.arity(groupBy, 2); assert.name(groupBy, 'groupBy'); assert.ok(Map.groupBy([], it => it) instanceof Map); assert.deepEqual(toArray(Map.groupBy([], it => it)), []); assert.deepEqual(toArray(Map.groupBy([1, 2], it => it ** 2)), [[1, [1]], [4, [2]]]); assert.deepEqual(toArray(Map.groupBy([1, 2, 1], it => it ** 2)), [[1, [1, 1]], [4, [2]]]); assert.deepEqual(toArray(Map.groupBy(createIterable([1, 2]), it => it ** 2)), [[1, [1]], [4, [2]]]); const element = {}; Map.groupBy([element], it => assert.same(it, element)); assert.throws(() => groupBy([1, 2], it => it)); }); core-js-3.6.1/tests/pure/esnext.map.includes.js000066400000000000000000000014531360057567700214500ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; QUnit.test('Map#includes', assert => { const { includes } = Map.prototype; assert.isFunction(includes); assert.name(includes, 'includes'); assert.arity(includes, 1); assert.nonEnumerable(Map.prototype, 'includes'); const object = {}; const map = new Map([[1, 1], [2, 2], [3, 3], [4, -0], [5, object], [6, NaN]]); assert.ok(map.includes(1)); assert.ok(map.includes(-0)); assert.ok(map.includes(0)); assert.ok(map.includes(object)); assert.ok(!map.includes(4)); assert.ok(!map.includes(-0.5)); assert.ok(!map.includes({})); assert.ok(map.includes(NaN)); assert.throws(() => includes.call({}, 1), TypeError); assert.throws(() => includes.call(undefined, 1), TypeError); assert.throws(() => includes.call(null, 1), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.key-by.js000066400000000000000000000014521360057567700210410ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import Map from 'core-js-pure/features/map'; import toArray from 'core-js-pure/features/array/from'; QUnit.test('Map.keyBy', assert => { const { keyBy } = Map; assert.isFunction(keyBy); assert.arity(keyBy, 2); assert.name(keyBy, 'keyBy'); assert.ok(Map.keyBy([], it => it) instanceof Map); assert.deepEqual(toArray(Map.keyBy([], it => it)), []); assert.deepEqual(toArray(Map.keyBy([1, 2], it => it ** 2)), [[1, 1], [4, 2]]); assert.deepEqual(toArray(Map.keyBy([1, 2, 1], it => it ** 2)), [[1, 1], [4, 2]]); assert.deepEqual(toArray(Map.keyBy(createIterable([1, 2]), it => it ** 2)), [[1, 1], [4, 2]]); const element = {}; Map.keyBy([element], it => assert.same(it, element)); assert.throws(() => keyBy([1, 2], it => it)); }); core-js-3.6.1/tests/pure/esnext.map.key-of.js000066400000000000000000000014331360057567700210320ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; QUnit.test('Map#keyOf', assert => { const { keyOf } = Map.prototype; assert.isFunction(keyOf); assert.arity(keyOf, 1); assert.nonEnumerable(Map.prototype, 'keyOf'); const object = {}; const map = new Map([[1, 1], [2, 2], [3, 3], [4, -0], [5, object], [6, NaN]]); assert.same(map.keyOf(1), 1); assert.same(map.keyOf(-0), 4); assert.same(map.keyOf(0), 4); assert.same(map.keyOf(object), 5); assert.same(map.keyOf(4), undefined); assert.same(map.keyOf(-0.5), undefined); assert.same(map.keyOf({}), undefined); assert.same(map.keyOf(NaN), undefined); assert.throws(() => keyOf.call({}, 1), TypeError); assert.throws(() => keyOf.call(undefined, 1), TypeError); assert.throws(() => keyOf.call(null, 1), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.map-keys.js000066400000000000000000000025541360057567700213730ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; import from from 'core-js-pure/features/array/from'; QUnit.test('Map#mapKeys', assert => { const { mapKeys } = Map.prototype; assert.isFunction(mapKeys); assert.arity(mapKeys, 1); assert.name(mapKeys, 'mapKeys'); assert.nonEnumerable(Map.prototype, 'mapKeys'); const map = new Map([[1, 2]]); const context = {}; map.mapKeys(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(new Map().mapKeys(it => it) instanceof Map); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).mapKeys((value, key) => `${ key }${ value }`)), [ ['a1', 1], ['12', 2], ['b3', 3], ['2q', 'q'], ['c[object Object]', {}], ['34', 4], ['dtrue', true], ['45', 5], ]); assert.throws(() => mapKeys.call({}, () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.map-values.js000066400000000000000000000026101360057567700217100ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; import from from 'core-js-pure/features/array/from'; QUnit.test('Map#mapValues', assert => { const { mapValues } = Map.prototype; assert.isFunction(mapValues); assert.arity(mapValues, 1); assert.name(mapValues, 'mapValues'); assert.nonEnumerable(Map.prototype, 'mapValues'); const map = new Map([[1, 2]]); const context = {}; map.mapValues(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(new Map().mapValues(it => it) instanceof Map); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).mapValues((value, key) => `${ key }${ value }`)), [ ['a', 'a1'], [1, '12'], ['b', 'b3'], [2, '2q'], ['c', 'c[object Object]'], [3, '34'], ['d', 'dtrue'], [4, '45'], ]); assert.throws(() => mapValues.call({}, () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.merge.js000066400000000000000000000017751360057567700207500ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; import from from 'core-js-pure/features/array/from'; QUnit.test('Map#merge', assert => { const { merge } = Map.prototype; assert.isFunction(merge); assert.arity(merge, 1); assert.name(merge, 'merge'); assert.nonEnumerable(Map.prototype, 'merge'); const map = new Map([[1, 2]]); const result = map.merge([[3, 4]]); assert.ok(result === map); assert.ok(result instanceof Map); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[5, 6]])), [[1, 2], [3, 4], [5, 6]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[3, 5], [5, 6]])), [[1, 2], [3, 5], [5, 6]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([])), [[1, 2], [3, 4]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[3, 5]], [[5, 6]])), [[1, 2], [3, 5], [5, 6]]); assert.throws(() => merge.call({}, [[1, 2]]), TypeError); assert.throws(() => merge.call(undefined, [[1, 2]]), TypeError); assert.throws(() => merge.call(null, [[1, 2]]), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.of.js000066400000000000000000000010241360057567700202400ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; import toArray from 'core-js-pure/features/array/from'; QUnit.test('Map.of', assert => { const { of } = Map; assert.isFunction(of); assert.arity(of, 0); assert.ok(Map.of() instanceof Map); assert.deepEqual(toArray(Map.of([1, 2])), [[1, 2]]); assert.deepEqual(toArray(Map.of([1, 2], [2, 3], [1, 4])), [[1, 4], [2, 3]]); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.6.1/tests/pure/esnext.map.reduce.js000066400000000000000000000034341360057567700211120ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; QUnit.test('Map#reduce', assert => { const { reduce } = Map.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.nonEnumerable(Map.prototype, 'reduce'); const set = new Map([['a', 1]]); const accumulator = {}; set.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 'a', 'correct index in callback'); assert.same(that, set, 'correct link to set in callback'); }, accumulator); assert.same(new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new Map([ ['a', 1], ['b', 2], ]).reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 'b', 'correct start index without initial accumulator'); }); assert.same(new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce((memo, value, key, s) => { s.delete('b'); values += value; keys += key; }, 0); assert.same(values, '13', 'correct order #1'); assert.same(keys, 'ac', 'correct order #2'); assert.throws(() => reduce.call({}, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.some.js000066400000000000000000000025321360057567700206040ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; QUnit.test('Map#some', assert => { const { some } = Map.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.nonEnumerable(Map.prototype, 'some'); let map = new Map([[9, 1]]); const context = {}; map.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 9, 'correct index in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); map = new Map([[0, 1], [1, '2'], [2, 3]]); assert.ok(map.some(it => typeof it === 'number')); assert.ok(map.some(it => it < 3)); assert.ok(!map.some(it => it < 0)); assert.ok(map.some(it => typeof it === 'string')); assert.ok(!map.some(function () { return +this !== 1; }, 1)); let result = ''; map.some((value, key) => { result += key; return false; }); assert.same(result, '012'); assert.ok(map.some((value, key, that) => that === map)); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.update-or-insert.js000066400000000000000000000033331360057567700230430ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; QUnit.test('Map#updateOrInsert', assert => { const { updateOrInsert } = Map.prototype; assert.isFunction(updateOrInsert); assert.arity(updateOrInsert, 2); assert.name(updateOrInsert, 'upsert'); assert.nonEnumerable(Map.prototype, 'updateOrInsert'); const map = new Map([['a', 2]]); assert.same(map.updateOrInsert('a', function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.ok(false, 'should not be called'); return 3; }), 4, 'returns a correct value'); assert.same(map.updateOrInsert('b', value => { assert.ok(false, 'should not be called'); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.size, 2, 'correct size'); assert.same(map.get('a'), 4, 'correct result #1'); assert.same(map.get('b'), 3, 'correct result #2'); assert.same(new Map([['a', 2]]).updateOrInsert('b', null, () => 3), 3); assert.same(new Map([['a', 2]]).updateOrInsert('a', value => value ** 2), 4); assert.throws(() => new Map().updateOrInsert('a'), TypeError); assert.throws(() => updateOrInsert.call({}, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call([], 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call(undefined, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call(null, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.update.js000066400000000000000000000035701360057567700211260ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; QUnit.test('Map#update', assert => { const { update } = Map.prototype; assert.isFunction(update); assert.arity(update, 2); assert.name(update, 'update'); assert.nonEnumerable(Map.prototype, 'update'); let map = new Map([[9, 2]]); assert.same(map.update(9, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 9, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); return value * 2; }), map, 'returns this'); assert.same(map.size, 1, 'correct size'); assert.same(map.get(9), 4, 'correct result'); map = new Map([[4, 5]]); map.update(9, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 9, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); return value * 2; }, function (key, that) { assert.same(arguments.length, 2, 'correct number of thunk arguments'); assert.same(key, 9, 'correct key in thunk'); assert.same(that, map, 'correct link to map in thunk'); return 2; }); assert.same(map.size, 2, 'correct size'); assert.same(map.get(4), 5, 'correct result #1'); assert.same(map.get(9), 4, 'correct result #2'); assert.throws(() => new Map([[9, 2]]).update(9), TypeError); assert.throws(() => new Map().update(9, () => { /* empty */ }), TypeError); assert.throws(() => update.call({}, () => { /* empty */ }), TypeError); assert.throws(() => update.call([], () => { /* empty */ }), TypeError); assert.throws(() => update.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => update.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.map.upsert.js000066400000000000000000000031431360057567700211620ustar00rootroot00000000000000import Map from 'core-js-pure/features/map'; QUnit.test('Map#upsert', assert => { const { upsert } = Map.prototype; assert.isFunction(upsert); assert.arity(upsert, 2); assert.name(upsert, 'upsert'); assert.nonEnumerable(Map.prototype, 'upsert'); const map = new Map([['a', 2]]); assert.same(map.upsert('a', function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.ok(false, 'should not be called'); return 3; }), 4, 'returns a correct value'); assert.same(map.upsert('b', value => { assert.ok(false, 'should not be called'); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.size, 2, 'correct size'); assert.same(map.get('a'), 4, 'correct result #1'); assert.same(map.get('b'), 3, 'correct result #2'); assert.same(new Map([['a', 2]]).upsert('b', null, () => 3), 3); assert.same(new Map([['a', 2]]).upsert('a', value => value ** 2), 4); assert.throws(() => new Map().upsert('a'), TypeError); assert.throws(() => upsert.call({}, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call([], 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(undefined, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(null, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.math.clamp.js000066400000000000000000000003741360057567700211130ustar00rootroot00000000000000import clamp from 'core-js-pure/features/math/clamp'; QUnit.test('Math.clamp', assert => { assert.isFunction(clamp); assert.arity(clamp, 3); assert.same(clamp(2, 4, 6), 4); assert.same(clamp(4, 2, 6), 4); assert.same(clamp(6, 2, 4), 4); }); core-js-3.6.1/tests/pure/esnext.math.deg-per-rad.js000066400000000000000000000002701360057567700221010ustar00rootroot00000000000000import DEG_PER_RAD from 'core-js-pure/features/math/deg-per-rad'; QUnit.test('Math.DEG_PER_RAD', assert => { assert.strictEqual(DEG_PER_RAD, Math.PI / 180, 'Is Math.PI / 180'); }); core-js-3.6.1/tests/pure/esnext.math.degrees.js000066400000000000000000000004731360057567700214350ustar00rootroot00000000000000import degrees from 'core-js-pure/features/math/degrees'; QUnit.test('Math.degrees', assert => { assert.isFunction(degrees); assert.arity(degrees, 1); assert.same(degrees(0), 0); assert.same(degrees(Math.PI / 2), 90); assert.same(degrees(Math.PI), 180); assert.same(degrees(3 * Math.PI / 2), 270); }); core-js-3.6.1/tests/pure/esnext.math.fscale.js000066400000000000000000000005111360057567700212450ustar00rootroot00000000000000import fscale from 'core-js-pure/features/math/fscale'; QUnit.test('Math.fscale', assert => { assert.isFunction(fscale); assert.arity(fscale, 5); assert.same(fscale(3, 1, 2, 1, 2), 3); assert.same(fscale(0, 3, 5, 8, 10), 5); assert.same(fscale(1, 1, 1, 1, 1), NaN); assert.same(fscale(-1, -1, -1, -1, -1), NaN); }); core-js-3.6.1/tests/pure/esnext.math.iaddh.js000066400000000000000000000005411360057567700210640ustar00rootroot00000000000000import iaddh from 'core-js-pure/features/math/iaddh'; QUnit.test('Math.iaddh', assert => { assert.isFunction(iaddh); assert.arity(iaddh, 4); assert.same(iaddh(0, 2, 1, 0), 2); assert.same(iaddh(0, 4, 1, 1), 5); assert.same(iaddh(2, 4, 1, 1), 5); assert.same(iaddh(0xFFFFFFFF, 4, 1, 1), 6); assert.same(iaddh(1, 4, 0xFFFFFFFF, 1), 6); }); core-js-3.6.1/tests/pure/esnext.math.imulh.js000066400000000000000000000004471360057567700211360ustar00rootroot00000000000000import imulh from 'core-js-pure/features/math/imulh'; QUnit.test('Math.imulh', assert => { assert.isFunction(imulh); assert.arity(imulh, 2); assert.same(imulh(0xFFFFFFFF, 7), -1); assert.same(imulh(0xFFFFFFF, 77), 4); assert.same(imulh(1, 7), 0); assert.same(imulh(-1, 7), -1); }); core-js-3.6.1/tests/pure/esnext.math.isubh.js000066400000000000000000000005411360057567700211250ustar00rootroot00000000000000import isubh from 'core-js-pure/features/math/isubh'; QUnit.test('Math.isubh', assert => { assert.isFunction(isubh); assert.arity(isubh, 4); assert.same(isubh(0, 2, 1, 0), 1); assert.same(isubh(0, 4, 1, 1), 2); assert.same(isubh(2, 4, 1, 1), 3); assert.same(isubh(0xFFFFFFFF, 4, 1, 1), 3); assert.same(isubh(1, 4, 0xFFFFFFFF, 1), 2); }); core-js-3.6.1/tests/pure/esnext.math.rad-per-deg.js000066400000000000000000000002701360057567700221010ustar00rootroot00000000000000import RAD_PER_DEG from 'core-js-pure/features/math/rad-per-deg'; QUnit.test('Math.RAD_PER_DEG', assert => { assert.strictEqual(RAD_PER_DEG, 180 / Math.PI, 'Is 180 / Math.PI'); }); core-js-3.6.1/tests/pure/esnext.math.radians.js000066400000000000000000000004731360057567700214400ustar00rootroot00000000000000import radians from 'core-js-pure/features/math/radians'; QUnit.test('Math.radians', assert => { assert.isFunction(radians); assert.arity(radians, 1); assert.same(radians(0), 0); assert.same(radians(90), Math.PI / 2); assert.same(radians(180), Math.PI); assert.same(radians(270), 3 * Math.PI / 2); }); core-js-3.6.1/tests/pure/esnext.math.scale.js000066400000000000000000000005001360057567700210750ustar00rootroot00000000000000import scale from 'core-js-pure/features/math/scale'; QUnit.test('Math.scale', assert => { assert.isFunction(scale); assert.arity(scale, 5); assert.same(scale(3, 1, 2, 1, 2), 3); assert.same(scale(0, 3, 5, 8, 10), 5); assert.same(scale(1, 1, 1, 1, 1), NaN); assert.same(scale(-1, -1, -1, -1, -1), NaN); }); core-js-3.6.1/tests/pure/esnext.math.seeded-prng.js000066400000000000000000000024021360057567700222060ustar00rootroot00000000000000import seededPRNG from 'core-js-pure/features/math/seeded-prng'; QUnit.test('Math.seededPRNG', assert => { assert.isFunction(seededPRNG); assert.arity(seededPRNG, 1); for (const gen of [seededPRNG({ seed: 42 }), seededPRNG({ seed: 42 })]) { assert.deepEqual(gen.next(), { value: 0.16461519912315087, done: false }); assert.deepEqual(gen.next(), { value: 0.2203933906000046, done: false }); assert.deepEqual(gen.next(), { value: 0.8249682894209105, done: false }); assert.deepEqual(gen.next(), { value: 0.10750079537509083, done: false }); assert.deepEqual(gen.next(), { value: 0.004673248161257476, done: false }); } for (const gen of [seededPRNG({ seed: 43 }), seededPRNG({ seed: 43 })]) { assert.deepEqual(gen.next(), { value: 0.1923438591811283, done: false }); assert.deepEqual(gen.next(), { value: 0.7896811578326683, done: false }); assert.deepEqual(gen.next(), { value: 0.9518230761883996, done: false }); assert.deepEqual(gen.next(), { value: 0.1414634102410296, done: false }); assert.deepEqual(gen.next(), { value: 0.7379838030207752, done: false }); } assert.throws(() => seededPRNG(), TypeError); assert.throws(() => seededPRNG(5), TypeError); assert.throws(() => seededPRNG({ seed: null }), TypeError); }); core-js-3.6.1/tests/pure/esnext.math.signbit.js000066400000000000000000000011231360057567700214470ustar00rootroot00000000000000import signbit from 'core-js-pure/features/math/signbit'; QUnit.test('Math.signbit', assert => { assert.isFunction(signbit); assert.strictEqual(signbit(NaN), false); assert.strictEqual(signbit(), false); assert.strictEqual(signbit(-0), true); assert.strictEqual(signbit(0), false); assert.strictEqual(signbit(Infinity), false); assert.strictEqual(signbit(-Infinity), true); assert.strictEqual(signbit(13510798882111488), false); assert.strictEqual(signbit(-13510798882111488), true); assert.strictEqual(signbit(42.5), false); assert.strictEqual(signbit(-42.5), true); }); core-js-3.6.1/tests/pure/esnext.math.umulh.js000066400000000000000000000004451360057567700211500ustar00rootroot00000000000000import umulh from 'core-js-pure/features/math/umulh'; QUnit.test('Math.umulh', assert => { assert.isFunction(umulh); assert.arity(umulh, 2); assert.same(umulh(0xFFFFFFFF, 7), 6); assert.same(umulh(0xFFFFFFF, 77), 4); assert.same(umulh(1, 7), 0); assert.same(umulh(-1, 7), 6); }); core-js-3.6.1/tests/pure/esnext.number.from-string.js000066400000000000000000000037401360057567700226250ustar00rootroot00000000000000import fromString from 'core-js-pure/features/number/from-string'; QUnit.test('Number.fromString', assert => { assert.isFunction(fromString); assert.name(fromString, 'fromString'); assert.arity(fromString, 2); assert.throws(() => fromString(undefined), TypeError, 'The first argument should be a string #1'); assert.throws(() => fromString(Object('10')), TypeError, 'The first argument should be a string #1'); assert.throws(() => fromString(''), SyntaxError, 'Empty string'); assert.same(fromString('-10', 2), -2, 'Works with negative numbers'); assert.throws(() => fromString('-'), SyntaxError, '-'); assert.same(fromString('10'), 10, 'Default radix is 10 #1'); assert.same(fromString('10', undefined), 10, 'Default radix is 10 #2'); for (let radix = 2; radix <= 36; ++radix) { assert.same(fromString('10', radix), radix, `Radix ${ radix }`); } assert.throws(() => fromString('10', -4294967294), RangeError, 'Radix uses ToInteger #1'); assert.same(fromString('10', 2.5), 2, 'Radix uses ToInteger #2'); assert.same(fromString('42'), 42); assert.same(fromString('42', 10), 42); assert.throws(() => fromString('0xc0ffee'), SyntaxError); assert.throws(() => fromString('0o755'), SyntaxError); assert.throws(() => fromString('0b00101010'), SyntaxError); assert.throws(() => fromString('C0FFEE', 16), SyntaxError); assert.same(fromString('c0ffee', 16), 12648430); assert.same(fromString('755', 8), 493); assert.throws(() => fromString(''), SyntaxError); assert.throws(() => fromString(' '), SyntaxError); assert.throws(() => fromString(' 1'), SyntaxError); assert.throws(() => fromString(' \n '), SyntaxError); assert.throws(() => fromString('x'), SyntaxError); assert.throws(() => fromString('1234', 0), RangeError); assert.throws(() => fromString('1234', 1), RangeError); assert.throws(() => fromString('1234', 37), RangeError); assert.throws(() => fromString('010'), SyntaxError); assert.throws(() => fromString('1_000_000_000'), SyntaxError); }); core-js-3.6.1/tests/pure/esnext.object.iterate-entries.js000066400000000000000000000014541360057567700234400ustar00rootroot00000000000000import iterateEntries from 'core-js-pure/features/object/iterate-entries'; import TO_STRING_TAG from 'core-js-pure/features/symbol/to-string-tag'; QUnit.test('Object.iterateEntries', assert => { assert.isFunction(iterateEntries); assert.name(iterateEntries, 'iterateEntries'); assert.arity(iterateEntries, 1); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateEntries(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[TO_STRING_TAG], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: ['q', 1], done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: ['e', 3], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/pure/esnext.object.iterate-keys.js000066400000000000000000000014121360057567700227340ustar00rootroot00000000000000import iterateKeys from 'core-js-pure/features/object/iterate-keys'; import TO_STRING_TAG from 'core-js-pure/features/symbol/to-string-tag'; QUnit.test('Object.iterateKeys', assert => { assert.isFunction(iterateKeys); assert.name(iterateKeys, 'iterateKeys'); assert.arity(iterateKeys, 1); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateKeys(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[TO_STRING_TAG], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/pure/esnext.object.iterate-values.js000066400000000000000000000014261360057567700232650ustar00rootroot00000000000000import iterateValues from 'core-js-pure/features/object/iterate-values'; import TO_STRING_TAG from 'core-js-pure/features/symbol/to-string-tag'; QUnit.test('Object.iterateValues', assert => { assert.isFunction(iterateValues); assert.name(iterateValues, 'iterateValues'); assert.arity(iterateValues, 1); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateValues(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[TO_STRING_TAG], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: 1, done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: 3, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/pure/esnext.observable.js000066400000000000000000000036261360057567700212160ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import { Observable, Symbol } from 'core-js-pure'; QUnit.test('Observable', assert => { assert.isFunction(Observable); assert.arity(Observable, 1); assert.throws(() => Observable(() => { /* empty */ }), 'throws w/o `new`'); const observable = new Observable(function (subscriptionObserver) { assert.same(typeof subscriptionObserver, 'object', 'Subscription observer is object'); assert.same(subscriptionObserver.constructor, Object); const { next, error, complete } = subscriptionObserver; assert.isFunction(next); assert.isFunction(error); assert.isFunction(complete); assert.arity(next, 1); assert.arity(error, 1); assert.arity(complete, 0); if (STRICT) { assert.same(this, undefined, 'correct executor context'); } }); observable.subscribe({}); assert.ok(observable instanceof Observable); }); QUnit.test('Observable#subscribe', assert => { assert.isFunction(Observable.prototype.subscribe); assert.arity(Observable.prototype.subscribe, 1); const subscription = new Observable(() => { /* empty */ }).subscribe({}); assert.same(typeof subscription, 'object', 'Subscription is object'); assert.same(subscription.constructor, Object); assert.isFunction(subscription.unsubscribe); assert.arity(subscription.unsubscribe, 0); }); QUnit.test('Observable#constructor', assert => { assert.same(Observable.prototype.constructor, Observable); }); QUnit.test('Observable#@@observable', assert => { assert.isFunction(Observable.prototype[Symbol.observable]); const observable = new Observable(() => { /* empty*/ }); assert.same(observable[Symbol.observable](), observable); }); QUnit.test('Observable.of', assert => { assert.isFunction(Observable.of); assert.arity(Observable.of, 0); }); QUnit.test('Observable.from', assert => { assert.isFunction(Observable.from); assert.arity(Observable.from, 1); }); core-js-3.6.1/tests/pure/esnext.promise.any.js000066400000000000000000000026421360057567700213330ustar00rootroot00000000000000import { AggregateError, Promise } from 'core-js-pure/features'; QUnit.test('Promise.any', assert => { assert.isFunction(Promise.any); assert.arity(Promise.any, 1); assert.ok(Promise.any([1, 2, 3]) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.any, resolved', assert => { assert.expect(1); const async = assert.async(); Promise.any([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(it => { assert.same(it, 1, 'resolved with a correct value'); async(); }); }); QUnit.test('Promise.any, rejected #1', assert => { assert.expect(2); const async = assert.async(); Promise.any([ Promise.reject(1), Promise.reject(2), Promise.reject(3), ]).catch(error => { assert.ok(error instanceof AggregateError, 'instanceof AggregateError'); assert.deepEqual(error.errors, [1, 2, 3], 'rejected with a correct value'); async(); }); }); QUnit.test('Promise.any, rejected #2', assert => { assert.expect(1); const async = assert.async(); Promise.any().catch(() => { assert.ok(true, 'rejected as expected'); async(); }); }); QUnit.test('Promise.any, rejected #3', assert => { assert.expect(2); const async = assert.async(); Promise.any([]).catch(error => { assert.ok(error instanceof AggregateError, 'instanceof AggregateError'); assert.deepEqual(error.errors, [], 'rejected with a correct value'); async(); }); }); core-js-3.6.1/tests/pure/esnext.promise.try.js000066400000000000000000000012621360057567700213570ustar00rootroot00000000000000import Promise from 'core-js-pure/features/promise'; QUnit.test('Promise.try', assert => { assert.isFunction(Promise.try); assert.arity(Promise.try, 1); assert.ok(Promise.try(() => 42) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.try, resolved', assert => { assert.expect(1); const async = assert.async(); Promise.try(() => 42).then(it => { assert.same(it, 42, 'resolved with a correct value'); async(); }); }); QUnit.test('Promise.try, rejected', assert => { assert.expect(1); const async = assert.async(); Promise.try(() => { throw new Error(); }).catch(() => { assert.ok(true, 'rejected as expected'); async(); }); }); core-js-3.6.1/tests/pure/esnext.reflect.define-metadata.js000066400000000000000000000006611360057567700235210ustar00rootroot00000000000000import defineMetadata from 'core-js-pure/features/reflect/define-metadata'; QUnit.test('Reflect.defineMetadata', assert => { assert.isFunction(defineMetadata); assert.arity(defineMetadata, 3); assert.throws(() => defineMetadata('key', 'value', undefined, undefined), TypeError); assert.same(defineMetadata('key', 'value', {}, undefined), undefined); assert.same(defineMetadata('key', 'value', {}, 'name'), undefined); }); core-js-3.6.1/tests/pure/esnext.reflect.delete-metadata.js000066400000000000000000000015651360057567700235350ustar00rootroot00000000000000import { defineMetadata, hasOwnMetadata, deleteMetadata } from 'core-js-pure/features/reflect'; import create from 'core-js-pure/features/object/create'; QUnit.test('Reflect.deleteMetadata', assert => { assert.isFunction(deleteMetadata); assert.arity(deleteMetadata, 2); assert.throws(() => deleteMetadata('key', undefined, undefined), TypeError); assert.same(deleteMetadata('key', {}, undefined), false); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(deleteMetadata('key', object, undefined), true); const prototype = {}; defineMetadata('key', 'value', prototype, undefined); assert.same(deleteMetadata('key', create(prototype), undefined), false); object = {}; defineMetadata('key', 'value', object, undefined); deleteMetadata('key', object, undefined); assert.same(hasOwnMetadata('key', object, undefined), false); }); core-js-3.6.1/tests/pure/esnext.reflect.get-metadata-keys.js000066400000000000000000000044321360057567700240170ustar00rootroot00000000000000import { defineMetadata, getMetadataKeys } from 'core-js-pure/features/reflect'; import create from 'core-js-pure/features/object/create'; QUnit.test('Reflect.getMetadataKeys', assert => { assert.isFunction(getMetadataKeys); assert.arity(getMetadataKeys, 1); assert.throws(() => getMetadataKeys(undefined, undefined), TypeError); assert.deepEqual(getMetadataKeys({}, undefined), []); let object = {}; defineMetadata('key', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key']); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); defineMetadata('key0', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, undefined); object = create(prototype); defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1', 'key2']); object = {}; assert.deepEqual(getMetadataKeys({}, 'name'), []); object = {}; defineMetadata('key', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); object = {}; defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); defineMetadata('key0', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, 'name'); object = create(prototype); defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1', 'key2']); }); core-js-3.6.1/tests/pure/esnext.reflect.get-metadata.js000066400000000000000000000020171360057567700230430ustar00rootroot00000000000000import { defineMetadata, getMetadata } from 'core-js-pure/features/reflect'; import create from 'core-js-pure/features/object/create'; QUnit.test('Reflect.getMetadata', assert => { assert.isFunction(getMetadata); assert.arity(getMetadata, 2); assert.throws(() => getMetadata('key', undefined, undefined), TypeError); assert.same(getMetadata('key', {}, undefined), undefined); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(getMetadata('key', object, undefined), 'value'); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(getMetadata('key', object, undefined), 'value'); assert.same(getMetadata('key', {}, 'name'), undefined); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(getMetadata('key', object, 'name'), 'value'); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(getMetadata('key', object, 'name'), 'value'); }); core-js-3.6.1/tests/pure/esnext.reflect.get-own-matadata.js000066400000000000000000000020641360057567700236420ustar00rootroot00000000000000import { defineMetadata, getOwnMetadata } from 'core-js-pure/features/reflect'; import create from 'core-js-pure/features/object/create'; QUnit.test('Reflect.getOwnMetadata', assert => { assert.isFunction(getOwnMetadata); assert.arity(getOwnMetadata, 2); assert.throws(() => getOwnMetadata('key', undefined, undefined), TypeError); assert.same(getOwnMetadata('key', {}, undefined), undefined); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(getOwnMetadata('key', object, undefined), 'value'); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(getOwnMetadata('key', object, undefined), undefined); assert.same(getOwnMetadata('key', {}, 'name'), undefined); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(getOwnMetadata('key', object, 'name'), 'value'); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(getOwnMetadata('key', object, 'name'), undefined); }); core-js-3.6.1/tests/pure/esnext.reflect.get-own-metadata-keys.js000066400000000000000000000044601360057567700246210ustar00rootroot00000000000000import { defineMetadata, getOwnMetadataKeys } from 'core-js-pure/features/reflect'; import create from 'core-js-pure/features/object/create'; QUnit.test('Reflect.getOwnMetadataKeys', assert => { assert.isFunction(getOwnMetadataKeys); assert.arity(getOwnMetadataKeys, 1); assert.throws(() => getOwnMetadataKeys(undefined, undefined), TypeError); assert.deepEqual(getOwnMetadataKeys({}, undefined), []); let object = {}; defineMetadata('key', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key']); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), []); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); defineMetadata('key0', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, undefined); object = create(prototype); defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; assert.deepEqual(getOwnMetadataKeys({}, 'name'), []); object = {}; defineMetadata('key', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key']); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), []); object = {}; defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); defineMetadata('key0', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, 'name'); object = create(prototype); defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); }); core-js-3.6.1/tests/pure/esnext.reflect.has-metadata.js000066400000000000000000000017731360057567700230470ustar00rootroot00000000000000import { defineMetadata, hasMetadata } from 'core-js-pure/features/reflect'; import create from 'core-js-pure/features/object/create'; QUnit.test('Reflect.hasMetadata', assert => { assert.isFunction(hasMetadata); assert.arity(hasMetadata, 2); assert.throws(() => hasMetadata('key', undefined, undefined), TypeError); assert.same(hasMetadata('key', {}, undefined), false); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(hasMetadata('key', object, undefined), true); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(hasMetadata('key', object, undefined), true); assert.same(hasMetadata('key', {}, 'name'), false); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(hasMetadata('key', object, 'name'), true); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(hasMetadata('key', object, 'name'), true); }); core-js-3.6.1/tests/pure/esnext.reflect.has-own-metadata.js000066400000000000000000000020361360057567700236410ustar00rootroot00000000000000import { defineMetadata, hasOwnMetadata } from 'core-js-pure/features/reflect'; import create from 'core-js-pure/features/object/create'; QUnit.test('Reflect.hasOwnMetadata', assert => { assert.isFunction(hasOwnMetadata); assert.arity(hasOwnMetadata, 2); assert.throws(() => hasOwnMetadata('key', undefined, undefined), TypeError); assert.same(hasOwnMetadata('key', {}, undefined), false); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(hasOwnMetadata('key', object, undefined), true); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(hasOwnMetadata('key', object, undefined), false); assert.same(hasOwnMetadata('key', {}, 'name'), false); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(hasOwnMetadata('key', object, 'name'), true); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(hasOwnMetadata('key', object, 'name'), false); }); core-js-3.6.1/tests/pure/esnext.reflect.metadata.js000066400000000000000000000010731360057567700222670ustar00rootroot00000000000000import { metadata, hasOwnMetadata } from 'core-js-pure/features/reflect'; QUnit.test('Reflect.metadata', assert => { assert.isFunction(metadata); assert.arity(metadata, 2); assert.isFunction(metadata('key', 'value')); const decorator = metadata('key', 'value'); assert.throws(() => decorator(undefined, 'name'), TypeError); let target = function () { /* empty */ }; decorator(target); assert.same(hasOwnMetadata('key', target, undefined), true); target = {}; decorator(target, 'name'); assert.same(hasOwnMetadata('key', target, 'name'), true); }); core-js-3.6.1/tests/pure/esnext.set.add-all.js000066400000000000000000000015341360057567700211560ustar00rootroot00000000000000import Set from 'core-js-pure/features/set'; import from from 'core-js-pure/features/array/from'; QUnit.test('Set#addAll', assert => { const { addAll } = Set.prototype; assert.isFunction(addAll); assert.arity(addAll, 0); assert.name(addAll, 'addAll'); assert.nonEnumerable(Set.prototype, 'addAll'); const set = new Set([1]); assert.same(set.addAll(2), set); assert.deepEqual(from(new Set([1, 2, 3]).addAll(4, 5)), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).addAll(3, 4)), [1, 2, 3, 4]); assert.deepEqual(from(new Set([1, 2, 3]).addAll()), [1, 2, 3]); assert.notThrows(() => addAll.call({ add() { /* empty */ } }, 1, 2, 3)); assert.throws(() => addAll.call({}, 1, 2, 3), TypeError); assert.throws(() => addAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => addAll.call(null, 1, 2, 3), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.delete-all.js000066400000000000000000000020461360057567700216670ustar00rootroot00000000000000import Set from 'core-js-pure/features/set'; import from from 'core-js-pure/features/array/from'; QUnit.test('Set#deleteAll', assert => { const { deleteAll } = Set.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.nonEnumerable(Set.prototype, 'deleteAll'); let set = new Set([1, 2, 3]); assert.same(set.deleteAll(1, 2), true); assert.deepEqual(from(set), [3]); set = new Set([1, 2, 3]); assert.same(set.deleteAll(3, 4), false); assert.deepEqual(from(set), [1, 2]); set = new Set([1, 2, 3]); assert.same(set.deleteAll(4, 5), false); assert.deepEqual(from(set), [1, 2, 3]); set = new Set([1, 2, 3]); assert.same(set.deleteAll(), true); assert.deepEqual(from(set), [1, 2, 3]); assert.notThrows(() => !deleteAll.call({ delete() { /* empty */ } }, 1, 2, 3)); assert.throws(() => deleteAll.call({}, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(null, 1, 2, 3), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.difference.js000066400000000000000000000017271360057567700217560ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import Set from 'core-js-pure/features/set'; import from from 'core-js-pure/features/array/from'; QUnit.test('Set#difference', assert => { const { difference } = Set.prototype; assert.isFunction(difference); assert.arity(difference, 1); assert.name(difference, 'difference'); assert.nonEnumerable(Set.prototype, 'difference'); const set = new Set([1]); assert.ok(set.difference([2]) !== set); assert.deepEqual(from(new Set([1, 2, 3]).difference([4, 5])), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).difference([3, 4])), [1, 2]); assert.deepEqual(from(new Set([1, 2, 3]).difference(createIterable([3, 4]))), [1, 2]); assert.throws(() => new Set([1, 2, 3]).difference(), TypeError); assert.throws(() => difference.call({}, [1, 2, 3]), TypeError); assert.throws(() => difference.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => difference.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.every.js000066400000000000000000000022721360057567700210120ustar00rootroot00000000000000import Set from 'core-js-pure/features/set'; QUnit.test('Set#every', assert => { const { every } = Set.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.nonEnumerable(Set.prototype, 'every'); const set = new Set([1]); const context = {}; set.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Set([1, 2, 3]).every(it => typeof it === 'number'), true); assert.same(new Set(['1', '2', '3']).some(it => typeof it === 'number'), false); assert.same(new Set([1, '2', 3]).every(it => typeof it === 'number'), false); assert.same(new Set().every(it => typeof it === 'number'), true); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.filter.js000066400000000000000000000021701360057567700211420ustar00rootroot00000000000000import Set from 'core-js-pure/features/set'; import from from 'core-js-pure/features/array/from'; QUnit.test('Set#filter', assert => { const { filter } = Set.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.nonEnumerable(Set.prototype, 'filter'); const set = new Set([1]); const context = {}; set.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(new Set().filter(it => it) instanceof Set); assert.deepEqual(from(new Set([1, 2, 3, 'q', {}, 4, true, 5]).filter(it => typeof it === 'number')), [1, 2, 3, 4, 5]); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.find.js000066400000000000000000000017571360057567700206070ustar00rootroot00000000000000import Set from 'core-js-pure/features/set'; QUnit.test('Set#find', assert => { const { find } = Set.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.nonEnumerable(Set.prototype, 'find'); const set = new Set([1]); const context = {}; set.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Set([2, 3, 4]).find(it => it % 2), 3); assert.same(new Set().find(it => it === 42), undefined); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.from.js000066400000000000000000000016461360057567700206270ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import Set from 'core-js-pure/features/set'; import toArray from 'core-js-pure/features/array/from'; QUnit.test('Set.from', assert => { const { from } = Set; assert.isFunction(from); assert.arity(from, 1); assert.ok(Set.from() instanceof Set); assert.deepEqual(toArray(Set.from([])), []); assert.deepEqual(toArray(Set.from([1])), [1]); assert.deepEqual(toArray(Set.from([1, 2, 3, 2, 1])), [1, 2, 3]); assert.deepEqual(toArray(Set.from(createIterable([1, 2, 3, 2, 1]))), [1, 2, 3]); const context = {}; Set.from([1], function (element, index) { assert.same(element, 1); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from(1)); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.6.1/tests/pure/esnext.set.intersection.js000066400000000000000000000017641360057567700223730ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import Set from 'core-js-pure/features/set'; import from from 'core-js-pure/features/array/from'; QUnit.test('Set#intersection', assert => { const { intersection } = Set.prototype; assert.isFunction(intersection); assert.arity(intersection, 1); assert.name(intersection, 'intersection'); assert.nonEnumerable(Set.prototype, 'intersection'); const set = new Set([1]); assert.ok(set.intersection([2]) !== set); assert.deepEqual(from(new Set([1, 2, 3]).intersection([4, 5])), []); assert.deepEqual(from(new Set([1, 2, 3]).intersection([2, 3, 4])), [2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createIterable([2, 3, 4]))), [2, 3]); assert.throws(() => new Set([1, 2, 3]).intersection(), TypeError); assert.throws(() => intersection.call({}, [1, 2, 3]), TypeError); assert.throws(() => intersection.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => intersection.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.is-disjoint-from.js000066400000000000000000000017561360057567700230630ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import Set from 'core-js-pure/features/set'; QUnit.test('Set#isDisjointFrom', assert => { const { isDisjointFrom } = Set.prototype; assert.isFunction(isDisjointFrom); assert.arity(isDisjointFrom, 1); assert.name(isDisjointFrom, 'isDisjointFrom'); assert.nonEnumerable(Set.prototype, 'isDisjointFrom'); assert.ok(new Set([1]).isDisjointFrom([2])); assert.ok(!new Set([1]).isDisjointFrom([1])); assert.ok(new Set([1, 2, 3]).isDisjointFrom([4, 5, 6])); assert.ok(!new Set([1, 2, 3]).isDisjointFrom([5, 4, 3])); assert.ok(new Set([1]).isDisjointFrom(createIterable([2]))); assert.ok(!new Set([1]).isDisjointFrom(createIterable([1]))); assert.throws(() => new Set([1, 2, 3]).isDisjointFrom(), TypeError); assert.throws(() => isDisjointFrom.call({}, [1, 2, 3]), TypeError); assert.throws(() => isDisjointFrom.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isDisjointFrom.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.is-subset-of.js000066400000000000000000000022461360057567700222010ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import Set from 'core-js-pure/features/set'; QUnit.test('Set#isSubsetOf', assert => { const { isSubsetOf } = Set.prototype; assert.isFunction(isSubsetOf); assert.arity(isSubsetOf, 1); assert.name(isSubsetOf, 'isSubsetOf'); assert.nonEnumerable(Set.prototype, 'isSubsetOf'); assert.ok(new Set([1]).isSubsetOf([1, 2, 3])); assert.ok(!new Set([1]).isSubsetOf([2, 3, 4])); assert.ok(new Set([1, 2, 3]).isSubsetOf([5, 4, 3, 2, 1])); assert.ok(!new Set([1, 2, 3]).isSubsetOf([5, 4, 3, 2])); assert.ok(new Set([1]).isSubsetOf(createIterable([1, 2, 3]))); assert.ok(!new Set([1]).isSubsetOf(createIterable([2, 3, 4]))); assert.ok(new Set([1]).isSubsetOf({ has: () => true })); assert.ok(!new Set([1]).isSubsetOf({ has: () => false })); assert.ok(isSubsetOf.call('ab', ['a', 'b', 'c'])); assert.ok(!isSubsetOf.call('ab', ['a'])); assert.throws(() => new Set([1, 2, 3]).isSubsetOf(), TypeError); assert.throws(() => isSubsetOf.call({}, [1, 2, 3]), TypeError); assert.throws(() => isSubsetOf.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isSubsetOf.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.is-superset-of.js000066400000000000000000000017551360057567700225520ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import Set from 'core-js-pure/features/set'; QUnit.test('Set#isSupersetOf', assert => { const { isSupersetOf } = Set.prototype; assert.isFunction(isSupersetOf); assert.arity(isSupersetOf, 1); assert.name(isSupersetOf, 'isSupersetOf'); assert.nonEnumerable(Set.prototype, 'isSupersetOf'); assert.ok(new Set([1, 2, 3]).isSupersetOf([1])); assert.ok(!new Set([2, 3, 4]).isSupersetOf([1])); assert.ok(new Set([5, 4, 3, 2, 1]).isSupersetOf([1, 2, 3])); assert.ok(!new Set([5, 4, 3, 2]).isSupersetOf([1, 2, 3])); assert.ok(new Set([1, 2, 3]).isSupersetOf(createIterable([1]))); assert.ok(!new Set([2, 3, 4]).isSupersetOf(createIterable([1]))); assert.throws(() => new Set([1, 2, 3]).isSupersetOf(), TypeError); assert.throws(() => isSupersetOf.call({}, [1, 2, 3]), TypeError); assert.throws(() => isSupersetOf.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isSupersetOf.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.join.js000066400000000000000000000011201360057567700206060ustar00rootroot00000000000000import Set from 'core-js-pure/features/set'; QUnit.test('Set#join', assert => { const { join } = Set.prototype; assert.isFunction(join); assert.arity(join, 1); assert.name(join, 'join'); assert.nonEnumerable(Set.prototype, 'join'); assert.strictEqual(new Set([1, 2, 3]).join(), '1,2,3'); assert.strictEqual(new Set([1, 2, 3]).join(undefined), '1,2,3'); assert.strictEqual(new Set([1, 2, 3]).join('|'), '1|2|3'); assert.throws(() => join.call({}), TypeError); assert.throws(() => join.call(undefined), TypeError); assert.throws(() => join.call(null), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.map.js000066400000000000000000000021571360057567700204370ustar00rootroot00000000000000import Set from 'core-js-pure/features/set'; import from from 'core-js-pure/features/array/from'; QUnit.test('Set#map', assert => { const { map } = Set.prototype; assert.isFunction(map); assert.arity(map, 1); assert.name(map, 'map'); assert.nonEnumerable(Set.prototype, 'map'); const set = new Set([1]); const context = {}; set.map(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(new Set().map(it => it) instanceof Set); assert.deepEqual(from(new Set([1, 2, 3]).map(it => it ** 2)), [1, 4, 9]); assert.deepEqual(from(new Set([1, 2, 3]).map(it => it % 2)), [1, 0]); assert.throws(() => map.call({}, () => { /* empty */ }), TypeError); assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.of.js000066400000000000000000000007721360057567700202670ustar00rootroot00000000000000import Set from 'core-js-pure/features/set'; import toArray from 'core-js-pure/features/array/from'; QUnit.test('Set.of', assert => { const { of } = Set; assert.isFunction(of); assert.arity(of, 0); assert.ok(Set.of() instanceof Set); assert.deepEqual(toArray(Set.of(1)), [1]); assert.deepEqual(toArray(Set.of(1, 2, 3, 2, 1)), [1, 2, 3]); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.6.1/tests/pure/esnext.set.reduce.js000066400000000000000000000032021360057567700211210ustar00rootroot00000000000000import Set from 'core-js-pure/features/set'; QUnit.test('Set#reduce', assert => { const { reduce } = Set.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.nonEnumerable(Set.prototype, 'reduce'); const set = new Set([1]); const accumulator = {}; set.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct index in callback'); assert.same(that, set, 'correct link to set in callback'); }, accumulator); assert.same(new Set([1, 2, 3]).reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new Set([1, 2]).reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 2, 'correct start index without initial accumulator'); }); assert.same(new Set([1, 2, 3]).reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new Set([1, 2, 3]).reduce((memo, value, key, s) => { s.delete(2); values += value; keys += key; }, 0); assert.same(values, '13', 'correct order #1'); assert.same(keys, '13', 'correct order #2'); assert.throws(() => reduce.call({}, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.some.js000066400000000000000000000022541360057567700206230ustar00rootroot00000000000000import Set from 'core-js-pure/features/set'; QUnit.test('Set#some', assert => { const { some } = Set.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.nonEnumerable(Set.prototype, 'some'); const set = new Set([1]); const context = {}; set.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Set([1, 2, 3]).some(it => typeof it === 'number'), true); assert.same(new Set(['1', '2', '3']).some(it => typeof it === 'number'), false); assert.same(new Set([1, '2', 3]).some(it => typeof it === 'number'), true); assert.same(new Set().some(it => typeof it === 'number'), false); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.symmetric-difference.js000066400000000000000000000021521360057567700237610ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import Set from 'core-js-pure/features/set'; import from from 'core-js-pure/features/array/from'; QUnit.test('Set#symmetricDifference', assert => { const { symmetricDifference } = Set.prototype; assert.isFunction(symmetricDifference); assert.arity(symmetricDifference, 1); assert.name(symmetricDifference, 'symmetricDifference'); assert.nonEnumerable(Set.prototype, 'symmetricDifference'); const set = new Set([1]); assert.ok(set.symmetricDifference([2]) !== set); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference([4, 5])), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference([3, 4])), [1, 2, 4]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(createIterable([3, 4]))), [1, 2, 4]); assert.throws(() => new Set([1, 2, 3]).symmetricDifference(), TypeError); assert.throws(() => symmetricDifference.call({}, [1, 2, 3]), TypeError); assert.throws(() => symmetricDifference.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => symmetricDifference.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/pure/esnext.set.union.js000066400000000000000000000016361360057567700210130ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import Set from 'core-js-pure/features/set'; import from from 'core-js-pure/features/array/from'; QUnit.test('Set#union', assert => { const { union } = Set.prototype; assert.isFunction(union); assert.arity(union, 1); assert.name(union, 'union'); assert.nonEnumerable(Set.prototype, 'union'); const set = new Set([1]); assert.ok(set.union([2]) !== set); assert.deepEqual(from(new Set([1, 2, 3]).union([4, 5])), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).union([3, 4])), [1, 2, 3, 4]); assert.deepEqual(from(new Set([1, 2, 3]).union(createIterable([3, 4]))), [1, 2, 3, 4]); assert.throws(() => new Set([1, 2, 3]).union(), TypeError); assert.throws(() => union.call({}, [1, 2, 3]), TypeError); assert.throws(() => union.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => union.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/pure/esnext.string.at.js000066400000000000000000000110611360057567700207730ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import at from 'core-js-pure/features/string/at'; QUnit.test('String#at', assert => { assert.isFunction(at); // String that starts with a BMP symbol assert.strictEqual(at('abc\uD834\uDF06def', -Infinity), ''); assert.strictEqual(at('abc\uD834\uDF06def', -1), ''); assert.strictEqual(at('abc\uD834\uDF06def', -0), 'a'); assert.strictEqual(at('abc\uD834\uDF06def', +0), 'a'); assert.strictEqual(at('abc\uD834\uDF06def', 1), 'b'); assert.strictEqual(at('abc\uD834\uDF06def', 3), '\uD834\uDF06'); assert.strictEqual(at('abc\uD834\uDF06def', 4), '\uDF06'); assert.strictEqual(at('abc\uD834\uDF06def', 5), 'd'); assert.strictEqual(at('abc\uD834\uDF06def', 42), ''); assert.strictEqual(at('abc\uD834\uDF06def', Infinity), ''); assert.strictEqual(at('abc\uD834\uDF06def', null), 'a'); assert.strictEqual(at('abc\uD834\uDF06def', undefined), 'a'); assert.strictEqual(at('abc\uD834\uDF06def'), 'a'); assert.strictEqual(at('abc\uD834\uDF06def', false), 'a'); assert.strictEqual(at('abc\uD834\uDF06def', NaN), 'a'); assert.strictEqual(at('abc\uD834\uDF06def', ''), 'a'); assert.strictEqual(at('abc\uD834\uDF06def', '_'), 'a'); assert.strictEqual(at('abc\uD834\uDF06def', '1'), 'b'); assert.strictEqual(at('abc\uD834\uDF06def', []), 'a'); assert.strictEqual(at('abc\uD834\uDF06def', {}), 'a'); assert.strictEqual(at('abc\uD834\uDF06def', -0.9), 'a'); assert.strictEqual(at('abc\uD834\uDF06def', 1.9), 'b'); assert.strictEqual(at('abc\uD834\uDF06def', 7.9), 'f'); assert.strictEqual(at('abc\uD834\uDF06def', 2 ** 32), ''); // String that starts with an astral symbol assert.strictEqual(at('\uD834\uDF06def', -Infinity), ''); assert.strictEqual(at('\uD834\uDF06def', -1), ''); assert.strictEqual(at('\uD834\uDF06def', -0), '\uD834\uDF06'); assert.strictEqual(at('\uD834\uDF06def', 0), '\uD834\uDF06'); assert.strictEqual(at('\uD834\uDF06def', 1), '\uDF06'); assert.strictEqual(at('\uD834\uDF06def', 2), 'd'); assert.strictEqual(at('\uD834\uDF06def', 3), 'e'); assert.strictEqual(at('\uD834\uDF06def', 4), 'f'); assert.strictEqual(at('\uD834\uDF06def', 42), ''); assert.strictEqual(at('\uD834\uDF06def', Infinity), ''); assert.strictEqual(at('\uD834\uDF06def', null), '\uD834\uDF06'); assert.strictEqual(at('\uD834\uDF06def', undefined), '\uD834\uDF06'); assert.strictEqual(at('\uD834\uDF06def'), '\uD834\uDF06'); assert.strictEqual(at('\uD834\uDF06def', false), '\uD834\uDF06'); assert.strictEqual(at('\uD834\uDF06def', NaN), '\uD834\uDF06'); assert.strictEqual(at('\uD834\uDF06def', ''), '\uD834\uDF06'); assert.strictEqual(at('\uD834\uDF06def', '_'), '\uD834\uDF06'); assert.strictEqual(at('\uD834\uDF06def', '1'), '\uDF06'); // Lone high surrogates assert.strictEqual(at('\uD834abc', -Infinity), ''); assert.strictEqual(at('\uD834abc', -1), ''); assert.strictEqual(at('\uD834abc', -0), '\uD834'); assert.strictEqual(at('\uD834abc', 0), '\uD834'); assert.strictEqual(at('\uD834abc', 1), 'a'); assert.strictEqual(at('\uD834abc', 42), ''); assert.strictEqual(at('\uD834abc', Infinity), ''); assert.strictEqual(at('\uD834abc', null), '\uD834'); assert.strictEqual(at('\uD834abc', undefined), '\uD834'); assert.strictEqual(at('\uD834abc'), '\uD834'); assert.strictEqual(at('\uD834abc', false), '\uD834'); assert.strictEqual(at('\uD834abc', NaN), '\uD834'); assert.strictEqual(at('\uD834abc', ''), '\uD834'); assert.strictEqual(at('\uD834abc', '_'), '\uD834'); assert.strictEqual(at('\uD834abc', '1'), 'a'); // Lone low surrogates assert.strictEqual(at('\uDF06abc', -Infinity), ''); assert.strictEqual(at('\uDF06abc', -1), ''); assert.strictEqual(at('\uDF06abc', -0), '\uDF06'); assert.strictEqual(at('\uDF06abc', 0), '\uDF06'); assert.strictEqual(at('\uDF06abc', 1), 'a'); assert.strictEqual(at('\uDF06abc', 42), ''); assert.strictEqual(at('\uDF06abc', Infinity), ''); assert.strictEqual(at('\uDF06abc', null), '\uDF06'); assert.strictEqual(at('\uDF06abc', undefined), '\uDF06'); assert.strictEqual(at('\uDF06abc'), '\uDF06'); assert.strictEqual(at('\uDF06abc', false), '\uDF06'); assert.strictEqual(at('\uDF06abc', NaN), '\uDF06'); assert.strictEqual(at('\uDF06abc', ''), '\uDF06'); assert.strictEqual(at('\uDF06abc', '_'), '\uDF06'); assert.strictEqual(at('\uDF06abc', '1'), 'a'); assert.strictEqual(at(42, 0), '4'); assert.strictEqual(at(42, 1), '2'); assert.strictEqual(at({ toString() { return 'abc'; }, }, 2), 'c'); if (STRICT) { assert.throws(() => at(null, 0), TypeError); assert.throws(() => at(undefined, 0), TypeError); } }); core-js-3.6.1/tests/pure/esnext.string.code-points.js000066400000000000000000000024011360057567700226110ustar00rootroot00000000000000import Symbol from 'core-js-pure/features/symbol'; import codePoints from 'core-js-pure/features/string/code-points'; QUnit.test('String#codePoints', assert => { assert.isFunction(codePoints); let iterator = codePoints('qwe'); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'String Iterator'); assert.strictEqual(String(iterator), '[object String Iterator]'); assert.deepEqual(iterator.next(), { value: { codePoint: 113, position: 0 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 119, position: 1 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 101, position: 2 }, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); iterator = codePoints('𠮷𠮷𠮷'); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 0 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 2 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 4 }, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/pure/esnext.string.replace-all.js000066400000000000000000000031061360057567700225510ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; import replaceAll from 'core-js-pure/features/string/replace-all'; import Symbol from 'core-js-pure/features/symbol'; QUnit.test('String#replaceAll', assert => { assert.isFunction(replaceAll); assert.same(replaceAll('q=query+string+parameters', '+', ' '), 'q=query string parameters'); assert.same(replaceAll('foo', 'o', {}), 'f[object Object][object Object]'); assert.same(replaceAll('[object Object]x[object Object]', {}, 'y'), 'yxy'); assert.same(replaceAll({}, 'bject', 'lolo'), '[ololo Ololo]'); assert.same(replaceAll('aba', 'b', (search, i, string) => { assert.same(search, 'b', '`search` is `b`'); assert.same(i, 1, '`i` is 1'); assert.same(string, 'aba', '`string` is `aba`'); return 'c'; }), 'aca'); const searcher = { [Symbol.replace](O, replaceValue) { assert.same(this, searcher, '`this` is `searcher`'); assert.same(String(O), 'aba', '`O` is `aba`'); assert.same(String(replaceValue), 'c', '`replaceValue` is `c`'); return 'foo'; }, }; assert.same(replaceAll('aba', searcher, 'c'), 'foo'); assert.same(replaceAll('aba', 'b'), 'aundefineda'); assert.same(replaceAll('xxx', '', '_'), '_x_x_x_'); if (STRICT) { assert.throws(() => replaceAll(null, 'a', 'b'), TypeError); assert.throws(() => replaceAll(undefined, 'a', 'b'), TypeError); } assert.throws(() => replaceAll('b.b.b.b.b', /\./, 'a'), TypeError); assert.same(replaceAll('b.b.b.b.b', /\./g, 'a'), 'babababab'); const object = {}; assert.same(replaceAll('[object Object]', object, 'a'), 'a'); }); core-js-3.6.1/tests/pure/esnext.symbol.async-dispose.js000066400000000000000000000004131360057567700231460ustar00rootroot00000000000000import Symbol from 'core-js-pure/features/symbol'; QUnit.test('Symbol.asyncDispose', assert => { assert.ok('asyncDispose' in Symbol, 'Symbol.asyncDispose available'); assert.ok(Object(Symbol.asyncDispose) instanceof Symbol, 'Symbol.asyncDispose is symbol'); }); core-js-3.6.1/tests/pure/esnext.symbol.dispose.js000066400000000000000000000003621360057567700220360ustar00rootroot00000000000000import Symbol from 'core-js-pure/features/symbol'; QUnit.test('Symbol.dispose', assert => { assert.ok('dispose' in Symbol, 'Symbol.dispose available'); assert.ok(Object(Symbol.dispose) instanceof Symbol, 'Symbol.dispose is symbol'); }); core-js-3.6.1/tests/pure/esnext.symbol.observable.js000066400000000000000000000004011360057567700225060ustar00rootroot00000000000000import Symbol from 'core-js-pure/features/symbol'; QUnit.test('Symbol.observable', assert => { assert.ok('observable' in Symbol, 'Symbol.observable available'); assert.ok(Object(Symbol.observable) instanceof Symbol, 'Symbol.observable is symbol'); }); core-js-3.6.1/tests/pure/esnext.symbol.pattern-match.js000066400000000000000000000004131360057567700231340ustar00rootroot00000000000000import Symbol from 'core-js-pure/features/symbol'; QUnit.test('Symbol.patternMatch', assert => { assert.ok('patternMatch' in Symbol, 'Symbol.patternMatch available'); assert.ok(Object(Symbol.patternMatch) instanceof Symbol, 'Symbol.patternMatch is symbol'); }); core-js-3.6.1/tests/pure/esnext.symbol.replace-all.js000066400000000000000000000004041360057567700225460ustar00rootroot00000000000000import Symbol from 'core-js-pure/features/symbol'; QUnit.test('Symbol.replaceAll', assert => { assert.ok('replaceAll' in Symbol, 'Symbol.replaceAll is available'); assert.ok(Object(Symbol.replaceAll) instanceof Symbol, 'Symbol.replaceAll is symbol'); }); core-js-3.6.1/tests/pure/esnext.weak-map.delete-all.js000066400000000000000000000027341360057567700226020ustar00rootroot00000000000000import WeakMap from 'core-js-pure/features/weak-map'; QUnit.test('WeakMap#deleteAll', assert => { const { deleteAll } = WeakMap.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.nonEnumerable(WeakMap.prototype, 'deleteAll'); const a = []; const b = []; const c = []; const d = []; const e = []; let set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.same(set.deleteAll(a, b), true); assert.ok(!set.has(a)); assert.ok(!set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.same(set.deleteAll(c, d), false); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(!set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.same(set.deleteAll(d, e), false); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.same(set.deleteAll(), true); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); assert.notThrows(() => !deleteAll.call({ delete() { /* empty */ } }, a, b, c)); assert.throws(() => deleteAll.call({}, a, b, c), TypeError); assert.throws(() => deleteAll.call(undefined, a, b, c), TypeError); assert.throws(() => deleteAll.call(null, a, b, c), TypeError); }); core-js-3.6.1/tests/pure/esnext.weak-map.from.js000066400000000000000000000015171360057567700215330ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import WeakMap from 'core-js-pure/features/weak-map'; QUnit.test('WeakMap.from', assert => { const { from } = WeakMap; assert.isFunction(from); assert.arity(from, 1); assert.ok(WeakMap.from() instanceof WeakMap); const array = []; assert.same(WeakMap.from([[array, 2]]).get(array), 2); assert.same(WeakMap.from(createIterable([[array, 2]])).get(array), 2); const pair = [{}, 1]; const context = {}; WeakMap.from([pair], function (element, index) { assert.same(element, pair); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from([{}, 1])); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.6.1/tests/pure/esnext.weak-map.of.js000066400000000000000000000006701360057567700211730ustar00rootroot00000000000000import WeakMap from 'core-js-pure/features/weak-map'; QUnit.test('WeakMap.of', assert => { const { of } = WeakMap; assert.isFunction(of); assert.arity(of, 0); const array = []; assert.ok(WeakMap.of() instanceof WeakMap); assert.same(WeakMap.of([array, 2]).get(array), 2); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.6.1/tests/pure/esnext.weak-map.upsert.js000066400000000000000000000031411360057567700221050ustar00rootroot00000000000000import WeakMap from 'core-js-pure/features/weak-map'; QUnit.test('WeakMap#upsert', assert => { const { upsert } = WeakMap.prototype; assert.isFunction(upsert); assert.arity(upsert, 2); assert.name(upsert, 'upsert'); assert.nonEnumerable(WeakMap.prototype, 'upsert'); const a = {}; const b = {}; const map = new WeakMap([[a, 2]]); assert.same(map.upsert(a, function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.ok(false, 'should not be called'); return 3; }), 4, 'returns a correct value'); assert.same(map.upsert(b, value => { assert.ok(false, 'should not be called'); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.get(a), 4, 'correct result #1'); assert.same(map.get(b), 3, 'correct result #2'); assert.same(new WeakMap([[a, 2]]).upsert(b, null, () => 3), 3); assert.same(new WeakMap([[a, 2]]).upsert(a, value => value ** 2), 4); assert.throws(() => new WeakMap().upsert(a), TypeError); assert.throws(() => upsert.call({}, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call([], a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(undefined, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(null, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/pure/esnext.weak-set.add-all.js000066400000000000000000000016411360057567700221020ustar00rootroot00000000000000import WeakSet from 'core-js-pure/features/weak-set'; QUnit.test('WeakSet#addAll', assert => { const { addAll } = WeakSet.prototype; assert.isFunction(addAll); assert.arity(addAll, 0); assert.name(addAll, 'addAll'); assert.nonEnumerable(WeakSet.prototype, 'addAll'); const a = []; const b = []; const c = []; let set = new WeakSet([a]); assert.same(set.addAll(b), set); set = new WeakSet([a]).addAll(b, c); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(set.has(c)); set = new WeakSet([a]).addAll(a, b); assert.ok(set.has(a)); assert.ok(set.has(b)); set = new WeakSet([a]).addAll(); assert.ok(set.has(a)); assert.notThrows(() => addAll.call({ add() { /* empty */ } }, a, b, c)); assert.throws(() => addAll.call({}, a, b, c), TypeError); assert.throws(() => addAll.call(undefined, a, b, c), TypeError); assert.throws(() => addAll.call(null, a, b, c), TypeError); }); core-js-3.6.1/tests/pure/esnext.weak-set.delete-all.js000066400000000000000000000027071360057567700226200ustar00rootroot00000000000000import WeakSet from 'core-js-pure/features/weak-set'; QUnit.test('WeakSet#deleteAll', assert => { const { deleteAll } = WeakSet.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.nonEnumerable(WeakSet.prototype, 'deleteAll'); const a = []; const b = []; const c = []; const d = []; const e = []; let set = new WeakSet([a, b, c]); assert.same(set.deleteAll(a, b), true); assert.ok(!set.has(a)); assert.ok(!set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakSet([a, b, c]); assert.same(set.deleteAll(c, d), false); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(!set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakSet([a, b, c]); assert.same(set.deleteAll(d, e), false); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakSet([a, b, c]); assert.same(set.deleteAll(), true); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); assert.notThrows(() => !deleteAll.call({ delete() { /* empty */ } }, a, b, c)); assert.throws(() => deleteAll.call({}, a, b, c), TypeError); assert.throws(() => deleteAll.call(undefined, a, b, c), TypeError); assert.throws(() => deleteAll.call(null, a, b, c), TypeError); }); core-js-3.6.1/tests/pure/esnext.weak-set.from.js000066400000000000000000000014671360057567700215550ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import WeakSet from 'core-js-pure/features/weak-set'; QUnit.test('WeakSet.from', assert => { const { from } = WeakSet; assert.isFunction(from); assert.arity(from, 1); assert.ok(WeakSet.from() instanceof WeakSet); const array = []; assert.ok(WeakSet.from([array]).has(array)); assert.ok(WeakSet.from(createIterable([array])).has(array)); const object = {}; const context = {}; WeakSet.from([object], function (element, index) { assert.same(element, object); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from({})); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.6.1/tests/pure/esnext.weak-set.of.js000066400000000000000000000006471360057567700212150ustar00rootroot00000000000000import WeakSet from 'core-js-pure/features/weak-set'; QUnit.test('WeakSet.of', assert => { const { of } = WeakSet; assert.isFunction(of); assert.arity(of, 0); const array = []; assert.ok(WeakSet.of() instanceof WeakSet); assert.ok(WeakSet.of(array).has(array)); assert.throws(() => of(1)); let arg = null; function F(it) { arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.6.1/tests/pure/helpers.get-iterator-method.js000066400000000000000000000011571360057567700231070ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import getIteratorMethod from 'core-js-pure/features/get-iterator-method'; QUnit.test('getIteratorMethod helper', assert => { assert.isFunction(getIteratorMethod); const iterable = createIterable([]); const iterFn = getIteratorMethod(iterable); assert.isFunction(iterFn); assert.isIterator(iterFn.call(iterable)); assert.isFunction(getIteratorMethod([])); assert.isFunction(getIteratorMethod(function () { return arguments; }())); assert.isFunction(getIteratorMethod(Array.prototype)); assert.strictEqual(getIteratorMethod({}), undefined); }); core-js-3.6.1/tests/pure/helpers.get-iterator.js000066400000000000000000000006441360057567700216310ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import getIterator from 'core-js-pure/features/get-iterator'; QUnit.test('getIterator helper', assert => { assert.isFunction(getIterator); assert.isIterator(getIterator([])); assert.isIterator(getIterator(function () { return arguments; }())); assert.isIterator(getIterator(createIterable([]))); assert.throws(() => getIterator({}), TypeError); }); core-js-3.6.1/tests/pure/helpers.is-iterable.js000066400000000000000000000006321360057567700214200ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; import isIterable from 'core-js-pure/features/is-iterable'; QUnit.test('isIterable helper', assert => { assert.isFunction(isIterable); assert.ok(isIterable(createIterable([]))); assert.ok(isIterable([])); assert.ok(isIterable(function () { return arguments; }())); assert.ok(isIterable(Array.prototype)); assert.ok(!isIterable({})); }); core-js-3.6.1/tests/pure/index.js000066400000000000000000000207451360057567700166750ustar00rootroot00000000000000/* eslint-disable import/first */ import '../helpers/qunit-helpers'; import { GLOBAL } from '../helpers/constants'; QUnit.module('ES'); import './es.array.concat'; import './es.array.copy-within'; import './es.array.every'; import './es.array.fill'; import './es.array.filter'; import './es.array.find-index'; import './es.array.find'; import './es.array.for-each'; import './es.array.flat'; import './es.array.flat-map'; import './es.array.from'; import './es.array.includes'; import './es.array.index-of'; import './es.array.is-array'; import './es.array.iterator'; import './es.array.join'; import './es.array.last-index-of'; import './es.array.map'; import './es.array.of'; import './es.array.reduce-right'; import './es.array.reduce'; import './es.array.reverse'; import './es.array.slice'; import './es.array.some'; import './es.array.sort'; import './es.array.splice'; import './es.date.now'; import './es.date.to-iso-string'; import './es.date.to-json'; import './es.function.bind'; import './es.function.has-instance'; import './es.global-this'; import './es.json.stringify'; import './es.map'; import './es.math.acosh'; import './es.math.asinh'; import './es.math.atanh'; import './es.math.cbrt'; import './es.math.clz32'; import './es.math.cosh'; import './es.math.expm1'; import './es.math.fround'; import './es.math.hypot'; import './es.math.imul'; import './es.math.log10'; import './es.math.log1p'; import './es.math.log2'; import './es.math.sign'; import './es.math.sinh'; import './es.math.tanh'; import './es.math.trunc'; import './es.number.epsilon'; import './es.number.is-finite'; import './es.number.is-integer'; import './es.number.is-nan'; import './es.number.is-safe-integer'; import './es.number.max-safe-integer'; import './es.number.min-safe-integer'; import './es.number.parse-float'; import './es.number.parse-int'; import './es.number.to-fixed'; import './es.number.to-precision'; import './es.object.assign'; import './es.object.create'; import './es.object.define-getter'; import './es.object.define-properties'; import './es.object.define-property'; import './es.object.define-setter'; import './es.object.entries'; import './es.object.freeze'; import './es.object.from-entries'; import './es.object.get-own-property-descriptor'; import './es.object.get-own-property-descriptors'; import './es.object.get-own-property-names'; import './es.object.get-prototype-of'; import './es.object.is-extensible'; import './es.object.is-frozen'; import './es.object.is-sealed'; import './es.object.is'; import './es.object.keys'; import './es.object.lookup-getter'; import './es.object.lookup-setter'; import './es.object.prevent-extensions'; import './es.object.seal'; import './es.object.set-prototype-of'; import './es.object.values'; import './es.parse-float'; import './es.parse-int'; import './es.promise'; import './es.promise.all-settled'; import './es.promise.finally'; import './es.reflect.apply'; import './es.reflect.construct'; import './es.reflect.define-property'; import './es.reflect.delete-property'; import './es.reflect.get-own-property-descriptor'; import './es.reflect.get-prototype-of'; import './es.reflect.get'; import './es.reflect.has'; import './es.reflect.is-extensible'; import './es.reflect.own-keys'; import './es.reflect.prevent-extensions'; import './es.reflect.set-prototype-of'; import './es.reflect.set'; import './es.set'; import './es.string.anchor'; import './es.string.big'; import './es.string.blink'; import './es.string.bold'; import './es.string.code-point-at'; import './es.string.ends-with'; import './es.string.fixed'; import './es.string.fontcolor'; import './es.string.fontsize'; import './es.string.from-code-point'; import './es.string.includes'; import './es.string.italics'; import './es.string.iterator'; import './es.string.link'; import './es.string.match-all'; import './es.string.pad-end'; import './es.string.pad-start'; import './es.string.raw'; import './es.string.repeat'; import './es.string.small'; import './es.string.starts-with'; import './es.string.strike'; import './es.string.sub'; import './es.string.sup'; import './es.string.trim'; import './es.string.trim-start'; import './es.string.trim-end'; import './es.symbol'; import './es.symbol.async-iterator'; import './es.weak-map'; import './es.weak-set'; QUnit.module('ESNext'); import './esnext.aggregate-error'; import './esnext.array.is-template-object'; import './esnext.async-iterator.constructor'; import './esnext.async-iterator.as-indexed-pairs'; import './esnext.async-iterator.drop'; import './esnext.async-iterator.every'; import './esnext.async-iterator.filter'; import './esnext.async-iterator.find'; import './esnext.async-iterator.flat-map'; import './esnext.async-iterator.for-each'; import './esnext.async-iterator.from'; import './esnext.async-iterator.map'; import './esnext.async-iterator.reduce'; import './esnext.async-iterator.some'; import './esnext.async-iterator.take'; import './esnext.async-iterator.to-array'; import './esnext.composite-key'; import './esnext.composite-symbol'; import './esnext.iterator.constructor'; import './esnext.iterator.as-indexed-pairs'; import './esnext.iterator.drop'; import './esnext.iterator.every'; import './esnext.iterator.filter'; import './esnext.iterator.find'; import './esnext.iterator.flat-map'; import './esnext.iterator.for-each'; import './esnext.iterator.from'; import './esnext.iterator.map'; import './esnext.iterator.reduce'; import './esnext.iterator.some'; import './esnext.iterator.take'; import './esnext.iterator.to-array'; import './esnext.math.clamp'; import './esnext.math.deg-per-rad'; import './esnext.math.degrees'; import './esnext.math.fscale'; import './esnext.math.iaddh'; import './esnext.math.imulh'; import './esnext.math.isubh'; import './esnext.math.rad-per-deg'; import './esnext.math.radians'; import './esnext.math.scale'; import './esnext.math.signbit'; import './esnext.math.umulh'; import './esnext.math.seeded-prng'; import './esnext.number.from-string'; import './esnext.object.iterate-entries'; import './esnext.object.iterate-keys'; import './esnext.object.iterate-values'; import './esnext.observable'; import './esnext.promise.any'; import './esnext.promise.try'; import './esnext.reflect.define-metadata'; import './esnext.reflect.delete-metadata'; import './esnext.reflect.get-metadata-keys'; import './esnext.reflect.get-metadata'; import './esnext.reflect.get-own-matadata'; import './esnext.reflect.get-own-metadata-keys'; import './esnext.reflect.has-metadata'; import './esnext.reflect.has-own-metadata'; import './esnext.reflect.metadata'; import './esnext.map.delete-all'; import './esnext.map.every'; import './esnext.map.filter'; import './esnext.map.find'; import './esnext.map.find-key'; import './esnext.map.from'; import './esnext.map.group-by'; import './esnext.map.includes'; import './esnext.map.key-by'; import './esnext.map.key-of'; import './esnext.map.map-keys'; import './esnext.map.map-values'; import './esnext.map.merge'; import './esnext.map.of'; import './esnext.map.reduce'; import './esnext.map.some'; import './esnext.map.update'; import './esnext.map.update-or-insert'; import './esnext.map.upsert'; import './esnext.set.add-all'; import './esnext.set.delete-all'; import './esnext.set.difference'; import './esnext.set.every'; import './esnext.set.filter'; import './esnext.set.find'; import './esnext.set.from'; import './esnext.set.intersection'; import './esnext.set.is-disjoint-from'; import './esnext.set.is-subset-of'; import './esnext.set.is-superset-of'; import './esnext.set.join'; import './esnext.set.map'; import './esnext.set.of'; import './esnext.set.reduce'; import './esnext.set.some'; import './esnext.set.symmetric-difference'; import './esnext.set.union'; import './esnext.string.at'; import './esnext.string.code-points'; import './esnext.symbol.async-dispose'; import './esnext.symbol.dispose'; import './esnext.symbol.observable'; import './esnext.symbol.pattern-match'; import './esnext.symbol.replace-all'; import './esnext.weak-map.delete-all'; import './esnext.weak-map.from'; import './esnext.weak-map.of'; import './esnext.weak-map.upsert'; import './esnext.weak-set.add-all'; import './esnext.weak-set.delete-all'; import './esnext.weak-set.from'; import './esnext.weak-set.of'; QUnit.module('Web'); import './web.dom-collections.iterator'; import './web.immediate'; import './web.queue-microtask'; import './web.timers'; import './web.url'; import './web.url-search-params'; QUnit.module('Helpers'); import './helpers.get-iterator-method'; import './helpers.get-iterator'; import './helpers.is-iterable'; import core from 'core-js-pure'; GLOBAL.core = core; core-js-3.6.1/tests/pure/web.dom-collections.iterator.js000066400000000000000000000030761360057567700232630ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants'; import Symbol from 'core-js-pure/features/symbol'; import getIteratorMethod from 'core-js-pure/features/get-iterator-method'; QUnit.test('Iterable DOM collections', assert => { let absent = true; const collections = [ 'CSSRuleList', 'CSSStyleDeclaration', 'CSSValueList', 'ClientRectList', 'DOMRectList', 'DOMStringList', 'DOMTokenList', 'DataTransferItemList', 'FileList', 'HTMLAllCollection', 'HTMLCollection', 'HTMLFormElement', 'HTMLSelectElement', 'MediaList', 'MimeTypeArray', 'NamedNodeMap', 'NodeList', 'PaintRequestList', 'Plugin', 'PluginArray', 'SVGLengthList', 'SVGNumberList', 'SVGPathSegList', 'SVGPointList', 'SVGStringList', 'SVGTransformList', 'SourceBufferList', 'StyleSheetList', 'TextTrackCueList', 'TextTrackList', 'TouchList', ]; for (const name of collections) { const Collection = GLOBAL[name]; if (Collection) { assert.same(Collection.prototype[Symbol.toStringTag], name, `${ name }::@@toStringTag is '${ name }'`); assert.isFunction(getIteratorMethod(Collection.prototype), `${ name }::@@iterator is function`); absent = false; } } if (GLOBAL.NodeList && GLOBAL.document && document.querySelectorAll && document.querySelectorAll('div') instanceof NodeList) { assert.isFunction(getIteratorMethod(document.querySelectorAll('div')), 'works with document.querySelectorAll'); } if (absent) { assert.ok(true, 'DOM collections are absent'); } }); core-js-3.6.1/tests/pure/web.immediate.js000066400000000000000000000022611360057567700202710ustar00rootroot00000000000000import { timeLimitedPromise } from '../helpers/helpers'; import { setImmediate, clearImmediate } from 'core-js-pure'; QUnit.test('setImmediate / clearImmediate', assert => { let called = false; assert.expect(6); assert.isFunction(setImmediate, 'setImmediate is function'); assert.isFunction(clearImmediate, 'clearImmediate is function'); timeLimitedPromise(1e3, res => { setImmediate(() => { called = true; res(); }); }).then(() => { assert.ok(true, 'setImmediate works'); }).catch(() => { assert.ok(false, 'setImmediate works'); }).then(assert.async()); assert.strictEqual(called, false, 'setImmediate is async'); timeLimitedPromise(1e3, res => { setImmediate((a, b) => { res(a + b); }, 'a', 'b'); }).then(it => { assert.strictEqual(it, 'ab', 'setImmediate works with additional args'); }).catch(() => { assert.ok(false, 'setImmediate works with additional args'); }).then(assert.async()); timeLimitedPromise(50, res => { clearImmediate(setImmediate(res)); }).then(() => { assert.ok(false, 'clearImmediate works'); }).catch(() => { assert.ok(true, 'clearImmediate works'); }).then(assert.async()); }); core-js-3.6.1/tests/pure/web.queue-microtask.js000066400000000000000000000010321360057567700214440ustar00rootroot00000000000000import queueMicrotask from 'core-js-pure/features/queue-microtask'; QUnit.test('queueMicrotask', assert => { assert.expect(3); assert.isFunction(queueMicrotask); assert.arity(queueMicrotask, 1); const async = assert.async(); let done = false; let after = false; queueMicrotask(() => { if (!done) { done = true; assert.ok(after, 'works'); async(); } }); setTimeout(() => { if (!done) { done = true; assert.ok(false, 'fails'); async(); } }, 3e3); after = true; }); core-js-3.6.1/tests/pure/web.timers.js000066400000000000000000000026431360057567700176420ustar00rootroot00000000000000import { timeLimitedPromise } from '../helpers/helpers'; import { setTimeout, setInterval } from 'core-js-pure'; QUnit.test('setTimeout / clearTimeout', assert => { assert.expect(2); timeLimitedPromise(1e3, resolve => { setTimeout((a, b) => { resolve(a + b); }, 10, 'a', 'b'); }).then(it => { assert.strictEqual(it, 'ab', 'setTimeout works with additional args'); }).catch(() => { assert.ok(false, 'setTimeout works with additional args'); }).then(assert.async()); timeLimitedPromise(50, resolve => { clearTimeout(setTimeout(resolve, 10)); }).then(() => { assert.ok(false, 'clearImmediate works with wraped setTimeout'); }).catch(() => { assert.ok(true, 'clearImmediate works with wraped setTimeout'); }).then(assert.async()); }); QUnit.test('setInterval / clearInterval', assert => { assert.expect(1); timeLimitedPromise(1e4, (resolve, reject) => { let i = 0; const interval = setInterval((a, b) => { if (a + b !== 'ab' || i > 2) reject({ a, b, i }); if (i++ === 2) { clearInterval(interval); setTimeout(resolve, 30); } }, 5, 'a', 'b'); }).then(() => { assert.ok(true, 'setInterval & clearInterval works with additional args'); }).catch(error => { if (!error) error = {}; assert.ok(false, `setInterval & clearInterval works with additional args: ${ error.a }, ${ error.b }, times: ${ error.i }`); }).then(assert.async()); }); core-js-3.6.1/tests/pure/web.url-search-params.js000066400000000000000000000670671360057567700217000ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import { createIterable } from '../helpers/helpers'; import { Symbol, URL, URLSearchParams } from 'core-js-pure'; QUnit.test('URLSearchParams', assert => { assert.isFunction(URLSearchParams); assert.arity(URLSearchParams, 0); assert.same(String(new URLSearchParams()), ''); assert.same(String(new URLSearchParams('')), ''); assert.same(String(new URLSearchParams('a=b')), 'a=b'); assert.same(String(new URLSearchParams(new URLSearchParams('a=b'))), 'a=b'); assert.same(String(new URLSearchParams([])), ''); assert.same(String(new URLSearchParams([[1, 2], ['a', 'b']])), '1=2&a=b'); assert.same(String(new URLSearchParams(createIterable([createIterable(['a', 'b']), createIterable(['c', 'd'])]))), 'a=b&c=d'); assert.same(String(new URLSearchParams({})), ''); assert.same(String(new URLSearchParams({ 1: 2, a: 'b' })), '1=2&a=b'); assert.same(String(new URLSearchParams('?a=b')), 'a=b', 'leading ? should be ignored'); assert.same(String(new URLSearchParams('??a=b')), '%3Fa=b'); assert.same(String(new URLSearchParams('?')), ''); assert.same(String(new URLSearchParams('??')), '%3F='); assert.same(String(new URLSearchParams('a=b c')), 'a=b+c'); assert.same(String(new URLSearchParams('a=b&b=c&a=d')), 'a=b&b=c&a=d'); assert.same(String(new URLSearchParams('a==')), 'a=%3D'); assert.same(String(new URLSearchParams('a=b=')), 'a=b%3D'); assert.same(String(new URLSearchParams('a=b=c')), 'a=b%3Dc'); assert.same(String(new URLSearchParams('a==b')), 'a=%3Db'); let params = new URLSearchParams('a=b'); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.has('b'), false, 'search params object has not got name "b"'); params = new URLSearchParams('a=b&c'); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.has('c'), true, 'search params object has name "c"'); params = new URLSearchParams('&a&&& &&&&&a+b=& c&m%c3%b8%c3%b8'); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.has('a b'), true, 'search params object has name "a b"'); assert.same(params.has(' '), true, 'search params object has name " "'); assert.same(params.has('c'), false, 'search params object did not have the name "c"'); assert.same(params.has(' c'), true, 'search params object has name " c"'); assert.same(params.has('møø'), true, 'search params object has name "møø"'); params = new URLSearchParams('a=b+c'); assert.same(params.get('a'), 'b c', 'parse +'); params = new URLSearchParams('a+b=c'); assert.same(params.get('a b'), 'c', 'parse +'); params = new URLSearchParams('a=b c'); assert.same(params.get('a'), 'b c', 'parse " "'); params = new URLSearchParams('a b=c'); assert.same(params.get('a b'), 'c', 'parse " "'); params = new URLSearchParams('a=b%20c'); assert.same(params.get('a'), 'b c', 'parse %20'); params = new URLSearchParams('a%20b=c'); assert.same(params.get('a b'), 'c', 'parse %20'); params = new URLSearchParams('a=b\0c'); assert.same(params.get('a'), 'b\0c', 'parse \\0'); params = new URLSearchParams('a\0b=c'); assert.same(params.get('a\0b'), 'c', 'parse \\0'); params = new URLSearchParams('a=b%00c'); assert.same(params.get('a'), 'b\0c', 'parse %00'); params = new URLSearchParams('a%00b=c'); assert.same(params.get('a\0b'), 'c', 'parse %00'); params = new URLSearchParams('a=b\u2384'); assert.same(params.get('a'), 'b\u2384', 'parse \u2384'); params = new URLSearchParams('a\u2384b=c'); assert.same(params.get('a\u2384b'), 'c', 'parse \u2384'); params = new URLSearchParams('a=b%e2%8e%84'); assert.same(params.get('a'), 'b\u2384', 'parse %e2%8e%84'); params = new URLSearchParams('a%e2%8e%84b=c'); assert.same(params.get('a\u2384b'), 'c', 'parse %e2%8e%84'); params = new URLSearchParams('a=b\uD83D\uDCA9c'); assert.same(params.get('a'), 'b\uD83D\uDCA9c', 'parse \uD83D\uDCA9'); params = new URLSearchParams('a\uD83D\uDCA9b=c'); assert.same(params.get('a\uD83D\uDCA9b'), 'c', 'parse \uD83D\uDCA9'); params = new URLSearchParams('a=b%f0%9f%92%a9c'); assert.same(params.get('a'), 'b\uD83D\uDCA9c', 'parse %f0%9f%92%a9'); params = new URLSearchParams('a%f0%9f%92%a9b=c'); assert.same(params.get('a\uD83D\uDCA9b'), 'c', 'parse %f0%9f%92%a9'); params = new URLSearchParams(); params.set('query', '+15555555555'); assert.same(params.toString(), 'query=%2B15555555555'); assert.same(params.get('query'), '+15555555555', 'parse encoded +'); params = new URLSearchParams(params.toString()); assert.same(params.get('query'), '+15555555555', 'parse encoded +'); const testData = [ { input: '?a=%', output: [['a', '%']], name: 'handling %' }, { input: { '+': '%C2' }, output: [['+', '%C2']], name: 'object with +' }, { input: { c: 'x', a: '?' }, output: [['c', 'x'], ['a', '?']], name: 'object with two keys' }, { input: [['c', 'x'], ['a', '?']], output: [['c', 'x'], ['a', '?']], name: 'array with two keys' }, // eslint-disable-next-line max-len // !!! { input: { 'a\0b': '42', 'c\uD83D': '23', dሴ: 'foo' }, output: [['a\0b', '42'], ['c\uFFFD', '23'], ['d\u1234', 'foo']], name: 'object with NULL, non-ASCII, and surrogate keys' }, ]; for (const { input, output, name } of testData) { params = new URLSearchParams(input); let i = 0; params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey, `construct with ${ name }`); assert.same(value, reqValue, `construct with ${ name }`); }); } assert.throws(() => { URLSearchParams(''); }, 'throws w/o `new`'); assert.throws(() => { new URLSearchParams([[1, 2, 3]]); }, 'sequence elements must be pairs #1'); assert.throws(() => { new URLSearchParams([createIterable([createIterable([1, 2, 3])])]); }, 'sequence elements must be pairs #2'); assert.throws(() => { new URLSearchParams([[1]]); }, 'sequence elements must be pairs #3'); assert.throws(() => { new URLSearchParams([createIterable([createIterable([1])])]); }, 'sequence elements must be pairs #4'); }); QUnit.test('URLSearchParams#append', assert => { const { append } = URLSearchParams.prototype; assert.isFunction(append); assert.arity(append, 2); assert.enumerable(URLSearchParams.prototype, 'append'); assert.same(new URLSearchParams().append('a', 'b'), undefined, 'void'); let params = new URLSearchParams(); params.append('a', 'b'); assert.same(String(params), 'a=b'); params.append('a', 'b'); assert.same(String(params), 'a=b&a=b'); params.append('a', 'c'); assert.same(String(params), 'a=b&a=b&a=c'); params = new URLSearchParams(); params.append('', ''); assert.same(String(params), '='); params.append('', ''); assert.same(String(params), '=&='); params = new URLSearchParams(); params.append(undefined, undefined); assert.same(String(params), 'undefined=undefined'); params.append(undefined, undefined); assert.same(String(params), 'undefined=undefined&undefined=undefined'); params = new URLSearchParams(); params.append(null, null); assert.same(String(params), 'null=null'); params.append(null, null); assert.same(String(params), 'null=null&null=null'); params = new URLSearchParams(); params.append('first', 1); params.append('second', 2); params.append('third', ''); params.append('first', 10); assert.ok(params.has('first'), 'search params object has name "first"'); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); assert.same(params.get('second'), '2', 'search params object has name "second" with value "2"'); assert.same(params.get('third'), '', 'search params object has name "third" with value ""'); params.append('first', 10); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); assert.throws(() => { return new URLSearchParams('').append(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#delete', assert => { const $delete = URLSearchParams.prototype.delete; assert.isFunction($delete); assert.arity($delete, 1); assert.enumerable(URLSearchParams.prototype, 'delete'); let params = new URLSearchParams('a=b&c=d'); params.delete('a'); assert.same(String(params), 'c=d'); params = new URLSearchParams('a=a&b=b&a=a&c=c'); params.delete('a'); assert.same(String(params), 'b=b&c=c'); params = new URLSearchParams('a=a&=&b=b&c=c'); params.delete(''); assert.same(String(params), 'a=a&b=b&c=c'); params = new URLSearchParams('a=a&null=null&b=b'); params.delete(null); assert.same(String(params), 'a=a&b=b'); params = new URLSearchParams('a=a&undefined=undefined&b=b'); params.delete(undefined); assert.same(String(params), 'a=a&b=b'); params = new URLSearchParams(); params.append('first', 1); assert.same(params.has('first'), true, 'search params object has name "first"'); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); params.delete('first'); assert.same(params.has('first'), false, 'search params object has no "first" name'); params.append('first', 1); params.append('first', 10); params.delete('first'); assert.same(params.has('first'), false, 'search params object has no "first" name'); if (DESCRIPTORS) { let url = new URL('http://example.com/?param1¶m2'); url.searchParams.delete('param1'); url.searchParams.delete('param2'); assert.same(String(url), 'http://example.com/', 'url.href does not have ?'); assert.same(url.search, '', 'url.search does not have ?'); url = new URL('http://example.com/?'); url.searchParams.delete('param1'); // assert.same(String(url), 'http://example.com/', 'url.href does not have ?'); // Safari bug assert.same(url.search, '', 'url.search does not have ?'); } assert.throws(() => { return new URLSearchParams('').delete(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#get', assert => { const { get } = URLSearchParams.prototype; assert.isFunction(get); assert.arity(get, 1); assert.enumerable(URLSearchParams.prototype, 'get'); let params = new URLSearchParams('a=b&c=d'); assert.same(params.get('a'), 'b'); assert.same(params.get('c'), 'd'); assert.same(params.get('e'), null); params = new URLSearchParams('a=b&c=d&a=e'); assert.same(params.get('a'), 'b'); params = new URLSearchParams('=b&c=d'); assert.same(params.get(''), 'b'); params = new URLSearchParams('a=&c=d&a=e'); assert.same(params.get('a'), ''); params = new URLSearchParams('first=second&third&&'); assert.same(params.has('first'), true, 'Search params object has name "first"'); assert.same(params.get('first'), 'second', 'Search params object has name "first" with value "second"'); assert.same(params.get('third'), '', 'Search params object has name "third" with the empty value.'); assert.same(params.get('fourth'), null, 'Search params object has no "fourth" name and value.'); assert.same(new URLSearchParams('a=b c').get('a'), 'b c'); assert.same(new URLSearchParams('a b=c').get('a b'), 'c'); assert.same(new URLSearchParams('a=b%20c').get('a'), 'b c', 'parse %20'); assert.same(new URLSearchParams('a%20b=c').get('a b'), 'c', 'parse %20'); assert.same(new URLSearchParams('a=b\0c').get('a'), 'b\0c', 'parse \\0'); assert.same(new URLSearchParams('a\0b=c').get('a\0b'), 'c', 'parse \\0'); assert.same(new URLSearchParams('a=b%2Bc').get('a'), 'b+c', 'parse %2B'); assert.same(new URLSearchParams('a%2Bb=c').get('a+b'), 'c', 'parse %2B'); assert.same(new URLSearchParams('a=b%00c').get('a'), 'b\0c', 'parse %00'); assert.same(new URLSearchParams('a%00b=c').get('a\0b'), 'c', 'parse %00'); assert.same(new URLSearchParams('a==').get('a'), '=', 'parse ='); assert.same(new URLSearchParams('a=b=').get('a'), 'b=', 'parse ='); assert.same(new URLSearchParams('a=b=c').get('a'), 'b=c', 'parse ='); assert.same(new URLSearchParams('a==b').get('a'), '=b', 'parse ='); assert.same(new URLSearchParams('a=b\u2384').get('a'), 'b\u2384', 'parse \\u2384'); assert.same(new URLSearchParams('a\u2384b=c').get('a\u2384b'), 'c', 'parse \\u2384'); assert.same(new URLSearchParams('a=b%e2%8e%84').get('a'), 'b\u2384', 'parse %e2%8e%84'); assert.same(new URLSearchParams('a%e2%8e%84b=c').get('a\u2384b'), 'c', 'parse %e2%8e%84'); assert.same(new URLSearchParams('a=b\uD83D\uDCA9c').get('a'), 'b\uD83D\uDCA9c', 'parse \\uD83D\\uDCA9'); assert.same(new URLSearchParams('a\uD83D\uDCA9b=c').get('a\uD83D\uDCA9b'), 'c', 'parse \\uD83D\\uDCA9'); assert.same(new URLSearchParams('a=b%f0%9f%92%a9c').get('a'), 'b\uD83D\uDCA9c', 'parse %f0%9f%92%a9'); assert.same(new URLSearchParams('a%f0%9f%92%a9b=c').get('a\uD83D\uDCA9b'), 'c', 'parse %f0%9f%92%a9'); assert.same(new URLSearchParams('=').get(''), '', 'parse ='); assert.throws(() => { return new URLSearchParams('').get(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#getAll', assert => { const { getAll } = URLSearchParams.prototype; assert.isFunction(getAll); assert.arity(getAll, 1); assert.enumerable(URLSearchParams.prototype, 'getAll'); let params = new URLSearchParams('a=b&c=d'); assert.arrayEqual(params.getAll('a'), ['b']); assert.arrayEqual(params.getAll('c'), ['d']); assert.arrayEqual(params.getAll('e'), []); params = new URLSearchParams('a=b&c=d&a=e'); assert.arrayEqual(params.getAll('a'), ['b', 'e']); params = new URLSearchParams('=b&c=d'); assert.arrayEqual(params.getAll(''), ['b']); params = new URLSearchParams('a=&c=d&a=e'); assert.arrayEqual(params.getAll('a'), ['', 'e']); params = new URLSearchParams('a=1&a=2&a=3&a'); assert.arrayEqual(params.getAll('a'), ['1', '2', '3', ''], 'search params object has expected name "a" values'); params.set('a', 'one'); assert.arrayEqual(params.getAll('a'), ['one'], 'search params object has expected name "a" values'); assert.throws(() => { return new URLSearchParams('').getAll(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#has', assert => { const { has } = URLSearchParams.prototype; assert.isFunction(has); assert.arity(has, 1); assert.enumerable(URLSearchParams.prototype, 'has'); let params = new URLSearchParams('a=b&c=d'); assert.same(params.has('a'), true); assert.same(params.has('c'), true); assert.same(params.has('e'), false); params = new URLSearchParams('a=b&c=d&a=e'); assert.same(params.has('a'), true); params = new URLSearchParams('=b&c=d'); assert.same(params.has(''), true); params = new URLSearchParams('null=a'); assert.same(params.has(null), true); params = new URLSearchParams('a=b&c=d&&'); params.append('first', 1); params.append('first', 2); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.has('c'), true, 'search params object has name "c"'); assert.same(params.has('first'), true, 'search params object has name "first"'); assert.same(params.has('d'), false, 'search params object has no name "d"'); params.delete('first'); assert.same(params.has('first'), false, 'search params object has no name "first"'); assert.throws(() => { return new URLSearchParams('').has(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#set', assert => { const { set } = URLSearchParams.prototype; assert.isFunction(set); assert.arity(set, 2); assert.enumerable(URLSearchParams.prototype, 'set'); let params = new URLSearchParams('a=b&c=d'); params.set('a', 'B'); assert.same(String(params), 'a=B&c=d'); params = new URLSearchParams('a=b&c=d&a=e'); params.set('a', 'B'); assert.same(String(params), 'a=B&c=d'); params.set('e', 'f'); assert.same(String(params), 'a=B&c=d&e=f'); params = new URLSearchParams('a=1&a=2&a=3'); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.get('a'), '1', 'search params object has name "a" with value "1"'); params.set('first', 4); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.get('a'), '1', 'search params object has name "a" with value "1"'); assert.same(String(params), 'a=1&a=2&a=3&first=4'); params.set('a', 4); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.get('a'), '4', 'search params object has name "a" with value "4"'); assert.same(String(params), 'a=4&first=4'); assert.throws(() => { return new URLSearchParams('').set(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#sort', assert => { const { sort } = URLSearchParams.prototype; assert.isFunction(sort); assert.arity(sort, 0); assert.enumerable(URLSearchParams.prototype, 'sort'); let params = new URLSearchParams('a=1&b=4&a=3&b=2'); params.sort(); assert.same(String(params), 'a=1&a=3&b=4&b=2'); params.delete('a'); params.append('a', '0'); params.append('b', '0'); params.sort(); assert.same(String(params), 'a=0&b=4&b=2&b=0'); const testData = [ { input: 'z=b&a=b&z=a&a=a', output: [['a', 'b'], ['a', 'a'], ['z', 'b'], ['z', 'a']], }, { input: '\uFFFD=x&\uFFFC&\uFFFD=a', output: [['\uFFFC', ''], ['\uFFFD', 'x'], ['\uFFFD', 'a']], }, { input: 'ffi&🌈', // 🌈 > code point, but < code unit because two code units output: [['🌈', ''], ['ffi', '']], }, { input: 'é&e\uFFFD&e\u0301', output: [['e\u0301', ''], ['e\uFFFD', ''], ['é', '']], }, { input: 'z=z&a=a&z=y&a=b&z=x&a=c&z=w&a=d&z=v&a=e&z=u&a=f&z=t&a=g', // eslint-disable-next-line max-len output: [['a', 'a'], ['a', 'b'], ['a', 'c'], ['a', 'd'], ['a', 'e'], ['a', 'f'], ['a', 'g'], ['z', 'z'], ['z', 'y'], ['z', 'x'], ['z', 'w'], ['z', 'v'], ['z', 'u'], ['z', 't']], }, { input: 'bbb&bb&aaa&aa=x&aa=y', output: [['aa', 'x'], ['aa', 'y'], ['aaa', ''], ['bb', ''], ['bbb', '']], }, { input: 'z=z&=f&=t&=x', output: [['', 'f'], ['', 't'], ['', 'x'], ['z', 'z']], }, { input: 'a🌈&a💩', output: [['a🌈', ''], ['a💩', '']], }, ]; for (const { input, output } of testData) { let i = 0; params = new URLSearchParams(input); params.sort(); params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey); assert.same(value, reqValue); }); i = 0; const url = new URL(`?${ input }`, 'https://example/'); params = url.searchParams; params.sort(); params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey); assert.same(value, reqValue); }); } if (DESCRIPTORS) { const url = new URL('http://example.com/?'); url.searchParams.sort(); assert.same(url.href, 'http://example.com/', 'Sorting non-existent params removes ? from URL'); assert.same(url.search, '', 'Sorting non-existent params removes ? from URL'); } }); QUnit.test('URLSearchParams#toString', assert => { const { toString } = URLSearchParams.prototype; assert.isFunction(toString); assert.arity(toString, 0); let params = new URLSearchParams(); params.append('a', 'b c'); assert.same(String(params), 'a=b+c'); params.delete('a'); params.append('a b', 'c'); assert.same(String(params), 'a+b=c'); params = new URLSearchParams(); params.append('a', ''); assert.same(String(params), 'a='); params.append('a', ''); assert.same(String(params), 'a=&a='); params.append('', 'b'); assert.same(String(params), 'a=&a=&=b'); params.append('', ''); assert.same(String(params), 'a=&a=&=b&='); params.append('', ''); assert.same(String(params), 'a=&a=&=b&=&='); params = new URLSearchParams(); params.append('', 'b'); assert.same(String(params), '=b'); params.append('', 'b'); assert.same(String(params), '=b&=b'); params = new URLSearchParams(); params.append('', ''); assert.same(String(params), '='); params.append('', ''); assert.same(String(params), '=&='); params = new URLSearchParams(); params.append('a', 'b+c'); assert.same(String(params), 'a=b%2Bc'); params.delete('a'); params.append('a+b', 'c'); assert.same(String(params), 'a%2Bb=c'); params = new URLSearchParams(); params.append('=', 'a'); assert.same(String(params), '%3D=a'); params.append('b', '='); assert.same(String(params), '%3D=a&b=%3D'); params = new URLSearchParams(); params.append('&', 'a'); assert.same(String(params), '%26=a'); params.append('b', '&'); assert.same(String(params), '%26=a&b=%26'); params = new URLSearchParams(); params.append('a', '\r'); assert.same(String(params), 'a=%0D'); params = new URLSearchParams(); params.append('a', '\n'); assert.same(String(params), 'a=%0A'); params = new URLSearchParams(); params.append('a', '\r\n'); assert.same(String(params), 'a=%0D%0A'); params = new URLSearchParams(); params.append('a', 'b%c'); assert.same(String(params), 'a=b%25c'); params.delete('a'); params.append('a%b', 'c'); assert.same(String(params), 'a%25b=c'); params = new URLSearchParams(); params.append('a', 'b\0c'); assert.same(String(params), 'a=b%00c'); params.delete('a'); params.append('a\0b', 'c'); assert.same(String(params), 'a%00b=c'); params = new URLSearchParams(); params.append('a', 'b\uD83D\uDCA9c'); assert.same(String(params), 'a=b%F0%9F%92%A9c'); params.delete('a'); params.append('a\uD83D\uDCA9b', 'c'); assert.same(String(params), 'a%F0%9F%92%A9b=c'); params = new URLSearchParams('a=b&c=d&&e&&'); assert.same(String(params), 'a=b&c=d&e='); params = new URLSearchParams('a = b &a=b&c=d%20'); assert.same(String(params), 'a+=+b+&a=b&c=d+'); params = new URLSearchParams('a=&a=b'); assert.same(String(params), 'a=&a=b'); }); QUnit.test('URLSearchParams#forEach', assert => { const { forEach } = URLSearchParams.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.enumerable(URLSearchParams.prototype, 'forEach'); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let result = ''; params.forEach((value, key, that) => { assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); assert.same(that, params); result += key; }); assert.same(result, 'abc'); new URL('http://a.b/c').searchParams.forEach(() => { assert.ok(false, 'should not be called'); }); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); params = url.searchParams; result = ''; params.forEach((val, key) => { url.search = 'x=1&y=2&z=3'; result += key + val; }); assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); result = ''; params.forEach((value, key) => { params.delete('b'); result += key + value; }); assert.same(result, 'a1c3'); }); QUnit.test('URLSearchParams#entries', assert => { const { entries } = URLSearchParams.prototype; assert.isFunction(entries); assert.arity(entries, 0); assert.enumerable(URLSearchParams.prototype, 'entries'); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let iterator = params.entries(); let result = ''; let entry; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); result += key; } assert.same(result, 'abc'); assert.ok(new URL('http://a.b/c').searchParams.entries().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams.entries(); result = ''; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; url.search = 'x=1&y=2&z=3'; result += key + value; } assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.entries(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const [key, value] = entry.value; result += key + value; } assert.same(result, 'a1c3'); }); QUnit.test('URLSearchParams#keys', assert => { const { keys } = URLSearchParams.prototype; assert.isFunction(keys); assert.arity(keys, 0); assert.enumerable(URLSearchParams.prototype, 'keys'); let iterator = new URLSearchParams('a=1&b=2&c=3').keys(); let result = ''; let entry; while (!(entry = iterator.next()).done) { result += entry.value; } assert.same(result, 'abc'); assert.ok(new URL('http://a.b/c').searchParams.keys().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams.keys(); result = ''; while (!(entry = iterator.next()).done) { const key = entry.value; url.search = 'x=1&y=2&z=3'; result += key; } assert.same(result, 'ayz'); } // fails in Chrome 66- const params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.keys(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const key = entry.value; result += key; } assert.same(result, 'ac'); }); QUnit.test('URLSearchParams#values', assert => { const { values } = URLSearchParams.prototype; assert.isFunction(values); assert.arity(values, 0); assert.enumerable(URLSearchParams.prototype, 'values'); let iterator = new URLSearchParams('a=1&b=2&c=3').values(); let result = ''; let entry; while (!(entry = iterator.next()).done) { result += entry.value; } assert.same(result, '123'); assert.ok(new URL('http://a.b/c').searchParams.values().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=a&b=b&c=c&d=d'); iterator = url.searchParams.keys(); result = ''; while (!(entry = iterator.next()).done) { const { value } = entry; url.search = 'x=x&y=y&z=z'; result += value; } assert.same(result, 'ayz'); } // fails in Chrome 66- const params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.values(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const key = entry.value; result += key; } assert.same(result, '13'); }); QUnit.test('URLSearchParams#@@iterator', assert => { const entries = URLSearchParams.prototype[Symbol.iterator]; assert.isFunction(entries); assert.arity(entries, 0); assert.same(entries, URLSearchParams.prototype.entries); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let iterator = params[Symbol.iterator](); let result = ''; let entry; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); result += key; } assert.same(result, 'abc'); assert.ok(new URL('http://a.b/c').searchParams[Symbol.iterator]().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams[Symbol.iterator](); result = ''; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; url.search = 'x=1&y=2&z=3'; result += key + value; } assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); iterator = params[Symbol.iterator](); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const [key, value] = entry.value; result += key + value; } assert.same(result, 'a1c3'); }); core-js-3.6.1/tests/pure/web.url.js000066400000000000000000000670561360057567700171520ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import urlTestData from '../wpt-url-resources/urltestdata'; import settersTestData from '../wpt-url-resources/setters'; import toASCIITestData from '../wpt-url-resources/toascii'; import { URL, URLSearchParams } from 'core-js-pure'; const { hasOwnProperty } = Object.prototype; QUnit.test('URL constructor', assert => { assert.isFunction(URL); assert.arity(URL, 1); assert.same(String(new URL('http://www.domain.com/a/b')), 'http://www.domain.com/a/b'); assert.same(String(new URL('/c/d', 'http://www.domain.com/a/b')), 'http://www.domain.com/c/d'); assert.same(String(new URL('b/c', 'http://www.domain.com/a/b')), 'http://www.domain.com/a/b/c'); assert.same(String(new URL('b/c', new URL('http://www.domain.com/a/b'))), 'http://www.domain.com/a/b/c'); assert.same(String(new URL({ toString: () => 'https://example.org/' })), 'https://example.org/'); assert.same(String(new URL('nonspecial://example.com/')), 'nonspecial://example.com/'); assert.same(String(new URL('https://測試')), 'https://xn--g6w251d/', 'unicode parsing'); assert.same(String(new URL('https://xxпривет.тест')), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(new URL('https://xxПРИВЕТ.тест')), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(new URL('http://Example.com/', 'https://example.org/')), 'http://example.com/'); assert.same(String(new URL('https://Example.com/', 'https://example.org/')), 'https://example.com/'); assert.same(String(new URL('nonspecial://Example.com/', 'https://example.org/')), 'nonspecial://Example.com/'); assert.same(String(new URL('http:Example.com/', 'https://example.org/')), 'http://example.com/'); assert.same(String(new URL('https:Example.com/', 'https://example.org/')), 'https://example.org/Example.com/'); assert.same(String(new URL('nonspecial:Example.com/', 'https://example.org/')), 'nonspecial:Example.com/'); assert.same(String(new URL('http://0300.168.0xF0')), 'http://192.168.0.240/'); assert.same(String(new URL('http://[20:0:0:1:0:0:0:ff]')), 'http://[20:0:0:1::ff]/'); // assert.same(String(new URL('http://257.168.0xF0')), 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // TypeError in Chrome and Safari assert.same(String(new URL('http://0300.168.0xG0')), 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); assert.same(String(new URL('file:///var/log/system.log')), 'file:///var/log/system.log', 'file scheme'); // assert.same(String(new URL('file://nnsc.nsf.net/bar/baz')), 'file://nnsc.nsf.net/bar/baz', 'file scheme'); // 'file:///bar/baz' in FF // assert.same(String(new URL('file://localhost/bar/baz')), 'file:///bar/baz', 'file scheme'); // 'file://localhost/bar/baz' in Chrome assert.throws(() => new URL(), 'TypeError: Failed to construct \'URL\': 1 argument required, but only 0 present.'); assert.throws(() => new URL(''), 'TypeError: Failed to construct \'URL\': Invalid URL'); assert.throws(() => new URL('', 'about:blank'), 'TypeError: Failed to construct \'URL\': Invalid URL'); assert.throws(() => new URL('abc'), 'TypeError: Failed to construct \'URL\': Invalid URL'); assert.throws(() => new URL('//abc'), 'TypeError: Failed to construct \'URL\': Invalid URL'); assert.throws(() => new URL('http:///www.domain.com/', 'abc'), 'TypeError: Failed to construct \'URL\': Invalid base URL'); assert.throws(() => new URL('http:///www.domain.com/', null), 'TypeError: Failed to construct \'URL\': Invalid base URL'); assert.throws(() => new URL('//abc', null), 'TypeError: Failed to construct \'URL\': Invalid base URL'); assert.throws(() => new URL('http://[20:0:0:1:0:0:0:ff'), 'incorrect IPv6'); assert.throws(() => new URL('http://[20:0:0:1:0:0:0:fg]'), 'incorrect IPv6'); // assert.throws(() => new URL('http://a%b'), 'forbidden host code point'); // no error in FF assert.throws(() => new URL('1http://zloirock.ru'), 'incorrect scheme'); }); QUnit.test('URL#href', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'href')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'href'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.href, 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.href, 'http://zloirock.ru/?foo=bar'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://測試'; assert.same(url.href, 'https://xn--g6w251d/', 'unicode parsing'); assert.same(String(url), 'https://xn--g6w251d/', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://xxпривет.тест'; assert.same(url.href, 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(url), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://xxПРИВЕТ.тест'; assert.same(url.href, 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(url), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); url = new URL('http://zloirock.ru/'); url.href = 'http://0300.168.0xF0'; assert.same(url.href, 'http://192.168.0.240/'); assert.same(String(url), 'http://192.168.0.240/'); url = new URL('http://zloirock.ru/'); url.href = 'http://[20:0:0:1:0:0:0:ff]'; assert.same(url.href, 'http://[20:0:0:1::ff]/'); assert.same(String(url), 'http://[20:0:0:1::ff]/'); // url = new URL('http://zloirock.ru/'); // url.href = 'http://257.168.0xF0'; // TypeError and Safari // assert.same(url.href, 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // `F` instead of `f` in Chrome // assert.same(String(url), 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // `F` instead of `f` in Chrome url = new URL('http://zloirock.ru/'); url.href = 'http://0300.168.0xG0'; assert.same(url.href, 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); assert.same(String(url), 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); url = new URL('http://192.168.0.240/'); url.href = 'file:///var/log/system.log'; assert.same(url.href, 'file:///var/log/system.log', 'file -> ip'); assert.same(String(url), 'file:///var/log/system.log', 'file -> ip'); url = new URL('file:///var/log/system.log'); url.href = 'http://0300.168.0xF0'; assert.same(url.href, 'http://192.168.0.240/', 'file -> http'); assert.same(String(url), 'http://192.168.0.240/', 'file -> http'); // assert.throws(() => new URL('http://zloirock.ru/').href = undefined, 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = '', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'abc', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = '//abc', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://[20:0:0:1:0:0:0:ff', 'incorrect IPv6'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://[20:0:0:1:0:0:0:fg]', 'incorrect IPv6'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://a%b', 'forbidden host code point'); // no error in Chrome and FF // assert.throws(() => new URL('http://zloirock.ru/').href = '1http://zloirock.ru', 'incorrect scheme'); // no error in Chrome } }); QUnit.test('URL#origin', assert => { const url = new URL('http://es6.zloirock.ru/tests.html'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'origin')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'origin'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); } assert.same(url.origin, 'http://es6.zloirock.ru'); assert.same(new URL('https://測試/tests').origin, 'https://xn--g6w251d'); }); QUnit.test('URL#protocol', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'protocol')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'protocol'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.protocol, 'http:'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.protocol = 'https'; assert.same(url.protocol, 'https:'); assert.same(String(url), 'https://zloirock.ru/'); // https://nodejs.org/api/url.html#url_special_schemes // url = new URL('http://zloirock.ru/'); // url.protocol = 'fish'; // assert.same(url.protocol, 'http:'); // assert.same(url.href, 'http://zloirock.ru/'); // assert.same(String(url), 'http://zloirock.ru/'); url = new URL('http://zloirock.ru/'); url.protocol = '1http'; assert.same(url.protocol, 'http:'); assert.same(url.href, 'http://zloirock.ru/', 'incorrect scheme'); assert.same(String(url), 'http://zloirock.ru/', 'incorrect scheme'); } }); QUnit.test('URL#username', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'username')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'username'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.username, ''); url = new URL('http://username@zloirock.ru/'); assert.same(url.username, 'username'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.username = 'username'; assert.same(url.username, 'username'); assert.same(String(url), 'http://username@zloirock.ru/'); } }); QUnit.test('URL#password', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'password')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'password'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.password, ''); url = new URL('http://username:password@zloirock.ru/'); assert.same(url.password, 'password'); // url = new URL('http://:password@zloirock.ru/'); // TypeError in FF // assert.same(url.password, 'password'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.username = 'username'; url.password = 'password'; assert.same(url.password, 'password'); assert.same(String(url), 'http://username:password@zloirock.ru/'); // url = new URL('http://zloirock.ru/'); // url.password = 'password'; // assert.same(url.password, 'password'); // '' in FF // assert.same(String(url), 'http://:password@zloirock.ru/'); // 'http://zloirock.ru/' in FF } }); QUnit.test('URL#host', assert => { let url = new URL('http://zloirock.ru:81/path'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'host')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'host'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.host, 'zloirock.ru:81'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru:81/path'); url.host = 'example.com:82'; assert.same(url.host, 'example.com:82'); assert.same(String(url), 'http://example.com:82/path'); // url = new URL('http://zloirock.ru:81/path'); // url.host = 'other?domain.com'; // assert.same(String(url), 'http://other:81/path'); // 'http://other/?domain.com/path' in Safari url = new URL('https://www.mydomain.com:8080/path/'); url.host = 'www.otherdomain.com:80'; assert.same(url.href, 'https://www.otherdomain.com:80/path/', 'set default port for another protocol'); // url = new URL('https://www.mydomain.com:8080/path/'); // url.host = 'www.otherdomain.com:443'; // assert.same(url.href, 'https://www.otherdomain.com/path/', 'set default port'); url = new URL('http://zloirock.ru/foo'); url.host = '測試'; assert.same(url.host, 'xn--g6w251d', 'unicode parsing'); assert.same(String(url), 'http://xn--g6w251d/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = 'xxпривет.тест'; assert.same(url.host, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = 'xxПРИВЕТ.тест'; assert.same(url.host, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = '0300.168.0xF0'; assert.same(url.host, '192.168.0.240'); assert.same(String(url), 'http://192.168.0.240/foo'); // url = new URL('http://zloirock.ru/foo'); // url.host = '[20:0:0:1:0:0:0:ff]'; // assert.same(url.host, '[20:0:0:1::ff]'); // ':0' in Chrome, 'zloirock.ru' in Safari // assert.same(String(url), 'http://[20:0:0:1::ff]/foo'); // 'http://[20:0/foo' in Chrome, 'http://zloirock.ru/foo' in Safari // url = new URL('file:///var/log/system.log'); // url.host = 'nnsc.nsf.net'; // does not work in FF // assert.same(url.hostname, 'nnsc.nsf.net', 'file'); // assert.same(String(url), 'file://nnsc.nsf.net/var/log/system.log', 'file'); // url = new URL('http://zloirock.ru/'); // url.host = '[20:0:0:1:0:0:0:ff'; // assert.same(url.host, 'zloirock.ru', 'incorrect IPv6'); // ':0' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0/' in Chrome // url = new URL('http://zloirock.ru/'); // url.host = '[20:0:0:1:0:0:0:fg]'; // assert.same(url.host, 'zloirock.ru', 'incorrect IPv6'); // ':0' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0/' in Chrome // url = new URL('http://zloirock.ru/'); // url.host = 'a%b'; // assert.same(url.host, 'zloirock.ru', 'forbidden host code point'); // '' in Chrome, 'a%b' in FF // assert.same(String(url), 'http://zloirock.ru/', 'forbidden host code point'); // 'http://a%25b/' in Chrome, 'http://a%b/' in FF } }); QUnit.test('URL#hostname', assert => { let url = new URL('http://zloirock.ru:81/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'hostname')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'hostname'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.hostname, 'zloirock.ru'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru:81/'); url.hostname = 'example.com'; assert.same(url.hostname, 'example.com'); assert.same(String(url), 'http://example.com:81/'); // url = new URL('http://zloirock.ru:81/'); // url.hostname = 'example.com:82'; // assert.same(url.hostname, 'example.com'); // '' in Chrome // assert.same(String(url), 'http://example.com:81/'); // 'ttp://example.com:82:81/' in Chrome url = new URL('http://zloirock.ru/foo'); url.hostname = '測試'; assert.same(url.hostname, 'xn--g6w251d', 'unicode parsing'); assert.same(String(url), 'http://xn--g6w251d/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = 'xxпривет.тест'; assert.same(url.hostname, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = 'xxПРИВЕТ.тест'; assert.same(url.hostname, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = '0300.168.0xF0'; assert.same(url.hostname, '192.168.0.240'); assert.same(String(url), 'http://192.168.0.240/foo'); // url = new URL('http://zloirock.ru/foo'); // url.hostname = '[20:0:0:1:0:0:0:ff]'; // assert.same(url.hostname, '[20:0:0:1::ff]'); // 'zloirock.ru' in Safari // assert.same(String(url), 'http://[20:0:0:1::ff]/foo'); // 'http://zloirock.ru/foo' in Safari // url = new URL('file:///var/log/system.log'); // url.hostname = 'nnsc.nsf.net'; // does not work in FF // assert.same(url.hostname, 'nnsc.nsf.net', 'file'); // assert.same(String(url), 'file://nnsc.nsf.net/var/log/system.log', 'file'); // url = new URL('http://zloirock.ru/'); // url.hostname = '[20:0:0:1:0:0:0:ff'; // assert.same(url.hostname, 'zloirock.ru', 'incorrect IPv6'); // '' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0:0:1:0:0:0:ff' in Chrome // url = new URL('http://zloirock.ru/'); // url.hostname = '[20:0:0:1:0:0:0:fg]'; // assert.same(url.hostname, 'zloirock.ru', 'incorrect IPv6'); // '' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0:0:1:0:0:0:ff/' in Chrome // url = new URL('http://zloirock.ru/'); // url.hostname = 'a%b'; // assert.same(url.hostname, 'zloirock.ru', 'forbidden host code point'); // '' in Chrome, 'a%b' in FF // assert.same(String(url), 'http://zloirock.ru/', 'forbidden host code point'); // 'http://a%25b/' in Chrome, 'http://a%b/' in FF } }); QUnit.test('URL#port', assert => { let url = new URL('http://zloirock.ru:1337/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'port')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'port'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.port, '1337'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.port = 80; assert.same(url.port, ''); assert.same(String(url), 'http://zloirock.ru/'); url.port = 1337; assert.same(url.port, '1337'); assert.same(String(url), 'http://zloirock.ru:1337/'); // url.port = 'abcd'; // assert.same(url.port, '1337'); // '0' in Chrome // assert.same(String(url), 'http://zloirock.ru:1337/'); // 'http://zloirock.ru:0/' in Chrome // url.port = '5678abcd'; // assert.same(url.port, '5678'); // '1337' in FF // assert.same(String(url), 'http://zloirock.ru:5678/'); // 'http://zloirock.ru:1337/"' in FF url.port = 1234.5678; assert.same(url.port, '1234'); assert.same(String(url), 'http://zloirock.ru:1234/'); // url.port = 1e10; // assert.same(url.port, '1234'); // '0' in Chrome // assert.same(String(url), 'http://zloirock.ru:1234/'); // 'http://zloirock.ru:0/' in Chrome } }); QUnit.test('URL#pathname', assert => { let url = new URL('http://zloirock.ru/foo/bar'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'pathname')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'pathname'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.pathname, '/foo/bar'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.pathname = 'bar/baz'; assert.same(url.pathname, '/bar/baz'); assert.same(String(url), 'http://zloirock.ru/bar/baz'); } }); QUnit.test('URL#search', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'search')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'search'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.search, ''); url = new URL('http://zloirock.ru/?foo=bar'); assert.same(url.search, '?foo=bar'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/?'); assert.same(url.search, ''); assert.same(String(url), 'http://zloirock.ru/?'); url.search = 'foo=bar'; assert.same(url.search, '?foo=bar'); assert.same(String(url), 'http://zloirock.ru/?foo=bar'); url.search = '?bar=baz'; assert.same(url.search, '?bar=baz'); assert.same(String(url), 'http://zloirock.ru/?bar=baz'); url.search = ''; assert.same(url.search, ''); assert.same(String(url), 'http://zloirock.ru/'); } }); QUnit.test('URL#searchParams', assert => { let url = new URL('http://zloirock.ru/?foo=bar&bar=baz'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'searchParams')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'searchParams'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); } assert.ok(url.searchParams instanceof URLSearchParams); assert.same(url.searchParams.get('foo'), 'bar'); assert.same(url.searchParams.get('bar'), 'baz'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.searchParams.append('foo', 'bar'); assert.same(String(url), 'http://zloirock.ru/?foo=bar'); url = new URL('http://zloirock.ru/'); url.search = 'foo=bar'; assert.same(url.searchParams.get('foo'), 'bar'); url = new URL('http://zloirock.ru/?foo=bar&bar=baz'); url.search = ''; assert.same(url.searchParams.has('foo'), false); } }); QUnit.test('URL#hash', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'hash')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'hash'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.hash, ''); url = new URL('http://zloirock.ru/#foo'); assert.same(url.hash, '#foo'); url = new URL('http://zloirock.ru/#'); assert.same(url.hash, ''); assert.same(String(url), 'http://zloirock.ru/#'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/#'); url.hash = 'foo'; assert.same(url.hash, '#foo'); assert.same(String(url), 'http://zloirock.ru/#foo'); url.hash = ''; assert.same(url.hash, ''); assert.same(String(url), 'http://zloirock.ru/'); // url.hash = '#'; // assert.same(url.hash, ''); // assert.same(String(url), 'http://zloirock.ru/'); // 'http://zloirock.ru/#' in FF url.hash = '#foo'; assert.same(url.hash, '#foo'); assert.same(String(url), 'http://zloirock.ru/#foo'); url.hash = '#foo#bar'; assert.same(url.hash, '#foo#bar'); assert.same(String(url), 'http://zloirock.ru/#foo#bar'); url = new URL('http://zloirock.ru/'); url.hash = 'абa'; assert.same(url.hash, '#%D0%B0%D0%B1a'); // url = new URL('http://zloirock.ru/'); // url.hash = '\udc01\ud802a'; // assert.same(url.hash, '#%EF%BF%BD%EF%BF%BDa', 'unmatched surrogates'); } }); QUnit.test('URL#toJSON', assert => { const { toJSON } = URL.prototype; assert.isFunction(toJSON); assert.arity(toJSON, 0); assert.enumerable(URL.prototype, 'toJSON'); const url = new URL('http://zloirock.ru/'); assert.same(url.toJSON(), 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.toJSON(), 'http://zloirock.ru/?foo=bar'); } }); QUnit.test('URL#toString', assert => { const { toString } = URL.prototype; assert.isFunction(toString); assert.arity(toString, 0); assert.enumerable(URL.prototype, 'toString'); const url = new URL('http://zloirock.ru/'); assert.same(url.toString(), 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.toString(), 'http://zloirock.ru/?foo=bar'); } }); QUnit.test('URL.sham', assert => { assert.same(URL.sham, DESCRIPTORS ? undefined : true); }); // `core-js` URL implementation pass all (exclude some encoding-ralated) tests // from the next 3 test cases, but URLs from all of popular browsers fail a serious part of tests. // Replacing all of them does not looks like a good idea, so next test cases disabled by default. // see https://github.com/web-platform-tests/wpt/blob/master/url QUnit.skip('WPT URL constructor tests', assert => { for (const expected of urlTestData) { if (typeof expected == 'string') continue; const name = `Parsing: <${ expected.input }> against <${ expected.base }>`; if (expected.failure) { assert.throws(() => new URL(expected.input, expected.base || 'about:blank'), name); } else { const url = new URL(expected.input, expected.base || 'about:blank'); assert.same(url.href, expected.href, `${ name }: href`); assert.same(url.protocol, expected.protocol, `${ name }: protocol`); assert.same(url.username, expected.username, `${ name }: username`); assert.same(url.password, expected.password, `${ name }: password`); assert.same(url.host, expected.host, `${ name }: host`); assert.same(url.hostname, expected.hostname, `${ name }: hostname`); assert.same(url.port, expected.port, `${ name }: port`); assert.same(url.pathname, expected.pathname, `${ name }: pathname`); assert.same(url.search, expected.search, `${ name }: search`); if ('searchParams' in expected) { assert.same(url.searchParams.toString(), expected.searchParams, `${ name }: searchParams`); } assert.same(url.hash, expected.hash, `${ name }: hash`); if ('origin' in expected) { assert.same(url.origin, expected.origin, `${ name }: origin`); } } } }); // see https://github.com/web-platform-tests/wpt/blob/master/url if (DESCRIPTORS) QUnit.skip('WPT URL setters tests', assert => { for (const setter in settersTestData) { const testCases = settersTestData[setter]; for (const { href, newValue, comment, expected } of testCases) { let name = `Setting <${ href }>.${ setter } = '${ newValue }'.`; if (comment) name += ` ${ comment }`; const url = new URL(href); url[setter] = newValue; for (const attribute in expected) { assert.same(url[attribute], expected[attribute], name); } } } }); // see https://github.com/web-platform-tests/wpt/blob/master/url QUnit.skip('WPT conversion to ASCII tests', assert => { for (const { comment, input, output } of toASCIITestData) { let name = `Parsing: <${ input }>`; if (comment) name += ` ${ comment }`; if (output === null) { assert.throws(() => new URL(`https://${ input }/x`), name); } else { const url = new URL(`https://${ input }/x`); assert.same(url.host, output, name); assert.same(url.hostname, output, name); assert.same(url.pathname, '/x', name); assert.same(url.href, `https://${ output }/x`, name); } } }); core-js-3.6.1/tests/targets-parser.js000066400000000000000000000037011360057567700175470ustar00rootroot00000000000000'use strict'; const { deepStrictEqual } = require('assert'); const targetsParser = require('../packages/core-js-compat/targets-parser'); // browserslist deepStrictEqual(targetsParser('ie 11, chrome 56, ios 12.2'), new Map([ ['chrome', '56'], ['ie', '11'], ['ios', '12.2-12.4'], ])); // targets object deepStrictEqual(targetsParser({ ie: 11, chrome: 56, ios: '12.2', }), new Map([ ['chrome', '56'], ['ie', '11'], ['ios', '12.2'], ])); // targets.browsers deepStrictEqual(targetsParser({ browsers: 'ie 11, chrome 56, ios_saf 12.2' }), new Map([ ['chrome', '56'], ['ie', '11'], ['ios', '12.2-12.4'], ])); // targets.esmodules deepStrictEqual(targetsParser({ esmodules: true }), new Map([ ['chrome', '61'], ['edge', '16'], ['firefox', '60'], ['ios', '10.3'], ['opera', '48'], ['opera_mobile', '45'], ['safari', '10.1'], ['samsung', '8.0'], ])); // targets.node: current deepStrictEqual(targetsParser({ node: 'current' }), new Map([ ['node', String(process.versions.node)], ])); // targets.node: version deepStrictEqual(targetsParser({ node: '13.2' }), new Map([ ['node', '13.2'], ])); // normalization deepStrictEqual(targetsParser({ ie_mob: 11, chromeandroid: 56, and_ff: 60, ios_saf: '12.2', op_mob: 40, op_mini: 1, random: 42, }), new Map([ ['chrome', '56'], ['firefox', '60'], ['ie', '11'], ['ios', '12.2'], ['opera_mobile', '40'], ])); // mixed deepStrictEqual(targetsParser({ esmodules: true, node: 'current', browsers: 'edge 13, safari 5.1, ios 13', android: '4.2', chrome: 77, electron: 1, ie: 8, samsung: 4, ie_mob: 11, chromeandroid: 56, and_ff: 65, ios_saf: '12.2', op_mob: 40, random: 42, }), new Map([ ['android', '4.2'], ['chrome', '56'], ['edge', '13'], ['electron', '1'], ['firefox', '60'], ['ie', '8'], ['ios', '10.3'], ['node', String(process.versions.node)], ['opera', '48'], ['opera_mobile', '40'], ['safari', '5.1'], ['samsung', '4'], ])); core-js-3.6.1/tests/tests.html000066400000000000000000000007661360057567700163060ustar00rootroot00000000000000 Core
core-js-3.6.1/tests/tests/000077500000000000000000000000001360057567700154075ustar00rootroot00000000000000core-js-3.6.1/tests/tests/es.array-buffer.constructor.js000066400000000000000000000014661360057567700233330ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants'; QUnit.test('ArrayBuffer', assert => { const Symbol = GLOBAL.Symbol || {}; // in Safari 5 typeof ArrayBuffer is 'object' assert.same(ArrayBuffer, Object(ArrayBuffer), 'is object'); // 0 in V8 ~ Chromium 27- assert.arity(ArrayBuffer, 1); // Safari 5 bug assert.name(ArrayBuffer, 'ArrayBuffer'); // Safari 5 bug if (NATIVE) assert.looksNative(ArrayBuffer); assert.same(new ArrayBuffer(123).byteLength, 123, 'length'); // fails in Safari assert.throws(() => new ArrayBuffer(-1), RangeError, 'negative length'); assert.notThrows(() => new ArrayBuffer(0.5), 'fractional length'); assert.notThrows(() => new ArrayBuffer(), 'missed length'); if (DESCRIPTORS) assert.same(ArrayBuffer[Symbol.species], ArrayBuffer, '@@species'); }); core-js-3.6.1/tests/tests/es.array-buffer.is-view.js000066400000000000000000000014671360057567700223320ustar00rootroot00000000000000import { GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; QUnit.test('ArrayBuffer.isView', assert => { const { isView } = ArrayBuffer; assert.isFunction(isView); assert.arity(isView, 1); assert.name(isView, 'isView'); assert.looksNative(isView); assert.nonEnumerable(ArrayBuffer, 'isView'); for (const name in TYPED_ARRAYS) { if (GLOBAL[name]) { assert.same(isView(new GLOBAL[name]([1])), true, `${ name } - true`); } } assert.same(isView(new DataView(new ArrayBuffer(1))), true, 'DataView - true'); assert.same(isView(new ArrayBuffer(1)), false, 'ArrayBuffer - false'); const examples = [undefined, null, false, true, 0, 1, '', 'qwe', {}, [], function () { /* empty */ }]; for (const example of examples) { assert.same(isView(example), false, `${ example } - false`); } }); core-js-3.6.1/tests/tests/es.array-buffer.slice.js000066400000000000000000000025351360057567700220430ustar00rootroot00000000000000QUnit.test('ArrayBuffer#slice', assert => { const { slice } = ArrayBuffer.prototype; function arrayToBuffer(it) { const buffer = new ArrayBuffer(it.length); const view = new DataView(buffer); for (let i = 0, { length } = it; i < length; ++i) { view.setUint8(i, it[i]); } return buffer; } function bufferToArray(it) { const results = []; const view = new DataView(it); for (let i = 0, { byteLength } = view; i < byteLength; ++i) { results.push(view.getUint8(i)); } return results; } assert.isFunction(slice); assert.arity(slice, 2); assert.name(slice, 'slice'); assert.looksNative(slice); // assert.nonEnumerable(ArrayBuffer.prototype, 'slice'); const buffer = arrayToBuffer([1, 2, 3, 4, 5]); assert.ok(buffer instanceof ArrayBuffer, 'correct buffer'); assert.ok(buffer.slice() !== buffer, 'returns new buffer'); assert.ok(buffer.slice() instanceof ArrayBuffer, 'correct instance'); assert.arrayEqual(bufferToArray(buffer.slice()), [1, 2, 3, 4, 5]); assert.arrayEqual(bufferToArray(buffer.slice(1, 3)), [2, 3]); assert.arrayEqual(bufferToArray(buffer.slice(1, undefined)), [2, 3, 4, 5]); assert.arrayEqual(bufferToArray(buffer.slice(1, -1)), [2, 3, 4]); assert.arrayEqual(bufferToArray(buffer.slice(-2, -1)), [4]); assert.arrayEqual(bufferToArray(buffer.slice(-2, -3)), []); }); core-js-3.6.1/tests/tests/es.array.concat.js000066400000000000000000000030561360057567700207430ustar00rootroot00000000000000/* eslint-disable no-sparse-arrays */ QUnit.test('Array#concat', assert => { const { concat } = Array.prototype; assert.isFunction(concat); assert.arity(concat, 1); assert.name(concat, 'concat'); assert.looksNative(concat); assert.nonEnumerable(Array.prototype, 'concat'); let array = [1, 2]; const sparseArray = [1, , 2]; const nonSpreadableArray = [1, 2]; nonSpreadableArray[Symbol.isConcatSpreadable] = false; const arrayLike = { 0: 1, 1: 2, length: 2 }; const spreadableArrayLike = { 0: 1, 1: 2, length: 2, [Symbol.isConcatSpreadable]: true }; assert.deepEqual(array.concat(), [1, 2], '#1'); assert.deepEqual(sparseArray.concat(), [1, , 2], '#2'); assert.deepEqual(nonSpreadableArray.concat(), [[1, 2]], '#3'); assert.deepEqual(concat.call(arrayLike), [{ 0: 1, 1: 2, length: 2 }], '#4'); assert.deepEqual(concat.call(spreadableArrayLike), [1, 2], '#5'); assert.deepEqual([].concat(array), [1, 2], '#6'); assert.deepEqual([].concat(sparseArray), [1, , 2], '#7'); assert.deepEqual([].concat(nonSpreadableArray), [[1, 2]], '#8'); assert.deepEqual([].concat(arrayLike), [{ 0: 1, 1: 2, length: 2 }], '#9'); assert.deepEqual([].concat(spreadableArrayLike), [1, 2], '#10'); assert.deepEqual(array.concat(sparseArray, nonSpreadableArray, arrayLike, spreadableArrayLike), [ 1, 2, 1, , 2, [1, 2], { 0: 1, 1: 2, length: 2 }, 1, 2, ], '#11'); array = []; array.constructor = { [Symbol.species]: function () { // eslint-disable-line object-shorthand return { foo: 1 }; } }; assert.same(array.concat().foo, 1, '@@species'); }); core-js-3.6.1/tests/tests/es.array.copy-within.js000066400000000000000000000033141360057567700217430ustar00rootroot00000000000000import { NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#copyWithin', assert => { const { copyWithin } = Array.prototype; assert.isFunction(copyWithin); assert.arity(copyWithin, 2); assert.name(copyWithin, 'copyWithin'); assert.looksNative(copyWithin); const array = [1]; assert.strictEqual(array.copyWithin(0), array); assert.nonEnumerable(Array.prototype, 'copyWithin'); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(0, 3), [4, 5, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(1, 3), [1, 4, 5, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(1, 2), [1, 3, 4, 5, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(2, 2), [1, 2, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(0, 3, 4), [4, 2, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(1, 3, 4), [1, 4, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(1, 2, 4), [1, 3, 4, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(0, -2), [4, 5, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(0, -2, -1), [4, 2, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(-4, -3, -2), [1, 3, 3, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(-4, -3, -1), [1, 3, 4, 4, 5]); assert.deepEqual([1, 2, 3, 4, 5].copyWithin(-4, -3), [1, 3, 4, 5, 5]); if (STRICT) { assert.throws(() => copyWithin.call(null, 0), TypeError); assert.throws(() => copyWithin.call(undefined, 0), TypeError); } if (NATIVE) { assert.deepEqual(copyWithin.call({ 0: 1, 1: 2, 2: 3, length: -1, }, 1, 2), { 0: 1, 1: 2, 2: 3, length: -1, }, 'uses ToLength'); } assert.ok('copyWithin' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.6.1/tests/tests/es.array.every.js000066400000000000000000000027601360057567700206270ustar00rootroot00000000000000import { NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#every', assert => { const { every } = Array.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.looksNative(every); assert.nonEnumerable(Array.prototype, 'every'); let array = [1]; const context = {}; array.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok([1, 2, 3].every(it => typeof it === 'number')); assert.ok([1, 2, 3].every(it => it < 4)); assert.ok(![1, 2, 3].every(it => it < 3)); assert.ok(![1, 2, 3].every(it => typeof it === 'string')); assert.ok([1, 2, 3].every(function () { return +this === 1; }, 1)); let result = ''; [1, 2, 3].every((value, key) => result += key); assert.ok(result === '012'); array = [1, 2, 3]; assert.ok(array.every((value, key, that) => that === array)); if (STRICT) { assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); } if (NATIVE) { assert.notThrows(() => every.call({ length: -1, 0: 1, }, () => { throw new Error(); }), 'uses ToLength'); } }); core-js-3.6.1/tests/tests/es.array.fill.js000066400000000000000000000023441360057567700204210ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#fill', assert => { const { fill } = Array.prototype; assert.isFunction(fill); assert.arity(fill, 1); assert.name(fill, 'fill'); assert.looksNative(fill); assert.nonEnumerable(Array.prototype, 'fill'); const array = new Array(5); assert.strictEqual(array.fill(5), array); assert.deepEqual(Array(5).fill(5), [5, 5, 5, 5, 5]); assert.deepEqual(Array(5).fill(5, 1), [undefined, 5, 5, 5, 5]); assert.deepEqual(Array(5).fill(5, 1, 4), [undefined, 5, 5, 5, undefined]); assert.deepEqual(Array(5).fill(5, 6, 1), [undefined, undefined, undefined, undefined, undefined]); assert.deepEqual(Array(5).fill(5, -3, 4), [undefined, undefined, 5, 5, undefined]); assert.arrayEqual(fill.call({ length: 5 }, 5), [5, 5, 5, 5, 5]); if (STRICT) { assert.throws(() => fill.call(null, 0), TypeError); assert.throws(() => fill.call(undefined, 0), TypeError); } if (NATIVE && DESCRIPTORS) { assert.notThrows(() => fill.call(Object.defineProperty({ length: -1, }, 0, { set() { throw Error(); }, })), 'uses ToLength'); } assert.ok('fill' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.6.1/tests/tests/es.array.filter.js000066400000000000000000000024551360057567700207630ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('Array#filter', assert => { const { filter } = Array.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.looksNative(filter); assert.nonEnumerable(Array.prototype, 'filter'); let array = [1]; const context = {}; array.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([1, 2, 3, 4, 5], [1, 2, 3, 'q', {}, 4, true, 5].filter(it => typeof it === 'number')); if (STRICT) { assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); } assert.notThrows(() => filter.call({ length: -1, 0: 1, }, () => { throw new Error(); }), 'uses ToLength'); array = []; array.constructor = { [Symbol.species]: function () { // eslint-disable-line object-shorthand return { foo: 1 }; } }; assert.same(array.filter(Boolean).foo, 1, '@@species'); }); core-js-3.6.1/tests/tests/es.array.find-index.js000066400000000000000000000024461360057567700215230ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#findIndex', assert => { const { findIndex } = Array.prototype; assert.isFunction(findIndex); assert.arity(findIndex, 1); assert.name(findIndex, 'findIndex'); assert.looksNative(findIndex); assert.nonEnumerable(Array.prototype, 'findIndex'); const array = [1]; const context = {}; array.findIndex(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same([1, 3, NaN, 42, {}].findIndex(it => it === 42), 3); assert.same([1, 3, NaN, 42, {}].findIndex(it => it === 43), -1); if (STRICT) { assert.throws(() => findIndex.call(null, 0), TypeError); assert.throws(() => findIndex.call(undefined, 0), TypeError); } if (NATIVE && DESCRIPTORS) { assert.notThrows(() => findIndex.call({ length: -1, 0: 1, }, () => { throw new Error(); }) === -1, 'uses ToLength'); } assert.ok('findIndex' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.6.1/tests/tests/es.array.find.js000066400000000000000000000023521360057567700204120ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#find', assert => { const { find } = Array.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.looksNative(find); assert.nonEnumerable(Array.prototype, 'find'); const array = [1]; const context = {}; array.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same([1, 3, NaN, 42, {}].find(it => it === 42), 42); assert.same([1, 3, NaN, 42, {}].find(it => it === 43), undefined); if (STRICT) { assert.throws(() => find.call(null, 0), TypeError); assert.throws(() => find.call(undefined, 0), TypeError); } if (NATIVE && DESCRIPTORS) { assert.notThrows(() => find.call({ length: -1, 0: 1, }, () => { throw new Error(); }) === undefined, 'uses ToLength'); } assert.ok('find' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.6.1/tests/tests/es.array.flat-map.js000066400000000000000000000023311360057567700211700ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('Array#flatMap', assert => { const { flatMap } = Array.prototype; assert.isFunction(flatMap); assert.name(flatMap, 'flatMap'); assert.arity(flatMap, 1); assert.looksNative(flatMap); assert.nonEnumerable(Array.prototype, 'flatMap'); assert.deepEqual([].flatMap(it => it), []); assert.deepEqual([1, 2, 3].flatMap(it => it), [1, 2, 3]); assert.deepEqual([1, 2, 3].flatMap(it => [it, it]), [1, 1, 2, 2, 3, 3]); assert.deepEqual([1, 2, 3].flatMap(it => [[it], [it]]), [[1], [1], [2], [2], [3], [3]]); assert.deepEqual([1, [2, 3]].flatMap(() => 1), [1, 1]); const array = [1]; const context = {}; array.flatMap(function (value, key, that) { assert.same(value, 1); assert.same(key, 0); assert.same(that, array); assert.same(this, context); return value; }, context); if (STRICT) { assert.throws(() => flatMap.call(null, it => it), TypeError); assert.throws(() => flatMap.call(undefined, it => it), TypeError); } assert.notThrows(() => flatMap.call({ length: -1 }, () => { throw new Error(); }).length === 0, 'uses ToLength'); assert.ok('flatMap' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.6.1/tests/tests/es.array.flat.js000066400000000000000000000022411360057567700204150ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants'; QUnit.test('Array#flat', assert => { const { flat } = Array.prototype; const { defineProperty } = Object; assert.isFunction(flat); assert.name(flat, 'flat'); assert.arity(flat, 0); assert.looksNative(flat); assert.nonEnumerable(Array.prototype, 'flat'); assert.deepEqual([].flat(), []); const array = [1, [2, 3], [4, [5, 6]]]; assert.deepEqual(array.flat(0), array); assert.deepEqual(array.flat(1), [1, 2, 3, 4, [5, 6]]); assert.deepEqual(array.flat(), [1, 2, 3, 4, [5, 6]]); assert.deepEqual(array.flat(2), [1, 2, 3, 4, 5, 6]); assert.deepEqual(array.flat(3), [1, 2, 3, 4, 5, 6]); assert.deepEqual(array.flat(-1), array); assert.deepEqual(array.flat(Infinity), [1, 2, 3, 4, 5, 6]); if (STRICT) { assert.throws(() => flat.call(null), TypeError); assert.throws(() => flat.call(undefined), TypeError); } if (DESCRIPTORS) { assert.notThrows(() => flat.call(defineProperty({ length: -1 }, 0, { get() { throw new Error(); }, })).length === 0, 'uses ToLength'); } assert.ok('flat' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.6.1/tests/tests/es.array.for-each.js000066400000000000000000000032511360057567700211550ustar00rootroot00000000000000import { NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#forEach', assert => { const { forEach } = Array.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.name(forEach, 'forEach'); assert.looksNative(forEach); assert.nonEnumerable(Array.prototype, 'forEach'); let array = [1]; const context = {}; array.forEach(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); let result = ''; [1, 2, 3].forEach(value => { result += value; }); assert.ok(result === '123'); result = ''; [1, 2, 3].forEach((value, key) => { result += key; }); assert.ok(result === '012'); result = ''; [1, 2, 3].forEach((value, key, that) => { result += that; }); assert.ok(result === '1,2,31,2,31,2,3'); result = ''; [1, 2, 3].forEach(function () { result += this; }, 1); assert.ok(result === '111'); result = ''; array = []; array[5] = ''; array.forEach((value, key) => { result += key; }); assert.ok(result === '5'); if (STRICT) { assert.throws(() => { forEach.call(null, () => { /* empty */ }); }, TypeError); assert.throws(() => { forEach.call(undefined, () => { /* empty */ }); }, TypeError); } if (NATIVE) { assert.notThrows(() => forEach.call({ length: -1, 0: 1, }, () => { throw new Error(); }) === undefined, 'uses ToLength'); } }); core-js-3.6.1/tests/tests/es.array.from.js000066400000000000000000000102751360057567700204400ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL } from '../helpers/constants'; import { createIterable } from '../helpers/helpers'; QUnit.test('Array.from', assert => { const Symbol = GLOBAL.Symbol || {}; const { from } = Array; const { defineProperty } = Object; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(Array, 'from'); let types = { 'array-like': { length: '3', 0: '1', 1: '2', 2: '3', }, arguments: function () { return arguments; }('1', '2', '3'), array: ['1', '2', '3'], iterable: createIterable(['1', '2', '3']), string: '123', }; for (const type in types) { const data = types[type]; assert.arrayEqual(from(data), ['1', '2', '3'], `Works with ${ type }`); assert.arrayEqual(from(data, it => it ** 2), [1, 4, 9], `Works with ${ type } + mapFn`); } types = { 'array-like': { length: 1, 0: 1, }, arguments: function () { return arguments; }(1), array: [1], iterable: createIterable([1]), string: '1', }; for (const type in types) { const data = types[type]; const context = {}; assert.arrayEqual(from(data, function (value, key) { assert.same(this, context, `Works with ${ type }, correct callback context`); assert.same(value, type === 'string' ? '1' : 1, `Works with ${ type }, correct callback key`); assert.same(key, 0, `Works with ${ type }, correct callback value`); assert.same(arguments.length, 2, `Works with ${ type }, correct callback arguments number`); return 42; }, context), [42], `Works with ${ type }, correct result`); } const primitives = [false, true, 0]; for (const primitive of primitives) { assert.arrayEqual(from(primitive), [], `Works with ${ primitive }`); } assert.throws(() => from(null), TypeError, 'Throws on null'); assert.throws(() => from(undefined), TypeError, 'Throws on undefined'); assert.arrayEqual(from('𠮷𠮷𠮷'), ['𠮷', '𠮷', '𠮷'], 'Uses correct string iterator'); let done = true; from(createIterable([1, 2, 3], { return() { return done = false; }, }), () => false); assert.ok(done, '.return #default'); done = false; try { from(createIterable([1, 2, 3], { return() { return done = true; }, }), () => { throw new Error(); }); } catch { /* empty */ } assert.ok(done, '.return #throw'); class C { /* empty */ } let instance = from.call(C, createIterable([1, 2])); assert.ok(instance instanceof C, 'generic, iterable case, instanceof'); assert.arrayEqual(instance, [1, 2], 'generic, iterable case, elements'); instance = from.call(C, { 0: 1, 1: 2, length: 2, }); assert.ok(instance instanceof C, 'generic, array-like case, instanceof'); assert.arrayEqual(instance, [1, 2], 'generic, array-like case, elements'); let array = [1, 2, 3]; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; assert.arrayEqual(from(array), [1, 2, 3], 'Array with custom iterator, elements'); assert.ok(done, 'call @@iterator in Array with custom iterator'); array = [1, 2, 3]; delete array[1]; assert.arrayEqual(from(array, String), ['1', 'undefined', '3'], 'Ignores holes'); assert.notThrows(() => from({ length: -1, 0: 1, }, () => { throw new Error(); }).length === 0, 'Uses ToLength'); assert.arrayEqual(from([], undefined), [], 'Works with undefined as asecond argument'); assert.throws(() => from([], null), TypeError, 'Throws with null as second argument'); assert.throws(() => from([], 0), TypeError, 'Throws with 0 as second argument'); assert.throws(() => from([], ''), TypeError, 'Throws with "" as second argument'); assert.throws(() => from([], false), TypeError, 'Throws with false as second argument'); assert.throws(() => from([], {}), TypeError, 'Throws with {} as second argument'); if (DESCRIPTORS) { let called = false; defineProperty(C.prototype, 0, { set() { called = true; }, }); from.call(C, [1, 2, 3]); assert.ok(!called, 'Should not call prototype accessors'); } }); core-js-3.6.1/tests/tests/es.array.includes.js000066400000000000000000000022151360057567700212760ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#includes', assert => { const { includes } = Array.prototype; assert.isFunction(includes); assert.name(includes, 'includes'); assert.arity(includes, 1); assert.looksNative(includes); assert.nonEnumerable(Array.prototype, 'includes'); const object = {}; const array = [1, 2, 3, -0, object]; assert.ok(array.includes(1)); assert.ok(array.includes(-0)); assert.ok(array.includes(0)); assert.ok(array.includes(object)); assert.ok(!array.includes(4)); assert.ok(!array.includes(-0.5)); assert.ok(!array.includes({})); assert.ok(Array(1).includes(undefined)); assert.ok([NaN].includes(NaN)); if (STRICT) { assert.throws(() => includes.call(null, 0), TypeError); assert.throws(() => includes.call(undefined, 0), TypeError); } if (NATIVE && DESCRIPTORS) { assert.notThrows(() => includes.call(Object.defineProperty({ length: -1, }, 0, { get() { throw new Error(); }, }), 1) === false, 'uses ToLength'); } assert.ok('includes' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); core-js-3.6.1/tests/tests/es.array.index-of.js000066400000000000000000000021371360057567700212040ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#indexOf', assert => { const { indexOf } = Array.prototype; assert.isFunction(indexOf); assert.arity(indexOf, 1); assert.name(indexOf, 'indexOf'); assert.looksNative(indexOf); assert.nonEnumerable(Array.prototype, 'indexOf'); assert.same(0, [1, 1, 1].indexOf(1)); assert.same(-1, [1, 2, 3].indexOf(1, 1)); assert.same(1, [1, 2, 3].indexOf(2, 1)); assert.same(-1, [1, 2, 3].indexOf(2, -1)); assert.same(1, [1, 2, 3].indexOf(2, -2)); assert.same(-1, [NaN].indexOf(NaN)); assert.same(3, Array(2).concat([1, 2, 3]).indexOf(2)); assert.same(-1, Array(1).indexOf(undefined)); assert.same(0, [1].indexOf(1, -0), "shouldn't return negative zero"); if (STRICT) { assert.throws(() => indexOf.call(null, 0), TypeError); assert.throws(() => indexOf.call(undefined, 0), TypeError); } if (NATIVE && DESCRIPTORS) { assert.notThrows(() => indexOf.call(Object.defineProperty({ length: -1, }, 0, { get() { throw new Error(); }, }), 1) === -1, 'uses ToLength'); } }); core-js-3.6.1/tests/tests/es.array.is-array.js000066400000000000000000000005461360057567700212240ustar00rootroot00000000000000QUnit.test('Array.isArray', assert => { const { isArray } = Array; assert.isFunction(isArray); assert.arity(isArray, 1); assert.name(isArray, 'isArray'); assert.looksNative(isArray); assert.nonEnumerable(Array, 'isArray'); assert.ok(!isArray({})); assert.ok(!isArray(function () { return arguments; }())); assert.ok(isArray([])); }); core-js-3.6.1/tests/tests/es.array.iterator.js000066400000000000000000000101411360057567700213160ustar00rootroot00000000000000import { GLOBAL, NATIVE } from '../helpers/constants'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('Array#keys', assert => { const { keys } = Array.prototype; assert.isFunction(keys); assert.arity(keys, 0); assert.name(keys, 'keys'); assert.looksNative(keys); assert.nonEnumerable(Array.prototype, 'keys'); const iterator = ['q', 'w', 'e'].keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.strictEqual(String(iterator), '[object Array Iterator]'); assert.deepEqual(iterator.next(), { value: 0, done: false, }); assert.deepEqual(iterator.next(), { value: 1, done: false, }); assert.deepEqual(iterator.next(), { value: 2, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); if (NATIVE) { assert.deepEqual(keys.call({ length: -1, }).next(), { value: undefined, done: true, }, 'uses ToLength'); } assert.ok('keys' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); QUnit.test('Array#values', assert => { const { values } = Array.prototype; assert.isFunction(values); assert.arity(values, 0); assert.name(values, 'values'); assert.looksNative(values); assert.nonEnumerable(Array.prototype, 'values'); const iterator = ['q', 'w', 'e'].values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); if (NATIVE) { assert.deepEqual(values.call({ length: -1, }).next(), { value: undefined, done: true, }, 'uses ToLength'); } assert.ok('values' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); QUnit.test('Array#entries', assert => { const { entries } = Array.prototype; assert.isFunction(entries); assert.arity(entries, 0); assert.name(entries, 'entries'); assert.looksNative(entries); assert.nonEnumerable(Array.prototype, 'entries'); const iterator = ['q', 'w', 'e'].entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: [0, 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: [1, 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: [2, 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); if (NATIVE) { assert.deepEqual(entries.call({ length: -1, }).next(), { value: undefined, done: true, }, 'uses ToLength'); } assert.ok('entries' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); }); QUnit.test('Array#@@iterator', assert => { assert.isIterable(Array.prototype); assert.arity(Array.prototype[Symbol.iterator], 0); assert.name(Array.prototype[Symbol.iterator], 'values'); assert.looksNative(Array.prototype[Symbol.iterator]); assert.nonEnumerable(Array.prototype, Symbol.iterator); assert.strictEqual(Array.prototype[Symbol.iterator], Array.prototype.values); const iterator = ['q', 'w', 'e'][Symbol.iterator](); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); if (NATIVE) { assert.deepEqual(Array.prototype[Symbol.iterator].call({ length: -1, }).next(), { value: undefined, done: true, }, 'uses ToLength'); } }); core-js-3.6.1/tests/tests/es.array.join.js000066400000000000000000000011131360057567700204230ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('Array#join', assert => { const { join } = Array.prototype; assert.isFunction(join); assert.arity(join, 1); assert.name(join, 'join'); assert.looksNative(join); assert.nonEnumerable(Array.prototype, 'join'); assert.strictEqual(join.call([1, 2, 3], undefined), '1,2,3'); assert.strictEqual(join.call('123'), '1,2,3'); assert.strictEqual(join.call('123', '|'), '1|2|3'); if (STRICT) { assert.throws(() => join.call(null, 0), TypeError); assert.throws(() => join.call(undefined, 0), TypeError); } }); core-js-3.6.1/tests/tests/es.array.last-index-of.js000066400000000000000000000024431360057567700221450ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#lastIndexOf', assert => { const { lastIndexOf } = Array.prototype; assert.isFunction(lastIndexOf); assert.arity(lastIndexOf, 1); assert.name(lastIndexOf, 'lastIndexOf'); assert.looksNative(lastIndexOf); assert.nonEnumerable(Array.prototype, 'lastIndexOf'); assert.same(2, [1, 1, 1].lastIndexOf(1)); assert.same(-1, [1, 2, 3].lastIndexOf(3, 1)); assert.same(1, [1, 2, 3].lastIndexOf(2, 1)); assert.same(-1, [1, 2, 3].lastIndexOf(2, -3)); assert.same(-1, [1, 2, 3].lastIndexOf(1, -4)); assert.same(1, [1, 2, 3].lastIndexOf(2, -2)); assert.same(-1, [NaN].lastIndexOf(NaN)); assert.same(1, [1, 2, 3].concat(Array(2)).lastIndexOf(2)); assert.same(0, [1].lastIndexOf(1, -0), "shouldn't return negative zero"); if (STRICT) { assert.throws(() => lastIndexOf.call(null, 0), TypeError); assert.throws(() => lastIndexOf.call(undefined, 0), TypeError); } if (NATIVE && DESCRIPTORS) { assert.notThrows(() => lastIndexOf.call(Object.defineProperties({ length: -1, }, { 2147483646: { get() { throw new Error(); }, }, 4294967294: { get() { throw new Error(); }, }, }), 1) === -1, 'uses ToLength'); } }); core-js-3.6.1/tests/tests/es.array.map.js000066400000000000000000000026141360057567700202500ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('Array#map', assert => { const { map } = Array.prototype; assert.isFunction(map); assert.arity(map, 1); assert.name(map, 'map'); assert.looksNative(map); assert.nonEnumerable(Array.prototype, 'map'); let array = [1]; const context = {}; array.map(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.deepEqual([2, 3, 4], [1, 2, 3].map(value => value + 1)); assert.deepEqual([1, 3, 5], [1, 2, 3].map((value, key) => value + key)); assert.deepEqual([2, 2, 2], [1, 2, 3].map(function () { return +this; }, 2)); if (STRICT) { assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); } assert.notThrows(() => map.call({ length: -1, 0: 1, }, () => { throw new Error(); }).length === 0, 'uses ToLength'); array = []; array.constructor = { [Symbol.species]: function () { // eslint-disable-line object-shorthand return { foo: 1 }; } }; assert.same(array.map(Boolean).foo, 1, '@@species'); }); core-js-3.6.1/tests/tests/es.array.of.js000066400000000000000000000015021360057567700200720ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Array.of', assert => { const { defineProperty } = Object; assert.isFunction(Array.of); assert.arity(Array.of, 0); assert.name(Array.of, 'of'); assert.looksNative(Array.of); assert.nonEnumerable(Array, 'of'); assert.deepEqual(Array.of(1), [1]); assert.deepEqual(Array.of(1, 2, 3), [1, 2, 3]); class C { /* empty */ } const instance = Array.of.call(C, 1, 2); assert.ok(instance instanceof C); assert.strictEqual(instance[0], 1); assert.strictEqual(instance[1], 2); assert.strictEqual(instance.length, 2); if (DESCRIPTORS) { let called = false; defineProperty(C.prototype, 0, { set() { called = true; }, }); Array.of.call(C, 1, 2, 3); assert.ok(!called, 'Should not call prototype accessors'); } }); core-js-3.6.1/tests/tests/es.array.reduce-right.js000066400000000000000000000037031360057567700220550ustar00rootroot00000000000000import { NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#reduceRight', assert => { const { reduceRight } = Array.prototype; assert.isFunction(reduceRight); assert.arity(reduceRight, 1); assert.name(reduceRight, 'reduceRight'); assert.looksNative(reduceRight); assert.nonEnumerable(Array.prototype, 'reduceRight'); const array = [1]; const accumulator = {}; array.reduceRight(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same([1, 2, 3].reduceRight(((a, b) => a + b), 1), 7, 'works with initial accumulator'); [1, 2].reduceRight((memo, value, key) => { assert.same(memo, 2, 'correct default accumulator'); assert.same(value, 1, 'correct start value without initial accumulator'); assert.same(key, 0, 'correct start index without initial accumulator'); }); assert.same([1, 2, 3].reduceRight((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; [1, 2, 3].reduceRight((memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '321', 'correct order #1'); assert.same(keys, '210', 'correct order #2'); assert.same(reduceRight.call({ 0: 1, 1: 2, length: 2, }, (a, b) => a + b), 3, 'generic'); if (STRICT) { assert.throws(() => reduceRight.call(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduceRight.call(undefined, () => { /* empty */ }, 1), TypeError); } if (NATIVE) { assert.notThrows(() => reduceRight.call({ length: -1, 2147483646: 0, 4294967294: 0, }, () => { throw new Error(); }, 1) === undefined, 'uses ToLength'); } }); core-js-3.6.1/tests/tests/es.array.reduce.js000066400000000000000000000035201360057567700207370ustar00rootroot00000000000000import { NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#reduce', assert => { const { reduce } = Array.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.looksNative(reduce); assert.nonEnumerable(Array.prototype, 'reduce'); const array = [1]; const accumulator = {}; array.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same([1, 2, 3].reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); [1, 2].reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 1, 'correct start index without initial accumulator'); }); assert.same([1, 2, 3].reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; [1, 2, 3].reduce((memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '123', 'correct order #1'); assert.same(keys, '012', 'correct order #2'); assert.same(reduce.call({ 0: 1, 1: 2, length: 2, }, (a, b) => a + b), 3, 'generic'); if (STRICT) { assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); } if (NATIVE) { assert.notThrows(() => reduce.call({ length: -1, 0: 1, }, () => { throw new Error(); }, 1) === undefined, 'uses ToLength'); } }); core-js-3.6.1/tests/tests/es.array.reverse.js000066400000000000000000000011511360057567700211410ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('Array#reverse', assert => { const { reverse } = Array.prototype; assert.isFunction(reverse); assert.arity(reverse, 0); assert.name(reverse, 'reverse'); assert.looksNative(reverse); assert.nonEnumerable(Array.prototype, 'reverse'); const a = [1, 2.2, 3.3]; function fn() { +a; a.reverse(); } fn(); assert.arrayEqual(a, [3.3, 2.2, 1]); if (STRICT) { assert.throws(() => reverse.call(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reverse.call(undefined, () => { /* empty */ }, 1), TypeError); } }); core-js-3.6.1/tests/tests/es.array.slice.js000066400000000000000000000032311360057567700205660ustar00rootroot00000000000000import { GLOBAL, NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#slice', assert => { const { slice } = Array.prototype; const { isArray } = Array; assert.isFunction(slice); assert.arity(slice, 2); assert.name(slice, 'slice'); assert.looksNative(slice); assert.nonEnumerable(Array.prototype, 'slice'); let array = ['1', '2', '3', '4', '5']; assert.deepEqual(array.slice(), array); assert.deepEqual(array.slice(1, 3), ['2', '3']); assert.deepEqual(array.slice(1, undefined), ['2', '3', '4', '5']); assert.deepEqual(array.slice(1, -1), ['2', '3', '4']); assert.deepEqual(array.slice(-2, -1), ['4']); assert.deepEqual(array.slice(-2, -3), []); const string = '12345'; assert.deepEqual(slice.call(string), array); assert.deepEqual(slice.call(string, 1, 3), ['2', '3']); assert.deepEqual(slice.call(string, 1, undefined), ['2', '3', '4', '5']); assert.deepEqual(slice.call(string, 1, -1), ['2', '3', '4']); assert.deepEqual(slice.call(string, -2, -1), ['4']); assert.deepEqual(slice.call(string, -2, -3), []); const list = GLOBAL.document && document.body && document.body.childNodes; if (list) { assert.notThrows(() => isArray(slice.call(list)), 'works on NodeList'); } if (NATIVE) { if (STRICT) { assert.throws(() => slice.call(null), TypeError); assert.throws(() => slice.call(undefined), TypeError); } assert.deepEqual(slice.call({ length: -1, 0: 1, }, 0, 1), [], 'uses ToLength'); } array = []; array.constructor = { [Symbol.species]: function () { // eslint-disable-line object-shorthand return { foo: 1 }; } }; assert.same(array.slice().foo, 1, '@@species'); }); core-js-3.6.1/tests/tests/es.array.some.js000066400000000000000000000030401360057567700204300ustar00rootroot00000000000000import { NATIVE, STRICT } from '../helpers/constants'; QUnit.test('Array#some', assert => { const { some } = Array.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.looksNative(some); assert.nonEnumerable(Array.prototype, 'some'); let array = [1]; const context = {}; array.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok([1, '2', 3].some(value => typeof value === 'number')); assert.ok([1, 2, 3].some(value => value < 3)); assert.ok(![1, 2, 3].some(value => value < 0)); assert.ok(![1, 2, 3].some(value => typeof value === 'string')); assert.ok(![1, 2, 3].some(function () { return +this !== 1; }, 1)); let result = ''; [1, 2, 3].some((value, key) => { result += key; return false; }); assert.ok(result === '012'); array = [1, 2, 3]; assert.ok(!array.some((value, key, that) => that !== array)); if (STRICT) { assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); } if (NATIVE) { assert.notThrows(() => some.call({ length: -1, 0: 1, }, () => { throw new Error(); }) === false, 'uses ToLength'); } }); core-js-3.6.1/tests/tests/es.array.sort.js000066400000000000000000000012261360057567700204600ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('Array#sort', assert => { const { sort } = Array.prototype; assert.isFunction(sort); assert.arity(sort, 1); assert.name(sort, 'sort'); assert.looksNative(sort); assert.nonEnumerable(Array.prototype, 'sort'); assert.notThrows(() => [1, 2, 3].sort(undefined).length === 3, 'works with undefined'); assert.throws(() => [1, 2, 3].sort(null), 'throws on null'); assert.throws(() => [1, 2, 3].sort({}), 'throws on {}'); if (STRICT) { assert.throws(() => sort.call(null), TypeError, 'ToObject(this)'); assert.throws(() => sort.call(undefined), TypeError, 'ToObject(this)'); } }); core-js-3.6.1/tests/tests/es.array.splice.js000066400000000000000000000024131360057567700207470ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('Array#splice', assert => { const { splice } = Array.prototype; assert.isFunction(splice); assert.arity(splice, 2); assert.name(splice, 'splice'); assert.looksNative(splice); assert.nonEnumerable(Array.prototype, 'splice'); let array = [1, 2, 3, 4, 5]; assert.deepEqual(array.splice(2), [3, 4, 5]); assert.deepEqual(array, [1, 2]); array = [1, 2, 3, 4, 5]; assert.deepEqual(array.splice(-2), [4, 5]); assert.deepEqual(array, [1, 2, 3]); array = [1, 2, 3, 4, 5]; assert.deepEqual(array.splice(2, 2), [3, 4]); assert.deepEqual(array, [1, 2, 5]); array = [1, 2, 3, 4, 5]; assert.deepEqual(array.splice(2, -2), []); assert.deepEqual(array, [1, 2, 3, 4, 5]); array = [1, 2, 3, 4, 5]; assert.deepEqual(array.splice(2, 2, 6, 7), [3, 4]); assert.deepEqual(array, [1, 2, 6, 7, 5]); if (STRICT) { assert.throws(() => splice.call(null), TypeError); assert.throws(() => splice.call(undefined), TypeError); } assert.deepEqual(splice.call({ length: -1, 0: 1, }), [], 'uses ToLength'); array = []; array.constructor = { [Symbol.species]: function () { // eslint-disable-line object-shorthand return { foo: 1 }; } }; assert.same(array.splice().foo, 1, '@@species'); }); core-js-3.6.1/tests/tests/es.data-view.js000066400000000000000000000176521360057567700202470ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE } from '../helpers/constants'; QUnit.test('DataView', assert => { assert.same(DataView, Object(DataView), 'is object'); // in Safari 5 typeof DataView is 'object' if (NATIVE) assert.arity(DataView, 3); // 1 in IE11 if (NATIVE) assert.name(DataView, 'DataView'); // Safari 5 bug if (NATIVE) assert.looksNative(DataView); // Safari 5 bug let dataview = new DataView(new ArrayBuffer(8)); assert.same(dataview.byteOffset, 0, '#byteOffset, passed buffer'); assert.same(dataview.byteLength, 8, '#byteLength, passed buffer'); dataview = new DataView(new ArrayBuffer(16), 8); assert.same(dataview.byteOffset, 8, '#byteOffset, passed buffer and byteOffset'); assert.same(dataview.byteLength, 8, '#byteLength, passed buffer and byteOffset'); dataview = new DataView(new ArrayBuffer(24), 8, 8); assert.same(dataview.byteOffset, 8, '#byteOffset, passed buffer, byteOffset and length'); assert.same(dataview.byteLength, 8, '#byteLength, passed buffer, byteOffset and length'); if (NATIVE) { // fails in IE / MS Edge dataview = new DataView(new ArrayBuffer(8), undefined); assert.same(dataview.byteOffset, 0, '#byteOffset, passed buffer and undefined'); assert.same(dataview.byteLength, 8, '#byteLength, passed buffer and undefined'); // fails in IE / MS Edge dataview = new DataView(new ArrayBuffer(16), 8, undefined); assert.same(dataview.byteOffset, 8, '#byteOffset, passed buffer, byteOffset and undefined'); assert.same(dataview.byteLength, 8, '#byteLength, passed buffer, byteOffset and undefined'); // fails in IE10 dataview = new DataView(new ArrayBuffer(8), 8); assert.same(dataview.byteOffset, 8, '#byteOffset, passed buffer and byteOffset with buffer length'); assert.same(dataview.byteLength, 0, '#byteLength, passed buffer and byteOffset with buffer length'); // TypeError in IE + FF bug - TypeError instead of RangeError assert.throws(() => new DataView(new ArrayBuffer(8), -1), RangeError, 'If offset < 0, throw a RangeError exception'); assert.throws(() => new DataView(new ArrayBuffer(8), 16), RangeError, 'If newByteLength < 0, throw a RangeError exception'); assert.throws(() => new DataView(new ArrayBuffer(24), 8, 24), RangeError, 'If offset+newByteLength > bufferByteLength, throw a RangeError exception'); // Android ~ 4.0 assert.throws(() => DataView(1), TypeError, 'throws without `new`'); assert.throws(() => DataView(1), 'throws without `new`'); } else { // FF bug - TypeError instead of RangeError assert.throws(() => new DataView(new ArrayBuffer(8), -1), 'If offset < 0, throw a RangeError exception'); assert.throws(() => new DataView(new ArrayBuffer(8), 16), 'If newByteLength < 0, throw a RangeError exception'); assert.throws(() => new DataView(new ArrayBuffer(24), 8, 24), 'If offset+newByteLength > bufferByteLength, throw a RangeError exception'); } dataview = new DataView(new ArrayBuffer(8)); dataview.setUint32(0, 0x12345678); assert.same(dataview.getUint32(0), 0x12345678, 'big endian/big endian'); dataview.setUint32(0, 0x12345678, true); assert.same(dataview.getUint32(0, true), 0x12345678, 'little endian/little endian'); dataview.setUint32(0, 0x12345678, true); assert.same(dataview.getUint32(0), 0x78563412, 'little endian/big endian'); dataview.setUint32(0, 0x12345678); assert.same(dataview.getUint32(0, true), 0x78563412, 'big endian/little endian'); assert.throws(() => new DataView({}), 'non-ArrayBuffer argument, object'); assert.throws(() => new DataView('foo'), 'non-ArrayBuffer argument, string'); }); if (DESCRIPTORS) { QUnit.test('DataView accessors', assert => { const uint8array = new Uint8Array(8); const dataview = new DataView(uint8array.buffer); assert.arrayEqual(uint8array, [0, 0, 0, 0, 0, 0, 0, 0]); dataview.setUint8(0, 255); assert.arrayEqual(uint8array, [0xFF, 0, 0, 0, 0, 0, 0, 0]); dataview.setInt8(1, -1); assert.arrayEqual(uint8array, [0xFF, 0xFF, 0, 0, 0, 0, 0, 0]); dataview.setUint16(2, 0x1234); assert.arrayEqual(uint8array, [0xFF, 0xFF, 0x12, 0x34, 0, 0, 0, 0]); dataview.setInt16(4, -1); assert.arrayEqual(uint8array, [0xFF, 0xFF, 0x12, 0x34, 0xFF, 0xFF, 0, 0]); dataview.setUint32(1, 0x12345678); assert.arrayEqual(uint8array, [0xFF, 0x12, 0x34, 0x56, 0x78, 0xFF, 0, 0]); dataview.setInt32(4, -2023406815); assert.arrayEqual(uint8array, [0xFF, 0x12, 0x34, 0x56, 0x87, 0x65, 0x43, 0x21]); dataview.setFloat32(2, 1.2e+38); assert.arrayEqual(uint8array, [0xFF, 0x12, 0x7E, 0xB4, 0x8E, 0x52, 0x43, 0x21]); dataview.setFloat64(0, -1.2345678e+301); assert.arrayEqual(uint8array, [0xFE, 0x72, 0x6F, 0x51, 0x5F, 0x61, 0x77, 0xE5]); const data = [0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87]; for (let i = 0, { length } = data; i < length; ++i) { uint8array[i] = data[i]; } assert.same(dataview.getUint8(0), 128); assert.same(dataview.getInt8(1), -127); assert.same(dataview.getUint16(2), 33411); assert.same(dataview.getInt16(3), -31868); assert.same(dataview.getUint32(4), 2223343239); assert.same(dataview.getInt32(2), -2105310075); assert.same(dataview.getFloat32(2), -1.932478247535851e-37); assert.same(dataview.getFloat64(0), -3.116851295377095e-306); }); QUnit.test('DataView endian', assert => { const { buffer } = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7]); let dataview = new DataView(buffer); assert.same(dataview.byteLength, 8, 'buffer'); assert.same(dataview.byteOffset, 0, 'buffer'); assert.throws(() => dataview.getUint8(-2)); assert.throws(() => dataview.getUint8(8), 'bounds for buffer'); assert.throws(() => dataview.setUint8(-2, 0), 'bounds for buffer'); assert.throws(() => dataview.setUint8(8, 0), 'bounds for buffer'); dataview = new DataView(buffer, 2); assert.same(dataview.byteLength, 6, 'buffer, byteOffset'); assert.same(dataview.byteOffset, 2, 'buffer, byteOffset'); assert.same(dataview.getUint8(5), 7, 'buffer, byteOffset'); assert.throws(() => dataview.getUint8(-2), 'bounds for buffer, byteOffset'); assert.throws(() => dataview.getUint8(6), 'bounds for buffer, byteOffset'); assert.throws(() => dataview.setUint8(-2, 0), 'bounds for buffer, byteOffset'); assert.throws(() => dataview.setUint8(6, 0), 'bounds for buffer, byteOffset'); assert.throws(() => new DataView(buffer, -1), 'invalid byteOffset'); assert.throws(() => new DataView(buffer, 9), 'invalid byteOffset'); dataview = new DataView(buffer, 2, 4); assert.same(dataview.byteLength, 4, 'buffer, byteOffset, length'); assert.same(dataview.byteOffset, 2, 'buffer, byteOffset, length'); assert.same(dataview.getUint8(3), 5, 'buffer, byteOffset, length'); assert.throws(() => dataview.getUint8(-2), 'bounds for buffer, byteOffset, length'); assert.throws(() => dataview.getUint8(4), 'bounds for buffer, byteOffset, length'); assert.throws(() => dataview.setUint8(-2, 0), 'bounds for buffer, byteOffset, length'); assert.throws(() => dataview.setUint8(4, 0), 'bounds for buffer, byteOffset, length'); assert.throws(() => new DataView(buffer, 0, 9), 'invalid byteOffset+length'); assert.throws(() => new DataView(buffer, 8, 1), 'invalid byteOffset+length'); assert.throws(() => new DataView(buffer, 9, -1), 'invalid byteOffset+length'); }); } const types = ['Uint8', 'Int8', 'Uint16', 'Int16', 'Uint32', 'Int32', 'Float32', 'Float64']; for (const type of types) { const GETTER = `get${ type }`; const SETTER = `set${ type }`; QUnit.test(`DataView#${ GETTER }`, assert => { assert.isFunction(DataView.prototype[GETTER]); NATIVE && assert.arity(DataView.prototype[GETTER], 1); assert.same(new DataView(new ArrayBuffer(8))[GETTER](0), 0, 'returns element'); }); QUnit.test(`DataView#${ SETTER }`, assert => { assert.isFunction(DataView.prototype[SETTER]); NATIVE && assert.arity(DataView.prototype[SETTER], 2); assert.same(new DataView(new ArrayBuffer(8))[SETTER](0, 0), undefined, 'void'); }); } core-js-3.6.1/tests/tests/es.date.now.js000066400000000000000000000004151360057567700200720ustar00rootroot00000000000000QUnit.test('Date.now', assert => { const { now } = Date; assert.isFunction(now); assert.arity(now, 0); assert.name(now, 'now'); assert.looksNative(now); assert.nonEnumerable(Date, 'now'); assert.ok(+new Date() - now() < 10, 'Date.now() ~ +new Date'); }); core-js-3.6.1/tests/tests/es.date.to-iso-string.js000066400000000000000000000016171360057567700220120ustar00rootroot00000000000000QUnit.test('Date#toISOString', assert => { const { toISOString } = Date.prototype; assert.isFunction(toISOString); assert.arity(toISOString, 0); assert.name(toISOString, 'toISOString'); assert.looksNative(toISOString); assert.nonEnumerable(Date.prototype, 'toISOString'); assert.strictEqual(new Date(0).toISOString(), '1970-01-01T00:00:00.000Z'); assert.strictEqual(new Date(1e12 + 1).toISOString(), '2001-09-09T01:46:40.001Z'); assert.strictEqual(new Date(-5e13 - 1).toISOString(), '0385-07-25T07:06:39.999Z'); const future = new Date(1e15 + 1).toISOString(); assert.ok(future === '+033658-09-27T01:46:40.001Z' || future === '33658-09-27T01:46:40.001Z'); const prehistoric = new Date(-1e15 + 1).toISOString(); assert.ok(prehistoric === '-029719-04-05T22:13:20.001Z' || prehistoric === '-29719-04-05T22:13:20.001Z'); assert.throws(() => new Date(NaN).toISOString(), RangeError); }); core-js-3.6.1/tests/tests/es.date.to-json.js000066400000000000000000000007461360057567700206670ustar00rootroot00000000000000QUnit.test('Date#toJSON', assert => { const { toJSON } = Date.prototype; assert.isFunction(toJSON); assert.arity(toJSON, 1); assert.name(toJSON, 'toJSON'); assert.looksNative(toJSON); assert.nonEnumerable(Date.prototype, 'toJSON'); const date = new Date(); assert.same(date.toJSON(), date.toISOString(), 'base'); assert.same(new Date(NaN).toJSON(), null, 'not finite'); assert.same(toJSON.call({ toISOString() { return 42; }, }), 42, 'generic'); }); core-js-3.6.1/tests/tests/es.date.to-primitive.js000066400000000000000000000023671360057567700217270ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('Date#@@toPrimitive', assert => { const toPrimitive = Date.prototype[Symbol.toPrimitive]; assert.isFunction(toPrimitive); assert.arity(toPrimitive, 1); assert.nonEnumerable(Date.prototype, Symbol.toPrimitive); const date = new Date(); assert.same(date[Symbol.toPrimitive]('string'), date.toString(), 'generic, hint "string"'); assert.same(date[Symbol.toPrimitive]('number'), +date, 'generic, hint "number"'); assert.same(date[Symbol.toPrimitive]('default'), date.toString(), 'generic, hint "default"'); assert.same(toPrimitive.call(Object(2), 'string'), '2', 'generic, hint "string"'); assert.same(toPrimitive.call(Object(2), 'number'), 2, 'generic, hint "number"'); assert.same(toPrimitive.call(Object(2), 'default'), '2', 'generic, hint "default"'); let data = [undefined, '', 'foo', { toString() { return 'string'; } }]; for (const value of data) { assert.throws(() => new Date()[Symbol.toPrimitive](value), TypeError, `throws on ${ value } as a hint`); } if (STRICT) { data = [1, false, 'string', null, undefined]; for (const value of data) { assert.throws(() => toPrimitive.call(value, 'string'), TypeError, `throws on ${ value } as \`this\``); } } }); core-js-3.6.1/tests/tests/es.date.to-string.js000066400000000000000000000004761360057567700212240ustar00rootroot00000000000000QUnit.test('Date#toString', assert => { const { toString } = Date.prototype; assert.isFunction(toString); assert.arity(toString, 0); assert.name(toString, 'toString'); assert.looksNative(toString); assert.nonEnumerable(Date.prototype, 'toString'); assert.same(String(new Date(NaN)), 'Invalid Date'); }); core-js-3.6.1/tests/tests/es.function.bind.js000066400000000000000000000016411360057567700211150ustar00rootroot00000000000000QUnit.test('Function#bind', assert => { const { bind } = Function.prototype; assert.isFunction(bind); assert.arity(bind, 1); assert.name(bind, 'bind'); assert.looksNative(bind); assert.nonEnumerable(Function.prototype, 'bind'); assert.same(function () { return this.a; }.bind({ a: 42 })(), 42); assert.same(new (function () { /* empty */ })().a, undefined); function A(a, b) { this.a = a; this.b = b; } const instance = new (A.bind(null, 1))(2); assert.ok(instance instanceof A); assert.strictEqual(instance.a, 1); assert.strictEqual(instance.b, 2); assert.same((it => it).bind(null, 42)(), 42); const regExpTest = RegExp.prototype.test.bind(/a/); assert.ok(regExpTest('a')); const Date2017 = Date.bind(null, 2017); const date = new Date2017(11); assert.ok(date instanceof Date); assert.strictEqual(date.getFullYear(), 2017); assert.strictEqual(date.getMonth(), 11); }); core-js-3.6.1/tests/tests/es.function.has-instance.js000066400000000000000000000004361360057567700225570ustar00rootroot00000000000000QUnit.test('Function#@@hasInstance', assert => { assert.ok(Symbol.hasInstance in Function.prototype); assert.nonEnumerable(Function.prototype, Symbol.hasInstance); assert.ok(Function[Symbol.hasInstance](() => { /* empty */ })); assert.ok(!Function[Symbol.hasInstance]({})); }); core-js-3.6.1/tests/tests/es.function.name.js000066400000000000000000000013711360057567700211210ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; if (DESCRIPTORS) { QUnit.test('Function#name', assert => { assert.ok('name' in Function.prototype); assert.nonEnumerable(Function.prototype, 'name'); function foo() { /* empty */ } assert.same(foo.name, 'foo'); assert.same(function () { /* empty */ }.name, ''); if (Object.freeze) { assert.same(Object.freeze(() => { /* empty */ }).name, ''); } function bar() { /* empty */ } bar.toString = function () { throw new Error(); }; assert.notThrows(() => bar.name === 'bar', 'works with redefined `.toString`'); const baz = Object(() => { /* empty */ }); baz.toString = function () { return ''; }; assert.same(baz.name, ''); }); } core-js-3.6.1/tests/tests/es.global-this.js000066400000000000000000000002371360057567700205620ustar00rootroot00000000000000QUnit.test('globalThis', assert => { assert.same(globalThis, Object(globalThis), 'is object'); assert.same(globalThis.Math, Math, 'contains globals'); }); core-js-3.6.1/tests/tests/es.json.stringify.js000066400000000000000000000016431360057567700213450ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants'; if (GLOBAL.JSON) { QUnit.test('Well‑formed JSON.stringify', assert => { const { stringify } = JSON; assert.isFunction(stringify); assert.arity(stringify, 3); assert.name(stringify, 'stringify'); assert.looksNative(stringify); assert.same(stringify({ foo: 'bar' }), '{"foo":"bar"}', 'basic'); assert.same(stringify('\uDEAD'), '"\\udead"', 'r1'); assert.same(stringify('\uDF06\uD834'), '"\\udf06\\ud834"', 'r2'); assert.same(stringify('\uDF06ab\uD834'), '"\\udf06ab\\ud834"', 'r3'); assert.same(stringify('𠮷'), '"𠮷"', 'r4'); assert.same(stringify('\uD834\uDF06'), '"𝌆"', 'r5'); assert.same(stringify('\uD834\uD834\uDF06'), '"\\ud834𝌆"', 'r6'); assert.same(stringify('\uD834\uDF06\uDF06'), '"𝌆\\udf06"', 'r7'); assert.same(stringify({ '𠮷': ['\uDF06\uD834'] }), '{"𠮷":["\\udf06\\ud834"]}', 'r8'); }); } core-js-3.6.1/tests/tests/es.map.js000066400000000000000000000316711360057567700171400ustar00rootroot00000000000000/* eslint-disable sonarjs/no-element-overwrite */ import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants'; import { createIterable, is, nativeSubclass } from '../helpers/helpers'; const Symbol = GLOBAL.Symbol || {}; const { getOwnPropertyDescriptor, keys, getOwnPropertyNames, getOwnPropertySymbols, freeze } = Object; const { ownKeys } = GLOBAL.Reflect || {}; QUnit.test('Map', assert => { assert.isFunction(Map); assert.arity(Map, 0); assert.name(Map, 'Map'); assert.looksNative(Map); assert.ok('clear' in Map.prototype, 'clear in Map.prototype'); assert.ok('delete' in Map.prototype, 'delete in Map.prototype'); assert.ok('forEach' in Map.prototype, 'forEach in Map.prototype'); assert.ok('get' in Map.prototype, 'get in Map.prototype'); assert.ok('has' in Map.prototype, 'has in Map.prototype'); assert.ok('set' in Map.prototype, 'set in Map.prototype'); assert.ok(new Map() instanceof Map, 'new Map instanceof Map'); assert.strictEqual(new Map(createIterable([[1, 1], [2, 2], [3, 3]])).size, 3, 'Init from iterable'); assert.strictEqual(new Map([[freeze({}), 1], [2, 3]]).size, 2, 'Support frozen objects'); let done = false; try { new Map(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.ok(done, '.return #throw'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; new Map(array); assert.ok(done); const object = {}; new Map().set(object, 1); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(Map); assert.ok(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.ok(new Subclass() instanceof Map, 'correct subclassing with native classes #2'); assert.strictEqual(new Subclass().set(1, 2).get(1), 2, 'correct subclassing with native classes #3'); } }); QUnit.test('Map#clear', assert => { assert.isFunction(Map.prototype.clear); assert.arity(Map.prototype.clear, 0); assert.name(Map.prototype.clear, 'clear'); assert.looksNative(Map.prototype.clear); assert.nonEnumerable(Map.prototype, 'clear'); let map = new Map(); map.clear(); assert.strictEqual(map.size, 0); map = new Map(); map.set(1, 2); map.set(2, 3); map.set(1, 4); map.clear(); assert.strictEqual(map.size, 0); assert.ok(!map.has(1)); assert.ok(!map.has(2)); const frozen = freeze({}); map = new Map(); map.set(1, 2); map.set(frozen, 3); map.clear(); assert.strictEqual(map.size, 0, 'Support frozen objects'); assert.ok(!map.has(1)); assert.ok(!map.has(frozen)); }); QUnit.test('Map#delete', assert => { assert.isFunction(Map.prototype.delete); assert.arity(Map.prototype.delete, 1); if (NATIVE) assert.name(Map.prototype.delete, 'delete'); assert.looksNative(Map.prototype.delete); assert.nonEnumerable(Map.prototype, 'delete'); const object = {}; const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 7); map.set(2, 5); map.set(1, 4); map.set(object, 9); assert.strictEqual(map.size, 5); assert.ok(map.delete(NaN)); assert.strictEqual(map.size, 4); assert.ok(!map.delete(4)); assert.strictEqual(map.size, 4); map.delete([]); assert.strictEqual(map.size, 4); map.delete(object); assert.strictEqual(map.size, 3); const frozen = freeze({}); map.set(frozen, 42); assert.strictEqual(map.size, 4); map.delete(frozen); assert.strictEqual(map.size, 3); }); QUnit.test('Map#forEach', assert => { assert.isFunction(Map.prototype.forEach); assert.arity(Map.prototype.forEach, 1); assert.name(Map.prototype.forEach, 'forEach'); assert.looksNative(Map.prototype.forEach); assert.nonEnumerable(Map.prototype, 'forEach'); let result = {}; let count = 0; const object = {}; let map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 7); map.set(2, 5); map.set(1, 4); map.set(object, 9); map.forEach((value, key) => { count++; result[value] = key; }); assert.strictEqual(count, 5); assert.deepEqual(result, { 1: NaN, 7: 3, 5: 2, 4: 1, 9: object, }); map = new Map(); map.set('0', 9); map.set('1', 9); map.set('2', 9); map.set('3', 9); result = ''; map.forEach((value, key) => { result += key; if (key === '2') { map.delete('2'); map.delete('3'); map.delete('1'); map.set('4', 9); } }); assert.strictEqual(result, '0124'); map = new Map([['0', 1]]); result = ''; map.forEach(it => { map.delete('0'); if (result !== '') throw new Error(); result += it; }); assert.strictEqual(result, '1'); assert.throws(() => { Map.prototype.forEach.call(new Set(), () => { /* empty */ }); }, 'non-generic'); }); QUnit.test('Map#get', assert => { assert.isFunction(Map.prototype.get); assert.name(Map.prototype.get, 'get'); assert.arity(Map.prototype.get, 1); assert.looksNative(Map.prototype.get); assert.nonEnumerable(Map.prototype, 'get'); const object = {}; const frozen = freeze({}); const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(frozen, 42); map.set(object, object); assert.strictEqual(map.get(NaN), 1); assert.strictEqual(map.get(4), undefined); assert.strictEqual(map.get({}), undefined); assert.strictEqual(map.get(object), object); assert.strictEqual(map.get(frozen), 42); assert.strictEqual(map.get(2), 5); }); QUnit.test('Map#has', assert => { assert.isFunction(Map.prototype.has); assert.name(Map.prototype.has, 'has'); assert.arity(Map.prototype.has, 1); assert.looksNative(Map.prototype.has); assert.nonEnumerable(Map.prototype, 'has'); const object = {}; const frozen = freeze({}); const map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(frozen, 42); map.set(object, object); assert.ok(map.has(NaN)); assert.ok(map.has(object)); assert.ok(map.has(2)); assert.ok(map.has(frozen)); assert.ok(!map.has(4)); assert.ok(!map.has({})); }); QUnit.test('Map#set', assert => { assert.isFunction(Map.prototype.set); assert.name(Map.prototype.set, 'set'); assert.arity(Map.prototype.set, 2); assert.looksNative(Map.prototype.set); assert.nonEnumerable(Map.prototype, 'set'); const object = {}; let map = new Map(); map.set(NaN, 1); map.set(2, 1); map.set(3, 1); map.set(2, 5); map.set(1, 4); map.set(object, object); assert.ok(map.size === 5); const chain = map.set(7, 2); assert.strictEqual(chain, map); map.set(7, 2); assert.strictEqual(map.size, 6); assert.strictEqual(map.get(7), 2); assert.strictEqual(map.get(NaN), 1); map.set(NaN, 42); assert.strictEqual(map.size, 6); assert.strictEqual(map.get(NaN), 42); map.set({}, 11); assert.strictEqual(map.size, 7); assert.strictEqual(map.get(object), object); map.set(object, 27); assert.strictEqual(map.size, 7); assert.strictEqual(map.get(object), 27); map = new Map(); map.set(NaN, 2); map.set(NaN, 3); map.set(NaN, 4); assert.strictEqual(map.size, 1); const frozen = freeze({}); map = new Map().set(frozen, 42); assert.strictEqual(map.get(frozen), 42); }); QUnit.test('Map#size', assert => { assert.nonEnumerable(Map.prototype, 'size'); const map = new Map(); map.set(2, 1); const { size } = map; assert.strictEqual(typeof size, 'number', 'size is number'); assert.strictEqual(size, 1, 'size is correct'); if (DESCRIPTORS) { const sizeDescriptor = getOwnPropertyDescriptor(Map.prototype, 'size'); assert.ok(sizeDescriptor && sizeDescriptor.get, 'size is getter'); assert.ok(sizeDescriptor && !sizeDescriptor.set, 'size isnt setter'); assert.throws(() => Map.prototype.size, TypeError); } }); QUnit.test('Map & -0', assert => { let map = new Map(); map.set(-0, 1); assert.strictEqual(map.size, 1); assert.ok(map.has(0)); assert.ok(map.has(-0)); assert.strictEqual(map.get(0), 1); assert.strictEqual(map.get(-0), 1); map.forEach((val, key) => { assert.ok(!is(key, -0)); }); map.delete(-0); assert.strictEqual(map.size, 0); map = new Map([[-0, 1]]); map.forEach((val, key) => { assert.ok(!is(key, -0)); }); map = new Map(); map.set(4, 4); map.set(3, 3); map.set(2, 2); map.set(1, 1); map.set(0, 0); assert.ok(map.has(-0)); }); QUnit.test('Map#@@toStringTag', assert => { assert.strictEqual(Map.prototype[Symbol.toStringTag], 'Map', 'Map::@@toStringTag is `Map`'); assert.strictEqual(String(new Map()), '[object Map]', 'correct stringification'); }); QUnit.test('Map Iterator', assert => { const map = new Map(); map.set('a', 1); map.set('b', 2); map.set('c', 3); map.set('d', 4); const results = []; const iterator = map.keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.nonEnumerable(iterator, 'next'); assert.nonEnumerable(iterator, Symbol.iterator); results.push(iterator.next().value); assert.ok(map.delete('a')); assert.ok(map.delete('b')); assert.ok(map.delete('c')); map.set('e'); results.push(iterator.next().value); results.push(iterator.next().value); assert.ok(iterator.next().done); map.set('f'); assert.ok(iterator.next().done); assert.deepEqual(results, ['a', 'd', 'e']); }); QUnit.test('Map#keys', assert => { assert.isFunction(Map.prototype.keys); assert.name(Map.prototype.keys, 'keys'); assert.arity(Map.prototype.keys, 0); assert.looksNative(Map.prototype.keys); assert.nonEnumerable(Map.prototype, 'keys'); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: 'a', done: false, }); assert.deepEqual(iterator.next(), { value: 's', done: false, }); assert.deepEqual(iterator.next(), { value: 'd', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#values', assert => { assert.isFunction(Map.prototype.values); assert.name(Map.prototype.values, 'values'); assert.arity(Map.prototype.values, 0); assert.looksNative(Map.prototype.values); assert.nonEnumerable(Map.prototype, 'values'); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#entries', assert => { assert.isFunction(Map.prototype.entries); assert.name(Map.prototype.entries, 'entries'); assert.arity(Map.prototype.entries, 0); assert.looksNative(Map.prototype.entries); assert.nonEnumerable(Map.prototype, 'entries'); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map.entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Map Iterator'); assert.deepEqual(iterator.next(), { value: ['a', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['s', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['d', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Map#@@iterator', assert => { assert.isIterable(Map.prototype); assert.name(Map.prototype.entries, 'entries'); assert.arity(Map.prototype.entries, 0); assert.looksNative(Map.prototype[Symbol.iterator]); assert.strictEqual(Map.prototype[Symbol.iterator], Map.prototype.entries); const map = new Map(); map.set('a', 'q'); map.set('s', 'w'); map.set('d', 'e'); const iterator = map[Symbol.iterator](); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Map Iterator'); assert.strictEqual(String(iterator), '[object Map Iterator]'); assert.deepEqual(iterator.next(), { value: ['a', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['s', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['d', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/tests/es.math.acosh.js000066400000000000000000000013061360057567700204000ustar00rootroot00000000000000QUnit.test('Math.acosh', assert => { const { acosh } = Math; assert.isFunction(acosh); assert.name(acosh, 'acosh'); assert.arity(acosh, 1); assert.looksNative(acosh); assert.nonEnumerable(Math, 'acosh'); assert.same(acosh(NaN), NaN); assert.same(acosh(0.5), NaN); assert.same(acosh(-1), NaN); assert.same(acosh(-1e300), NaN); assert.same(acosh(1), 0); assert.strictEqual(acosh(Infinity), Infinity); assert.epsilon(acosh(1234), 7.811163220849231); assert.epsilon(acosh(8.88), 2.8737631531629235); assert.epsilon(acosh(1e+160), 369.10676205960726); assert.epsilon(acosh(Number.MAX_VALUE), 710.475860073944); assert.epsilon(acosh(1 + Number.EPSILON), 2.1073424255447017e-8); }); core-js-3.6.1/tests/tests/es.math.asinh.js000066400000000000000000000012271360057567700204070ustar00rootroot00000000000000QUnit.test('Math.asinh', assert => { const { asinh } = Math; assert.isFunction(asinh); assert.name(asinh, 'asinh'); assert.arity(asinh, 1); assert.looksNative(asinh); assert.nonEnumerable(Math, 'asinh'); assert.same(asinh(NaN), NaN); assert.same(asinh(0), 0); assert.same(asinh(-0), -0); assert.strictEqual(asinh(Infinity), Infinity); assert.strictEqual(asinh(-Infinity), -Infinity); assert.epsilon(asinh(1234), 7.811163549201245); assert.epsilon(asinh(9.99), 2.997227420191335); assert.epsilon(asinh(1e150), 346.0809111296668); assert.epsilon(asinh(1e7), 16.811242831518268); assert.epsilon(asinh(-1e7), -16.811242831518268); }); core-js-3.6.1/tests/tests/es.math.atanh.js000066400000000000000000000013521360057567700203770ustar00rootroot00000000000000QUnit.test('Math.atanh', assert => { const { atanh } = Math; assert.isFunction(atanh); assert.name(atanh, 'atanh'); assert.arity(atanh, 1); assert.looksNative(atanh); assert.nonEnumerable(Math, 'atanh'); assert.same(atanh(NaN), NaN); assert.same(atanh(-2), NaN); assert.same(atanh(-1.5), NaN); assert.same(atanh(2), NaN); assert.same(atanh(1.5), NaN); assert.strictEqual(atanh(-1), -Infinity); assert.strictEqual(atanh(1), Infinity); assert.same(atanh(0), 0); assert.same(atanh(-0), -0); assert.same(atanh(-1e300), NaN); assert.same(atanh(1e300), NaN); assert.epsilon(atanh(0.5), 0.5493061443340549); assert.epsilon(atanh(-0.5), -0.5493061443340549); assert.epsilon(atanh(0.444), 0.47720201260109457); }); core-js-3.6.1/tests/tests/es.math.cbrt.js000066400000000000000000000010311360057567700202300ustar00rootroot00000000000000QUnit.test('Math.cbrt', assert => { const { cbrt } = Math; assert.isFunction(cbrt); assert.name(cbrt, 'cbrt'); assert.arity(cbrt, 1); assert.looksNative(cbrt); assert.nonEnumerable(Math, 'cbrt'); assert.same(cbrt(NaN), NaN); assert.same(cbrt(0), 0); assert.same(cbrt(-0), -0); assert.strictEqual(cbrt(Infinity), Infinity); assert.strictEqual(cbrt(-Infinity), -Infinity); assert.strictEqual(cbrt(-8), -2); assert.strictEqual(cbrt(8), 2); assert.epsilon(cbrt(-1000), -10); assert.epsilon(cbrt(1000), 10); }); core-js-3.6.1/tests/tests/es.math.clz32.js000066400000000000000000000006671360057567700202510ustar00rootroot00000000000000QUnit.test('Math.clz32', assert => { const { clz32 } = Math; assert.isFunction(clz32); assert.name(clz32, 'clz32'); assert.arity(clz32, 1); assert.looksNative(clz32); assert.nonEnumerable(Math, 'clz32'); assert.strictEqual(clz32(0), 32); assert.strictEqual(clz32(1), 31); assert.same(clz32(-1), 0); assert.strictEqual(clz32(0.6), 32); assert.same(clz32(2 ** 32 - 1), 0); assert.strictEqual(clz32(2 ** 32), 32); }); core-js-3.6.1/tests/tests/es.math.cosh.js000066400000000000000000000012761360057567700202450ustar00rootroot00000000000000QUnit.test('Math.cosh', assert => { const { cosh } = Math; assert.isFunction(cosh); assert.name(cosh, 'cosh'); assert.arity(cosh, 1); assert.looksNative(cosh); assert.nonEnumerable(Math, 'cosh'); assert.same(cosh(NaN), NaN); assert.strictEqual(cosh(0), 1); assert.strictEqual(cosh(-0), 1); assert.strictEqual(cosh(Infinity), Infinity); assert.strictEqual(cosh(-Infinity), Infinity); assert.epsilon(cosh(12), 81377.395712574, 1e-9); assert.epsilon(cosh(22), 1792456423.065795780980053377, 1e-5); assert.epsilon(cosh(-10), 11013.23292010332313972137); assert.epsilon(cosh(-23), 4872401723.1244513000, 1e-5); assert.epsilon(cosh(710), 1.1169973830808557e+308, 1e+295); }); core-js-3.6.1/tests/tests/es.math.expm1.js000066400000000000000000000007671360057567700203470ustar00rootroot00000000000000QUnit.test('Math.expm1', assert => { const { expm1 } = Math; assert.isFunction(expm1); assert.name(expm1, 'expm1'); assert.arity(expm1, 1); assert.looksNative(expm1); assert.nonEnumerable(Math, 'expm1'); assert.same(expm1(NaN), NaN); assert.same(expm1(0), 0); assert.same(expm1(-0), -0); assert.strictEqual(expm1(Infinity), Infinity); assert.strictEqual(expm1(-Infinity), -1); assert.epsilon(expm1(10), 22025.465794806718); assert.epsilon(expm1(-10), -0.9999546000702375); }); core-js-3.6.1/tests/tests/es.math.fround.js000066400000000000000000000026201360057567700206000ustar00rootroot00000000000000QUnit.test('Math.fround', assert => { const { fround } = Math; assert.isFunction(fround); assert.name(fround, 'fround'); assert.arity(fround, 1); assert.looksNative(fround); assert.nonEnumerable(Math, 'fround'); assert.same(fround(undefined), NaN); assert.same(fround(NaN), NaN); assert.same(fround(0), 0); assert.same(fround(-0), -0); assert.same(fround(Number.MIN_VALUE), 0); assert.same(fround(-Number.MIN_VALUE), -0); assert.strictEqual(fround(Infinity), Infinity); assert.strictEqual(fround(-Infinity), -Infinity); assert.strictEqual(fround(1.7976931348623157e+308), Infinity); assert.strictEqual(fround(-1.7976931348623157e+308), -Infinity); assert.strictEqual(fround(3.4028235677973366e+38), Infinity); assert.strictEqual(fround(3), 3); assert.strictEqual(fround(-3), -3); const maxFloat32 = 3.4028234663852886e+38; const minFloat32 = 1.401298464324817e-45; assert.strictEqual(fround(maxFloat32), maxFloat32); assert.strictEqual(fround(-maxFloat32), -maxFloat32); assert.strictEqual(fround(maxFloat32 + 2 ** 102), maxFloat32); assert.strictEqual(fround(minFloat32), minFloat32); assert.strictEqual(fround(-minFloat32), -minFloat32); assert.same(fround(minFloat32 / 2), 0); assert.same(fround(-minFloat32 / 2), -0); assert.strictEqual(fround(minFloat32 / 2 + 2 ** -202), minFloat32); assert.strictEqual(fround(-minFloat32 / 2 - 2 ** -202), -minFloat32); }); core-js-3.6.1/tests/tests/es.math.hypot.js000066400000000000000000000036011360057567700204460ustar00rootroot00000000000000QUnit.test('Math.hypot', assert => { const { hypot, sqrt } = Math; assert.isFunction(hypot); assert.name(hypot, 'hypot'); assert.arity(hypot, 2); assert.looksNative(hypot); assert.nonEnumerable(Math, 'hypot'); assert.strictEqual(hypot(), 0); assert.strictEqual(hypot(1), 1); assert.same(hypot('', 0), 0); assert.same(hypot(0, ''), 0); assert.strictEqual(hypot(Infinity, 0), Infinity, 'Infinity, 0'); assert.strictEqual(hypot(-Infinity, 0), Infinity, '-Infinity, 0'); assert.strictEqual(hypot(0, Infinity), Infinity, '0, Infinity'); assert.strictEqual(hypot(0, -Infinity), Infinity, '0, -Infinity'); assert.strictEqual(hypot(Infinity, NaN), Infinity, 'Infinity, NaN'); assert.strictEqual(hypot(NaN, -Infinity), Infinity, 'NaN, -Infinity'); assert.same(hypot(NaN, 0), NaN, 'NaN, 0'); assert.same(hypot(0, NaN), NaN, '0, NaN'); assert.same(hypot(0, -0), 0); assert.same(hypot(0, 0), 0); assert.same(hypot(-0, -0), 0); assert.same(hypot(-0, 0), 0); assert.strictEqual(hypot(0, 1), 1); assert.strictEqual(hypot(0, -1), 1); assert.strictEqual(hypot(-0, 1), 1); assert.strictEqual(hypot(-0, -1), 1); assert.same(hypot(0), 0); assert.strictEqual(hypot(1), 1); assert.strictEqual(hypot(2), 2); assert.strictEqual(hypot(0, 0, 1), 1); assert.strictEqual(hypot(0, 1, 0), 1); assert.strictEqual(hypot(1, 0, 0), 1); assert.strictEqual(hypot(2, 3, 4), sqrt(2 * 2 + 3 * 3 + 4 * 4)); assert.strictEqual(hypot(2, 3, 4, 5), sqrt(2 * 2 + 3 * 3 + 4 * 4 + 5 * 5)); assert.epsilon(hypot(66, 66), 93.33809511662427); assert.epsilon(hypot(0.1, 100), 100.0000499999875); assert.strictEqual(hypot(1e+300, 1e+300), 1.4142135623730952e+300); assert.strictEqual(Math.floor(hypot(1e-300, 1e-300) * 1e308), 141421356); assert.strictEqual(hypot(1e+300, 1e+300, 2, 3), 1.4142135623730952e+300); assert.strictEqual(hypot(-3, 4), 5); assert.strictEqual(hypot(3, -4), 5); }); core-js-3.6.1/tests/tests/es.math.imul.js000066400000000000000000000030051360057567700202470ustar00rootroot00000000000000QUnit.test('Math.imul', assert => { const { imul } = Math; assert.isFunction(imul); assert.name(imul, 'imul'); assert.arity(imul, 2); assert.looksNative(imul); assert.nonEnumerable(Math, 'imul'); assert.same(imul(0, 0), 0); assert.strictEqual(imul(123, 456), 56088); assert.strictEqual(imul(-123, 456), -56088); assert.strictEqual(imul(123, -456), -56088); assert.strictEqual(imul(19088743, 4275878552), 602016552); assert.same(imul(false, 7), 0); assert.same(imul(7, false), 0); assert.same(imul(false, false), 0); assert.strictEqual(imul(true, 7), 7); assert.strictEqual(imul(7, true), 7); assert.strictEqual(imul(true, true), 1); assert.same(imul(undefined, 7), 0); assert.same(imul(7, undefined), 0); assert.same(imul(undefined, undefined), 0); assert.same(imul('str', 7), 0); assert.same(imul(7, 'str'), 0); assert.same(imul({}, 7), 0); assert.same(imul(7, {}), 0); assert.same(imul([], 7), 0); assert.same(imul(7, []), 0); assert.strictEqual(imul(0xFFFFFFFF, 5), -5); assert.strictEqual(imul(0xFFFFFFFE, 5), -10); assert.strictEqual(imul(2, 4), 8); assert.strictEqual(imul(-1, 8), -8); assert.strictEqual(imul(-2, -2), 4); assert.same(imul(-0, 7), 0); assert.same(imul(7, -0), 0); assert.same(imul(0.1, 7), 0); assert.same(imul(7, 0.1), 0); assert.same(imul(0.9, 7), 0); assert.same(imul(7, 0.9), 0); assert.strictEqual(imul(1.1, 7), 7); assert.strictEqual(imul(7, 1.1), 7); assert.strictEqual(imul(1.9, 7), 7); assert.strictEqual(imul(7, 1.9), 7); }); core-js-3.6.1/tests/tests/es.math.log10.js000066400000000000000000000013311360057567700202230ustar00rootroot00000000000000QUnit.test('Math.log10', assert => { const { log10 } = Math; assert.isFunction(log10); assert.name(log10, 'log10'); assert.arity(log10, 1); assert.looksNative(log10); assert.nonEnumerable(Math, 'log10'); assert.same(log10(''), log10(0)); assert.same(log10(NaN), NaN); assert.same(log10(-1), NaN); assert.same(log10(0), -Infinity); assert.same(log10(-0), -Infinity); assert.same(log10(1), 0); assert.same(log10(Infinity), Infinity); assert.epsilon(log10(0.1), -1); assert.epsilon(log10(0.5), -0.3010299956639812); assert.epsilon(log10(1.5), 0.17609125905568124); assert.epsilon(log10(5), 0.6989700043360189); assert.epsilon(log10(50), 1.6989700043360187); assert.epsilon(log10(1000), 3); }); core-js-3.6.1/tests/tests/es.math.log1p.js000066400000000000000000000010501360057567700203210ustar00rootroot00000000000000QUnit.test('Math.log1p', assert => { const { log1p } = Math; assert.isFunction(log1p); assert.name(log1p, 'log1p'); assert.arity(log1p, 1); assert.looksNative(log1p); assert.nonEnumerable(Math, 'log1p'); assert.same(log1p(''), log1p(0)); assert.same(log1p(NaN), NaN); assert.same(log1p(-2), NaN); assert.same(log1p(-1), -Infinity); assert.same(log1p(0), 0); assert.same(log1p(-0), -0); assert.same(log1p(Infinity), Infinity); assert.epsilon(log1p(5), 1.791759469228055); assert.epsilon(log1p(50), 3.9318256327243257); }); core-js-3.6.1/tests/tests/es.math.log2.js000066400000000000000000000010461360057567700201470ustar00rootroot00000000000000QUnit.test('Math.log2', assert => { const { log2 } = Math; assert.isFunction(log2); assert.name(log2, 'log2'); assert.arity(log2, 1); assert.looksNative(log2); assert.nonEnumerable(Math, 'log2'); assert.same(log2(''), log2(0)); assert.same(log2(NaN), NaN); assert.same(log2(-1), NaN); assert.same(log2(0), -Infinity); assert.same(log2(-0), -Infinity); assert.same(log2(1), 0); assert.same(log2(Infinity), Infinity); assert.same(log2(0.5), -1); assert.same(log2(32), 5); assert.epsilon(log2(5), 2.321928094887362); }); core-js-3.6.1/tests/tests/es.math.sign.js000066400000000000000000000011151360057567700202410ustar00rootroot00000000000000QUnit.test('Math.sign', assert => { const { sign } = Math; assert.isFunction(sign); assert.name(sign, 'sign'); assert.arity(sign, 1); assert.looksNative(sign); assert.nonEnumerable(Math, 'sign'); assert.same(sign(NaN), NaN); assert.same(sign(), NaN); assert.same(sign(-0), -0); assert.same(sign(0), 0); assert.strictEqual(sign(Infinity), 1); assert.strictEqual(sign(-Infinity), -1); assert.strictEqual(sign(13510798882111488), 1); assert.strictEqual(sign(-13510798882111488), -1); assert.strictEqual(sign(42.5), 1); assert.strictEqual(sign(-42.5), -1); }); core-js-3.6.1/tests/tests/es.math.sinh.js000066400000000000000000000010301360057567700202360ustar00rootroot00000000000000QUnit.test('Math.sinh', assert => { const { sinh } = Math; assert.isFunction(sinh); assert.name(sinh, 'sinh'); assert.arity(sinh, 1); assert.looksNative(sinh); assert.nonEnumerable(Math, 'sinh'); assert.same(sinh(NaN), NaN); assert.same(sinh(0), 0); assert.same(sinh(-0), -0); assert.strictEqual(sinh(Infinity), Infinity); assert.strictEqual(sinh(-Infinity), -Infinity); assert.epsilon(sinh(-5), -74.20321057778875); assert.epsilon(sinh(2), 3.6268604078470186); assert.strictEqual(sinh(-2e-17), -2e-17); }); core-js-3.6.1/tests/tests/es.math.tanh.js000066400000000000000000000010071360057567700202330ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants'; QUnit.test('Math.tanh', assert => { const { tanh } = Math; assert.isFunction(tanh); assert.name(tanh, 'tanh'); assert.arity(tanh, 1); assert.looksNative(tanh); assert.nonEnumerable(Math, 'tanh'); assert.same(tanh(NaN), NaN); assert.same(tanh(0), 0); assert.same(tanh(-0), -0); assert.strictEqual(tanh(Infinity), 1); assert.strictEqual(tanh(90), 1); assert.epsilon(tanh(10), 0.9999999958776927); if (NATIVE) assert.strictEqual(tanh(710), 1); }); core-js-3.6.1/tests/tests/es.math.trunc.js000066400000000000000000000021161360057567700204360ustar00rootroot00000000000000QUnit.test('Math.trunc', assert => { const { trunc } = Math; assert.isFunction(trunc); assert.name(trunc, 'trunc'); assert.arity(trunc, 1); assert.looksNative(trunc); assert.nonEnumerable(Math, 'trunc'); assert.same(trunc(NaN), NaN, 'NaN -> NaN'); assert.same(trunc(-0), -0, '-0 -> -0'); assert.same(trunc(0), 0, '0 -> 0'); assert.same(trunc(Infinity), Infinity, 'Infinity -> Infinity'); assert.same(trunc(-Infinity), -Infinity, '-Infinity -> -Infinity'); assert.same(trunc(null), 0, 'null -> 0'); assert.same(trunc({}), NaN, '{} -> NaN'); assert.strictEqual(trunc([]), 0, '[] -> 0'); assert.strictEqual(trunc(1.01), 1, '1.01 -> 0'); assert.strictEqual(trunc(1.99), 1, '1.99 -> 0'); assert.strictEqual(trunc(-1), -1, '-1 -> -1'); assert.strictEqual(trunc(-1.99), -1, '-1.99 -> -1'); assert.strictEqual(trunc(-555.555), -555, '-555.555 -> -555'); assert.strictEqual(trunc(0x20000000000001), 0x20000000000001, '0x20000000000001 -> 0x20000000000001'); assert.strictEqual(trunc(-0x20000000000001), -0x20000000000001, '-0x20000000000001 -> -0x20000000000001'); }); core-js-3.6.1/tests/tests/es.number.constructor.js000066400000000000000000000152741360057567700222400ustar00rootroot00000000000000import { nativeSubclass } from '../helpers/helpers'; const whitespaces = ' \t\u000B\f\u00A0\uFEFF\n\r\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'; function getCheck(assert) { return function (a, b) { assert.same(Number(a), b, `Number ${ typeof a } ${ a } -> ${ b }`); const x = new Number(a); assert.ok(x === Object(x), `new Number ${ typeof a } ${ a } is object`); assert.strictEqual({}.toString.call(x).slice(8, -1), 'Number', `classof new Number ${ typeof a } ${ a } is Number`); assert.same(x.valueOf(), b, `new Number(${ typeof a } ${ a }).valueOf() -> ${ b }`); }; } QUnit.test('Number constructor: regression', assert => { const check = getCheck(assert); assert.isFunction(Number); assert.arity(Number, 1); assert.name(Number, 'Number'); assert.looksNative(Number); assert.same(Number.prototype.constructor, Number); assert.same(1.0.constructor, Number); const constants = ['MAX_VALUE', 'MIN_VALUE', 'NaN', 'NEGATIVE_INFINITY', 'POSITIVE_INFINITY']; for (const constant of constants) { assert.ok(constant in Number, `Number.${ constant }`); assert.nonEnumerable(Number, constant); } assert.same(Number(), 0); assert.same(new Number().valueOf(), 0); check(42, 42); check(42.42, 42.42); check(new Number(42), 42); check(new Number(42.42), 42.42); check('42', 42); check('42.42', 42.42); check('0x42', 66); check('0X42', 66); check('0xzzz', NaN); check('0x1g', NaN); check('+0x1', NaN); check('-0x1', NaN); check('+0X1', NaN); check('-0X1', NaN); check(new String('42'), 42); check(new String('42.42'), 42.42); check(new String('0x42'), 66); check(null, 0); check(undefined, NaN); check(false, 0); check(true, 1); check(new Boolean(false), 0); check(new Boolean(true), 1); check({}, NaN); check({ valueOf: '1.1', }, NaN); check({ valueOf: '1.1', toString() { return '2.2'; }, }, 2.2); check({ valueOf() { return '1.1'; }, }, 1.1); check({ valueOf() { return '1.1'; }, toString() { return '2.2'; }, }, 1.1); check({ valueOf() { return '-0x1a2b3c'; }, }, NaN); check({ toString() { return '-0x1a2b3c'; }, }, NaN); check({ valueOf() { return 42; }, }, 42); check({ valueOf() { return '42'; }, }, 42); check({ valueOf() { return null; }, }, 0); check({ toString() { return 42; }, }, 42); check({ toString() { return '42'; }, }, 42); check({ valueOf() { return 1; }, toString() { return 2; }, }, 1); check({ valueOf: 1, toString() { return 2; }, }, 2); let number = 1; assert.strictEqual(Number({ valueOf() { return ++number; }, }), 2, 'Number call valueOf only once #1'); assert.strictEqual(number, 2, 'Number call valueOf only once #2'); number = 1; assert.strictEqual(Number({ toString() { return ++number; }, }), 2, 'Number call toString only once #1'); assert.strictEqual(number, 2, 'Number call toString only once #2'); number = 1; assert.strictEqual(new Number({ valueOf() { return ++number; }, }).valueOf(), 2, 'new Number call valueOf only once #1'); assert.strictEqual(number, 2, 'new Number call valueOf only once #2'); number = 1; assert.strictEqual(new Number({ toString() { return ++number; }, }).valueOf(), 2, 'new Number call toString only once #1'); assert.strictEqual(number, 2, 'new Number call toString only once #2'); assert.throws(() => Number(Object.create(null)), TypeError, 'Number assert.throws on object w/o valueOf and toString'); assert.throws(() => Number({ valueOf: 1, toString: 2, }), TypeError, 'Number assert.throws on object then valueOf and toString are not functions'); assert.throws(() => new Number(Object.create(null)), TypeError, 'new Number assert.throws on object w/o valueOf and toString'); assert.throws(() => new Number({ valueOf: 1, toString: 2, }), TypeError, 'new Number assert.throws on object then valueOf and toString are not functions'); number = new Number(42); assert.strictEqual(typeof number.constructor(number), 'number'); check(`${ whitespaces }42`, 42); check(`42${ whitespaces }`, 42); check(`${ whitespaces }42${ whitespaces }`, 42); check(`${ whitespaces }0x42`, 66); check(`0x42${ whitespaces }`, 66); check(`${ whitespaces }0x42${ whitespaces }`, 66); check(`${ whitespaces }0X42`, 66); check(`0X42${ whitespaces }`, 66); check(`${ whitespaces }0X42${ whitespaces }`, 66); if (nativeSubclass) { const Subclass = nativeSubclass(Number); assert.ok(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.ok(new Subclass() instanceof Number, 'correct subclassing with native classes #2'); assert.same(new Subclass(1).toFixed(2), '1.00', 'correct subclassing with native classes #3'); } }); QUnit.test('Number constructor: binary', assert => { const check = getCheck(assert); check('0b1', 1); check('0B1', 1); check('0b12', NaN); check('0b234', NaN); check('0b1!', NaN); check('+0b1', NaN); check('-0b1', NaN); check(' 0b1', 1); check('0b1\n', 1); check('\n 0b1\n ', 1); check(' 0B1', 1); check('0B1\n', 1); check('\n 0B1\n ', 1); check({ valueOf() { return '0b11'; }, }, 3); check({ toString() { return '0b111'; }, }, 7); check({ valueOf() { return '0b101010'; }, }, 42); check({ toString() { return '0b101010'; }, }, 42); check(`${ whitespaces }0b11`, 3); check(`0b11${ whitespaces }`, 3); check(`${ whitespaces }0b11${ whitespaces }`, 3); check(`${ whitespaces }0B11`, 3); check(`0B11${ whitespaces }`, 3); check(`${ whitespaces }0B11${ whitespaces }`, 3); }); QUnit.test('Number constructor: octal', assert => { const check = getCheck(assert); check('0o7', 7); check('0O7', 7); check('0o18', NaN); check('0o89a', NaN); check('0o1!', NaN); check('+0o1', NaN); check('-0o1', NaN); check(' 0o1', 1); check('0o1\n', 1); check('\n 0o1\n ', 1); check(' 0O1', 1); check('0O1\n', 1); check('\n 0O1\n ', 1); check({ valueOf() { return '0o77'; }, }, 63); check({ toString() { return '0o777'; }, }, 511); check({ valueOf() { return '0o12345'; }, }, 5349); check({ toString() { return '0o12345'; }, }, 5349); check(`${ whitespaces }0o11`, 9); check(`0o11${ whitespaces }`, 9); check(`${ whitespaces }0o11${ whitespaces }`, 9); check(`${ whitespaces }0O11`, 9); check(`0O11${ whitespaces }`, 9); check(`${ whitespaces }0O11${ whitespaces }`, 9); }); core-js-3.6.1/tests/tests/es.number.epsilon.js000066400000000000000000000005321360057567700213130ustar00rootroot00000000000000QUnit.test('Number.EPSILON', assert => { const { EPSILON } = Number; assert.ok('EPSILON' in Number, 'EPSILON in Number'); assert.nonEnumerable(Number, 'EPSILON'); assert.strictEqual(EPSILON, 2 ** -52, 'Is 2^-52'); assert.ok(1 !== 1 + EPSILON, '1 isnt 1 + EPSILON'); assert.strictEqual(1, 1 + EPSILON / 2, '1 is 1 + EPSILON / 2'); }); core-js-3.6.1/tests/tests/es.number.is-finite.js000066400000000000000000000017141360057567700215340ustar00rootroot00000000000000QUnit.test('Number.isFinite', assert => { const { isFinite } = Number; const { create } = Object; assert.isFunction(isFinite); assert.name(isFinite, 'isFinite'); assert.arity(isFinite, 1); assert.looksNative(isFinite); assert.nonEnumerable(Number, 'isFinite'); const finite = [ 1, 0.1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, ]; for (const value of finite) { assert.ok(isFinite(value), `isFinite ${ typeof value } ${ value }`); } const notFinite = [ NaN, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notFinite) { assert.ok(!isFinite(value), `not isFinite ${ typeof value } ${ value }`); } assert.ok(!isFinite(create(null)), 'Number.isFinite(Object.create(null)) -> false'); }); core-js-3.6.1/tests/tests/es.number.is-integer.js000066400000000000000000000017421360057567700217140ustar00rootroot00000000000000QUnit.test('Number.isInteger', assert => { const { isInteger } = Number; const { create } = Object; assert.isFunction(isInteger); assert.name(isInteger, 'isInteger'); assert.arity(isInteger, 1); assert.looksNative(isInteger); assert.nonEnumerable(Number, 'isInteger'); const integers = [ 1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, ]; for (const value of integers) { assert.ok(isInteger(value), `isInteger ${ typeof value } ${ value }`); } const notIntegers = [ NaN, 0.1, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notIntegers) { assert.ok(!isInteger(value), `not isInteger ${ typeof value } ${ value }`); } assert.ok(!isInteger(create(null)), 'Number.isInteger(Object.create(null)) -> false'); }); core-js-3.6.1/tests/tests/es.number.is-nan.js000066400000000000000000000015121360057567700210260ustar00rootroot00000000000000QUnit.test('Number.isNaN', assert => { const { isNaN } = Number; const { create } = Object; assert.isFunction(isNaN); assert.name(isNaN, 'isNaN'); assert.arity(isNaN, 1); assert.looksNative(isNaN); assert.nonEnumerable(Number, 'isNaN'); assert.ok(isNaN(NaN), 'Number.isNaN NaN'); const notNaNs = [ 1, 0.1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notNaNs) { assert.ok(!isNaN(value), `not Number.isNaN ${ typeof value } ${ value }`); } assert.ok(!isNaN(create(null)), 'Number.isNaN(Object.create(null)) -> false'); }); core-js-3.6.1/tests/tests/es.number.is-safe-integer.js000066400000000000000000000022041360057567700226220ustar00rootroot00000000000000QUnit.test('Number.isSafeInteger', assert => { const { isSafeInteger } = Number; const { create } = Object; assert.isFunction(isSafeInteger); assert.name(isSafeInteger, 'isSafeInteger'); assert.arity(isSafeInteger, 1); assert.looksNative(isSafeInteger); assert.nonEnumerable(Number, 'isSafeInteger'); const safeIntegers = [ 1, -1, 2 ** 16, 2 ** 16 - 1, 2 ** 31, 2 ** 31 - 1, 2 ** 32, 2 ** 32 - 1, -0, 9007199254740991, -9007199254740991, ]; for (const value of safeIntegers) { assert.ok(isSafeInteger(value), `isSafeInteger ${ typeof value } ${ value }`); } const notSafeIntegers = [ 9007199254740992, -9007199254740992, NaN, 0.1, Infinity, 'NaN', '5', false, new Number(NaN), new Number(Infinity), new Number(5), new Number(0.1), undefined, null, {}, function () { /* empty */ }, ]; for (const value of notSafeIntegers) { assert.ok(!isSafeInteger(value), `not isSafeInteger ${ typeof value } ${ value }`); } assert.ok(!isSafeInteger(create(null)), 'Number.isSafeInteger(Object.create(null)) -> false'); }); core-js-3.6.1/tests/tests/es.number.max-safe-integer.js000066400000000000000000000003401360057567700227730ustar00rootroot00000000000000QUnit.test('Number.MAX_SAFE_INTEGER', assert => { assert.ok('MAX_SAFE_INTEGER' in Number); assert.nonEnumerable(Number, 'MAX_SAFE_INTEGER'); assert.strictEqual(Number.MAX_SAFE_INTEGER, 2 ** 53 - 1, 'Is 2^53 - 1'); }); core-js-3.6.1/tests/tests/es.number.min-safe-integer.js000066400000000000000000000003441360057567700227750ustar00rootroot00000000000000QUnit.test('Number.MIN_SAFE_INTEGER', assert => { assert.ok('MIN_SAFE_INTEGER' in Number); assert.nonEnumerable(Number, 'MIN_SAFE_INTEGER'); assert.strictEqual(Number.MIN_SAFE_INTEGER, -(2 ** 53) + 1, 'Is -2^53 + 1'); }); core-js-3.6.1/tests/tests/es.number.parse-float.js000066400000000000000000000014121360057567700220550ustar00rootroot00000000000000import { GLOBAL, WHITESPACES } from '../helpers/constants'; QUnit.test('Number.parseFloat', assert => { const { parseFloat } = Number; assert.isFunction(parseFloat); assert.name(parseFloat, 'parseFloat'); assert.arity(parseFloat, 1); assert.looksNative(parseFloat); assert.nonEnumerable(Number, 'parseFloat'); assert.same(parseFloat, GLOBAL.parseFloat); assert.same(parseFloat('0'), 0); assert.same(parseFloat(' 0'), 0); assert.same(parseFloat('+0'), 0); assert.same(parseFloat(' +0'), 0); assert.same(parseFloat('-0'), -0); assert.same(parseFloat(' -0'), -0); assert.same(parseFloat(`${ WHITESPACES }+0`), 0); assert.same(parseFloat(`${ WHITESPACES }-0`), -0); assert.same(parseFloat(null), NaN); assert.same(parseFloat(undefined), NaN); }); core-js-3.6.1/tests/tests/es.number.parse-int.js000066400000000000000000000033731360057567700215520ustar00rootroot00000000000000import { GLOBAL, WHITESPACES } from '../helpers/constants'; QUnit.test('Number.parseInt', assert => { const { parseInt } = Number; assert.isFunction(parseInt); assert.name(parseInt, 'parseInt'); assert.arity(parseInt, 2); assert.looksNative(parseInt); assert.nonEnumerable(Number, 'parseInt'); assert.same(parseInt, GLOBAL.parseInt); for (let radix = 2; radix <= 36; ++radix) { assert.same(parseInt('10', radix), radix, `radix ${ radix }`); } const strings = ['01', '08', '10', '42']; for (const string of strings) { assert.same(parseInt(string), parseInt(string, 10), `default radix is 10: ${ string }`); } assert.same(parseInt('0x16'), parseInt('0x16', 16), 'default radix is 16: 0x16'); assert.same(parseInt(' 0x16'), parseInt('0x16', 16), 'ignores leading whitespace #1'); assert.same(parseInt(' 42'), parseInt('42', 10), 'ignores leading whitespace #2'); assert.same(parseInt(' 08'), parseInt('08', 10), 'ignores leading whitespace #3'); assert.same(parseInt(`${ WHITESPACES }08`), parseInt('08', 10), 'ignores leading whitespace #4'); assert.same(parseInt(`${ WHITESPACES }0x16`), parseInt('0x16', 16), 'ignores leading whitespace #5'); const fakeZero = { valueOf() { return 0; }, }; assert.same(parseInt('08', fakeZero), parseInt('08', 10), 'valueOf #1'); assert.same(parseInt('0x16', fakeZero), parseInt('0x16', 16), 'valueOf #2'); assert.same(parseInt('-0xF'), -15, 'signed hex #1'); assert.same(parseInt('-0xF', 16), -15, 'signed hex #2'); assert.same(parseInt('+0xF'), 15, 'signed hex #3'); assert.same(parseInt('+0xF', 16), 15, 'signed hex #4'); assert.same(parseInt('10', -4294967294), 2, 'radix uses ToUint32'); assert.same(parseInt(null), NaN); assert.same(parseInt(undefined), NaN); }); core-js-3.6.1/tests/tests/es.number.to-fixed.js000066400000000000000000000071421360057567700213650ustar00rootroot00000000000000QUnit.test('Number#toFixed', assert => { const { toFixed } = Number.prototype; assert.isFunction(toFixed); assert.name(toFixed, 'toFixed'); assert.arity(toFixed, 1); assert.looksNative(toFixed); assert.nonEnumerable(Number.prototype, 'toFixed'); assert.same(0.00008.toFixed(3), '0.000'); assert.same(0.9.toFixed(0), '1'); assert.same(1.255.toFixed(2), '1.25'); assert.same(1843654265.0774949.toFixed(5), '1843654265.07749'); assert.same(1000000000000000128.0.toFixed(0), '1000000000000000128'); assert.same(toFixed.call(1), '1'); assert.same(toFixed.call(1, 0), '1'); assert.same(toFixed.call(1, 1), '1.0'); assert.same(toFixed.call(1, 1.1), '1.0'); assert.same(toFixed.call(1, 0.9), '1'); assert.same(toFixed.call(1, '0'), '1'); assert.same(toFixed.call(1, '1'), '1.0'); assert.same(toFixed.call(1, '1.1'), '1.0'); assert.same(toFixed.call(1, '0.9'), '1'); assert.same(toFixed.call(1, NaN), '1'); assert.same(toFixed.call(1, 'some string'), '1'); assert.notThrows(() => toFixed.call(1, -0.1) === '1'); assert.same(new Number(1).toFixed(), '1'); assert.same(new Number(1).toFixed(0), '1'); assert.same(new Number(1).toFixed(1), '1.0'); assert.same(new Number(1).toFixed(1.1), '1.0'); assert.same(new Number(1).toFixed(0.9), '1'); assert.same(new Number(1).toFixed('0'), '1'); assert.same(new Number(1).toFixed('1'), '1.0'); assert.same(new Number(1).toFixed('1.1'), '1.0'); assert.same(new Number(1).toFixed('0.9'), '1'); assert.same(new Number(1).toFixed(NaN), '1'); assert.same(new Number(1).toFixed('some string'), '1'); assert.notThrows(() => new Number(1).toFixed(-0.1) === '1'); assert.same(NaN.toFixed(), 'NaN'); assert.same(NaN.toFixed(0), 'NaN'); assert.same(NaN.toFixed(1), 'NaN'); assert.same(NaN.toFixed(1.1), 'NaN'); assert.same(NaN.toFixed(0.9), 'NaN'); assert.same(NaN.toFixed('0'), 'NaN'); assert.same(NaN.toFixed('1'), 'NaN'); assert.same(NaN.toFixed('1.1'), 'NaN'); assert.same(NaN.toFixed('0.9'), 'NaN'); assert.same(NaN.toFixed(NaN), 'NaN'); assert.same(NaN.toFixed('some string'), 'NaN'); assert.notThrows(() => NaN.toFixed(-0.1) === 'NaN'); assert.same(new Number(1e21).toFixed(), String(1e21)); assert.same(new Number(1e21).toFixed(0), String(1e21)); assert.same(new Number(1e21).toFixed(1), String(1e21)); assert.same(new Number(1e21).toFixed(1.1), String(1e21)); assert.same(new Number(1e21).toFixed(0.9), String(1e21)); assert.same(new Number(1e21).toFixed('0'), String(1e21)); assert.same(new Number(1e21).toFixed('1'), String(1e21)); assert.same(new Number(1e21).toFixed('1.1'), String(1e21)); assert.same(new Number(1e21).toFixed('0.9'), String(1e21)); assert.same(new Number(1e21).toFixed(NaN), String(1e21)); assert.same(new Number(1e21).toFixed('some string'), String(1e21)); assert.notThrows(() => new Number(1e21).toFixed(-0.1) === String(1e21)); assert.throws(() => 1.0.toFixed(-101), RangeError, 'If f < 0 or f > 20, throw a RangeError exception.'); assert.throws(() => 1.0.toFixed(101), RangeError, 'If f < 0 or f > 20, throw a RangeError exception.'); assert.throws(() => NaN.toFixed(Infinity), RangeError, 'If f < 0 or f > 20, throw a RangeError exception.'); assert.throws(() => toFixed.call({}, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed.call('123', 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed.call(false, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed.call(null, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toFixed.call(undefined, 1), TypeError, '? thisNumberValue(this value)'); }); core-js-3.6.1/tests/tests/es.number.to-precision.js000066400000000000000000000027761360057567700222710ustar00rootroot00000000000000QUnit.test('Number#toPrecision', assert => { const { toPrecision } = Number.prototype; assert.isFunction(toPrecision); assert.name(toPrecision, 'toPrecision'); assert.arity(toPrecision, 1); assert.looksNative(toPrecision); assert.nonEnumerable(Number.prototype, 'toPrecision'); assert.same(0.00008.toPrecision(3), '0.0000800', '0.00008.toPrecision(3)'); assert.same(1.255.toPrecision(2), '1.3', '1.255.toPrecision(2)'); assert.same(1843654265.0774949.toPrecision(13), '1843654265.077', '1843654265.0774949.toPrecision(13)'); assert.same(NaN.toPrecision(1), 'NaN', 'If x is NaN, return the String "NaN".'); assert.same(123.456.toPrecision(), '123.456', 'If precision is undefined, return ! ToString(x).'); assert.same(123.456.toPrecision(undefined), '123.456', 'If precision is undefined, return ! ToString(x).'); assert.throws(() => 0.9.toPrecision(0), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(() => 0.9.toPrecision(101), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(() => toPrecision.call({}, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision.call('123', 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision.call(false, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision.call(null, 1), TypeError, '? thisNumberValue(this value)'); assert.throws(() => toPrecision.call(undefined, 1), TypeError, '? thisNumberValue(this value)'); }); core-js-3.6.1/tests/tests/es.object.assign.js000066400000000000000000000044761360057567700211170ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Object.assign', assert => { const { assign, keys, defineProperty } = Object; assert.isFunction(assign); assert.arity(assign, 2); assert.name(assign, 'assign'); assert.looksNative(assign); assert.nonEnumerable(Object, 'assign'); let object = { q: 1 }; assert.strictEqual(object, assign(object, { bar: 2 }), 'assign return target'); assert.strictEqual(object.bar, 2, 'assign define properties'); assert.deepEqual(assign({}, { q: 1 }, { w: 2 }), { q: 1, w: 2 }); assert.deepEqual(assign({}, 'qwe'), { 0: 'q', 1: 'w', 2: 'e' }); assert.throws(() => assign(null, { q: 1 }), TypeError); assert.throws(() => assign(undefined, { q: 1 }), TypeError); let string = assign('qwe', { q: 1 }); assert.strictEqual(typeof string, 'object'); assert.strictEqual(String(string), 'qwe'); assert.strictEqual(string.q, 1); assert.same(assign({}, { valueOf: 42 }).valueOf, 42, 'IE enum keys bug'); if (DESCRIPTORS) { object = { baz: 1 }; assign(object, defineProperty({}, 'bar', { get() { return this.baz + 1; }, })); assert.ok(object.bar === undefined, "assign don't copy descriptors"); object = { a: 'a' }; const c = Symbol('c'); const d = Symbol('d'); object[c] = 'c'; defineProperty(object, 'b', { value: 'b' }); defineProperty(object, d, { value: 'd' }); const object2 = assign({}, object); assert.strictEqual(object2.a, 'a', 'a'); assert.strictEqual(object2.b, undefined, 'b'); assert.strictEqual(object2[c], 'c', 'c'); assert.strictEqual(object2[d], undefined, 'd'); try { assert.strictEqual(Function('assign', ` return assign({ b: 1 }, { get a() { delete this.b; }, b: 2 }); `)(assign).b, 1); } catch { /* empty */ } try { assert.strictEqual(Function('assign', ` return assign({ b: 1 }, { get a() { Object.defineProperty(this, "b", { value: 3, enumerable: false }); }, b: 2 }); `)(assign).b, 1); } catch { /* empty */ } } string = 'abcdefghijklmnopqrst'; const result = {}; for (let i = 0, { length } = string; i < length; ++i) { const char = string.charAt(i); result[char] = char; } assert.strictEqual(keys(assign({}, result)).join(''), string); }); core-js-3.6.1/tests/tests/es.object.create.js000066400000000000000000000023201360057567700210600ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Object.create', assert => { const { create, getPrototypeOf, getOwnPropertyNames } = Object; function getPropertyNames(object) { let result = []; do { result = result.concat(getOwnPropertyNames(object)); } while (object = getPrototypeOf(object)); return result; } assert.isFunction(create); assert.arity(create, 2); assert.name(create, 'create'); assert.looksNative(create); assert.nonEnumerable(Object, 'create'); let object = { q: 1 }; assert.ok({}.isPrototypeOf.call(object, create(object))); assert.ok(create(object).q === 1); function F() { return this.a = 1; } assert.ok(create(new F()) instanceof F); assert.ok(F.prototype === getPrototypeOf(getPrototypeOf(create(new F())))); assert.ok(create(new F()).a === 1); assert.ok(create({}, { a: { value: 42 } }).a === 42); object = create(null, { w: { value: 2 } }); assert.same(object, Object(object)); assert.ok(!('toString' in object)); assert.ok(object.w === 2); assert.deepEqual(getPropertyNames(create(null)), []); }); QUnit.test('Object.create.sham flag', assert => { assert.same(Object.create.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/tests/es.object.define-getter.js000066400000000000000000000020021360057567700223340ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants'; if (DESCRIPTORS) { QUnit.test('Object#__defineGetter__', assert => { const { __defineGetter__ } = Object.prototype; assert.isFunction(__defineGetter__); assert.arity(__defineGetter__, 2); assert.name(__defineGetter__, '__defineGetter__'); assert.looksNative(__defineGetter__); assert.nonEnumerable(Object.prototype, '__defineGetter__'); const object = {}; assert.same(object.__defineGetter__('key', () => 42), undefined, 'void'); assert.same(object.key, 42, 'works'); object.__defineSetter__('key', function () { this.foo = 43; }); object.key = 44; assert.ok(object.key === 42 && object.foo === 43, 'works with setter'); if (STRICT) { assert.throws(() => __defineGetter__.call(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __defineGetter__.call(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.6.1/tests/tests/es.object.define-properties.js000066400000000000000000000012761360057567700232520ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Object.defineProperties', assert => { const { defineProperties } = Object; assert.isFunction(defineProperties); assert.arity(defineProperties, 2); assert.name(defineProperties, 'defineProperties'); assert.looksNative(defineProperties); assert.nonEnumerable(Object, 'defineProperties'); const source = {}; const result = defineProperties(source, { q: { value: 42 }, w: { value: 33 } }); assert.same(result, source); assert.same(result.q, 42); assert.same(result.w, 33); }); QUnit.test('Object.defineProperties.sham flag', assert => { assert.same(Object.defineProperties.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/tests/es.object.define-property.js000066400000000000000000000014461360057567700227410ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Object.defineProperty', assert => { const { defineProperty, create } = Object; assert.isFunction(defineProperty); assert.arity(defineProperty, 3); assert.name(defineProperty, 'defineProperty'); assert.looksNative(defineProperty); assert.nonEnumerable(Object, 'defineProperty'); const source = {}; const result = defineProperty(source, 'q', { value: 42, }); assert.same(result, source); assert.same(result.q, 42); assert.throws(() => defineProperty(42, 1, {})); assert.throws(() => defineProperty({}, create(null), {})); assert.throws(() => defineProperty({}, 1, 1)); }); QUnit.test('Object.defineProperty.sham flag', assert => { assert.same(Object.defineProperty.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/tests/es.object.define-setter.js000066400000000000000000000021641360057567700223610ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants'; if (DESCRIPTORS) { QUnit.test('Object#__defineSetter__', assert => { const { __defineSetter__ } = Object.prototype; assert.isFunction(__defineSetter__); assert.arity(__defineSetter__, 2); assert.name(__defineSetter__, '__defineSetter__'); assert.looksNative(__defineSetter__); assert.nonEnumerable(Object.prototype, '__defineSetter__'); let object = {}; assert.same(object.__defineSetter__('key', function () { this.foo = 43; }), undefined, 'void'); object.key = 44; assert.same(object.foo, 43, 'works'); object = {}; object.__defineSetter__('key', function () { this.foo = 43; }); object.__defineGetter__('key', () => 42); object.key = 44; assert.ok(object.key === 42 && object.foo === 43, 'works with getter'); if (STRICT) { assert.throws(() => __defineSetter__.call(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __defineSetter__.call(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.6.1/tests/tests/es.object.entries.js000066400000000000000000000023051360057567700212710ustar00rootroot00000000000000QUnit.test('Object.entries', assert => { const { entries, create, assign } = Object; assert.isFunction(entries); assert.arity(entries, 1); assert.name(entries, 'entries'); assert.looksNative(entries); assert.nonEnumerable(Object, 'entries'); assert.deepEqual(entries({ q: 1, w: 2, e: 3 }), [['q', 1], ['w', 2], ['e', 3]]); assert.deepEqual(entries(new String('qwe')), [['0', 'q'], ['1', 'w'], ['2', 'e']]); assert.deepEqual(entries(assign(create({ q: 1, w: 2, e: 3 }), { a: 4, s: 5, d: 6 })), [['a', 4], ['s', 5], ['d', 6]]); assert.deepEqual(entries({ valueOf: 42 }), [['valueOf', 42]], 'IE enum keys bug'); try { assert.deepEqual(Function('entries', ` return entries({ a: 1, get b() { delete this.c; return 2; }, c: 3 }); `)(entries), [['a', 1], ['b', 2]]); } catch { /* empty */ } try { assert.deepEqual(Function('entries', ` return entries({ a: 1, get b() { Object.defineProperty(this, "c", { value: 4, enumerable: false }); return 2; }, c: 3 }); `)(entries), [['a', 1], ['b', 2]]); } catch { /* empty */ } }); core-js-3.6.1/tests/tests/es.object.freeze.js000066400000000000000000000021021360057567700210730ustar00rootroot00000000000000import { GLOBAL, NATIVE } from '../helpers/constants'; QUnit.test('Object.freeze', assert => { const { freeze, isFrozen, keys, getOwnPropertyNames, getOwnPropertySymbols } = Object; const { ownKeys } = GLOBAL.Reflect || {}; assert.isFunction(freeze); assert.arity(freeze, 1); assert.name(freeze, 'freeze'); assert.looksNative(freeze); assert.nonEnumerable(Object, 'freeze'); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => freeze(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(freeze(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } if (NATIVE) assert.ok(isFrozen(freeze({}))); const results = []; for (const key in freeze({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(freeze({})), []); assert.arrayEqual(getOwnPropertyNames(freeze({})), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(freeze({})), []); if (ownKeys) assert.arrayEqual(ownKeys(freeze({})), []); }); core-js-3.6.1/tests/tests/es.object.from-entries.js000066400000000000000000000015231360057567700222330ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Object.fromEntries', assert => { const { fromEntries } = Object; assert.isFunction(fromEntries); assert.arity(fromEntries, 1); assert.name(fromEntries, 'fromEntries'); assert.looksNative(fromEntries); assert.nonEnumerable(Object, 'fromEntries'); assert.ok(fromEntries([]) instanceof Object); assert.same(fromEntries([['foo', 1]]).foo, 1); assert.same(fromEntries(createIterable([['bar', 2]])).bar, 2); class Unit { constructor(id) { this.id = id; } toString() { return `unit${ this.id }`; } } const units = new Set([new Unit(101), new Unit(102), new Unit(103)]); const object = fromEntries(units.entries()); assert.same(object.unit101.id, 101); assert.same(object.unit102.id, 102); assert.same(object.unit103.id, 103); }); core-js-3.6.1/tests/tests/es.object.get-own-property-descriptor.js000066400000000000000000000022141360057567700252350ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Object.getOwnPropertyDescriptor', assert => { const { getOwnPropertyDescriptor } = Object; assert.isFunction(getOwnPropertyDescriptor); assert.arity(getOwnPropertyDescriptor, 2); assert.name(getOwnPropertyDescriptor, 'getOwnPropertyDescriptor'); assert.looksNative(getOwnPropertyDescriptor); assert.nonEnumerable(Object, 'getOwnPropertyDescriptor'); assert.deepEqual(getOwnPropertyDescriptor({ q: 42 }, 'q'), { writable: true, enumerable: true, configurable: true, value: 42, }); assert.ok(getOwnPropertyDescriptor({}, 'toString') === undefined); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertyDescriptor(value) || true, `accept ${ typeof value }`); } assert.throws(() => getOwnPropertyDescriptor(null), TypeError, 'throws on null'); assert.throws(() => getOwnPropertyDescriptor(undefined), TypeError, 'throws on undefined'); }); QUnit.test('Object.getOwnPropertyDescriptor.sham flag', assert => { assert.same(Object.getOwnPropertyDescriptor.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/tests/es.object.get-own-property-descriptors.js000066400000000000000000000024451360057567700254260ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Object.getOwnPropertyDescriptors', assert => { const { create, getOwnPropertyDescriptors } = Object; assert.isFunction(getOwnPropertyDescriptors); assert.arity(getOwnPropertyDescriptors, 1); assert.name(getOwnPropertyDescriptors, 'getOwnPropertyDescriptors'); assert.looksNative(getOwnPropertyDescriptors); assert.nonEnumerable(Object, 'getOwnPropertyDescriptors'); const object = create({ q: 1 }, { e: { value: 3 } }); object.w = 2; const symbol = Symbol('4'); object[symbol] = 4; const descriptors = getOwnPropertyDescriptors(object); assert.strictEqual(descriptors.q, undefined); assert.deepEqual(descriptors.w, { enumerable: true, configurable: true, writable: true, value: 2, }); if (DESCRIPTORS) { assert.deepEqual(descriptors.e, { enumerable: false, configurable: false, writable: false, value: 3, }); } else { assert.deepEqual(descriptors.e, { enumerable: true, configurable: true, writable: true, value: 3, }); } assert.strictEqual(descriptors[symbol].value, 4); }); QUnit.test('Object.getOwnPropertyDescriptors.sham flag', assert => { assert.same(Object.getOwnPropertyDescriptors.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/tests/es.object.get-own-property-names.js000066400000000000000000000035241360057567700241670ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants'; import { includes } from '../helpers/helpers'; QUnit.test('Object.getOwnPropertyNames', assert => { const { getOwnPropertyNames } = Object; assert.isFunction(getOwnPropertyNames); assert.arity(getOwnPropertyNames, 1); assert.name(getOwnPropertyNames, 'getOwnPropertyNames'); assert.looksNative(getOwnPropertyNames); assert.nonEnumerable(Object, 'getOwnPropertyNames'); function F1() { this.w = 1; } function F2() { this.toString = 1; } F1.prototype.q = F2.prototype.q = 1; const names = getOwnPropertyNames([1, 2, 3]); assert.strictEqual(names.length, 4); assert.ok(includes(names, '0')); assert.ok(includes(names, '1')); assert.ok(includes(names, '2')); assert.ok(includes(names, 'length')); assert.deepEqual(getOwnPropertyNames(new F1()), ['w']); assert.deepEqual(getOwnPropertyNames(new F2()), ['toString']); assert.ok(includes(getOwnPropertyNames(Array.prototype), 'toString')); assert.ok(includes(getOwnPropertyNames(Object.prototype), 'toString')); assert.ok(includes(getOwnPropertyNames(Object.prototype), 'constructor')); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertyNames(value), `accept ${ typeof value }`); } assert.throws(() => { getOwnPropertyNames(null); }, TypeError, 'throws on null'); assert.throws(() => { getOwnPropertyNames(undefined); }, TypeError, 'throws on undefined'); if (GLOBAL.document) { assert.notThrows(() => { const iframe = document.createElement('iframe'); iframe.src = 'http://example.com'; document.documentElement.appendChild(iframe); const window = iframe.contentWindow; document.documentElement.removeChild(iframe); return getOwnPropertyNames(window); }, 'IE11 bug with iframe and window'); } }); core-js-3.6.1/tests/tests/es.object.get-prototype-of.js000066400000000000000000000027641360057567700230550ustar00rootroot00000000000000import { CORRECT_PROTOTYPE_GETTER } from '../helpers/constants'; QUnit.test('Object.getPrototypeOf', assert => { const { create, getPrototypeOf } = Object; assert.isFunction(getPrototypeOf); assert.arity(getPrototypeOf, 1); assert.name(getPrototypeOf, 'getPrototypeOf'); assert.looksNative(getPrototypeOf); assert.nonEnumerable(Object, 'getPrototypeOf'); assert.ok(getPrototypeOf({}) === Object.prototype); assert.ok(getPrototypeOf([]) === Array.prototype); function F() { /* empty */ } assert.ok(getPrototypeOf(new F()) === F.prototype); const object = { q: 1 }; assert.ok(getPrototypeOf(create(object)) === object); assert.ok(getPrototypeOf(create(null)) === null); assert.ok(getPrototypeOf(getPrototypeOf({})) === null); function Foo() { /* empty */ } Foo.prototype.foo = 'foo'; function Bar() { /* empty */ } Bar.prototype = create(Foo.prototype); Bar.prototype.constructor = Bar; assert.strictEqual(getPrototypeOf(Bar.prototype).foo, 'foo'); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getPrototypeOf(value), `accept ${ typeof value }`); } assert.throws(() => getPrototypeOf(null), TypeError, 'throws on null'); assert.throws(() => getPrototypeOf(undefined), TypeError, 'throws on undefined'); assert.strictEqual(getPrototypeOf('foo'), String.prototype); }); QUnit.test('Object.getPrototypeOf.sham flag', assert => { assert.same(Object.getPrototypeOf.sham, CORRECT_PROTOTYPE_GETTER ? undefined : true); }); core-js-3.6.1/tests/tests/es.object.is-extensible.js000066400000000000000000000013021360057567700223670ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants'; QUnit.test('Object.isExtensible', assert => { const { preventExtensions, isExtensible } = Object; assert.isFunction(isExtensible); assert.arity(isExtensible, 1); assert.name(isExtensible, 'isExtensible'); assert.nonEnumerable(Object, 'isExtensible'); assert.looksNative(isExtensible); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isExtensible(value) || true, `accept ${ value }`); assert.same(isExtensible(value), false, `returns true on ${ value }`); } assert.same(isExtensible({}), true); if (NATIVE) assert.ok(!isExtensible(preventExtensions({}))); }); core-js-3.6.1/tests/tests/es.object.is-frozen.js000066400000000000000000000011721360057567700215350ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants'; QUnit.test('Object.isFrozen', assert => { const { freeze, isFrozen } = Object; assert.isFunction(isFrozen); assert.arity(isFrozen, 1); assert.name(isFrozen, 'isFrozen'); assert.looksNative(isFrozen); assert.nonEnumerable(Object, 'isFrozen'); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isFrozen(value) || true, `accept ${ value }`); assert.same(isFrozen(value), true, `returns true on ${ value }`); } assert.same(isFrozen({}), false); if (NATIVE) assert.ok(isFrozen(freeze({}))); }); core-js-3.6.1/tests/tests/es.object.is-sealed.js000066400000000000000000000011661360057567700214720ustar00rootroot00000000000000import { NATIVE } from '../helpers/constants'; QUnit.test('Object.isSealed', assert => { const { seal, isSealed } = Object; assert.isFunction(isSealed); assert.arity(isSealed, 1); assert.name(isSealed, 'isSealed'); assert.looksNative(isSealed); assert.nonEnumerable(Object, 'isSealed'); const primitives = [42, 'string', false, null, undefined]; for (const value of primitives) { assert.notThrows(() => isSealed(value) || true, `accept ${ value }`); assert.same(isSealed(value), true, `returns true on ${ value }`); } assert.same(isSealed({}), false); if (NATIVE) assert.ok(isSealed(seal({}))); }); core-js-3.6.1/tests/tests/es.object.is.js000066400000000000000000000005361360057567700202370ustar00rootroot00000000000000QUnit.test('Object.is', assert => { const { is } = Object; assert.isFunction(is); assert.arity(is, 2); assert.name(is, 'is'); assert.looksNative(is); assert.nonEnumerable(Object, 'is'); assert.ok(is(1, 1), '1 is 1'); assert.ok(is(NaN, NaN), '1 is 1'); assert.ok(!is(0, -0), '0 isnt -0'); assert.ok(!is({}, {}), '{} isnt {}'); }); core-js-3.6.1/tests/tests/es.object.keys.js000066400000000000000000000015571360057567700206030ustar00rootroot00000000000000import { includes } from '../helpers/helpers'; QUnit.test('Object.keys', assert => { const { keys } = Object; assert.isFunction(keys); assert.arity(keys, 1); assert.name(keys, 'keys'); assert.looksNative(keys); assert.nonEnumerable(Object, 'keys'); function F1() { this.w = 1; } function F2() { this.toString = 1; } F1.prototype.q = F2.prototype.q = 1; assert.deepEqual(keys([1, 2, 3]), ['0', '1', '2']); assert.deepEqual(keys(new F1()), ['w']); assert.deepEqual(keys(new F2()), ['toString']); assert.ok(!includes(keys(Array.prototype), 'push')); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => keys(value), `accept ${ typeof value }`); } assert.throws(() => keys(null), TypeError, 'throws on null'); assert.throws(() => keys(undefined), TypeError, 'throws on undefined'); }); core-js-3.6.1/tests/tests/es.object.lookup-getter.js000066400000000000000000000023231360057567700224210ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants'; if (DESCRIPTORS) { QUnit.test('Object#__lookupGetter__', assert => { const { __lookupGetter__ } = Object.prototype; const { create } = Object; assert.isFunction(__lookupGetter__); assert.arity(__lookupGetter__, 1); assert.name(__lookupGetter__, '__lookupGetter__'); assert.looksNative(__lookupGetter__); assert.nonEnumerable(Object.prototype, '__lookupGetter__'); assert.same({}.__lookupGetter__('key'), undefined, 'empty object'); assert.same({ key: 42 }.__lookupGetter__('key'), undefined, 'data descriptor'); const object = {}; function setter() { /* empty */ } object.__defineGetter__('key', setter); assert.same(object.__lookupGetter__('key'), setter, 'own getter'); assert.same(create(object).__lookupGetter__('key'), setter, 'proto getter'); assert.same(create(object).__lookupGetter__('foo'), undefined, 'empty proto'); if (STRICT) { assert.throws(() => __lookupGetter__.call(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __lookupGetter__.call(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.6.1/tests/tests/es.object.lookup-setter.js000066400000000000000000000023231360057567700224350ustar00rootroot00000000000000import { DESCRIPTORS, STRICT } from '../helpers/constants'; if (DESCRIPTORS) { QUnit.test('Object#__lookupSetter__', assert => { const { __lookupSetter__ } = Object.prototype; const { create } = Object; assert.isFunction(__lookupSetter__); assert.arity(__lookupSetter__, 1); assert.name(__lookupSetter__, '__lookupSetter__'); assert.looksNative(__lookupSetter__); assert.nonEnumerable(Object.prototype, '__lookupSetter__'); assert.same({}.__lookupSetter__('key'), undefined, 'empty object'); assert.same({ key: 42 }.__lookupSetter__('key'), undefined, 'data descriptor'); const object = {}; function setter() { /* empty */ } object.__defineSetter__('key', setter); assert.same(object.__lookupSetter__('key'), setter, 'own getter'); assert.same(create(object).__lookupSetter__('key'), setter, 'proto getter'); assert.same(create(object).__lookupSetter__('foo'), undefined, 'empty proto'); if (STRICT) { assert.throws(() => __lookupSetter__.call(null, 1, () => { /* empty */ }), TypeError, 'Throws on null as `this`'); assert.throws(() => __lookupSetter__.call(undefined, 1, () => { /* empty */ }), TypeError, 'Throws on undefined as `this`'); } }); } core-js-3.6.1/tests/tests/es.object.prevent-extensions.js000066400000000000000000000023731360057567700235050ustar00rootroot00000000000000import { GLOBAL, NATIVE } from '../helpers/constants'; QUnit.test('Object.preventExtensions', assert => { const { preventExtensions, keys, isExtensible, getOwnPropertyNames, getOwnPropertySymbols } = Object; const { ownKeys } = GLOBAL.Reflect || {}; assert.isFunction(preventExtensions); assert.arity(preventExtensions, 1); assert.name(preventExtensions, 'preventExtensions'); assert.looksNative(preventExtensions); assert.nonEnumerable(Object, 'preventExtensions'); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => preventExtensions(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(preventExtensions(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } if (NATIVE) assert.ok(!isExtensible(preventExtensions({}))); const results = []; for (const key in preventExtensions({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(preventExtensions({})), []); assert.arrayEqual(getOwnPropertyNames(preventExtensions({})), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(preventExtensions({})), []); if (ownKeys) assert.arrayEqual(ownKeys(preventExtensions({})), []); }); core-js-3.6.1/tests/tests/es.object.seal.js000066400000000000000000000020421360057567700205420ustar00rootroot00000000000000import { GLOBAL, NATIVE } from '../helpers/constants'; QUnit.test('Object.seal', assert => { const { seal, isSealed, keys, getOwnPropertyNames, getOwnPropertySymbols } = Object; const { ownKeys } = GLOBAL.Reflect || {}; assert.isFunction(seal); assert.arity(seal, 1); assert.name(seal, 'seal'); assert.looksNative(seal); assert.nonEnumerable(Object, 'seal'); const data = [42, 'foo', false, null, undefined, {}]; for (const value of data) { assert.notThrows(() => seal(value) || true, `accept ${ {}.toString.call(value).slice(8, -1) }`); assert.same(seal(value), value, `returns target on ${ {}.toString.call(value).slice(8, -1) }`); } if (NATIVE) assert.ok(isSealed(seal({}))); const results = []; for (const key in seal({})) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(seal({})), []); assert.arrayEqual(getOwnPropertyNames(seal({})), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(seal({})), []); if (ownKeys) assert.arrayEqual(ownKeys(seal({})), []); }); core-js-3.6.1/tests/tests/es.object.set-prototype-of.js000066400000000000000000000014371360057567700230650ustar00rootroot00000000000000import { PROTO } from '../helpers/constants'; if (PROTO) QUnit.test('Object.setPrototypeOf', assert => { const { setPrototypeOf } = Object; assert.isFunction(setPrototypeOf); assert.arity(setPrototypeOf, 2); assert.name(setPrototypeOf, 'setPrototypeOf'); assert.looksNative(setPrototypeOf); assert.nonEnumerable(Object, 'setPrototypeOf'); assert.ok('apply' in setPrototypeOf({}, Function.prototype), 'Parent properties in target'); assert.strictEqual(setPrototypeOf({ a: 2 }, { b() { return this.a ** 2; }, }).b(), 4, 'Child and parent properties in target'); const object = {}; assert.strictEqual(setPrototypeOf(object, { a: 1 }), object, 'setPrototypeOf return target'); assert.ok(!('toString' in setPrototypeOf({}, null)), 'Can set null as prototype'); }); core-js-3.6.1/tests/tests/es.object.to-string.js000066400000000000000000000067341360057567700215600ustar00rootroot00000000000000import { GLOBAL, STRICT } from '../helpers/constants'; QUnit.test('Object#toString', assert => { const { toString } = Object.prototype; const Symbol = GLOBAL.Symbol || {}; assert.arity(toString, 0); assert.name(toString, 'toString'); assert.looksNative(toString); assert.nonEnumerable(Object.prototype, 'toString'); if (STRICT) { assert.strictEqual(toString.call(null), '[object Null]', 'null -> `Null`'); assert.strictEqual(toString.call(undefined), '[object Undefined]', 'undefined -> `Undefined`'); } assert.strictEqual(toString.call(true), '[object Boolean]', 'bool -> `Boolean`'); assert.strictEqual(toString.call('string'), '[object String]', 'string -> `String`'); assert.strictEqual(toString.call(7), '[object Number]', 'number -> `Number`'); assert.strictEqual(`${ {} }`, '[object Object]', '{} -> `Object`'); assert.strictEqual(toString.call([]), '[object Array]', ' [] -> `Array`'); assert.strictEqual(toString.call(() => { /* empty */ }), '[object Function]', 'function -> `Function`'); assert.strictEqual(toString.call(/./), '[object RegExp]', 'regexp -> `RegExp`'); assert.strictEqual(toString.call(new TypeError()), '[object Error]', 'new TypeError -> `Error`'); assert.strictEqual(toString.call(function () { return arguments; }()), '[object Arguments]', 'arguments -> `Arguments`'); const constructors = [ 'Array', 'RegExp', 'Boolean', 'String', 'Number', 'Error', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'ArrayBuffer', ]; for (const name of constructors) { const Constructor = GLOBAL[name]; if (Constructor) { assert.strictEqual(toString.call(new Constructor(1)), `[object ${ name }]`, `new ${ name }(1) -> \`${ name }\``); } } if (GLOBAL.DataView) { assert.strictEqual(`${ new DataView(new ArrayBuffer(1)) }`, '[object DataView]', 'dataview -> `DataView`'); } if (GLOBAL.Set) { assert.strictEqual(`${ new Set() }`, '[object Set]', 'set -> `Set`'); } if (GLOBAL.Map) { assert.strictEqual(`${ new Map() }`, '[object Map]', 'map -> `Map`'); } if (GLOBAL.WeakSet) { assert.strictEqual(`${ new WeakSet() }`, '[object WeakSet]', 'weakset -> `WeakSet`'); } if (GLOBAL.WeakMap) { assert.strictEqual(`${ new WeakMap() }`, '[object WeakMap]', 'weakmap -> `WeakMap`'); } if (GLOBAL.Promise) { assert.strictEqual(`${ new Promise((() => { /* empty */ })) }`, '[object Promise]', 'promise -> `Promise`'); } if (''[Symbol.iterator]) { assert.strictEqual(`${ ''[Symbol.iterator]() }`, '[object String Iterator]', 'String Iterator -> `String Iterator`'); } if ([].entries) { assert.strictEqual(`${ [].entries() }`, '[object Array Iterator]', 'Array Iterator -> `Array Iterator`'); } if (GLOBAL.Set && Set.entries) { assert.strictEqual(`${ new Set().entries() }`, '[object Set Iterator]', 'Set Iterator -> `Set Iterator`'); } if (GLOBAL.Map && Map.entries) { assert.strictEqual(`${ new Map().entries() }`, '[object Map Iterator]', 'Map Iterator -> `Map Iterator`'); } assert.strictEqual(`${ Math }`, '[object Math]', 'Math -> `Math`'); if (GLOBAL.JSON) { assert.strictEqual(`${ JSON }`, '[object JSON]', 'JSON -> `JSON`'); } function Class() { /* empty */ } Class.prototype[Symbol.toStringTag] = 'Class'; assert.strictEqual(`${ new Class() }`, '[object Class]', 'user class instance -> [Symbol.toStringTag]'); }); core-js-3.6.1/tests/tests/es.object.values.js000066400000000000000000000017751360057567700211310ustar00rootroot00000000000000QUnit.test('Object.values', assert => { const { values, create, assign } = Object; assert.isFunction(values); assert.arity(values, 1); assert.name(values, 'values'); assert.looksNative(values); assert.nonEnumerable(Object, 'values'); assert.deepEqual(values({ q: 1, w: 2, e: 3 }), [1, 2, 3]); assert.deepEqual(values(new String('qwe')), ['q', 'w', 'e']); assert.deepEqual(values(assign(create({ q: 1, w: 2, e: 3 }), { a: 4, s: 5, d: 6 })), [4, 5, 6]); assert.deepEqual(values({ valueOf: 42 }), [42], 'IE enum keys bug'); try { assert.deepEqual(Function('values', ` return values({ a: 1, get b() { delete this.c; return 2; }, c: 3 }); `)(values), [1, 2]); } catch { /* empty */ } try { assert.deepEqual(Function('values', ` return values({ a: 1, get b() { Object.defineProperty(this, "c", { value: 4, enumerable: false }); return 2; }, c: 3 }); `)(values), [1, 2]); } catch { /* empty */ } }); core-js-3.6.1/tests/tests/es.parse-float.js000066400000000000000000000011761360057567700205750ustar00rootroot00000000000000import { WHITESPACES } from '../helpers/constants'; QUnit.test('parseFloat', assert => { assert.isFunction(parseFloat); assert.name(parseFloat, 'parseFloat'); assert.arity(parseFloat, 1); assert.looksNative(parseFloat); assert.same(parseFloat('0'), 0); assert.same(parseFloat(' 0'), 0); assert.same(parseFloat('+0'), 0); assert.same(parseFloat(' +0'), 0); assert.same(parseFloat('-0'), -0); assert.same(parseFloat(' -0'), -0); assert.same(parseFloat(`${ WHITESPACES }+0`), 0); assert.same(parseFloat(`${ WHITESPACES }-0`), -0); assert.same(parseFloat(null), NaN); assert.same(parseFloat(undefined), NaN); }); core-js-3.6.1/tests/tests/es.parse-int.js000066400000000000000000000032231360057567700202550ustar00rootroot00000000000000import { WHITESPACES } from '../helpers/constants'; /* eslint-disable radix */ QUnit.test('parseInt', assert => { assert.isFunction(parseInt); assert.name(parseInt, 'parseInt'); assert.arity(parseInt, 2); assert.looksNative(parseInt); for (let radix = 2; radix <= 36; ++radix) { assert.same(parseInt('10', radix), radix, `radix ${ radix }`); } const strings = ['01', '08', '10', '42']; for (const string of strings) { assert.same(parseInt(string), parseInt(string, 10), `default radix is 10: ${ string }`); } assert.same(parseInt('0x16'), parseInt('0x16', 16), 'default radix is 16: 0x16'); assert.same(parseInt(' 0x16'), parseInt('0x16', 16), 'ignores leading whitespace #1'); assert.same(parseInt(' 42'), parseInt('42', 10), 'ignores leading whitespace #2'); assert.same(parseInt(' 08'), parseInt('08', 10), 'ignores leading whitespace #3'); assert.same(parseInt(`${ WHITESPACES }08`), parseInt('08', 10), 'ignores leading whitespace #4'); assert.same(parseInt(`${ WHITESPACES }0x16`), parseInt('0x16', 16), 'ignores leading whitespace #5'); const fakeZero = { valueOf() { return 0; }, }; assert.same(parseInt('08', fakeZero), parseInt('08', 10), 'valueOf #1'); assert.same(parseInt('0x16', fakeZero), parseInt('0x16', 16), 'valueOf #2'); assert.same(parseInt('-0xF'), -15, 'signed hex #1'); assert.same(parseInt('-0xF', 16), -15, 'signed hex #2'); assert.same(parseInt('+0xF'), 15, 'signed hex #3'); assert.same(parseInt('+0xF', 16), 15, 'signed hex #4'); assert.same(parseInt('10', -4294967294), 2, 'radix uses ToUint32'); assert.same(parseInt(null), NaN); assert.same(parseInt(undefined), NaN); }); core-js-3.6.1/tests/tests/es.promise.all-settled.js000066400000000000000000000016651360057567700222520ustar00rootroot00000000000000QUnit.test('Promise.allSettled', assert => { assert.isFunction(Promise.allSettled); assert.arity(Promise.allSettled, 1); assert.looksNative(Promise.allSettled); assert.nonEnumerable(Promise, 'allSettled'); assert.ok(Promise.allSettled([1, 2, 3]) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.allSettled, resolved', assert => { assert.expect(1); const async = assert.async(); Promise.allSettled([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(it => { assert.deepEqual(it, [ { value: 1, status: 'fulfilled' }, { reason: 2, status: 'rejected' }, { value: 3, status: 'fulfilled' }, ], 'resolved with a correct value'); async(); }); }); QUnit.test('Promise.allSettled, rejected', assert => { assert.expect(1); const async = assert.async(); Promise.allSettled().catch(() => { assert.ok(true, 'rejected as expected'); async(); }); }); core-js-3.6.1/tests/tests/es.promise.finally.js000066400000000000000000000035721360057567700214750ustar00rootroot00000000000000QUnit.test('Promise#finally', assert => { assert.isFunction(Promise.prototype.finally); assert.arity(Promise.prototype.finally, 1); assert.looksNative(Promise.prototype.finally); assert.nonEnumerable(Promise.prototype, 'finally'); assert.ok(Promise.resolve(42).finally(() => { /* empty */ }) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise#finally, resolved', assert => { assert.expect(3); const async = assert.async(); let called = 0; let argument = null; Promise.resolve(42).finally(it => { called++; argument = it; }).then(it => { assert.same(it, 42, 'resolved with a correct value'); assert.same(called, 1, 'onFinally function called one time'); assert.same(argument, undefined, 'onFinally function called with a correct argument'); async(); }); }); QUnit.test('Promise#finally, rejected', assert => { assert.expect(2); const async = assert.async(); let called = 0; let argument = null; Promise.reject(42).finally(it => { called++; argument = it; }).catch(() => { assert.same(called, 1, 'onFinally function called one time'); assert.same(argument, undefined, 'onFinally function called with a correct argument'); async(); }); }); const promise = (() => { try { return Function('return (async function () { /* empty */ })()')(); } catch { /* empty */ } })(); if (promise && promise.constructor !== Promise) QUnit.test('Native Promise, patched', assert => { assert.isFunction(promise.finally); assert.arity(promise.finally, 1); assert.looksNative(promise.finally); assert.nonEnumerable(promise.constructor.prototype, 'finally'); function empty() { /* empty */ } assert.ok(promise.finally(empty) instanceof Promise, '`.finally` returns `Promise` instance #1'); assert.ok(new promise.constructor(empty).finally(empty) instanceof Promise, '`.finally` returns `Promise` instance #2'); }); core-js-3.6.1/tests/tests/es.promise.js000066400000000000000000000412441360057567700200360ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE, PROTO, STRICT } from '../helpers/constants'; import { createIterable } from '../helpers/helpers'; const Symbol = GLOBAL.Symbol || {}; const { setPrototypeOf, create } = Object; QUnit.test('Promise', assert => { assert.isFunction(Promise); assert.arity(Promise, 1); assert.name(Promise, 'Promise'); assert.looksNative(Promise); assert.throws(() => { Promise(); }, 'throws w/o `new`'); new Promise(function (resolve, reject) { assert.isFunction(resolve, 'resolver is function'); assert.isFunction(reject, 'rejector is function'); if (STRICT) assert.same(this, undefined, 'correct executor context'); }); }); if (DESCRIPTORS) QUnit.test('Promise operations order', assert => { let resolve, resolve2; assert.expect(1); const EXPECTED_ORDER = 'DEHAFGBC'; const async = assert.async(); let result = ''; const promise1 = new Promise(r => { resolve = r; }); resolve({ then() { result += 'A'; throw Error(); }, }); promise1.catch(() => { result += 'B'; }); promise1.catch(() => { result += 'C'; assert.same(result, EXPECTED_ORDER); async(); }); const promise2 = new Promise(r => { resolve2 = r; }); resolve2(Object.defineProperty({}, 'then', { get() { result += 'D'; throw Error(); }, })); result += 'E'; promise2.catch(() => { result += 'F'; }); promise2.catch(() => { result += 'G'; }); result += 'H'; setTimeout(() => { if (!~result.indexOf('C')) { assert.same(result, EXPECTED_ORDER); async(); } }, 1e3); }); QUnit.test('Promise#then', assert => { assert.isFunction(Promise.prototype.then); if (NATIVE) assert.arity(Promise.prototype.then, 2); assert.name(Promise.prototype.then, 'then'); assert.looksNative(Promise.prototype.then); assert.nonEnumerable(Promise.prototype, 'then'); let promise = new Promise(resolve => { resolve(42); }); let FakePromise1 = promise.constructor = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; const FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(promise.then(() => { /* empty */ }) instanceof FakePromise2, 'subclassing, @@species pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(promise.then(() => { /* empty */ }) instanceof Promise, 'subclassing, incorrect `this` pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1[Symbol.species] = function () { /* empty */ }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #1'); FakePromise1[Symbol.species] = function (executor) { executor(null, () => { /* empty */ }); }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #2'); FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, null); }; assert.throws(() => { promise.then(() => { /* empty */ }); }, 'NewPromiseCapability validations, #3'); }); QUnit.test('Promise#catch', assert => { assert.isFunction(Promise.prototype.catch); if (NATIVE) assert.arity(Promise.prototype.catch, 1); if (NATIVE) assert.name(Promise.prototype.catch, 'catch'); assert.looksNative(Promise.prototype.catch); assert.nonEnumerable(Promise.prototype, 'catch'); let promise = new Promise(resolve => { resolve(42); }); let FakePromise1 = promise.constructor = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; const FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(promise.catch(() => { /* empty */ }) instanceof FakePromise2, 'subclassing, @@species pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(promise.catch(() => { /* empty */ }) instanceof Promise, 'subclassing, incorrect `this` pattern'); promise = new Promise(resolve => { resolve(42); }); promise.constructor = FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1[Symbol.species] = function () { /* empty */ }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #1'); FakePromise1[Symbol.species] = function (executor) { executor(null, () => { /* empty */ }); }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #2'); FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, null); }; assert.throws(() => { promise.catch(() => { /* empty */ }); }, 'NewPromiseCapability validations, #3'); assert.same(Promise.prototype.catch.call({ then(x, y) { return y; }, }, 42), 42, 'calling `.then`'); }); QUnit.test('Promise#@@toStringTag', assert => { assert.ok(Promise.prototype[Symbol.toStringTag] === 'Promise', 'Promise::@@toStringTag is `Promise`'); assert.strictEqual(String(new Promise(() => { /* empty */ })), '[object Promise]', 'correct stringification'); }); QUnit.test('Promise.all', assert => { let FakePromise1, FakePromise2; const { all, resolve } = Promise; assert.isFunction(all); assert.arity(all, 1); assert.name(all, 'all'); assert.looksNative(all); assert.nonEnumerable(Promise, 'all'); const iterable = createIterable([1, 2, 3]); Promise.all(iterable).catch(() => { /* empty */ }); assert.ok(iterable.received, 'works with iterables: iterator received'); assert.ok(iterable.called, 'works with iterables: next called'); const array = []; let done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; Promise.all(array); assert.ok(done); assert.throws(() => { all.call(null, []).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); done = false; try { Promise.resolve = function () { throw new Error(); }; Promise.all(createIterable([1, 2, 3], { return() { done = true; }, })).catch(() => { /* empty */ }); } catch (error) { /* empty */ } Promise.resolve = resolve; assert.ok(done, 'iteration closing'); FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1.resolve = FakePromise2.resolve = Promise.resolve.bind(Promise); assert.ok(all.call(FakePromise1, [1, 2, 3]) instanceof FakePromise1, 'subclassing, `this` pattern'); FakePromise1 = function () { /* empty */ }; FakePromise2 = function (executor) { executor(null, () => { /* empty */ }); }; const FakePromise3 = function (executor) { executor(() => { /* empty */ }, null); }; FakePromise1.resolve = FakePromise2.resolve = FakePromise3.resolve = Promise.resolve.bind(Promise); assert.throws(() => { all.call(FakePromise1, [1, 2, 3]); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { all.call(FakePromise2, [1, 2, 3]); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { all.call(FakePromise3, [1, 2, 3]); }, 'NewPromiseCapability validations, #3'); }); QUnit.test('Promise.race', assert => { let FakePromise1, FakePromise2; const { race, resolve } = Promise; assert.isFunction(race); assert.arity(race, 1); assert.name(race, 'race'); assert.looksNative(race); assert.nonEnumerable(Promise, 'race'); const iterable = createIterable([1, 2, 3]); Promise.race(iterable).catch(() => { /* empty */ }); assert.ok(iterable.received, 'works with iterables: iterator received'); assert.ok(iterable.called, 'works with iterables: next called'); const array = []; let done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; Promise.race(array); assert.ok(done); assert.throws(() => { race.call(null, []).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); done = false; try { Promise.resolve = function () { throw new Error(); }; Promise.race(createIterable([1, 2, 3], { return() { done = true; }, })).catch(() => { /* empty */ }); } catch (error) { /* empty */ } Promise.resolve = resolve; assert.ok(done, 'iteration closing'); FakePromise1 = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise2 = FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; FakePromise1.resolve = FakePromise2.resolve = Promise.resolve.bind(Promise); assert.ok(race.call(FakePromise1, [1, 2, 3]) instanceof FakePromise1, 'subclassing, `this` pattern'); FakePromise1 = function () { /* empty */ }; FakePromise2 = function (executor) { executor(null, () => { /* empty */ }); }; const FakePromise3 = function (executor) { executor(() => { /* empty */ }, null); }; FakePromise1.resolve = FakePromise2.resolve = FakePromise3.resolve = Promise.resolve.bind(Promise); assert.throws(() => { race.call(FakePromise1, [1, 2, 3]); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { race.call(FakePromise2, [1, 2, 3]); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { race.call(FakePromise3, [1, 2, 3]); }, 'NewPromiseCapability validations, #3'); }); QUnit.test('Promise.resolve', assert => { const { resolve } = Promise; assert.isFunction(resolve); if (NATIVE) assert.arity(resolve, 1); assert.name(resolve, 'resolve'); assert.looksNative(resolve); assert.nonEnumerable(Promise, 'resolve'); assert.throws(() => { resolve.call(null, 1).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); function FakePromise1(executor) { executor(() => { /* empty */ }, () => { /* empty */ }); } FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(resolve.call(FakePromise1, 42) instanceof FakePromise1, 'subclassing, `this` pattern'); assert.throws(() => { resolve.call(() => { /* empty */ }, 42); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { resolve.call(executor => { executor(null, () => { /* empty */ }); }, 42); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { resolve.call(executor => { executor(() => { /* empty */ }, null); }, 42); }, 'NewPromiseCapability validations, #3'); }); QUnit.test('Promise.reject', assert => { const { reject } = Promise; assert.isFunction(reject); if (NATIVE) assert.arity(reject, 1); assert.name(reject, 'reject'); assert.looksNative(reject); assert.nonEnumerable(Promise, 'reject'); assert.throws(() => { reject.call(null, 1).catch(() => { /* empty */ }); }, TypeError, 'throws without context'); function FakePromise1(executor) { executor(() => { /* empty */ }, () => { /* empty */ }); } FakePromise1[Symbol.species] = function (executor) { executor(() => { /* empty */ }, () => { /* empty */ }); }; assert.ok(reject.call(FakePromise1, 42) instanceof FakePromise1, 'subclassing, `this` pattern'); assert.throws(() => { reject.call(() => { /* empty */ }, 42); }, 'NewPromiseCapability validations, #1'); assert.throws(() => { reject.call(executor => { executor(null, () => { /* empty */ }); }, 42); }, 'NewPromiseCapability validations, #2'); assert.throws(() => { reject.call(executor => { executor(() => { /* empty */ }, null); }, 42); }, 'NewPromiseCapability validations, #3'); }); if (PROTO) QUnit.test('Promise subclassing', assert => { function SubPromise(executor) { const self = new Promise(executor); setPrototypeOf(self, SubPromise.prototype); self.mine = 'subclass'; return self; } setPrototypeOf(SubPromise, Promise); SubPromise.prototype = create(Promise.prototype); SubPromise.prototype.constructor = SubPromise; let promise1 = SubPromise.resolve(5); assert.strictEqual(promise1.mine, 'subclass'); promise1 = promise1.then(it => { assert.strictEqual(it, 5); }); assert.strictEqual(promise1.mine, 'subclass'); let promise2 = new SubPromise(resolve => { resolve(6); }); assert.strictEqual(promise2.mine, 'subclass'); promise2 = promise2.then(it => { assert.strictEqual(it, 6); }); assert.strictEqual(promise2.mine, 'subclass'); const promise3 = SubPromise.all([promise1, promise2]); assert.strictEqual(promise3.mine, 'subclass'); assert.ok(promise3 instanceof Promise); assert.ok(promise3 instanceof SubPromise); promise3.then(assert.async(), it => { assert.ok(it, false); }); }); // qunit@2.5 strange bug QUnit.skip('Unhandled rejection tracking', assert => { let done = false; const resume = assert.async(); if (GLOBAL.process) { assert.expect(3); function onunhandledrejection(reason, promise) { process.removeListener('unhandledRejection', onunhandledrejection); assert.same(promise, $promise, 'unhandledRejection, promise'); assert.same(reason, 42, 'unhandledRejection, reason'); $promise.catch(() => { // empty }); } function onrejectionhandled(promise) { process.removeListener('rejectionHandled', onrejectionhandled); assert.same(promise, $promise, 'rejectionHandled, promise'); done || resume(); done = true; } process.on('unhandledRejection', onunhandledrejection); process.on('rejectionHandled', onrejectionhandled); } else { if (GLOBAL.addEventListener) { assert.expect(8); function onunhandledrejection(it) { assert.same(it.promise, $promise, 'addEventListener(unhandledrejection), promise'); assert.same(it.reason, 42, 'addEventListener(unhandledrejection), reason'); GLOBAL.removeEventListener('unhandledrejection', onunhandledrejection); } GLOBAL.addEventListener('rejectionhandled', onunhandledrejection); function onrejectionhandled(it) { assert.same(it.promise, $promise, 'addEventListener(rejectionhandled), promise'); assert.same(it.reason, 42, 'addEventListener(rejectionhandled), reason'); GLOBAL.removeEventListener('rejectionhandled', onrejectionhandled); } GLOBAL.addEventListener('rejectionhandled', onrejectionhandled); } else assert.expect(4); GLOBAL.onunhandledrejection = function (it) { assert.same(it.promise, $promise, 'onunhandledrejection, promise'); assert.same(it.reason, 42, 'onunhandledrejection, reason'); setTimeout(() => { $promise.catch(() => { // empty }); }, 1); GLOBAL.onunhandledrejection = null; }; GLOBAL.onrejectionhandled = function (it) { assert.same(it.promise, $promise, 'onrejectionhandled, promise'); assert.same(it.reason, 42, 'onrejectionhandled, reason'); GLOBAL.onrejectionhandled = null; done || resume(); done = true; }; } Promise.reject(43).catch(() => { // empty }); const $promise = Promise.reject(42); setTimeout(() => { done || resume(); done = true; }, 3e3); }); const promise = (() => { try { return Function('return (async function () { /* empty */ })()')(); } catch { /* empty */ } })(); if (promise && promise.constructor !== Promise) QUnit.test('Native Promise, patched', assert => { assert.isFunction(promise.then); assert.arity(promise.then, 2); assert.looksNative(promise.then); assert.nonEnumerable(promise.constructor.prototype, 'then'); function empty() { /* empty */ } assert.ok(promise.then(empty) instanceof Promise, '`.then` returns `Promise` instance #1'); assert.ok(new promise.constructor(empty).then(empty) instanceof Promise, '`.then` returns `Promise` instance #2'); assert.ok(promise.catch(empty) instanceof Promise, '`.catch` returns `Promise` instance #1'); assert.ok(new promise.constructor(empty).catch(empty) instanceof Promise, '`.catch` returns `Promise` instance #2'); assert.ok(promise.finally(empty) instanceof Promise, '`.finally` returns `Promise` instance #1'); assert.ok(new promise.constructor(empty).finally(empty) instanceof Promise, '`.finally` returns `Promise` instance #2'); }); core-js-3.6.1/tests/tests/es.reflect.apply.js000066400000000000000000000014031360057567700211210ustar00rootroot00000000000000QUnit.test('Reflect.apply', assert => { const { apply } = Reflect; assert.isFunction(apply); assert.arity(apply, 3); assert.name(apply, 'apply'); assert.looksNative(apply); assert.nonEnumerable(Reflect, 'apply'); assert.strictEqual(apply(Array.prototype.push, [1, 2], [3, 4, 5]), 5); function f(a, b, c) { return a + b + c; } f.apply = 42; assert.strictEqual(apply(f, null, ['foo', 'bar', 'baz']), 'foobarbaz', 'works with redefined apply'); assert.throws(() => apply(42, null, []), TypeError, 'throws on primitive'); assert.throws(() => apply(() => { /* empty */ }, null), TypeError, 'throws without third argument'); assert.throws(() => apply(() => { /* empty */ }, null, '123'), TypeError, 'throws on primitive as third argument'); }); core-js-3.6.1/tests/tests/es.reflect.construct.js000066400000000000000000000023011360057567700220160ustar00rootroot00000000000000QUnit.test('Reflect.construct', assert => { const { construct } = Reflect; const { getPrototypeOf } = Object; assert.isFunction(construct); assert.arity(construct, 2); assert.name(construct, 'construct'); assert.looksNative(construct); assert.nonEnumerable(Reflect, 'construct'); function A(a, b, c) { this.qux = a + b + c; } assert.strictEqual(construct(A, ['foo', 'bar', 'baz']).qux, 'foobarbaz', 'basic'); A.apply = 42; assert.strictEqual(construct(A, ['foo', 'bar', 'baz']).qux, 'foobarbaz', 'works with redefined apply'); const instance = construct(function () { this.x = 42; }, [], Array); assert.strictEqual(instance.x, 42, 'constructor with newTarget'); assert.ok(instance instanceof Array, 'prototype with newTarget'); assert.throws(() => construct(42, []), TypeError, 'throws on primitive'); function B() { /* empty */ } B.prototype = 42; assert.notThrows(() => getPrototypeOf(construct(B, [])) === Object.prototype); assert.notThrows(() => typeof construct(Date, []).getTime() == 'number', 'works with native constructors with 2 arguments'); assert.throws(() => construct(() => { /* empty */ }), 'throws when the second argument is not an object'); }); core-js-3.6.1/tests/tests/es.reflect.define-property.js000066400000000000000000000024601360057567700231140ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Reflect.defineProperty', assert => { const { defineProperty } = Reflect; const { getOwnPropertyDescriptor, create } = Object; assert.isFunction(defineProperty); assert.arity(defineProperty, 3); assert.name(defineProperty, 'defineProperty'); assert.looksNative(defineProperty); assert.nonEnumerable(Reflect, 'defineProperty'); let object = {}; assert.strictEqual(defineProperty(object, 'foo', { value: 123 }), true); assert.strictEqual(object.foo, 123); if (DESCRIPTORS) { object = {}; defineProperty(object, 'foo', { value: 123, enumerable: true, }); assert.deepEqual(getOwnPropertyDescriptor(object, 'foo'), { value: 123, enumerable: true, configurable: false, writable: false, }); assert.strictEqual(defineProperty(object, 'foo', { value: 42, }), false); } assert.throws(() => defineProperty(42, 'foo', { value: 42, }), TypeError, 'throws on primitive'); assert.throws(() => defineProperty(42, 1, {})); assert.throws(() => defineProperty({}, create(null), {})); assert.throws(() => defineProperty({}, 1, 1)); }); QUnit.test('Reflect.defineProperty.sham flag', assert => { assert.same(Reflect.defineProperty.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/tests/es.reflect.delete-property.js000066400000000000000000000013471360057567700231270ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Reflect.deleteProperty', assert => { const { deleteProperty } = Reflect; const { defineProperty, keys } = Object; assert.isFunction(deleteProperty); assert.arity(deleteProperty, 2); assert.name(deleteProperty, 'deleteProperty'); assert.looksNative(deleteProperty); assert.nonEnumerable(Reflect, 'deleteProperty'); const object = { bar: 456 }; assert.strictEqual(deleteProperty(object, 'bar'), true); assert.ok(keys(object).length === 0); if (DESCRIPTORS) { assert.strictEqual(deleteProperty(defineProperty({}, 'foo', { value: 42, }), 'foo'), false); } assert.throws(() => deleteProperty(42, 'foo'), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/tests/es.reflect.get-own-property-descriptor.js000066400000000000000000000015021360057567700254120ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Reflect.getOwnPropertyDescriptor', assert => { const { getOwnPropertyDescriptor } = Reflect; assert.isFunction(getOwnPropertyDescriptor); assert.arity(getOwnPropertyDescriptor, 2); assert.name(getOwnPropertyDescriptor, 'getOwnPropertyDescriptor'); assert.looksNative(getOwnPropertyDescriptor); assert.nonEnumerable(Reflect, 'getOwnPropertyDescriptor'); const object = { baz: 789 }; const descriptor = getOwnPropertyDescriptor(object, 'baz'); assert.strictEqual(descriptor.value, 789); assert.throws(() => getOwnPropertyDescriptor(42, 'constructor'), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.getOwnPropertyDescriptor.sham flag', assert => { assert.same(Reflect.getOwnPropertyDescriptor.sham, DESCRIPTORS ? undefined : true); }); core-js-3.6.1/tests/tests/es.reflect.get-prototype-of.js000066400000000000000000000012201360057567700232150ustar00rootroot00000000000000import { CORRECT_PROTOTYPE_GETTER } from '../helpers/constants'; QUnit.test('Reflect.getPrototypeOf', assert => { const { getPrototypeOf } = Reflect; assert.isFunction(getPrototypeOf); assert.arity(getPrototypeOf, 1); assert.name(getPrototypeOf, 'getPrototypeOf'); assert.looksNative(getPrototypeOf); assert.nonEnumerable(Reflect, 'getPrototypeOf'); assert.strictEqual(getPrototypeOf([]), Array.prototype); assert.throws(() => getPrototypeOf(42), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.getPrototypeOf.sham flag', assert => { assert.same(Reflect.getPrototypeOf.sham, CORRECT_PROTOTYPE_GETTER ? undefined : true); }); core-js-3.6.1/tests/tests/es.reflect.get.js000066400000000000000000000020761360057567700205620ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE } from '../helpers/constants'; QUnit.test('Reflect.get', assert => { const { defineProperty, create } = Object; const { get } = Reflect; assert.isFunction(get); if (NATIVE) assert.arity(get, 2); assert.name(get, 'get'); assert.looksNative(get); assert.nonEnumerable(Reflect, 'get'); assert.strictEqual(get({ qux: 987 }, 'qux'), 987); if (DESCRIPTORS) { const target = create(defineProperty({ z: 3 }, 'w', { get() { return this; }, }), { x: { value: 1, }, y: { get() { return this; }, }, }); const receiver = {}; assert.strictEqual(get(target, 'x', receiver), 1, 'get x'); assert.strictEqual(get(target, 'y', receiver), receiver, 'get y'); assert.strictEqual(get(target, 'z', receiver), 3, 'get z'); assert.strictEqual(get(target, 'w', receiver), receiver, 'get w'); assert.strictEqual(get(target, 'u', receiver), undefined, 'get u'); } assert.throws(() => get(42, 'constructor'), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/tests/es.reflect.has.js000066400000000000000000000007331360057567700205540ustar00rootroot00000000000000QUnit.test('Reflect.has', assert => { const { has } = Reflect; assert.isFunction(has); assert.arity(has, 2); assert.name(has, 'has'); assert.looksNative(has); assert.nonEnumerable(Reflect, 'has'); const object = { qux: 987 }; assert.strictEqual(has(object, 'qux'), true); assert.strictEqual(has(object, 'qwe'), false); assert.strictEqual(has(object, 'toString'), true); assert.throws(() => has(42, 'constructor'), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/tests/es.reflect.is-extensible.js000066400000000000000000000010631360057567700225510ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Reflect.isExtensible', assert => { const { isExtensible } = Reflect; const { preventExtensions } = Object; assert.isFunction(isExtensible); assert.arity(isExtensible, 1); assert.name(isExtensible, 'isExtensible'); assert.looksNative(isExtensible); assert.nonEnumerable(Reflect, 'isExtensible'); assert.ok(isExtensible({})); if (DESCRIPTORS) { assert.ok(!isExtensible(preventExtensions({}))); } assert.throws(() => isExtensible(42), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/tests/es.reflect.own-keys.js000066400000000000000000000017111360057567700215520ustar00rootroot00000000000000import { includes } from '../helpers/helpers'; QUnit.test('Reflect.ownKeys', assert => { const { ownKeys } = Reflect; const { defineProperty, create } = Object; const symbol = Symbol('c'); assert.isFunction(ownKeys); assert.arity(ownKeys, 1); assert.name(ownKeys, 'ownKeys'); assert.looksNative(ownKeys); assert.nonEnumerable(Reflect, 'ownKeys'); const object = { a: 1 }; defineProperty(object, 'b', { value: 2, }); object[symbol] = 3; let keys = ownKeys(object); assert.strictEqual(keys.length, 3, 'ownKeys return all own keys'); assert.ok(includes(keys, 'a'), 'ownKeys return all own keys: simple'); assert.ok(includes(keys, 'b'), 'ownKeys return all own keys: hidden'); assert.strictEqual(object[keys[2]], 3, 'ownKeys return all own keys: symbol'); keys = ownKeys(create(object)); assert.strictEqual(keys.length, 0, 'ownKeys return only own keys'); assert.throws(() => ownKeys(42), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/tests/es.reflect.prevent-extensions.js000066400000000000000000000014101360057567700236520ustar00rootroot00000000000000import { DESCRIPTORS, FREEZING } from '../helpers/constants'; QUnit.test('Reflect.preventExtensions', assert => { const { preventExtensions } = Reflect; const { isExtensible } = Object; assert.isFunction(preventExtensions); assert.arity(preventExtensions, 1); assert.name(preventExtensions, 'preventExtensions'); assert.looksNative(preventExtensions); assert.nonEnumerable(Reflect, 'preventExtensions'); const object = {}; assert.ok(preventExtensions(object), true); if (DESCRIPTORS) { assert.ok(!isExtensible(object)); } assert.throws(() => preventExtensions(42), TypeError, 'throws on primitive'); }); QUnit.test('Reflect.preventExtensions.sham flag', assert => { assert.same(Reflect.preventExtensions.sham, FREEZING ? undefined : true); }); core-js-3.6.1/tests/tests/es.reflect.set-prototype-of.js000066400000000000000000000013411360057567700232350ustar00rootroot00000000000000import { NATIVE, PROTO } from '../helpers/constants'; if (PROTO) QUnit.test('Reflect.setPrototypeOf', assert => { const { setPrototypeOf } = Reflect; assert.isFunction(setPrototypeOf); if (NATIVE) assert.arity(setPrototypeOf, 2); assert.name(setPrototypeOf, 'setPrototypeOf'); assert.looksNative(setPrototypeOf); assert.nonEnumerable(Reflect, 'setPrototypeOf'); let object = {}; assert.ok(setPrototypeOf(object, Array.prototype), true); assert.ok(object instanceof Array); assert.throws(() => setPrototypeOf({}, 42), TypeError); assert.throws(() => setPrototypeOf(42, {}), TypeError, 'throws on primitive'); object = {}; assert.ok(setPrototypeOf(object, object) === false, 'false on recursive __proto__'); }); core-js-3.6.1/tests/tests/es.reflect.set.js000066400000000000000000000054331360057567700205760ustar00rootroot00000000000000import { DESCRIPTORS, NATIVE } from '../helpers/constants'; QUnit.test('Reflect.set', assert => { const { set } = Reflect; const { defineProperty, getOwnPropertyDescriptor, create, getPrototypeOf } = Object; assert.isFunction(set); if (NATIVE) assert.arity(set, 3); assert.name(set, 'set'); assert.looksNative(set); assert.nonEnumerable(Reflect, 'set'); const object = {}; assert.ok(set(object, 'quux', 654), true); assert.strictEqual(object.quux, 654); let target = {}; const receiver = {}; set(target, 'foo', 1, receiver); assert.strictEqual(target.foo, undefined, 'target.foo === undefined'); assert.strictEqual(receiver.foo, 1, 'receiver.foo === 1'); if (DESCRIPTORS) { defineProperty(receiver, 'bar', { value: 0, writable: true, enumerable: false, configurable: true, }); set(target, 'bar', 1, receiver); assert.strictEqual(receiver.bar, 1, 'receiver.bar === 1'); assert.strictEqual(getOwnPropertyDescriptor(receiver, 'bar').enumerable, false, 'enumerability not overridden'); let out = null; target = create(defineProperty({ z: 3 }, 'w', { set() { out = this; }, }), { x: { value: 1, writable: true, configurable: true, }, y: { set() { out = this; }, }, c: { value: 1, writable: false, configurable: false, }, }); assert.strictEqual(set(target, 'x', 2, target), true, 'set x'); assert.strictEqual(target.x, 2, 'set x'); out = null; assert.strictEqual(set(target, 'y', 2, target), true, 'set y'); assert.strictEqual(out, target, 'set y'); assert.strictEqual(set(target, 'z', 4, target), true); assert.strictEqual(target.z, 4, 'set z'); out = null; assert.strictEqual(set(target, 'w', 1, target), true, 'set w'); assert.strictEqual(out, target, 'set w'); assert.strictEqual(set(target, 'u', 0, target), true, 'set u'); assert.strictEqual(target.u, 0, 'set u'); assert.strictEqual(set(target, 'c', 2, target), false, 'set c'); assert.strictEqual(target.c, 1, 'set c'); // https://github.com/zloirock/core-js/issues/392 let o = defineProperty({}, 'test', { writable: false, configurable: true, }); assert.strictEqual(set(getPrototypeOf(o), 'test', 1, o), false); // https://github.com/zloirock/core-js/issues/393 o = defineProperty({}, 'test', { get() { /* empty */ }, }); assert.notThrows(() => !set(getPrototypeOf(o), 'test', 1, o)); o = defineProperty({}, 'test', { // eslint-disable-next-line no-unused-vars set(v) { /* empty */ }, }); assert.notThrows(() => !set(getPrototypeOf(o), 'test', 1, o)); } assert.throws(() => set(42, 'q', 42), TypeError, 'throws on primitive'); }); core-js-3.6.1/tests/tests/es.regexp.constructor.js000066400000000000000000000041321360057567700222310ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL } from '../helpers/constants'; import { nativeSubclass } from '../helpers/helpers'; if (DESCRIPTORS) { QUnit.test('RegExp constructor', assert => { const Symbol = GLOBAL.Symbol || {}; assert.isFunction(RegExp); assert.arity(RegExp, 2); assert.name(RegExp, 'RegExp'); assert.looksNative(RegExp); assert.ok({}.toString.call(RegExp()).slice(8, -1), 'RegExp'); assert.ok({}.toString.call(new RegExp()).slice(8, -1), 'RegExp'); const regexp = /a/g; assert.notStrictEqual(regexp, new RegExp(regexp), 'new RegExp(regexp) isnt regexp'); assert.strictEqual(regexp, RegExp(regexp), 'RegExp(regexp) is regexp'); regexp[Symbol.match] = false; assert.notStrictEqual(regexp, RegExp(regexp), 'RegExp(regexp) isnt regexp, changed Symbol.match'); const object = {}; assert.notStrictEqual(object, RegExp(object), 'RegExp(O) isnt O'); object[Symbol.match] = true; object.constructor = RegExp; assert.strictEqual(object, RegExp(object), 'RegExp(O) is O, changed Symbol.match'); assert.strictEqual(String(regexp), '/a/g', 'b is /a/g'); assert.strictEqual(String(new RegExp(/a/g, 'mi')), '/a/im', 'Allows a regex with flags'); assert.ok(new RegExp(/a/g, 'im') instanceof RegExp, 'Works with instanceof'); assert.strictEqual(new RegExp(/a/g, 'im').constructor, RegExp, 'Has the right constructor'); /(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)/.exec('abcdefghijklmnopq'); let result = true; const characters = 'bcdefghij'; for (let i = 0, { length } = characters; i < length; ++i) { const chr = characters[i]; if (RegExp[`$${ i + 1 }`] !== chr) { result = false; } } assert.ok(result, 'Updates RegExp globals'); if (nativeSubclass) { const Subclass = nativeSubclass(RegExp); assert.ok(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.ok(new Subclass() instanceof RegExp, 'correct subclassing with native classes #2'); assert.ok(new Subclass('^abc$').test('abc'), 'correct subclassing with native classes #3'); } }); } core-js-3.6.1/tests/tests/es.regexp.exec.js000066400000000000000000000055441360057567700206000ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('RegExp#exec lastIndex updating', assert => { let re = /b/; assert.strictEqual(re.lastIndex, 0, '.lastIndex starts at 0 for non-global regexps'); re.exec('abc'); assert.strictEqual(re.lastIndex, 0, '.lastIndex isn\'t updated for non-global regexps'); re = /b/g; assert.strictEqual(re.lastIndex, 0, '.lastIndex starts at 0 for global regexps'); re.exec('abc'); assert.strictEqual(re.lastIndex, 2, '.lastIndex is updated for global regexps'); re = /b*/; re.exec('a'); assert.strictEqual(re.lastIndex, 0, '.lastIndex isn\'t updated for non-global regexps if the match is empty'); re = /b*/g; re.exec('a'); assert.strictEqual(re.lastIndex, 0, '.lastIndex isn\'t updated for global regexps if the match is empty'); }); QUnit.test('RegExp#exec capturing groups', assert => { assert.deepEqual(/(a?)/.exec('x'), ['', ''], '/(a?)/.exec("x") returns ["", ""]'); assert.deepEqual(/(a)?/.exec('x'), ['', undefined], '/(a)?/.exec("x") returns ["", undefined]'); // @nicolo-ribaudo: I don't know how to fix this in IE8. For the `/(a)?/` case it is fixed using // #replace, but here also #replace is buggy :( // assert.deepEqual(/(a?)?/.exec('x'), ['', undefined], '/(a?)?/.exec("x") returns ["", undefined]'); }); if (DESCRIPTORS) { QUnit.test('RegExp#exec sticky', assert => { const re = new RegExp('a', 'y'); const str = 'bbabaab'; assert.strictEqual(re.lastIndex, 0, '#1'); assert.strictEqual(re.exec(str), null, '#2'); assert.strictEqual(re.lastIndex, 0, '#3'); re.lastIndex = 1; assert.strictEqual(re.exec(str), null, '#4'); assert.strictEqual(re.lastIndex, 0, '#5'); re.lastIndex = 2; const result = re.exec(str); assert.deepEqual(result, ['a'], '#6'); assert.strictEqual(result.index, 2, '#7'); assert.strictEqual(re.lastIndex, 3, '#8'); assert.strictEqual(re.exec(str), null, '#9'); assert.strictEqual(re.lastIndex, 0, '#10'); re.lastIndex = 4; assert.deepEqual(re.exec(str), ['a'], '#11'); assert.strictEqual(re.lastIndex, 5, '#12'); assert.deepEqual(re.exec(str), ['a'], '#13'); assert.strictEqual(re.lastIndex, 6, '#14'); assert.strictEqual(re.exec(str), null, '#15'); assert.strictEqual(re.lastIndex, 0, '#16'); }); QUnit.test('RegExp#exec sticky anchored', assert => { const regex = new RegExp('^foo', 'y'); assert.deepEqual(regex.exec('foo'), ['foo'], '#1'); regex.lastIndex = 2; assert.strictEqual(regex.exec('..foo'), null, '#2'); regex.lastIndex = 2; assert.strictEqual(regex.exec('.\nfoo'), null, '#3'); const regex2 = new RegExp('^foo', 'my'); regex2.lastIndex = 2; assert.strictEqual(regex2.exec('..foo'), null, '#4'); regex2.lastIndex = 2; assert.deepEqual(regex2.exec('.\nfoo'), ['foo'], '#5'); assert.strictEqual(regex2.lastIndex, 5, '#6'); }); } core-js-3.6.1/tests/tests/es.regexp.flags.js000066400000000000000000000014231360057567700207400ustar00rootroot00000000000000/* eslint-disable unicorn/regex-shorthand */ import { DESCRIPTORS } from '../helpers/constants'; if (DESCRIPTORS) { QUnit.test('RegExp#flags', assert => { assert.nonEnumerable(RegExp.prototype, 'flags'); assert.strictEqual(/./g.flags, 'g', '/./g.flags is "g"'); assert.strictEqual(/./.flags, '', '/./.flags is ""'); assert.strictEqual(RegExp('.', 'gim').flags, 'gim', 'RegExp(".", "gim").flags is "gim"'); assert.strictEqual(RegExp('.').flags, '', 'RegExp(".").flags is ""'); assert.strictEqual(/./gim.flags, 'gim', '/./gim.flags is "gim"'); assert.strictEqual(/./gmi.flags, 'gim', '/./gmi.flags is "gim"'); assert.strictEqual(/./mig.flags, 'gim', '/./mig.flags is "gim"'); assert.strictEqual(/./mgi.flags, 'gim', '/./mgi.flags is "gim"'); }); } core-js-3.6.1/tests/tests/es.regexp.sticky.js000066400000000000000000000026161360057567700211570ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; if (DESCRIPTORS) { QUnit.test('RegExp#sticky', assert => { const re = new RegExp('a', 'y'); assert.strictEqual(re.sticky, true, '.sticky is true'); assert.strictEqual(re.flags, 'y', '.flags contains y'); assert.strictEqual(/a/.sticky, false); const stickyGetter = Object.getOwnPropertyDescriptor(RegExp.prototype, 'sticky').get; if (typeof stickyGetter === 'function') { // Old firefox versions set a non-configurable non-writable .sticky property // It works correctly, but it isn't a getter and it can't be polyfilled. // We need to skip these tests. assert.throws(() => { stickyGetter.call({}); }, undefined, '.sticky getter can only be called on RegExp instances'); try { stickyGetter.call(/a/); assert.ok(true, '.sticky getter works on literals'); } catch (error) { assert.ok(false, '.sticky getter works on literals'); } try { stickyGetter.call(new RegExp('a')); assert.ok(true, '.sticky getter works on instances'); } catch (error) { assert.ok(false, '.sticky getter works on instances'); } assert.ok(Object.hasOwnProperty.call(RegExp.prototype, 'sticky'), 'prototype has .sticky property'); assert.strictEqual(RegExp.prototype.sticky, undefined, '.sticky is undefined on prototype'); } }); } core-js-3.6.1/tests/tests/es.regexp.test.js000066400000000000000000000010441360057567700206220ustar00rootroot00000000000000 QUnit.test('RegExp#test delegates to exec', assert => { const exec = function () { execCalled = true; return /./.exec.apply(this, arguments); }; let execCalled = false; let re = /[ac]/; re.exec = exec; assert.strictEqual(re.test('abc'), true, '#1'); assert.ok(execCalled, '#2'); re = /a/; // Not a function, should be ignored re.exec = 3; assert.strictEqual(re.test('abc'), true, '#3'); re = /a/; // Does not return an object, should throw re.exec = () => 3; assert.throws(() => re.test('abc', '#4')); }); core-js-3.6.1/tests/tests/es.regexp.to-string.js000066400000000000000000000024711360057567700215760ustar00rootroot00000000000000/* eslint-disable unicorn/regex-shorthand */ import { STRICT } from '../helpers/constants'; QUnit.test('RegExp#toString', assert => { const { toString } = RegExp.prototype; assert.isFunction(toString); assert.arity(toString, 0); assert.name(toString, 'toString'); assert.looksNative(toString); assert.nonEnumerable(RegExp.prototype, 'toString'); assert.same(String(/pattern/), '/pattern/'); assert.same(String(/pattern/i), '/pattern/i'); assert.same(String(/pattern/mi), '/pattern/im'); assert.same(String(/pattern/im), '/pattern/im'); assert.same(String(/pattern/mgi), '/pattern/gim'); assert.same(String(new RegExp('pattern')), '/pattern/'); assert.same(String(new RegExp('pattern', 'i')), '/pattern/i'); assert.same(String(new RegExp('pattern', 'mi')), '/pattern/im'); assert.same(String(new RegExp('pattern', 'im')), '/pattern/im'); assert.same(String(new RegExp('pattern', 'mgi')), '/pattern/gim'); assert.same(toString.call({ source: 'foo', flags: 'bar', }), '/foo/bar'); assert.same(toString.call({}), '/undefined/undefined'); if (STRICT) { assert.throws(() => toString.call(7)); assert.throws(() => toString.call('a')); assert.throws(() => toString.call(false)); assert.throws(() => toString.call(null)); assert.throws(() => toString.call(undefined)); } }); core-js-3.6.1/tests/tests/es.set.js000066400000000000000000000300541360057567700171500ustar00rootroot00000000000000/* eslint-disable sonarjs/no-element-overwrite */ import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants'; import { createIterable, is, nativeSubclass } from '../helpers/helpers'; const Symbol = GLOBAL.Symbol || {}; const { getOwnPropertyDescriptor, keys, getOwnPropertyNames, getOwnPropertySymbols, freeze } = Object; const { ownKeys } = Reflect || {}; const { from } = Array; QUnit.test('Set', assert => { assert.isFunction(Set); assert.name(Set, 'Set'); assert.arity(Set, 0); assert.looksNative(Set); assert.ok('add' in Set.prototype, 'add in Set.prototype'); assert.ok('clear' in Set.prototype, 'clear in Set.prototype'); assert.ok('delete' in Set.prototype, 'delete in Set.prototype'); assert.ok('forEach' in Set.prototype, 'forEach in Set.prototype'); assert.ok('has' in Set.prototype, 'has in Set.prototype'); assert.ok(new Set() instanceof Set, 'new Set instanceof Set'); const set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); assert.strictEqual(set.size, 3); const result = []; set.forEach(val => { result.push(val); }); assert.deepEqual(result, [1, 2, 3]); assert.strictEqual(new Set(createIterable([1, 2, 3])).size, 3, 'Init from iterable'); assert.strictEqual(new Set([freeze({}), 1]).size, 2, 'Support frozen objects'); assert.strictEqual(new Set([NaN, NaN, NaN]).size, 1); assert.deepEqual(from(new Set([3, 4]).add(2).add(1)), [3, 4, 2, 1]); let done = false; const { add } = Set.prototype; // eslint-disable-next-line no-extend-native Set.prototype.add = function () { throw new Error(); }; try { new Set(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } // eslint-disable-next-line no-extend-native Set.prototype.add = add; assert.ok(done, '.return #throw'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; new Set(array); assert.ok(done); const object = {}; new Set().add(object); if (DESCRIPTORS) { const results = []; for (const key in results) keys.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(Set); assert.ok(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.ok(new Subclass() instanceof Set, 'correct subclassing with native classes #2'); assert.ok(new Subclass().add(2).has(2), 'correct subclassing with native classes #3'); } }); QUnit.test('Set#add', assert => { assert.isFunction(Set.prototype.add); assert.name(Set.prototype.add, 'add'); assert.arity(Set.prototype.add, 1); assert.looksNative(Set.prototype.add); assert.nonEnumerable(Set.prototype, 'add'); const array = []; let set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(array); assert.strictEqual(set.size, 5); const chain = set.add(NaN); assert.strictEqual(chain, set); assert.strictEqual(set.size, 5); set.add(2); assert.strictEqual(set.size, 5); set.add(array); assert.strictEqual(set.size, 5); set.add([]); assert.strictEqual(set.size, 6); set.add(4); assert.strictEqual(set.size, 7); const frozen = freeze({}); set = new Set(); set.add(frozen); assert.ok(set.has(frozen)); }); QUnit.test('Set#clear', assert => { assert.isFunction(Set.prototype.clear); assert.name(Set.prototype.clear, 'clear'); assert.arity(Set.prototype.clear, 0); assert.looksNative(Set.prototype.clear); assert.nonEnumerable(Set.prototype, 'clear'); let set = new Set(); set.clear(); assert.strictEqual(set.size, 0); set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); set.clear(); assert.strictEqual(set.size, 0); assert.ok(!set.has(1)); assert.ok(!set.has(2)); assert.ok(!set.has(3)); const frozen = freeze({}); set = new Set(); set.add(1); set.add(frozen); set.clear(); assert.strictEqual(set.size, 0, 'Support frozen objects'); assert.ok(!set.has(1)); assert.ok(!set.has(frozen)); }); QUnit.test('Set#delete', assert => { assert.isFunction(Set.prototype.delete); if (NATIVE) assert.name(Set.prototype.delete, 'delete'); assert.arity(Set.prototype.delete, 1); assert.looksNative(Set.prototype.delete); assert.nonEnumerable(Set.prototype, 'delete'); const array = []; const set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(array); assert.strictEqual(set.size, 5); assert.strictEqual(set.delete(NaN), true); assert.strictEqual(set.size, 4); assert.strictEqual(set.delete(4), false); assert.strictEqual(set.size, 4); set.delete([]); assert.strictEqual(set.size, 4); set.delete(array); assert.strictEqual(set.size, 3); const frozen = freeze({}); set.add(frozen); assert.strictEqual(set.size, 4); set.delete(frozen); assert.strictEqual(set.size, 3); }); QUnit.test('Set#forEach', assert => { assert.isFunction(Set.prototype.forEach); assert.name(Set.prototype.forEach, 'forEach'); assert.arity(Set.prototype.forEach, 1); assert.looksNative(Set.prototype.forEach); assert.nonEnumerable(Set.prototype, 'forEach'); let result = []; let count = 0; let set = new Set(); set.add(1); set.add(2); set.add(3); set.add(2); set.add(1); set.forEach(value => { count++; result.push(value); }); assert.strictEqual(count, 3); assert.deepEqual(result, [1, 2, 3]); set = new Set(); set.add('0'); set.add('1'); set.add('2'); set.add('3'); result = ''; set.forEach(it => { result += it; if (it === '2') { set.delete('2'); set.delete('3'); set.delete('1'); set.add('4'); } }); assert.strictEqual(result, '0124'); set = new Set(); set.add('0'); result = ''; set.forEach(it => { set.delete('0'); if (result !== '') throw new Error(); result += it; }); assert.strictEqual(result, '0'); assert.throws(() => { Set.prototype.forEach.call(new Map(), () => { /* empty */ }); }, 'non-generic'); }); QUnit.test('Set#has', assert => { assert.isFunction(Set.prototype.has); assert.name(Set.prototype.has, 'has'); assert.arity(Set.prototype.has, 1); assert.looksNative(Set.prototype.has); assert.nonEnumerable(Set.prototype, 'has'); const array = []; const frozen = freeze({}); const set = new Set(); set.add(NaN); set.add(2); set.add(3); set.add(2); set.add(1); set.add(frozen); set.add(array); assert.ok(set.has(NaN)); assert.ok(set.has(array)); assert.ok(set.has(frozen)); assert.ok(set.has(2)); assert.ok(!set.has(4)); assert.ok(!set.has([])); }); QUnit.test('Set#size', assert => { assert.nonEnumerable(Set.prototype, 'size'); const set = new Set(); set.add(1); const { size } = set; assert.strictEqual(typeof size, 'number', 'size is number'); assert.strictEqual(size, 1, 'size is correct'); if (DESCRIPTORS) { const sizeDescriptor = getOwnPropertyDescriptor(Set.prototype, 'size'); assert.ok(sizeDescriptor && sizeDescriptor.get, 'size is getter'); assert.ok(sizeDescriptor && !sizeDescriptor.set, 'size isnt setter'); assert.throws(() => Set.prototype.size, TypeError); } }); QUnit.test('Set & -0', assert => { let set = new Set(); set.add(-0); assert.strictEqual(set.size, 1); assert.ok(set.has(0)); assert.ok(set.has(-0)); set.forEach(it => { assert.ok(!is(it, -0)); }); set.delete(-0); assert.strictEqual(set.size, 0); set = new Set([-0]); set.forEach(key => { assert.ok(!is(key, -0)); }); set = new Set(); set.add(4); set.add(3); set.add(2); set.add(1); set.add(0); assert.ok(set.has(-0)); }); QUnit.test('Set#@@toStringTag', assert => { assert.strictEqual(Set.prototype[Symbol.toStringTag], 'Set', 'Set::@@toStringTag is `Set`'); assert.strictEqual(String(new Set()), '[object Set]', 'correct stringification'); }); QUnit.test('Set Iterator', assert => { const set = new Set(); set.add('a'); set.add('b'); set.add('c'); set.add('d'); const results = []; const iterator = set.keys(); results.push(iterator.next().value); assert.ok(set.delete('a')); assert.ok(set.delete('b')); assert.ok(set.delete('c')); set.add('e'); results.push(iterator.next().value); results.push(iterator.next().value); assert.ok(iterator.next().done); set.add('f'); assert.ok(iterator.next().done); assert.deepEqual(results, ['a', 'd', 'e']); }); QUnit.test('Set#keys', assert => { assert.isFunction(Set.prototype.keys); assert.name(Set.prototype.keys, 'values'); assert.arity(Set.prototype.keys, 0); assert.looksNative(Set.prototype.keys); assert.strictEqual(Set.prototype.keys, Set.prototype.values); assert.nonEnumerable(Set.prototype, 'keys'); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#values', assert => { assert.isFunction(Set.prototype.values); assert.name(Set.prototype.values, 'values'); assert.arity(Set.prototype.values, 0); assert.looksNative(Set.prototype.values); assert.nonEnumerable(Set.prototype, 'values'); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#entries', assert => { assert.isFunction(Set.prototype.entries); assert.name(Set.prototype.entries, 'entries'); assert.arity(Set.prototype.entries, 0); assert.looksNative(Set.prototype.entries); assert.nonEnumerable(Set.prototype, 'entries'); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set.entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Set Iterator'); assert.deepEqual(iterator.next(), { value: ['q', 'q'], done: false, }); assert.deepEqual(iterator.next(), { value: ['w', 'w'], done: false, }); assert.deepEqual(iterator.next(), { value: ['e', 'e'], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); QUnit.test('Set#@@iterator', assert => { assert.isIterable(Set.prototype); assert.name(Set.prototype[Symbol.iterator], 'values'); assert.arity(Set.prototype[Symbol.iterator], 0); assert.looksNative(Set.prototype[Symbol.iterator]); assert.strictEqual(Set.prototype[Symbol.iterator], Set.prototype.values); assert.nonEnumerable(Set.prototype, 'values'); const set = new Set(); set.add('q'); set.add('w'); set.add('e'); const iterator = set[Symbol.iterator](); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Set Iterator'); assert.strictEqual(String(iterator), '[object Set Iterator]'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/tests/es.string.anchor.js000066400000000000000000000006141360057567700211330ustar00rootroot00000000000000QUnit.test('String#anchor', assert => { const { anchor } = String.prototype; assert.isFunction(anchor); assert.arity(anchor, 1); assert.name(anchor, 'anchor'); assert.looksNative(anchor); assert.nonEnumerable(String.prototype, 'anchor'); assert.same('a'.anchor('b'), 'a', 'lower case'); assert.same('a'.anchor('"'), 'a', 'escape quotes'); }); core-js-3.6.1/tests/tests/es.string.big.js000066400000000000000000000004361360057567700204240ustar00rootroot00000000000000QUnit.test('String#big', assert => { const { big } = String.prototype; assert.isFunction(big); assert.arity(big, 0); assert.name(big, 'big'); assert.looksNative(big); assert.nonEnumerable(String.prototype, 'big'); assert.same('a'.big(), 'a', 'lower case'); }); core-js-3.6.1/tests/tests/es.string.blink.js000066400000000000000000000004641360057567700207630ustar00rootroot00000000000000QUnit.test('String#blink', assert => { const { blink } = String.prototype; assert.isFunction(blink); assert.arity(blink, 0); assert.name(blink, 'blink'); assert.looksNative(blink); assert.nonEnumerable(String.prototype, 'blink'); assert.same('a'.blink(), 'a', 'lower case'); }); core-js-3.6.1/tests/tests/es.string.bold.js000066400000000000000000000004431360057567700206010ustar00rootroot00000000000000QUnit.test('String#bold', assert => { const { bold } = String.prototype; assert.isFunction(bold); assert.arity(bold, 0); assert.name(bold, 'bold'); assert.looksNative(bold); assert.nonEnumerable(String.prototype, 'bold'); assert.same('a'.bold(), 'a', 'lower case'); }); core-js-3.6.1/tests/tests/es.string.code-point-at.js000066400000000000000000000071441360057567700223310ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('String#codePointAt', assert => { const { codePointAt } = String.prototype; assert.isFunction(codePointAt); assert.arity(codePointAt, 1); assert.name(codePointAt, 'codePointAt'); assert.looksNative(codePointAt); assert.nonEnumerable(String.prototype, 'codePointAt'); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(''), 0x61); assert.strictEqual('abc\uD834\uDF06def'.codePointAt('_'), 0x61); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(), 0x61); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(-Infinity), undefined); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(-1), undefined); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(-0), 0x61); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(0), 0x61); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(3), 0x1D306); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(4), 0xDF06); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(5), 0x64); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(42), undefined); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(Infinity), undefined); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(Infinity), undefined); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(NaN), 0x61); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(false), 0x61); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(null), 0x61); assert.strictEqual('abc\uD834\uDF06def'.codePointAt(undefined), 0x61); assert.strictEqual('\uD834\uDF06def'.codePointAt(''), 0x1D306); assert.strictEqual('\uD834\uDF06def'.codePointAt('1'), 0xDF06); assert.strictEqual('\uD834\uDF06def'.codePointAt('_'), 0x1D306); assert.strictEqual('\uD834\uDF06def'.codePointAt(), 0x1D306); assert.strictEqual('\uD834\uDF06def'.codePointAt(-1), undefined); assert.strictEqual('\uD834\uDF06def'.codePointAt(-0), 0x1D306); assert.strictEqual('\uD834\uDF06def'.codePointAt(0), 0x1D306); assert.strictEqual('\uD834\uDF06def'.codePointAt(1), 0xDF06); assert.strictEqual('\uD834\uDF06def'.codePointAt(42), undefined); assert.strictEqual('\uD834\uDF06def'.codePointAt(false), 0x1D306); assert.strictEqual('\uD834\uDF06def'.codePointAt(null), 0x1D306); assert.strictEqual('\uD834\uDF06def'.codePointAt(undefined), 0x1D306); assert.strictEqual('\uD834abc'.codePointAt(''), 0xD834); assert.strictEqual('\uD834abc'.codePointAt('_'), 0xD834); assert.strictEqual('\uD834abc'.codePointAt(), 0xD834); assert.strictEqual('\uD834abc'.codePointAt(-1), undefined); assert.strictEqual('\uD834abc'.codePointAt(-0), 0xD834); assert.strictEqual('\uD834abc'.codePointAt(0), 0xD834); assert.strictEqual('\uD834abc'.codePointAt(false), 0xD834); assert.strictEqual('\uD834abc'.codePointAt(NaN), 0xD834); assert.strictEqual('\uD834abc'.codePointAt(null), 0xD834); assert.strictEqual('\uD834abc'.codePointAt(undefined), 0xD834); assert.strictEqual('\uDF06abc'.codePointAt(''), 0xDF06); assert.strictEqual('\uDF06abc'.codePointAt('_'), 0xDF06); assert.strictEqual('\uDF06abc'.codePointAt(), 0xDF06); assert.strictEqual('\uDF06abc'.codePointAt(-1), undefined); assert.strictEqual('\uDF06abc'.codePointAt(-0), 0xDF06); assert.strictEqual('\uDF06abc'.codePointAt(0), 0xDF06); assert.strictEqual('\uDF06abc'.codePointAt(false), 0xDF06); assert.strictEqual('\uDF06abc'.codePointAt(NaN), 0xDF06); assert.strictEqual('\uDF06abc'.codePointAt(null), 0xDF06); assert.strictEqual('\uDF06abc'.codePointAt(undefined), 0xDF06); if (STRICT) { assert.throws(() => codePointAt.call(null, 0), TypeError); assert.throws(() => codePointAt.call(undefined, 0), TypeError); } }); core-js-3.6.1/tests/tests/es.string.ends-with.js000066400000000000000000000025111360057567700215610ustar00rootroot00000000000000import { GLOBAL, STRICT } from '../helpers/constants'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('String#endsWith', assert => { const { endsWith } = String.prototype; assert.isFunction(endsWith); assert.arity(endsWith, 1); assert.name(endsWith, 'endsWith'); assert.looksNative(endsWith); assert.nonEnumerable(String.prototype, 'endsWith'); assert.ok('undefined'.endsWith()); assert.ok(!'undefined'.endsWith(null)); assert.ok('abc'.endsWith('')); assert.ok('abc'.endsWith('c')); assert.ok('abc'.endsWith('bc')); assert.ok(!'abc'.endsWith('ab')); assert.ok('abc'.endsWith('', NaN)); assert.ok(!'abc'.endsWith('c', -1)); assert.ok('abc'.endsWith('a', 1)); assert.ok('abc'.endsWith('c', Infinity)); assert.ok('abc'.endsWith('a', true)); assert.ok(!'abc'.endsWith('c', 'x')); assert.ok(!'abc'.endsWith('a', 'x')); if (STRICT) { assert.throws(() => endsWith.call(null, '.'), TypeError); assert.throws(() => endsWith.call(undefined, '.'), TypeError); } const regexp = /./; assert.throws(() => '/./'.endsWith(regexp), TypeError); regexp[Symbol.match] = false; assert.notThrows(() => '/./'.endsWith(regexp)); const object = {}; assert.notThrows(() => '[object Object]'.endsWith(object)); object[Symbol.match] = true; assert.throws(() => '[object Object]'.endsWith(object), TypeError); }); core-js-3.6.1/tests/tests/es.string.fixed.js000066400000000000000000000004561360057567700207640ustar00rootroot00000000000000QUnit.test('String#fixed', assert => { const { fixed } = String.prototype; assert.isFunction(fixed); assert.arity(fixed, 0); assert.name(fixed, 'fixed'); assert.looksNative(fixed); assert.nonEnumerable(String.prototype, 'fixed'); assert.same('a'.fixed(), 'a', 'lower case'); }); core-js-3.6.1/tests/tests/es.string.fontcolor.js000066400000000000000000000006701360057567700216700ustar00rootroot00000000000000QUnit.test('String#fontcolor', assert => { const { fontcolor } = String.prototype; assert.isFunction(fontcolor); assert.arity(fontcolor, 1); assert.name(fontcolor, 'fontcolor'); assert.looksNative(fontcolor); assert.nonEnumerable(String.prototype, 'fontcolor'); assert.same('a'.fontcolor('b'), 'a', 'lower case'); assert.same('a'.fontcolor('"'), 'a', 'escape quotes'); }); core-js-3.6.1/tests/tests/es.string.fontsize.js000066400000000000000000000006541360057567700215260ustar00rootroot00000000000000QUnit.test('String#fontsize', assert => { const { fontsize } = String.prototype; assert.isFunction(fontsize); assert.arity(fontsize, 1); assert.name(fontsize, 'fontsize'); assert.looksNative(fontsize); assert.nonEnumerable(String.prototype, 'fontsize'); assert.same('a'.fontsize('b'), 'a', 'lower case'); assert.same('a'.fontsize('"'), 'a', 'escape quotes'); }); core-js-3.6.1/tests/tests/es.string.from-code-point.js000066400000000000000000000037741360057567700226750ustar00rootroot00000000000000QUnit.test('String.fromCodePoint', assert => { const { fromCodePoint } = String; assert.isFunction(fromCodePoint); assert.arity(fromCodePoint, 1); assert.name(fromCodePoint, 'fromCodePoint'); assert.looksNative(fromCodePoint); assert.nonEnumerable(String, 'fromCodePoint'); assert.strictEqual(fromCodePoint(''), '\0'); assert.strictEqual(fromCodePoint(), ''); assert.strictEqual(fromCodePoint(-0), '\0'); assert.strictEqual(fromCodePoint(0), '\0'); assert.strictEqual(fromCodePoint(0x1D306), '\uD834\uDF06'); assert.strictEqual(fromCodePoint(0x1D306, 0x61, 0x1D307), '\uD834\uDF06a\uD834\uDF07'); assert.strictEqual(fromCodePoint(0x61, 0x62, 0x1D307), 'ab\uD834\uDF07'); assert.strictEqual(fromCodePoint(false), '\0'); assert.strictEqual(fromCodePoint(null), '\0'); assert.throws(() => fromCodePoint('_'), RangeError); assert.throws(() => fromCodePoint('+Infinity'), RangeError); assert.throws(() => fromCodePoint('-Infinity'), RangeError); assert.throws(() => fromCodePoint(-1), RangeError); assert.throws(() => fromCodePoint(0x10FFFF + 1), RangeError); assert.throws(() => fromCodePoint(3.14), RangeError); assert.throws(() => fromCodePoint(3e-2), RangeError); assert.throws(() => fromCodePoint(-Infinity), RangeError); assert.throws(() => fromCodePoint(Infinity), RangeError); assert.throws(() => fromCodePoint(NaN), RangeError); assert.throws(() => fromCodePoint(undefined), RangeError); assert.throws(() => fromCodePoint({}), RangeError); assert.throws(() => fromCodePoint(/./), RangeError); let number = 0x60; assert.strictEqual(fromCodePoint({ valueOf() { return ++number; }, }), 'a'); assert.strictEqual(number, 0x61); // one code unit per symbol let counter = 2 ** 15 * 3 / 2; let result = []; while (--counter >= 0) result.push(0); // should not throw fromCodePoint.apply(null, result); counter = 2 ** 15 * 3 / 2; result = []; while (--counter >= 0) result.push(0xFFFF + 1); // should not throw fromCodePoint.apply(null, result); }); core-js-3.6.1/tests/tests/es.string.includes.js000066400000000000000000000017561360057567700214770ustar00rootroot00000000000000import { GLOBAL, STRICT } from '../helpers/constants'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('String#includes', assert => { const { includes } = String.prototype; assert.isFunction(includes); assert.arity(includes, 1); assert.name(includes, 'includes'); assert.looksNative(includes); assert.nonEnumerable(String.prototype, 'includes'); assert.ok(!'abc'.includes()); assert.ok('aundefinedb'.includes()); assert.ok('abcd'.includes('b', 1)); assert.ok(!'abcd'.includes('b', 2)); if (STRICT) { assert.throws(() => includes.call(null, '.'), TypeError); assert.throws(() => includes.call(undefined, '.'), TypeError); } const regexp = /./; assert.throws(() => '/./'.includes(regexp), TypeError); regexp[Symbol.match] = false; assert.notThrows(() => '/./'.includes(regexp)); const object = {}; assert.notThrows(() => '[object Object]'.includes(object)); object[Symbol.match] = true; assert.throws(() => '[object Object]'.includes(object), TypeError); }); core-js-3.6.1/tests/tests/es.string.italics.js000066400000000000000000000004761360057567700213170ustar00rootroot00000000000000QUnit.test('String#italics', assert => { const { italics } = String.prototype; assert.isFunction(italics); assert.arity(italics, 0); assert.name(italics, 'italics'); assert.looksNative(italics); assert.nonEnumerable(String.prototype, 'italics'); assert.same('a'.italics(), 'a', 'lower case'); }); core-js-3.6.1/tests/tests/es.string.iterator.js000066400000000000000000000022071360057567700215120ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('String#@@iterator', assert => { assert.isIterable(String.prototype); let iterator = 'qwe'[Symbol.iterator](); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'String Iterator'); assert.strictEqual(String(iterator), '[object String Iterator]'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); assert.deepEqual(iterator.next(), { value: 'w', done: false, }); assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.strictEqual(Array.from('𠮷𠮷𠮷').length, 3); iterator = '𠮷𠮷𠮷'[Symbol.iterator](); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: '𠮷', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/tests/es.string.link.js000066400000000000000000000005701360057567700206170ustar00rootroot00000000000000QUnit.test('String#link', assert => { const { link } = String.prototype; assert.isFunction(link); assert.arity(link, 1); assert.name(link, 'link'); assert.looksNative(link); assert.nonEnumerable(String.prototype, 'link'); assert.same('a'.link('b'), 'a', 'lower case'); assert.same('a'.link('"'), 'a', 'escape quotes'); }); core-js-3.6.1/tests/tests/es.string.match-all.js000066400000000000000000000066241360057567700215320ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('String#matchAll', assert => { const { matchAll } = String.prototype; const { assign } = Object; assert.isFunction(matchAll); assert.arity(matchAll, 1); assert.name(matchAll, 'matchAll'); assert.looksNative(matchAll); assert.nonEnumerable(String.prototype, 'matchAll'); let data = ['aabc', { toString() { return 'aabc'; } }]; for (const target of data) { const iterator = matchAll.call(target, /[ac]/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign(['a'], { input: 'aabc', index: 0, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['a'], { input: 'aabc', index: 1, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['c'], { input: 'aabc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); } let iterator = '1111a2b3cccc'.matchAll(/(\d)(\D)/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'RegExp String Iterator'); assert.strictEqual(String(iterator), '[object RegExp String Iterator]'); assert.deepEqual(iterator.next(), { value: assign(['1a', '1', 'a'], { input: '1111a2b3cccc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['2b', '2', 'b'], { input: '1111a2b3cccc', index: 5, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['3c', '3', 'c'], { input: '1111a2b3cccc', index: 7, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); assert.throws(() => '1111a2b3cccc'.matchAll(/(\d)(\D)/), TypeError); iterator = '1111a2b3cccc'.matchAll('(\\d)(\\D)'); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign(['1a', '1', 'a'], { input: '1111a2b3cccc', index: 3, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['2b', '2', 'b'], { input: '1111a2b3cccc', index: 5, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign(['3c', '3', 'c'], { input: '1111a2b3cccc', index: 7, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); /* IE8- issue iterator = 'abc'.matchAll(/\B/g); assert.isIterator(iterator); assert.isIterable(iterator); assert.deepEqual(iterator.next(), { value: assign([''], { input: 'abc', index: 1, }), done: false, }); assert.deepEqual(iterator.next(), { value: assign([''], { input: 'abc', index: 2, }), done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); */ data = [null, undefined, NaN, 42, {}, []]; for (const target of data) { assert.notThrows(() => ''.matchAll(target), `Not throws on ${ target } as the first argument`); } if (STRICT) { assert.throws(() => matchAll.call(null, /./g), TypeError, 'Throws on null as `this`'); assert.throws(() => matchAll.call(undefined, /./g), TypeError, 'Throws on undefined as `this`'); } }); core-js-3.6.1/tests/tests/es.string.match.js000066400000000000000000000263711360057567700207650ustar00rootroot00000000000000// TODO: fix escaping in regexps /* eslint-disable unicorn/no-unsafe-regex */ import { GLOBAL, NATIVE, STRICT } from '../helpers/constants'; import { patchRegExp$exec } from '../helpers/helpers'; const Symbol = GLOBAL.Symbol || {}; const run = assert => { assert.isFunction(''.match); assert.arity(''.match, 1); assert.name(''.match, 'match'); assert.looksNative(''.match); assert.nonEnumerable(String.prototype, 'match'); let instance = Object(true); instance.match = String.prototype.match; assert.strictEqual(instance.match(true)[0], 'true', 'S15.5.4.10_A1_T1'); instance = Object(false); instance.match = String.prototype.match; assert.strictEqual(instance.match(false)[0], 'false', 'S15.5.4.10_A1_T2'); let matched = ''.match(); let expected = RegExp().exec(''); assert.strictEqual(matched.length, expected.length, 'S15.5.4.10_A1_T4 #1'); assert.strictEqual(matched.index, expected.index, 'S15.5.4.10_A1_T4 #2'); assert.strictEqual(matched.input, expected.input, 'S15.5.4.10_A1_T4 #3'); assert.strictEqual('gnulluna'.match(null)[0], 'null', 'S15.5.4.10_A1_T5'); matched = Object('undefined').match(undefined); expected = RegExp(undefined).exec('undefined'); assert.strictEqual(matched.length, expected.length, 'S15.5.4.10_A1_T6 #1'); assert.strictEqual(matched.index, expected.index, 'S15.5.4.10_A1_T6 #2'); assert.strictEqual(matched.input, expected.input, 'S15.5.4.10_A1_T6 #3'); let object = { toString() { /* empty */ } }; matched = String(object).match(undefined); expected = RegExp(undefined).exec('undefined'); assert.strictEqual(matched.length, expected.length, 'S15.5.4.10_A1_T8 #1'); assert.strictEqual(matched.index, expected.index, 'S15.5.4.10_A1_T8 #2'); assert.strictEqual(matched.input, expected.input, 'S15.5.4.10_A1_T8 #3'); object = { toString() { return '\u0041B'; } }; let string = 'ABB\u0041BABAB'; assert.strictEqual(string.match(object)[0], 'AB', 'S15.5.4.10_A1_T10'); object = { toString() { throw new Error('intostr'); } }; string = 'ABB\u0041BABAB'; try { string.match(object); assert.ok(false, 'S15.5.4.10_A1_T11 #1 lead to throwing exception'); } catch (error) { assert.strictEqual(error.message, 'intostr', `S15.5.4.10_A1_T11 #1.1: Exception === "intostr". Actual: ${ error }`); } object = { toString() { return {}; }, valueOf() { throw new Error('intostr'); }, }; string = 'ABB\u0041BABAB'; try { string.match(object); assert.ok(false, 'S15.5.4.10_A1_T12 #1 lead to throwing exception'); } catch (error) { assert.strictEqual(error.message, 'intostr', `S15.5.4.10_A1_T12 #1.1: Exception === "intostr". Actual: ${ error }`); } object = { toString() { return {}; }, valueOf() { return 1; }, }; assert.strictEqual('ABB\u0041B\u0031ABAB\u0031BBAA'.match(object)[0], '1', 'S15.5.4.10_A1_T13 #1'); assert.strictEqual('ABB\u0041B\u0031ABAB\u0031BBAA'.match(object).length, 1, 'S15.5.4.10_A1_T13 #2'); let regexp = RegExp('77'); assert.strictEqual('ABB\u0041BABAB\u0037\u0037BBAA'.match(regexp)[0], '77', 'S15.5.4.10_A1_T14'); string = '1234567890'; assert.strictEqual(string.match(3)[0], '3', 'S15.5.4.10_A2_T1 #1'); assert.strictEqual(string.match(3).length, 1, 'S15.5.4.10_A2_T1 #2'); assert.strictEqual(string.match(3).index, 2, 'S15.5.4.10_A2_T1 #3'); assert.strictEqual(string.match(3).input, string, 'S15.5.4.10_A2_T1 #4'); let matches = ['34', '34', '34']; string = '343443444'; assert.strictEqual(string.match(/34/g).length, 3, 'S15.5.4.10_A2_T2 #1'); for (let i = 0, { length } = matches; i < length; ++i) { assert.strictEqual(string.match(/34/g)[i], matches[i], 'S15.5.4.10_A2_T2 #2'); } matches = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']; string = '123456abcde7890'; assert.strictEqual(string.match(/\d/g).length, 10, 'S15.5.4.10_A2_T3 #1'); for (let i = 0, { length } = matches; i < length; ++i) { assert.strictEqual(string.match(/\d/g)[i], matches[i], 'S15.5.4.10_A2_T3 #2'); } matches = ['12', '34', '56', '78', '90']; string = '123456abcde7890'; assert.strictEqual(string.match(/\d{2}/g).length, 5, 'S15.5.4.10_A2_T4 #1'); for (let i = 0, { length } = matches; i < length; ++i) { assert.strictEqual(string.match(/\d{2}/g)[i], matches[i], 'S15.5.4.10_A2_T4 #2'); } matches = ['ab', 'cd']; string = '123456abcde7890'; assert.strictEqual(string.match(/\D{2}/g).length, 2, 'S15.5.4.10_A2_T5 #1'); for (let i = 0, { length } = matches; i < length; ++i) { assert.strictEqual(string.match(/\D{2}/g)[i], matches[i], 'S15.5.4.10_A2_T5 #2'); } string = 'Boston, Mass. 02134'; assert.strictEqual(string.match(/(\d{5})([ -]?\d{4})?$/)[0], '02134', 'S15.5.4.10_A2_T6 #1'); assert.strictEqual(string.match(/(\d{5})([ -]?\d{4})?$/)[1], '02134', 'S15.5.4.10_A2_T6 #2'); if (NATIVE) assert.strictEqual(string.match(/(\d{5})([ -]?\d{4})?$/)[2], undefined, 'S15.5.4.10_A2_T6 #3'); assert.strictEqual(string.match(/(\d{5})([ -]?\d{4})?$/).length, 3, 'S15.5.4.10_A2_T6 #4'); assert.strictEqual(string.match(/(\d{5})([ -]?\d{4})?$/).index, 14, 'S15.5.4.10_A2_T6 #5'); assert.strictEqual(string.match(/(\d{5})([ -]?\d{4})?$/).input, string, 'S15.5.4.10_A2_T6 #6'); string = 'Boston, Mass. 02134'; assert.strictEqual(string.match(/(\d{5})([ -]?\d{4})?$/g).length, 1, 'S15.5.4.10_A2_T7 #1'); assert.strictEqual(string.match(/(\d{5})([ -]?\d{4})?$/g)[0], '02134', 'S15.5.4.10_A2_T7 #2'); /* IE8- buggy here (empty string instead of `undefined`), but we don't polyfill base `.match` logic matches = ['02134', '02134', undefined]; string = 'Boston, MA 02134'; regexp = /([\d]{5})([-\ ]?[\d]{4})?$/; regexp.lastIndex = 0; assert.strictEqual(string.match(regexp).length, 3, 'S15.5.4.10_A2_T8 #1'); assert.strictEqual(string.match(regexp).index, string.lastIndexOf('0'), 'S15.5.4.10_A2_T8 #2'); for (let i = 0, { length } = matches; i < length; ++i) { assert.strictEqual(string.match(regexp)[i], matches[i], 'S15.5.4.10_A2_T8 #3'); } string = 'Boston, MA 02134'; matches = ['02134', '02134', undefined]; regexp = /([\d]{5})([-\ ]?[\d]{4})?$/; regexp.lastIndex = string.length; assert.strictEqual(string.match(regexp).length, 3, 'S15.5.4.10_A2_T9 #1'); assert.strictEqual(string.match(regexp).index, string.lastIndexOf('0'), 'S15.5.4.10_A2_T9 #2'); for (let i = 0, { length } = matches; i < length; ++i) { assert.strictEqual(string.match(regexp)[i], matches[i], 'S15.5.4.10_A2_T9 #3'); } string = 'Boston, MA 02134'; matches = ['02134', '02134', undefined]; regexp = /([\d]{5})([-\ ]?[\d]{4})?$/; regexp.lastIndex = string.lastIndexOf('0'); assert.strictEqual(string.match(regexp).length, 3, 'S15.5.4.10_A2_T10 #1'); assert.strictEqual(string.match(regexp).index, string.lastIndexOf('0'), 'S15.5.4.10_A2_T10 #2'); for (let i = 0, { length } = matches; i < length; ++i) { assert.strictEqual(string.match(regexp)[i], matches[i], 'S15.5.4.10_A2_T10 #3'); } string = 'Boston, MA 02134'; matches = ['02134', '02134', undefined]; regexp = /([\d]{5})([-\ ]?[\d]{4})?$/; regexp.lastIndex = string.lastIndexOf('0') + 1; assert.strictEqual(string.match(regexp).length, 3, 'S15.5.4.10_A2_T11 #1'); assert.strictEqual(string.match(regexp).index, string.lastIndexOf('0'), 'S15.5.4.10_A2_T11 #2'); for (let i = 0, { length } = matches; i < length; ++i) { assert.strictEqual(string.match(regexp)[i], matches[i], 'S15.5.4.10_A2_T11 #3'); } */ string = 'Boston, MA 02134'; regexp = /(\d{5})([ -]?\d{4})?$/g; assert.strictEqual(string.match(regexp).length, 1, 'S15.5.4.10_A2_T12 #1'); assert.strictEqual(string.match(regexp)[0], '02134', 'S15.5.4.10_A2_T12 #2'); regexp = /(\d{5})([ -]?\d{4})?$/g; regexp.lastIndex = 0; string = 'Boston, MA 02134'; assert.strictEqual(string.match(regexp).length, 1, 'S15.5.4.10_A2_T13 #1'); assert.strictEqual(string.match(regexp)[0], '02134', 'S15.5.4.10_A2_T13 #2'); string = 'Boston, MA 02134'; regexp = /(\d{5})([ -]?\d{4})?$/g; regexp.lastIndex = string.length; assert.strictEqual(string.match(regexp).length, 1, 'S15.5.4.10_A2_T14 #1'); assert.strictEqual(string.match(regexp)[0], '02134', 'S15.5.4.10_A2_T14 #2'); string = 'Boston, MA 02134'; regexp = /(\d{5})([ -]?\d{4})?$/g; regexp.lastIndex = string.lastIndexOf('0'); assert.strictEqual(string.match(regexp).length, 1, 'S15.5.4.10_A2_T15 #1'); assert.strictEqual(string.match(regexp)[0], '02134', 'S15.5.4.10_A2_T15 #2'); string = 'Boston, MA 02134'; regexp = /(\d{5})([ -]?\d{4})?$/g; regexp.lastIndex = string.lastIndexOf('0') + 1; assert.strictEqual(string.match(regexp).length, 1, 'S15.5.4.10_A2_T16 #1'); assert.strictEqual(string.match(regexp)[0], '02134', 'S15.5.4.10_A2_T16 #2'); regexp = /0./; let number = 10203040506070809000; assert.strictEqual(''.match.call(number, regexp)[0], '02', 'S15.5.4.10_A2_T17 #1'); assert.strictEqual(''.match.call(number, regexp).length, 1, 'S15.5.4.10_A2_T17 #2'); assert.strictEqual(''.match.call(number, regexp).index, 1, 'S15.5.4.10_A2_T17 #3'); assert.strictEqual(''.match.call(number, regexp).input, String(number), 'S15.5.4.10_A2_T17 #4'); regexp = /0./; regexp.lastIndex = 0; number = 10203040506070809000; assert.strictEqual(''.match.call(number, regexp)[0], '02', 'S15.5.4.10_A2_T18 #1'); assert.strictEqual(''.match.call(number, regexp).length, 1, 'S15.5.4.10_A2_T18 #2'); assert.strictEqual(''.match.call(number, regexp).index, 1, 'S15.5.4.10_A2_T18 #3'); assert.strictEqual(''.match.call(number, regexp).input, String(number), 'S15.5.4.10_A2_T18 #4'); }; QUnit.test('String#match regression', run); QUnit.test('RegExp#@@match appearance', assert => { const match = /./[Symbol.match]; assert.isFunction(match); // assert.name(match, '[Symbol.match]'); assert.arity(match, 1); assert.looksNative(match); assert.nonEnumerable(RegExp.prototype, Symbol.match); }); QUnit.test('RegExp#@@match basic behavior', assert => { const string = '123456abcde7890'; const matches = ['12', '34', '56', '78', '90']; assert.strictEqual(/\d{2}/g[Symbol.match](string).length, 5); for (let i = 0, { length } = matches; i < length; ++i) { assert.strictEqual(/\d{2}/g[Symbol.match](string)[i], matches[i]); } }); QUnit.test('String#match delegates to @@match', assert => { const string = STRICT ? 'string' : Object('string'); const number = STRICT ? 42 : Object(42); const object = {}; object[Symbol.match] = function (it) { return { value: it }; }; assert.strictEqual(string.match(object).value, string); assert.strictEqual(''.match.call(number, object).value, number); const regexp = /./; regexp[Symbol.match] = function (it) { return { value: it }; }; assert.strictEqual(string.match(regexp).value, string); assert.strictEqual(''.match.call(number, regexp).value, number); }); QUnit.test('RegExp#@@match delegates to exec', assert => { const exec = function () { execCalled = true; return /./.exec.apply(this, arguments); }; let execCalled = false; let re = /[ac]/; re.exec = exec; assert.deepEqual(re[Symbol.match]('abc'), ['a']); assert.ok(execCalled); re = /a/; // Not a function, should be ignored re.exec = 3; assert.deepEqual(re[Symbol.match]('abc'), ['a']); re = /a/; // Does not return an object, should throw re.exec = () => 3; assert.throws(() => re[Symbol.match]('abc')); }); QUnit.test('RegExp#@@match implementation', patchRegExp$exec(run)); core-js-3.6.1/tests/tests/es.string.pad-end.js000066400000000000000000000014121360057567700211660ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('String#padEnd', assert => { const { padEnd } = String.prototype; assert.isFunction(padEnd); assert.arity(padEnd, 1); assert.name(padEnd, 'padEnd'); assert.looksNative(padEnd); assert.nonEnumerable(String.prototype, 'padEnd'); assert.strictEqual('abc'.padEnd(5), 'abc '); assert.strictEqual('abc'.padEnd(4, 'de'), 'abcd'); assert.strictEqual('abc'.padEnd(), 'abc'); assert.strictEqual('abc'.padEnd(5, '_'), 'abc__'); assert.strictEqual(''.padEnd(0), ''); assert.strictEqual('foo'.padEnd(1), 'foo'); assert.strictEqual('foo'.padEnd(5, ''), 'foo'); if (STRICT) { assert.throws(() => padEnd.call(null, 0), TypeError); assert.throws(() => padEnd.call(undefined, 0), TypeError); } }); core-js-3.6.1/tests/tests/es.string.pad-start.js000066400000000000000000000014541360057567700215630ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('String#padStart', assert => { const { padStart } = String.prototype; assert.isFunction(padStart); assert.arity(padStart, 1); assert.name(padStart, 'padStart'); assert.looksNative(padStart); assert.nonEnumerable(String.prototype, 'padStart'); assert.strictEqual('abc'.padStart(5), ' abc'); assert.strictEqual('abc'.padStart(4, 'de'), 'dabc'); assert.strictEqual('abc'.padStart(), 'abc'); assert.strictEqual('abc'.padStart(5, '_'), '__abc'); assert.strictEqual(''.padStart(0), ''); assert.strictEqual('foo'.padStart(1), 'foo'); assert.strictEqual('foo'.padStart(5, ''), 'foo'); if (STRICT) { assert.throws(() => padStart.call(null, 0), TypeError); assert.throws(() => padStart.call(undefined, 0), TypeError); } }); core-js-3.6.1/tests/tests/es.string.raw.js000066400000000000000000000010521360057567700204470ustar00rootroot00000000000000QUnit.test('String.raw', assert => { const { raw } = String; assert.isFunction(raw); assert.arity(raw, 1); assert.name(raw, 'raw'); assert.looksNative(raw); assert.nonEnumerable(String, 'raw'); assert.strictEqual(raw({ raw: ['Hi\\n', '!'] }, 'Bob'), 'Hi\\nBob!', 'raw is array'); assert.strictEqual(raw({ raw: 'test' }, 0, 1, 2), 't0e1s2t', 'raw is string'); assert.strictEqual(raw({ raw: 'test' }, 0), 't0est', 'lacks substituting'); assert.throws(() => raw({}), TypeError); assert.throws(() => raw({ raw: null }), TypeError); }); core-js-3.6.1/tests/tests/es.string.repeat.js000066400000000000000000000012221360057567700211350ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('String#repeat', assert => { const { repeat } = String.prototype; assert.isFunction(repeat); assert.arity(repeat, 1); assert.name(repeat, 'repeat'); assert.looksNative(repeat); assert.nonEnumerable(String.prototype, 'repeat'); assert.strictEqual('qwe'.repeat(3), 'qweqweqwe'); assert.strictEqual('qwe'.repeat(2.5), 'qweqwe'); assert.throws(() => 'qwe'.repeat(-1), RangeError); assert.throws(() => 'qwe'.repeat(Infinity), RangeError); if (STRICT) { assert.throws(() => repeat.call(null, 1), TypeError); assert.throws(() => repeat.call(undefined, 1), TypeError); } }); core-js-3.6.1/tests/tests/es.string.replace.js000066400000000000000000000216051360057567700212770ustar00rootroot00000000000000import { GLOBAL, NATIVE, STRICT } from '../helpers/constants'; import { patchRegExp$exec } from '../helpers/helpers'; const Symbol = GLOBAL.Symbol || {}; const run = assert => { assert.isFunction(''.replace); assert.arity(''.replace, 2); assert.name(''.replace, 'replace'); assert.looksNative(''.replace); assert.nonEnumerable(String.prototype, 'replace'); let instance = Object(true); instance.replace = String.prototype.replace; assert.strictEqual(instance.replace(true, 1), '1', 'S15.5.4.11_A1_T1'); instance = Object(false); instance.replace = String.prototype.replace; assert.strictEqual(instance.replace(false, undefined), 'undefined', 'S15.5.4.11_A1_T2'); assert.strictEqual('gnulluna'.replace(null, (a1, a2) => `${ a2 }`), 'g1una', 'S15.5.4.11_A1_T4'); assert.strictEqual('gnulluna'.replace(null, () => { /* empty */ }), 'gundefineduna', 'S15.5.4.11_A1_T5'); assert.strictEqual(Object('undefined').replace(undefined, (a1, a2) => a2 + 42), '42', 'S15.5.4.11_A1_T6'); assert.strictEqual('undefined'.replace('e', undefined), 'undundefinedfined', 'S15.5.4.11_A1_T7'); assert.strictEqual(String({ toString() { /* empty */ }, }).replace(/e/g, undefined), 'undundefinedfinundefinedd', 'S15.5.4.11_A1_T8'); assert.strictEqual(new String({ valueOf() { /* empty */ }, toString: undefined, }).replace(function () { /* empty */ }(), (a1, a2, a3) => a1 + a2 + a3), 'undefined0undefined', 'S15.5.4.11_A1_T9'); assert.strictEqual('ABB\u0041BABAB'.replace({ toString() { return '\u0041B'; }, }, () => { /* empty */ }), 'undefinedBABABAB', 'S15.5.4.11_A1_T10'); if (NATIVE) { try { 'ABB\u0041BABAB'.replace({ toString() { throw new Error('insearchValue'); }, }, { toString() { throw new Error('inreplaceValue'); }, }); assert.ok(false, 'S15.5.4.11_A1_T11 #1 lead to throwing exception'); } catch (error) { assert.strictEqual(error.message, 'insearchValue', 'S15.5.4.11_A1_T11 #2'); } try { Object('ABB\u0041BABAB').replace({ toString() { return {}; }, valueOf() { throw new Error('insearchValue'); }, }, { toString() { throw new Error('inreplaceValue'); }, }); assert.ok(false, 'S15.5.4.11_A1_T12 #1 lead to throwing exception'); } catch (error) { assert.strictEqual(error.message, 'insearchValue', 'S15.5.4.11_A1_T12 #2'); } } try { 'ABB\u0041BABAB\u0031BBAA'.replace({ toString() { return {}; }, valueOf() { throw new Error('insearchValue'); }, }, { toString() { return 1; }, }); assert.ok(false, 'S15.5.4.11_A1_T13 #1 lead to throwing exception'); } catch (error) { assert.strictEqual(error.message, 'insearchValue', 'S15.5.4.11_A1_T13 #2'); } assert.strictEqual('ABB\u0041BABAB\u0037\u0037BBAA'.replace(new RegExp('77'), 1), 'ABBABABAB\u0031BBAA', 'S15.5.4.11_A1_T14'); instance = Object(1100.00777001); instance.replace = String.prototype.replace; try { instance.replace({ toString() { return /77/; }, }, 1); assert.ok(false, 'S15.5.4.11_A1_T15 #1 lead to throwing exception'); } catch (error) { assert.ok(error instanceof TypeError, 'S15.5.4.11_A1_T15 #2'); } instance = Object(1100.00777001); instance.replace = String.prototype.replace; try { instance.replace(/77/, { toString() { return (a1, a2) => `${ a2 }z`; }, }); assert.ok(false, 'S15.5.4.11_A1_T16 #1 lead to throwing exception'); } catch (error) { assert.ok(error instanceof TypeError, 'S15.5.4.11_A1_T16 #2'); } assert.strictEqual('asdf'.replace(RegExp('', 'g'), '1'), '1a1s1d1f1', 'S15.5.4.11_A1_T17'); assert.strictEqual('She sells seashells by the seashore.'.replace(/sh/g, 'sch'), 'She sells seaschells by the seaschore.', 'S15.5.4.11_A2_T1'); assert.strictEqual('She sells seashells by the seashore.'.replace(/sh/g, '$$sch'), 'She sells sea$schells by the sea$schore.', 'S15.5.4.11_A2_T2'); assert.strictEqual('She sells seashells by the seashore.'.replace(/sh/g, '$&sch'), 'She sells seashschells by the seashschore.', 'S15.5.4.11_A2_T3'); // eslint-disable-next-line max-len assert.strictEqual('She sells seashells by the seashore.'.replace(/sh/g, '$`sch'), 'She sells seaShe sells seaschells by the seaShe sells seashells by the seaschore.', 'S15.5.4.11_A2_T4'); assert.strictEqual('She sells seashells by the seashore.'.replace(/sh/g, "$'sch"), 'She sells seaells by the seashore.schells by the seaore.schore.', 'S15.5.4.11_A2_T5'); assert.strictEqual('She sells seashells by the seashore.'.replace(/sh/, 'sch'), 'She sells seaschells by the seashore.', 'S15.5.4.11_A2_T6'); assert.strictEqual('She sells seashells by the seashore.'.replace(/sh/, '$$sch'), 'She sells sea$schells by the seashore.', 'S15.5.4.11_A2_T7'); assert.strictEqual('She sells seashells by the seashore.'.replace(/sh/, '$&sch'), 'She sells seashschells by the seashore.', 'S15.5.4.11_A2_T8'); assert.strictEqual('She sells seashells by the seashore.'.replace(/sh/, '$`sch'), 'She sells seaShe sells seaschells by the seashore.', 'S15.5.4.11_A2_T9'); assert.strictEqual('She sells seashells by the seashore.'.replace(/sh/, "$'sch"), 'She sells seaells by the seashore.schells by the seashore.', 'S15.5.4.11_A2_T10'); assert.strictEqual('uid=31'.replace(/(uid=)(\d+)/, '$1115'), 'uid=115', 'S15.5.4.11_A3_T1'); assert.strictEqual('uid=31'.replace(/(uid=)(\d+)/, '$11A15'), 'uid=1A15', 'S15.5.4.11_A3_T3'); assert.strictEqual('abc12 def34'.replace(/([a-z]+)(\d+)/, (a, b, c) => c + b), '12abc def34', 'S15.5.4.11_A4_T1'); assert.strictEqual('aaaaaaaaaa,aaaaaaaaaaaaaaa'.replace(/^(a+)\1*,\1+$/, '$1'), 'aaaaa', 'S15.5.4.11_A5_T1'); // https://github.com/zloirock/core-js/issues/471 assert.strictEqual('{price} Retail'.replace(/{price}/g, '$25.00'), '$25.00 Retail'); assert.strictEqual('a'.replace(/(.)/, '$0'), '$0'); }; QUnit.test('String#replace regression', run); QUnit.test('RegExp#@@replace appearance', assert => { const replace = /./[Symbol.replace]; assert.isFunction(replace); // assert.name(replace, '[Symbol.replace]'); assert.arity(replace, 2); assert.looksNative(replace); assert.nonEnumerable(RegExp.prototype, Symbol.replace); }); QUnit.test('RegExp#@@replace basic behavior', assert => { assert.strictEqual(/([a-z]+)(\d+)/[Symbol.replace]('abc12 def34', (a, b, c) => c + b), '12abc def34'); }); QUnit.test('String.replace delegates to @@replace', assert => { const string = STRICT ? 'string' : Object('string'); const number = STRICT ? 42 : Object(42); const object = {}; object[Symbol.replace] = function (a, b) { return { a, b }; }; assert.strictEqual(string.replace(object, 42).a, string); assert.strictEqual(string.replace(object, 42).b, 42); assert.strictEqual(''.replace.call(number, object, 42).a, number); assert.strictEqual(''.replace.call(number, object, 42).b, 42); const regexp = /./; regexp[Symbol.replace] = function (a, b) { return { a, b }; }; assert.strictEqual(string.replace(regexp, 42).a, string); assert.strictEqual(string.replace(regexp, 42).b, 42); assert.strictEqual(''.replace.call(number, regexp, 42).a, number); assert.strictEqual(''.replace.call(number, regexp, 42).b, 42); }); QUnit.test('RegExp#@@replace delegates to exec', assert => { const exec = function () { execCalled = true; return /./.exec.apply(this, arguments); }; let execCalled = false; let re = /[ac]/; re.exec = exec; assert.deepEqual(re[Symbol.replace]('abc', 'f'), 'fbc'); assert.ok(execCalled); assert.strictEqual(re.lastIndex, 0); execCalled = false; re = /[ac]/g; re.exec = exec; assert.deepEqual(re[Symbol.replace]('abc', 'f'), 'fbf'); assert.ok(execCalled); assert.strictEqual(re.lastIndex, 0); re = /a/; // Not a function, should be ignored re.exec = 3; assert.deepEqual(re[Symbol.replace]('abc', 'f'), 'fbc'); re = /a/; // Does not return an object, should throw re.exec = () => 3; assert.throws(() => re[Symbol.replace]('abc', 'f')); }); QUnit.test('RegExp#@@replace correctly handles substitutions', assert => { const re = /./; re.exec = function () { const result = ['23', '7']; result.groups = { '!!!': '7' }; result.index = 1; return result; }; assert.strictEqual('1234'.replace(re, '$1'), '174'); assert.strictEqual('1234'.replace(re, '$'), '174'); assert.strictEqual('1234'.replace(re, '$`'), '114'); assert.strictEqual('1234'.replace(re, '$\''), '144'); assert.strictEqual('1234'.replace(re, '$$'), '1$4'); assert.strictEqual('1234'.replace(re, '$&'), '1234'); assert.strictEqual('1234'.replace(re, '$x'), '1$x4'); let args; assert.strictEqual('1234'.replace(re, (..._args) => { args = _args; return 'x'; }), '1x4'); assert.deepEqual(args, ['23', '7', 1, '1234', { '!!!': '7' }]); }); QUnit.test('RegExp#@@replace implementation', patchRegExp$exec(run)); core-js-3.6.1/tests/tests/es.string.search.js000066400000000000000000000115771360057567700211400ustar00rootroot00000000000000import { GLOBAL, STRICT } from '../helpers/constants'; import { patchRegExp$exec } from '../helpers/helpers'; const Symbol = GLOBAL.Symbol || {}; const run = assert => { assert.isFunction(''.search); assert.arity(''.search, 1); assert.name(''.search, 'search'); assert.looksNative(''.search); assert.nonEnumerable(String.prototype, 'search'); let instance = Object(true); instance.search = String.prototype.search; assert.strictEqual(instance.search(true), 0, 'S15.5.4.12_A1_T1'); instance = Object(false); instance.search = String.prototype.search; assert.strictEqual(instance.search(false), 0, 'S15.5.4.12_A1_T2'); assert.strictEqual(''.search(), 0, 'S15.5.4.12_A1_T4 #1'); assert.strictEqual('--undefined--'.search(), 0, 'S15.5.4.12_A1_T4 #2'); assert.strictEqual('gnulluna'.search(null), 1, 'S15.5.4.12_A1_T5'); assert.strictEqual(Object('undefined').search(undefined), 0, 'S15.5.4.12_A1_T6'); assert.strictEqual('undefined'.search(undefined), 0, 'S15.5.4.12_A1_T7'); assert.strictEqual(String({ toString() { /* empty */ }, }).search(undefined), 0, 'S15.5.4.12_A1_T8'); assert.strictEqual('ssABB\u0041BABAB'.search({ toString() { return '\u0041B'; }, }), 2, 'S15.5.4.12_A1_T10'); try { 'ABB\u0041BABAB'.search({ toString() { throw new Error('intostr'); }, }); assert.ok(false, 'S15.5.4.12_A1_T11 #1 lead to throwing exception'); } catch (error) { assert.strictEqual(error.message, 'intostr', 'S15.5.4.12_A1_T11 #2'); } try { Object('ABB\u0041BABAB').search({ toString() { return {}; }, valueOf() { throw new Error('intostr'); }, }); assert.ok(false, 'S15.5.4.12_A1_T12 #1 lead to throwing exception'); } catch (error) { assert.strictEqual(error.message, 'intostr', 'S15.5.4.12_A1_T12 #2'); } assert.strictEqual('ABB\u0041B\u0031ABAB\u0031BBAA'.search({ toString() { return {}; }, valueOf() { return 1; }, }), 5, 'S15.5.4.12_A1_T13'); assert.strictEqual('ABB\u0041BABAB\u0037\u0037BBAA'.search(RegExp('77')), 9, 'S15.5.4.12_A1_T14'); assert.strictEqual(Object('test string').search('string'), 5, 'S15.5.4.12_A2_T1'); assert.strictEqual(Object('test string').search('String'), -1, 'S15.5.4.12_A2_T2'); assert.strictEqual(Object('test string').search(/string/i), 5, 'S15.5.4.12_A2_T3'); assert.strictEqual(Object('test string').search(/Four/), -1, 'S15.5.4.12_A2_T4'); assert.strictEqual(Object('one two three four five').search(/four/), 14, 'S15.5.4.12_A2_T5'); assert.strictEqual(Object('test string').search('notexist'), -1, 'S15.5.4.12_A2_T6'); assert.strictEqual(Object('test string probe').search('string pro'), 5, 'S15.5.4.12_A2_T7'); let string = Object('power of the power of the power of the power of the power of the power of the great sword'); assert.strictEqual(string.search(/the/), string.search(/the/g), 'S15.5.4.12_A3_T1'); string = Object('power \u006F\u0066 the power of the power \u006F\u0066 the power of the power \u006F\u0066 the power of the great sword'); assert.strictEqual(string.search(/of/), string.search(/of/g), 'S15.5.4.12_A3_T2'); }; QUnit.test('String#search regression', run); QUnit.test('RegExp#@@search appearance', assert => { const search = /./[Symbol.search]; assert.isFunction(search); // assert.name(search, '[Symbol.search]'); assert.arity(search, 1); assert.looksNative(search); assert.nonEnumerable(RegExp.prototype, Symbol.search); }); QUnit.test('RegExp#@@search basic behavior', assert => { assert.strictEqual(/four/[Symbol.search]('one two three four five'), 14); assert.strictEqual(/Four/[Symbol.search]('one two three four five'), -1); }); QUnit.test('String#search delegates to @@search', assert => { const string = STRICT ? 'string' : Object('string'); const number = STRICT ? 42 : Object(42); const object = {}; object[Symbol.search] = function (it) { return { value: it }; }; assert.strictEqual(string.search(object).value, string); assert.strictEqual(''.search.call(number, object).value, number); const regexp = /./; regexp[Symbol.search] = function (it) { return { value: it }; }; assert.strictEqual(string.search(regexp).value, string); assert.strictEqual(''.search.call(number, regexp).value, number); }); QUnit.test('RegExp#@@search delegates to exec', assert => { let execCalled = false; let re = /b/; re.lastIndex = 7; re.exec = function () { execCalled = true; return /./.exec.apply(this, arguments); }; assert.deepEqual(re[Symbol.search]('abc'), 1); assert.ok(execCalled); assert.strictEqual(re.lastIndex, 7); re = /b/; // Not a function, should be ignored re.exec = 3; assert.deepEqual(re[Symbol.search]('abc'), 1); re = /b/; // Does not return an object, should throw re.exec = () => 3; assert.throws(() => re[Symbol.search]('abc')); }); QUnit.test('RegExp#@@search implementation', patchRegExp$exec(run)); core-js-3.6.1/tests/tests/es.string.small.js000066400000000000000000000004641360057567700207740ustar00rootroot00000000000000QUnit.test('String#small', assert => { const { small } = String.prototype; assert.isFunction(small); assert.arity(small, 0); assert.name(small, 'small'); assert.looksNative(small); assert.nonEnumerable(String.prototype, 'small'); assert.same('a'.small(), 'a', 'lower case'); }); core-js-3.6.1/tests/tests/es.string.split.js000066400000000000000000001202121360057567700210110ustar00rootroot00000000000000import { GLOBAL, NATIVE, STRICT } from '../helpers/constants'; import { patchRegExp$exec } from '../helpers/helpers'; const Symbol = GLOBAL.Symbol || {}; const run = assert => { assert.isFunction(''.split); assert.arity(''.split, 2); assert.name(''.split, 'split'); assert.looksNative(''.split); assert.nonEnumerable(String.prototype, 'split'); assert.arrayEqual('ab'.split(), ['ab'], 'If "separator" is undefined must return Array with one String - "this" string'); assert.arrayEqual('ab'.split(undefined), ['ab'], 'If "separator" is undefined must return Array with one String - "this" string'); assert.arrayEqual('ab'.split(undefined, 0), [], 'If "separator" is undefined and "limit" set to 0 must return Array[]'); assert.arrayEqual(''.split(), [''], "''.split() results in ['']"); assert.arrayEqual(''.split(/./), [''], "''.split(/./) results in ['']"); assert.arrayEqual(''.split(/.?/), [], "''.split(/.?/) results in []"); assert.arrayEqual(''.split(/.??/), [], "''.split(/.??/) results in []"); assert.arrayEqual('ab'.split(/a*/), ['', 'b'], "'ab'.split(/a*/) results in ['', 'b']"); assert.arrayEqual('ab'.split(/a*?/), ['a', 'b'], "'ab'.split(/a*?/) results in ['a', 'b']"); assert.arrayEqual('ab'.split(/(?:ab)/), ['', ''], "'ab'.split(/(?:ab)/) results in ['', '']"); assert.arrayEqual('ab'.split(/(?:ab)*/), ['', ''], "'ab'.split(/(?:ab)*/) results in ['', '']"); assert.arrayEqual('ab'.split(/(?:ab)*?/), ['a', 'b'], "'ab'.split(/(?:ab)*?/) results in ['a', 'b']"); assert.arrayEqual('test'.split(''), ['t', 'e', 's', 't'], "'test'.split('') results in ['t', 'e', 's', 't']"); assert.arrayEqual('test'.split(), ['test'], "'test'.split() results in ['test']"); assert.arrayEqual('111'.split(1), ['', '', '', ''], "'111'.split(1) results in ['', '', '', '']"); assert.arrayEqual('test'.split(/(?:)/, 2), ['t', 'e'], "'test'.split(/(?:)/, 2) results in ['t', 'e']"); assert.arrayEqual('test'.split(/(?:)/, -1), ['t', 'e', 's', 't'], "'test'.split(/(?:)/, -1) results in ['t', 'e', 's', 't']"); assert.arrayEqual('test'.split(/(?:)/, undefined), ['t', 'e', 's', 't'], "'test'.split(/(?:)/, undefined) results in ['t', 'e', 's', 't']"); assert.arrayEqual('test'.split(/(?:)/, null), [], "'test'.split(/(?:)/, null) results in []"); assert.arrayEqual('test'.split(/(?:)/, NaN), [], "'test'.split(/(?:)/, NaN) results in []"); assert.arrayEqual('test'.split(/(?:)/, true), ['t'], "'test'.split(/(?:)/, true) results in ['t']"); assert.arrayEqual('test'.split(/(?:)/, '2'), ['t', 'e'], "'test'.split(/(?:)/, '2') results in ['t', 'e']"); assert.arrayEqual('test'.split(/(?:)/, 'two'), [], "'test'.split(/(?:)/, 'two') results in []"); assert.arrayEqual('a'.split(/-/), ['a'], "'a'.split(/-/) results in ['a']"); assert.arrayEqual('a'.split(/-?/), ['a'], "'a'.split(/-?/) results in ['a']"); assert.arrayEqual('a'.split(/-??/), ['a'], "'a'.split(/-??/) results in ['a']"); assert.arrayEqual('a'.split(/a/), ['', ''], "'a'.split(/a/) results in ['', '']"); assert.arrayEqual('a'.split(/a?/), ['', ''], "'a'.split(/a?/) results in ['', '']"); assert.arrayEqual('a'.split(/a??/), ['a'], "'a'.split(/a??/) results in ['a']"); assert.arrayEqual('ab'.split(/-/), ['ab'], "'ab'.split(/-/) results in ['ab']"); assert.arrayEqual('ab'.split(/-?/), ['a', 'b'], "'ab'.split(/-?/) results in ['a', 'b']"); assert.arrayEqual('ab'.split(/-??/), ['a', 'b'], "'ab'.split(/-??/) results in ['a', 'b']"); assert.arrayEqual('a-b'.split(/-/), ['a', 'b'], "'a-b'.split(/-/) results in ['a', 'b']"); assert.arrayEqual('a-b'.split(/-?/), ['a', 'b'], "'a-b'.split(/-?/) results in ['a', 'b']"); assert.arrayEqual('a-b'.split(/-??/), ['a', '-', 'b'], "'a-b'.split(/-??/) results in ['a', '-', 'b']"); assert.arrayEqual('a--b'.split(/-/), ['a', '', 'b'], "'a--b'.split(/-/) results in ['a', '', 'b']"); assert.arrayEqual('a--b'.split(/-?/), ['a', '', 'b'], "'a--b'.split(/-?/) results in ['a', '', 'b']"); assert.arrayEqual('a--b'.split(/-??/), ['a', '-', '-', 'b'], "'a--b'.split(/-??/) results in ['a', '-', '-', 'b']"); assert.arrayEqual(''.split(/()()/), [], "''.split(/()()/) results in []"); assert.arrayEqual('.'.split(/()()/), ['.'], "'.'.split(/()()/) results in ['.']"); assert.arrayEqual('.'.split(/(.?)(.?)/), ['', '.', '', ''], "'.'.split(/(.?)(.?)/) results in ['', '.', '', '']"); assert.arrayEqual('.'.split(/(.??)(.??)/), ['.'], "'.'.split(/(.??)(.??)/) results in ['.']"); assert.arrayEqual('.'.split(/(.)?(.)?/), ['', '.', undefined, ''], "'.'.split(/(.)?(.)?/) results in ['', '.', undefined, '']"); // eslint-disable-next-line max-len assert.arrayEqual('Aboldandcoded'.split(/<(\/)?([^<>]+)>/), ['A', undefined, 'B', 'bold', '/', 'B', 'and', undefined, 'CODE', 'coded', '/', 'CODE', ''], "'Aboldandcoded'.split(/<(\\/)?([^<>]+)>/) results in ['A', undefined, 'B', 'bold', '/', 'B', 'and', undefined, 'CODE', 'coded', '/', 'CODE', '']"); assert.arrayEqual('tesst'.split(/(s)*/), ['t', undefined, 'e', 's', 't'], "'tesst'.split(/(s)*/) results in ['t', undefined, 'e', 's', 't']"); // eslint-disable-next-line max-len assert.arrayEqual('tesst'.split(/(s)*?/), ['t', undefined, 'e', undefined, 's', undefined, 's', undefined, 't'], "'tesst'.split(/(s)*?/) results in ['t', undefined, 'e', undefined, 's', undefined, 's', undefined, 't']"); assert.arrayEqual('tesst'.split(/(s*)/), ['t', '', 'e', 'ss', 't'], "'tesst'.split(/(s*)/) results in ['t', '', 'e', 'ss', 't']"); assert.arrayEqual('tesst'.split(/(s*?)/), ['t', '', 'e', '', 's', '', 's', '', 't'], "'tesst'.split(/(s*?)/) results in ['t', '', 'e', '', 's', '', 's', '', 't']"); assert.arrayEqual('tesst'.split(/s*/), ['t', 'e', 't'], "'tesst'.split(/(?:s)*/) results in ['t', 'e', 't']"); assert.arrayEqual('tesst'.split(/(?=s+)/), ['te', 's', 'st'], "'tesst'.split(/(?=s+)/) results in ['te', 's', 'st']"); assert.arrayEqual('test'.split('t'), ['', 'es', ''], "'test'.split('t') results in ['', 'es', '']"); assert.arrayEqual('test'.split('es'), ['t', 't'], "'test'.split('es') results in ['t', 't']"); assert.arrayEqual('test'.split(/t/), ['', 'es', ''], "'test'.split(/t/) results in ['', 'es', '']"); assert.arrayEqual('test'.split(/es/), ['t', 't'], "'test'.split(/es/) results in ['t', 't']"); assert.arrayEqual('test'.split(/(t)/), ['', 't', 'es', 't', ''], "'test'.split(/(t)/) results in ['', 't', 'es', 't', '']"); assert.arrayEqual('test'.split(/(es)/), ['t', 'es', 't'], "'test'.split(/(es)/) results in ['t', 'es', 't']"); assert.arrayEqual('test'.split(/(t)(e)(s)(t)/), ['', 't', 'e', 's', 't', ''], "'test'.split(/(t)(e)(s)(t)/) results in ['', 't', 'e', 's', 't', '']"); assert.arrayEqual('.'.split(/(((.((.??)))))/), ['', '.', '.', '.', '', '', ''], "'.'.split(/(((.((.??)))))/) results in ['', '.', '.', '.', '', '', '']"); assert.arrayEqual('.'.split(/(((((.??)))))/), ['.'], "'.'.split(/(((((.??)))))/) results in ['.']"); assert.arrayEqual('a b c d'.split(/ /, -(2 ** 32) + 1), ['a'], "'a b c d'.split(/ /, -(2 ** 32) + 1) results in ['a']"); assert.arrayEqual('a b c d'.split(/ /, 2 ** 32 + 1), ['a'], "'a b c d'.split(/ /, 2 ** 32 + 1) results in ['a']"); assert.arrayEqual('a b c d'.split(/ /, Infinity), [], "'a b c d'.split(/ /, Infinity) results in []"); let instance = Object(true); instance.split = String.prototype.split; let split = instance.split(true, false); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T1 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T1 #2'); assert.strictEqual(split.length, 0, 'S15.5.4.14_A1_T1 #3'); instance = Object(false); instance.split = String.prototype.split; split = instance.split(false, 0, null); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T2 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T2 #2'); assert.strictEqual(split.length, 0, 'S15.5.4.14_A1_T2 #3'); split = ''.split(); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T4 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T4 #2'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A1_T4 #3'); assert.strictEqual(split[0], '', 'S15.5.4.14_A1_T4 #4'); split = 'gnulluna'.split(null); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T5 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T5 #2'); assert.strictEqual(split.length, 2, 'S15.5.4.14_A1_T5 #3'); assert.strictEqual(split[0], 'g', 'S15.5.4.14_A1_T5 #4'); assert.strictEqual(split[1], 'una', 'S15.5.4.14_A1_T5 #5'); if (NATIVE) { split = Object('1undefined').split(undefined); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T6 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T6 #2'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A1_T6 #3'); assert.strictEqual(split[0], '1undefined', 'S15.5.4.14_A1_T6 #4'); split = 'undefinedd'.split(undefined); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T7 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T7 #2'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A1_T7 #3'); assert.strictEqual(split[0], 'undefinedd', 'S15.5.4.14_A1_T7 #4'); split = String({ toString() { /* empty */ }, }).split(undefined); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T8 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T8 #2'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A1_T8 #3'); assert.strictEqual(split[0], 'undefined', 'S15.5.4.14_A1_T8 #4'); } split = new String({ valueOf() { /* empty */ }, toString: undefined, }).split(() => { /* empty */ }); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T9 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T9 #2'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A1_T9 #3'); assert.strictEqual(split[0], 'undefined', 'S15.5.4.14_A1_T9 #4'); split = 'ABB\u0041BABAB'.split({ toString() { return '\u0042B'; }, }, { valueOf() { return true; }, }); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T10 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T10 #2'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A1_T10 #3'); assert.strictEqual(split[0], 'A', 'S15.5.4.14_A1_T10 #4'); try { 'ABB\u0041BABAB'.split({ toString() { return '\u0041B'; }, }, { valueOf() { throw new Error('intointeger'); }, }); assert.ok(false, 'S15.5.4.14_A1_T11 #1 lead to throwing exception'); } catch (error) { assert.strictEqual(error.message, 'intointeger', 'S15.5.4.14_A1_T11 #2'); } if (NATIVE) { try { new String('ABB\u0041BABAB').split({ toString() { return '\u0041B'; }, }, { valueOf() { return {}; }, toString() { throw new Error('intointeger'); }, }); assert.ok(false, 'S15.5.4.14_A1_T12 #1 lead to throwing exception'); } catch (error) { assert.strictEqual(error.message, 'intointeger', 'S15.5.4.14_A1_T12 #2'); } } split = 'ABB\u0041BABAB\u0042cc^^\u0042Bvv%%B\u0042xxx'.split({ toString() { return '\u0042\u0042'; }, }, { valueOf() { return {}; }, toString() { return '2'; }, }); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T13 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T13 #2'); assert.strictEqual(split.length, 2, 'S15.5.4.14_A1_T13 #3'); assert.strictEqual(split[0], 'A', 'S15.5.4.14_A1_T13 #4'); assert.strictEqual(split[1], 'ABABA', 'S15.5.4.14_A1_T13 #5'); if (NATIVE) { try { instance = Object(10001.10001); instance.split = String.prototype.split; instance.split({ toString() { throw new Error('intostr'); }, }, { valueOf() { throw new Error('intoint'); }, }); assert.ok(false, 'S15.5.4.14_A1_T14 #1 lead to throwing exception'); } catch (error) { assert.strictEqual(error.message, 'intoint', 'S15.5.4.14_A1_T14 #2'); } try { class F { costructor(value) { this.value = value; } valueOf() { return `${ this.value }`; } toString() { return new Number(); } } F.prototype.split = String.prototype.split; new F().split({ toString() { return {}; }, valueOf() { throw new Error('intostr'); }, }, { valueOf() { throw new Error('intoint'); }, }); assert.ok(false, 'S15.5.4.14_A1_T15 #1 lead to throwing exception'); } catch (error) { assert.strictEqual(error.message, 'intoint', 'S15.5.4.14_A1_T15 #2'); } } try { String.prototype.split.call(6776767677.006771122677555, { toString() { return /77/g; }, }); assert.ok(false, 'S15.5.4.14_A1_T16 #1 lead to throwing exception'); } catch (error) { assert.ok(error instanceof TypeError, 'S15.5.4.14_A1_T16 #2'); } split = String.prototype.split.call(6776767677.006771122677555, /77/g); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T17 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T17 #2'); assert.strictEqual(split.length, 4, 'S15.5.4.14_A1_T17 #3'); assert.strictEqual(split[0], '6', 'S15.5.4.14_A1_T17 #4'); assert.strictEqual(split[1], '67676', 'S15.5.4.14_A1_T17 #5'); assert.strictEqual(split[2], '.006', 'S15.5.4.14_A1_T17 #6'); assert.strictEqual(split[3], '1', 'S15.5.4.14_A1_T17 #7'); split = String.prototype.split.call(6776767677.006771122677555, /00/, 1); assert.strictEqual(typeof split, 'object', 'S15.5.4.14_A1_T18 #1'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A1_T18 #2'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A1_T18 #3'); assert.strictEqual(split[0], '6776767677.', 'S15.5.4.14_A1_T18 #4'); split = Object('one,two,three,four,five').split(','); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T1 #1'); assert.strictEqual(split.length, 5, 'S15.5.4.14_A2_T1 #2'); assert.strictEqual(split[0], 'one', 'S15.5.4.14_A2_T1 #3'); assert.strictEqual(split[1], 'two', 'S15.5.4.14_A2_T1 #4'); assert.strictEqual(split[2], 'three', 'S15.5.4.14_A2_T1 #5'); assert.strictEqual(split[3], 'four', 'S15.5.4.14_A2_T1 #6'); assert.strictEqual(split[4], 'five', 'S15.5.4.14_A2_T1 #7'); split = Object('one two three four five').split(' '); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T2 #1'); assert.strictEqual(split.length, 5, 'S15.5.4.14_A2_T2 #2'); assert.strictEqual(split[0], 'one', 'S15.5.4.14_A2_T2 #3'); assert.strictEqual(split[1], 'two', 'S15.5.4.14_A2_T2 #4'); assert.strictEqual(split[2], 'three', 'S15.5.4.14_A2_T2 #5'); assert.strictEqual(split[3], 'four', 'S15.5.4.14_A2_T2 #6'); assert.strictEqual(split[4], 'five', 'S15.5.4.14_A2_T2 #7'); split = Object('one two three four five').split(RegExp(' '), 2); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T3 #1'); assert.strictEqual(split.length, 2, 'S15.5.4.14_A2_T3 #2'); assert.strictEqual(split[0], 'one', 'S15.5.4.14_A2_T3 #3'); assert.strictEqual(split[1], 'two', 'S15.5.4.14_A2_T3 #4'); split = Object('one two three').split(''); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T4 #1'); assert.strictEqual(split.length, 'one two three'.length, 'S15.5.4.14_A2_T4 #2'); assert.strictEqual(split[0], 'o', 'S15.5.4.14_A2_T4 #3'); assert.strictEqual(split[1], 'n', 'S15.5.4.14_A2_T4 #4'); assert.strictEqual(split[11], 'e', 'S15.5.4.14_A2_T4 #5'); assert.strictEqual(split[12], 'e', 'S15.5.4.14_A2_T4 #6'); split = Object('one-1,two-2,four-4').split(/,/); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T5 #1'); assert.strictEqual(split.length, 3, 'S15.5.4.14_A2_T5 #2'); assert.strictEqual(split[0], 'one-1', 'S15.5.4.14_A2_T5 #3'); assert.strictEqual(split[1], 'two-2', 'S15.5.4.14_A2_T5 #4'); assert.strictEqual(split[2], 'four-4', 'S15.5.4.14_A2_T5 #5'); let string = Object('one-1 two-2 three-3'); split = string.split(''); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T6 #1'); assert.strictEqual(split.length, string.length, 'S15.5.4.14_A2_T6 #2'); for (let i = 0, { length } = split; i < length; ++i) { assert.strictEqual(split[i], string.charAt(i), `S15.5.4.14_A2_T6 #${ i + 3 }`); } if (NATIVE) { string = 'thisundefinedisundefinedaundefinedstringundefinedobject'; split = string.split(undefined); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T7 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A2_T7 #2'); assert.strictEqual(split[0], string, 'S15.5.4.14_A2_T7 #3'); } string = 'thisnullisnullanullstringnullobject'; let expected = ['this', 'is', 'a', 'string', 'object']; split = string.split(null); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T8 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T8 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T8 #${ i + 3 }`); } string = 'thistrueistrueatruestringtrueobject'; expected = ['this', 'is', 'a', 'string', 'object']; split = string.split(true); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T9 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T9 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T9 #${ i + 3 }`); } string = 'this123is123a123string123object'; expected = ['this', 'is', 'a', 'string', 'object']; split = string.split(123); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T10 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T10 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T10 #${ i + 3 }`); } split = Object('one-1,two-2,four-4').split(':'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T11 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A2_T11 #2'); assert.strictEqual(split[0], 'one-1,two-2,four-4', 'S15.5.4.14_A2_T11 #3'); split = Object('one-1 two-2 four-4').split('r-42'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T12 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A2_T12 #2'); assert.strictEqual(split[0], 'one-1 two-2 four-4', 'S15.5.4.14_A2_T12 #3'); split = Object('one-1 two-2 four-4').split('-4'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T13 #1'); assert.strictEqual(split.length, 2, 'S15.5.4.14_A2_T13 #2'); assert.strictEqual(split[0], 'one-1 two-2 four', 'S15.5.4.14_A2_T13 #3'); assert.strictEqual(split[1], '', 'S15.5.4.14_A2_T13 #4'); split = Object('one-1 two-2 four-4').split('on'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T14 #1'); assert.strictEqual(split.length, 2, 'S15.5.4.14_A2_T14 #2'); assert.strictEqual(split[0], '', 'S15.5.4.14_A2_T14 #3'); assert.strictEqual(split[1], 'e-1 two-2 four-4', 'S15.5.4.14_A2_T14 #4'); split = new String().split(''); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T15 #1'); assert.strictEqual(split.length, 0, 'S15.5.4.14_A2_T15 #2'); assert.strictEqual(split[0], undefined, 'S15.5.4.14_A2_T15 #3'); split = new String().split(' '); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T16 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A2_T16 #2'); assert.strictEqual(split[0], '', 'S15.5.4.14_A2_T16 #3'); split = Object(' ').split(''); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T18 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A2_T18 #2'); assert.strictEqual(split[0], ' ', 'S15.5.4.14_A2_T18 #3'); split = Object(' ').split(' '); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T19 #1'); assert.strictEqual(split.length, 2, 'S15.5.4.14_A2_T19 #2'); assert.strictEqual(split[0], '', 'S15.5.4.14_A2_T19 #3'); assert.strictEqual(split[1], '', 'S15.5.4.14_A2_T19 #4'); split = ''.split('x'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T19 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A2_T19 #2'); assert.strictEqual(split[0], '', 'S15.5.4.14_A2_T19 #3'); string = Object('one-1 two-2 three-3'); split = string.split(new RegExp()); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T20 #1'); assert.strictEqual(split.length, string.length, 'S15.5.4.14_A2_T20 #2'); for (let i = 0, { length } = split; i < length; ++i) { assert.strictEqual(split[i], string.charAt(i), `S15.5.4.14_A2_T20 #${ i + 3 }`); } split = Object('hello').split('ll'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T21 #1'); assert.strictEqual(split.length, 2, 'S15.5.4.14_A2_T21 #2'); assert.strictEqual(split[0], 'he', 'S15.5.4.14_A2_T21 #3'); assert.strictEqual(split[1], 'o', 'S15.5.4.14_A2_T21 #4'); split = Object('hello').split('l'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T22 #1'); assert.strictEqual(split.length, 3, 'S15.5.4.14_A2_T22 #2'); assert.strictEqual(split[0], 'he', 'S15.5.4.14_A2_T22 #3'); assert.strictEqual(split[1], '', 'S15.5.4.14_A2_T22 #4'); assert.strictEqual(split[2], 'o', 'S15.5.4.14_A2_T22 #5'); split = Object('hello').split('x'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T23 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A2_T23 #2'); assert.strictEqual(split[0], 'hello', 'S15.5.4.14_A2_T23 #3'); split = Object('hello').split('h'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T24 #1'); assert.strictEqual(split.length, 2, 'S15.5.4.14_A2_T24 #2'); assert.strictEqual(split[0], '', 'S15.5.4.14_A2_T24 #3'); assert.strictEqual(split[1], 'ello', 'S15.5.4.14_A2_T24 #4'); split = Object('hello').split('o'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T25 #1'); assert.strictEqual(split.length, 2, 'S15.5.4.14_A2_T25 #2'); assert.strictEqual(split[0], 'hell', 'S15.5.4.14_A2_T25 #3'); assert.strictEqual(split[1], '', 'S15.5.4.14_A2_T25 #4'); split = Object('hello').split('hello'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T26 #1'); assert.strictEqual(split.length, 2, 'S15.5.4.14_A2_T26 #2'); assert.strictEqual(split[0], '', 'S15.5.4.14_A2_T26 #3'); assert.strictEqual(split[1], '', 'S15.5.4.14_A2_T26 #4'); split = Object('hello').split(undefined); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T27 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A2_T27 #2'); assert.strictEqual(split[0], 'hello', 'S15.5.4.14_A2_T27 #3'); split = Object('hello').split('hellothere'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T28 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A2_T28 #2'); assert.strictEqual(split[0], 'hello', 'S15.5.4.14_A2_T28 #3'); instance = Object(100111122133144155); instance.split = String.prototype.split; split = instance.split(1); expected = ['', '00', '', '', '', '22', '33', '44', '60']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T29 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T29 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T29 #${ i + 3 }`); } instance = Object(100111122133144155); instance.split = String.prototype.split; split = instance.split(1, 1); expected = ['']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T30 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T30 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T30 #${ i + 3 }`); } instance = Object(100111122133144155); instance.split = String.prototype.split; split = instance.split(1, 2); expected = ['', '00']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T31 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T31 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T31 #${ i + 3 }`); } instance = Object(100111122133144155); instance.split = String.prototype.split; split = instance.split(1, 0); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T32 #1'); assert.strictEqual(split.length, 0, 'S15.5.4.14_A2_T32 #2'); instance = Object(100111122133144155); instance.split = String.prototype.split; split = instance.split(1, 100); expected = ['', '00', '', '', '', '22', '33', '44', '60']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T33 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T33 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T33 #${ i + 3 }`); } instance = Object(100111122133144155); instance.split = String.prototype.split; split = instance.split(1, undefined); expected = ['', '00', '', '', '', '22', '33', '44', '60']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T34 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T34 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T34 #${ i + 3 }`); } instance = Object(100111122133144155); instance.split = String.prototype.split; split = instance.split(1, 2 ** 32 - 1); expected = ['', '00', '', '', '', '22', '33', '44', '60']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T35 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T35 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T35 #${ i + 3 }`); } instance = Object(100111122133144155); instance.split = String.prototype.split; split = instance.split(1, 'boo'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T36 #1'); assert.strictEqual(split.length, 0, 'S15.5.4.14_A2_T36 #2'); instance = Object(100111122133144155); instance.split = String.prototype.split; split = instance.split(1, -(2 ** 32) + 1); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T37 #1'); assert.arrayEqual(split, [''], 'S15.5.4.14_A2_T37 #2'); instance = Object(100111122133144155); instance.split = String.prototype.split; split = instance.split(1, NaN); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T38 #1'); assert.strictEqual(split.length, 0, 'S15.5.4.14_A2_T38 #2'); instance = Object('hello').split('l', 0); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T39 #1'); assert.strictEqual(split.length, 0, 'S15.5.4.14_A2_T39 #2'); split = Object('hello').split('l', 1); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T40 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A2_T40 #2'); assert.strictEqual(split[0], 'he', 'S15.5.4.14_A2_T40 #3'); split = Object('hello').split('l', 2); expected = ['he', '']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T41 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T41 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T41 #${ i + 3 }`); } split = Object('hello').split('l', 3); expected = ['he', '', 'o']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T42 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T42 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T42 #${ i + 3 }`); } split = Object('hello').split('l', 4); expected = ['he', '', 'o']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A2_T43 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A2_T43 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A2_T43 #${ i + 3 }`); } split = Object('one,two,three,four,five').split(); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A3_T1 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A3_T1 #2'); assert.strictEqual(split[0], 'one,two,three,four,five', 'S15.5.4.14_A3_T1 #3'); split = String.prototype.split.call({}); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A3_T2 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A3_T2 #2'); assert.strictEqual(split[0], '[object Object]', 'S15.5.4.14_A3_T2 #3'); split = String.prototype.split.call({ toString() { return 'function(){}'; }, }); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A3_T3 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A3_T3 #2'); assert.strictEqual(split[0], 'function(){}', 'S15.5.4.14_A3_T3 #3'); split = String.prototype.split.call(Object(NaN)); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A3_T4 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A3_T4 #2'); assert.strictEqual(split[0], 'NaN', 'S15.5.4.14_A3_T4 #3'); split = String.prototype.split.call(Object(-1234567890)); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A3_T5 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A3_T5 #2'); assert.strictEqual(split[0], '-1234567890', 'S15.5.4.14_A3_T5 #3'); instance = Object(-1e21); split = String.prototype.split.call(instance); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A3_T6 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A3_T6 #2'); assert.strictEqual(split[0], instance.toString(), 'S15.5.4.14_A3_T6 #3'); split = String.prototype.split.call(Math); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A3_T7 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A3_T7 #2'); assert.strictEqual(split[0], '[object Math]', 'S15.5.4.14_A3_T7 #3'); split = String.prototype.split.call([1, 2, 3, 4, 5]); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A3_T8 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A3_T8 #2'); assert.strictEqual(split[0], '1,2,3,4,5', 'S15.5.4.14_A3_T8 #3'); split = String.prototype.split.call(Object(false)); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A3_T9 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A3_T9 #2'); assert.strictEqual(split[0], 'false', 'S15.5.4.14_A3_T9 #3'); split = String.prototype.split.call(new String()); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A3_T10 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A3_T10 #2'); assert.strictEqual(split[0], '', 'S15.5.4.14_A3_T10 #3'); split = String.prototype.split.call(Object(' ')); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A3_T11 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A3_T11 #2'); assert.strictEqual(split[0], ' ', 'S15.5.4.14_A3_T11 #3'); if (NATIVE) { split = Object('hello').split(/l/); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T1 #1'); assert.strictEqual(split.length, 3, 'S15.5.4.14_A4_T1 #2'); assert.strictEqual(split[0], 'he', 'S15.5.4.14_A4_T1 #3'); assert.strictEqual(split[1], '', 'S15.5.4.14_A4_T1 #4'); assert.strictEqual(split[2], 'o', 'S15.5.4.14_A4_T1 #5'); } split = Object('hello').split(/l/, 0); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T2 #1'); assert.strictEqual(split.length, 0, 'S15.5.4.14_A4_T2 #2'); split = Object('hello').split(/l/, 1); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T3 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A4_T3 #2'); assert.strictEqual(split[0], 'he', 'S15.5.4.14_A4_T3 #3'); if (NATIVE) { split = Object('hello').split(/l/, 2); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T4 #1'); assert.strictEqual(split.length, 2, 'S15.5.4.14_A4_T4 #2'); assert.strictEqual(split[0], 'he', 'S15.5.4.14_A4_T4 #3'); assert.strictEqual(split[1], '', 'S15.5.4.14_A4_T4 #4'); split = Object('hello').split(/l/, 3); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T5 #1'); assert.strictEqual(split.length, 3, 'S15.5.4.14_A4_T5 #2'); assert.strictEqual(split[0], 'he', 'S15.5.4.14_A4_T5 #3'); assert.strictEqual(split[1], '', 'S15.5.4.14_A4_T5 #4'); assert.strictEqual(split[2], 'o', 'S15.5.4.14_A4_T5 #5'); split = Object('hello').split(/l/, 4); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T6 #1'); assert.strictEqual(split.length, 3, 'S15.5.4.14_A4_T6 #2'); assert.strictEqual(split[0], 'he', 'S15.5.4.14_A4_T6 #3'); assert.strictEqual(split[1], '', 'S15.5.4.14_A4_T6 #4'); assert.strictEqual(split[2], 'o', 'S15.5.4.14_A4_T6 #5'); split = Object('hello').split(/l/, undefined); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T7 #1'); assert.strictEqual(split.length, 3, 'S15.5.4.14_A4_T7 #2'); assert.strictEqual(split[0], 'he', 'S15.5.4.14_A4_T7 #3'); assert.strictEqual(split[1], '', 'S15.5.4.14_A4_T7 #4'); assert.strictEqual(split[2], 'o', 'S15.5.4.14_A4_T7 #5'); } split = Object('hello').split(/l/, 'hi'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T8 #1'); assert.strictEqual(split.length, 0, 'S15.5.4.14_A4_T8 #2'); split = Object('hello').split(new RegExp()); expected = ['h', 'e', 'l', 'l', 'o']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T10 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A4_T10 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A4_T10 #${ i + 3 }`); } split = Object('hello').split(new RegExp(), 0); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T11 #1'); assert.strictEqual(split.length, 0, 'S15.5.4.14_A4_T11 #2'); split = Object('hello').split(new RegExp(), 1); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T12 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A4_T12 #2'); assert.strictEqual(split[0], 'h', 'S15.5.4.14_A4_T12 #3'); split = Object('hello').split(new RegExp(), 2); expected = ['h', 'e']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T13 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A4_T13 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A4_T13 #${ i + 3 }`); } split = Object('hello').split(new RegExp(), 3); expected = ['h', 'e', 'l']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T14 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A4_T14 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A4_T14 #${ i + 3 }`); } split = Object('hello').split(new RegExp(), 4); expected = ['h', 'e', 'l', 'l']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T15 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A4_T15 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A4_T15 #${ i + 3 }`); } split = Object('hello').split(new RegExp(), undefined); expected = ['h', 'e', 'l', 'l', 'o']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T16 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A4_T16 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A4_T16 #${ i + 3 }`); } split = Object('hello').split(new RegExp(), 'hi'); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T18 #1'); assert.strictEqual(split.length, 0, 'S15.5.4.14_A4_T18 #2'); split = Object('a b c de f').split(/\s/); expected = ['a', 'b', 'c', 'de', 'f']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T19 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A4_T19 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A4_T19 #${ i + 3 }`); } split = Object('a b c de f').split(/\s/, 3); expected = ['a', 'b', 'c']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T20 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A4_T20 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A4_T20 #${ i + 3 }`); } split = Object('a b c de f').split(/X/); assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T21 #1'); assert.strictEqual(split.length, 1, 'S15.5.4.14_A4_T21 #2'); assert.strictEqual(split[0], 'a b c de f', 'S15.5.4.14_A4_T21 #3'); split = Object('dfe23iu 34 =+65--').split(/\d+/); expected = ['dfe', 'iu ', ' =+', '--']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T22 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A4_T22 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A4_T22 #${ i + 3 }`); } if (NATIVE) { split = Object('abc').split(/[a-z]/); expected = ['', '', '', '']; assert.strictEqual(split.constructor, Array, 'S15.5.4.14_A4_T24 #1'); assert.strictEqual(split.length, expected.length, 'S15.5.4.14_A4_T24 #2'); for (let i = 0, { length } = expected; i < length; ++i) { assert.strictEqual(expected[i], split[i], `S15.5.4.14_A4_T24 #${ i + 3 }`); } } }; QUnit.test('String#split regression', run); QUnit.test('RegExp#@@split appearance', assert => { const split = /./[Symbol.split]; assert.isFunction(split); // assert.name(split, '[Symbol.split]'); assert.arity(split, 2); assert.looksNative(split); assert.nonEnumerable(RegExp.prototype, Symbol.split); }); QUnit.test('RegExp#@@split basic behavior', assert => { assert.strictEqual(/\s/[Symbol.split]('a b c de f').length, 5); assert.strictEqual(/\s/[Symbol.split]('a b c de f', undefined).length, 5); assert.strictEqual(/\s/[Symbol.split]('a b c de f', 1).length, 1); assert.strictEqual(/\s/[Symbol.split]('a b c de f', 10).length, 5); }); QUnit.test('String#split delegates to @@split', assert => { const string = STRICT ? 'string' : Object('string'); const number = STRICT ? 42 : Object(42); const object = {}; object[Symbol.split] = function (a, b) { return { a, b }; }; assert.strictEqual(string.split(object, 42).a, string); assert.strictEqual(string.split(object, 42).b, 42); assert.strictEqual(''.split.call(number, object, 42).a, number); assert.strictEqual(''.split.call(number, object, 42).b, 42); const regexp = /./; regexp[Symbol.split] = function (a, b) { return { a, b }; }; assert.strictEqual(string.split(regexp, 42).a, string); assert.strictEqual(string.split(regexp, 42).b, 42); assert.strictEqual(''.split.call(number, regexp, 42).a, number); assert.strictEqual(''.split.call(number, regexp, 42).b, 42); }); QUnit.test('RegExp#@@split delegates to exec', assert => { let execCalled = false; let speciesCalled = false; let execSpeciesCalled = false; const re = /[24]/; re.exec = function () { execCalled = true; return /./.exec.apply(this, arguments); }; re.constructor = { // eslint-disable-next-line object-shorthand [Symbol.species]: function (source, flags) { const re2 = new RegExp(source, flags); speciesCalled = true; re2.exec = function () { execSpeciesCalled = true; return /./.exec.apply(this, arguments); }; return re2; }, }; assert.deepEqual(re[Symbol.split]('123451234'), ['1', '3', '51', '3', '']); assert.ok(!execCalled); assert.ok(speciesCalled); assert.ok(execSpeciesCalled); re.constructor = { // eslint-disable-next-line object-shorthand [Symbol.species]: function (source, flags) { const re2 = new RegExp(source, flags); // Not a function, should be ignored re2.exec = 3; return re2; }, }; assert.deepEqual(re[Symbol.split]('123451234'), ['1', '3', '51', '3', '']); re.constructor = { // eslint-disable-next-line object-shorthand [Symbol.species]: function (source, flags) { const re2 = new RegExp(source, flags); // Does not return an object, should throw re2.exec = () => 3; return re2; }, }; assert.throws(() => re[Symbol.split]('123451234')); }); QUnit.test('RegExp#@@split implementation', patchRegExp$exec(run)); core-js-3.6.1/tests/tests/es.string.starts-with.js000066400000000000000000000025251360057567700221550ustar00rootroot00000000000000import { GLOBAL, STRICT } from '../helpers/constants'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('String#startsWith', assert => { const { startsWith } = String.prototype; assert.isFunction(startsWith); assert.arity(startsWith, 1); assert.name(startsWith, 'startsWith'); assert.looksNative(startsWith); assert.nonEnumerable(String.prototype, 'startsWith'); assert.ok('undefined'.startsWith()); assert.ok(!'undefined'.startsWith(null)); assert.ok('abc'.startsWith('')); assert.ok('abc'.startsWith('a')); assert.ok('abc'.startsWith('ab')); assert.ok(!'abc'.startsWith('bc')); assert.ok('abc'.startsWith('', NaN)); assert.ok('abc'.startsWith('a', -1)); assert.ok(!'abc'.startsWith('a', 1)); assert.ok(!'abc'.startsWith('a', Infinity)); assert.ok('abc'.startsWith('b', true)); assert.ok('abc'.startsWith('a', 'x')); if (STRICT) { assert.throws(() => startsWith.call(null, '.'), TypeError); assert.throws(() => startsWith.call(undefined, '.'), TypeError); } const regexp = /./; assert.throws(() => '/./'.startsWith(regexp), TypeError); regexp[Symbol.match] = false; assert.notThrows(() => '/./'.startsWith(regexp)); const object = {}; assert.notThrows(() => '[object Object]'.startsWith(object)); object[Symbol.match] = true; assert.throws(() => '[object Object]'.startsWith(object), TypeError); }); core-js-3.6.1/tests/tests/es.string.strike.js000066400000000000000000000004771360057567700211710ustar00rootroot00000000000000QUnit.test('String#strike', assert => { const { strike } = String.prototype; assert.isFunction(strike); assert.arity(strike, 0); assert.name(strike, 'strike'); assert.looksNative(strike); assert.nonEnumerable(String.prototype, 'strike'); assert.same('a'.strike(), 'a', 'lower case'); }); core-js-3.6.1/tests/tests/es.string.sub.js000066400000000000000000000004361360057567700204540ustar00rootroot00000000000000QUnit.test('String#sub', assert => { const { sub } = String.prototype; assert.isFunction(sub); assert.arity(sub, 0); assert.name(sub, 'sub'); assert.looksNative(sub); assert.nonEnumerable(String.prototype, 'sub'); assert.same('a'.sub(), 'a', 'lower case'); }); core-js-3.6.1/tests/tests/es.string.sup.js000066400000000000000000000004361360057567700204720ustar00rootroot00000000000000QUnit.test('String#sup', assert => { const { sup } = String.prototype; assert.isFunction(sup); assert.arity(sup, 0); assert.name(sup, 'sup'); assert.looksNative(sup); assert.nonEnumerable(String.prototype, 'sup'); assert.same('a'.sup(), 'a', 'lower case'); }); core-js-3.6.1/tests/tests/es.string.trim-end.js000066400000000000000000000030011360057567700213710ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants'; QUnit.test('String#trimRight', assert => { const { trimRight } = String.prototype; assert.isFunction(trimRight); assert.arity(trimRight, 0); assert.name(trimRight, 'trimEnd'); assert.looksNative(trimRight); assert.nonEnumerable(String.prototype, 'trimRight'); assert.strictEqual(' \n q w e \n '.trimRight(), ' \n q w e', 'removes whitespaces at right side of string'); assert.strictEqual(WHITESPACES.trimRight(), '', 'removes all whitespaces'); assert.strictEqual('\u200B\u0085'.trimRight(), '\u200B\u0085', "shouldn't remove this symbols"); if (STRICT) { assert.throws(() => trimRight.call(null, 0), TypeError); assert.throws(() => trimRight.call(undefined, 0), TypeError); } }); QUnit.test('String#trimEnd', assert => { const { trimEnd } = String.prototype; assert.isFunction(trimEnd); assert.arity(trimEnd, 0); assert.name(trimEnd, 'trimEnd'); assert.looksNative(trimEnd); assert.nonEnumerable(String.prototype, 'trimEnd'); assert.same(trimEnd, String.prototype.trimRight, 'same #trimRight'); assert.strictEqual(' \n q w e \n '.trimEnd(), ' \n q w e', 'removes whitespaces at right side of string'); assert.strictEqual(WHITESPACES.trimEnd(), '', 'removes all whitespaces'); assert.strictEqual('\u200B\u0085'.trimEnd(), '\u200B\u0085', "shouldn't remove this symbols"); if (STRICT) { assert.throws(() => trimEnd.call(null, 0), TypeError); assert.throws(() => trimEnd.call(undefined, 0), TypeError); } }); core-js-3.6.1/tests/tests/es.string.trim-start.js000066400000000000000000000030171360057567700217670ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants'; QUnit.test('String#trimLeft', assert => { const { trimLeft } = String.prototype; assert.isFunction(trimLeft); assert.arity(trimLeft, 0); assert.name(trimLeft, 'trimStart'); assert.looksNative(trimLeft); assert.nonEnumerable(String.prototype, 'trimLeft'); assert.strictEqual(' \n q w e \n '.trimLeft(), 'q w e \n ', 'removes whitespaces at left side of string'); assert.strictEqual(WHITESPACES.trimLeft(), '', 'removes all whitespaces'); assert.strictEqual('\u200B\u0085'.trimLeft(), '\u200B\u0085', "shouldn't remove this symbols"); if (STRICT) { assert.throws(() => trimLeft.call(null, 0), TypeError); assert.throws(() => trimLeft.call(undefined, 0), TypeError); } }); QUnit.test('String#trimStart', assert => { const { trimStart } = String.prototype; assert.isFunction(trimStart); assert.arity(trimStart, 0); assert.name(trimStart, 'trimStart'); assert.looksNative(trimStart); assert.nonEnumerable(String.prototype, 'trimStart'); assert.same(trimStart, String.prototype.trimLeft, 'same #trimLeft'); assert.strictEqual(' \n q w e \n '.trimStart(), 'q w e \n ', 'removes whitespaces at left side of string'); assert.strictEqual(WHITESPACES.trimStart(), '', 'removes all whitespaces'); assert.strictEqual('\u200B\u0085'.trimStart(), '\u200B\u0085', "shouldn't remove this symbols"); if (STRICT) { assert.throws(() => trimStart.call(null, 0), TypeError); assert.throws(() => trimStart.call(undefined, 0), TypeError); } }); core-js-3.6.1/tests/tests/es.string.trim.js000066400000000000000000000013151360057567700206330ustar00rootroot00000000000000import { STRICT, WHITESPACES } from '../helpers/constants'; QUnit.test('String#trim', assert => { const { trim } = String.prototype; assert.isFunction(''.trim); assert.arity(trim, 0); assert.name(trim, 'trim'); assert.looksNative(trim); assert.nonEnumerable(String.prototype, 'trim'); assert.strictEqual(' \n q w e \n '.trim(), 'q w e', 'removes whitespaces at left & right side of string'); assert.strictEqual(WHITESPACES.trim(), '', 'removes all whitespaces'); assert.strictEqual('\u200B\u0085'.trim(), '\u200B\u0085', "shouldn't remove this symbols"); if (STRICT) { assert.throws(() => trim.call(null, 0), TypeError); assert.throws(() => trim.call(undefined, 0), TypeError); } }); core-js-3.6.1/tests/tests/es.symbol.async-iterator.js000066400000000000000000000011261360057567700226230ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Symbol.asyncIterator', assert => { assert.ok('asyncIterator' in Symbol, 'Symbol.asyncIterator available'); assert.nonEnumerable(Symbol, 'asyncIterator'); assert.ok(Object(Symbol.asyncIterator) instanceof Symbol, 'Symbol.asyncIterator is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'asyncIterator'); assert.ok(!descriptor.enumerble, 'non-enumerable'); assert.ok(!descriptor.writable, 'non-writable'); assert.ok(!descriptor.configurable, 'non-configurable'); } }); core-js-3.6.1/tests/tests/es.symbol.description.js000066400000000000000000000023551360057567700222070ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Symbol#description', assert => { assert.same(Symbol('foo').description, 'foo'); assert.same(Symbol('').description, ''); assert.same(Symbol(')').description, ')'); assert.same(Symbol({}).description, '[object Object]'); assert.same(Symbol(null).description, 'null'); assert.same(Symbol(undefined).description, undefined); assert.same(Symbol().description, undefined); assert.same(Object(Symbol('foo')).description, 'foo'); assert.same(Object(Symbol()).description, undefined); if (DESCRIPTORS) { assert.ok(!Object.prototype.hasOwnProperty.call(Symbol('foo'), 'description')); const descriptor = Object.getOwnPropertyDescriptor(Symbol.prototype, 'description'); assert.same(descriptor.enumerable, false); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); } if (typeof Symbol() == 'symbol') { assert.same(Symbol('foo').toString(), 'Symbol(foo)'); assert.same(String(Symbol('foo')), 'Symbol(foo)'); assert.same(Symbol('').toString(), 'Symbol()'); assert.same(String(Symbol('')), 'Symbol()'); assert.same(Symbol().toString(), 'Symbol()'); assert.same(String(Symbol()), 'Symbol()'); } }); core-js-3.6.1/tests/tests/es.symbol.js000066400000000000000000000242741360057567700176710ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants'; const { defineProperty, defineProperties, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, keys, create, } = Object; const { ownKeys } = GLOBAL.Reflect || {}; QUnit.test('Symbol', assert => { assert.isFunction(Symbol); if (NATIVE) assert.strictEqual(Symbol.length, 0, 'arity is 0'); assert.name(Symbol, 'Symbol'); assert.looksNative(Symbol); const symbol1 = Symbol('symbol'); const symbol2 = Symbol('symbol'); assert.ok(symbol1 !== symbol2, 'Symbol("symbol") !== Symbol("symbol")'); const object = {}; object[symbol1] = 42; assert.ok(object[symbol1] === 42, 'Symbol() work as key'); assert.ok(object[symbol2] !== 42, 'Various symbols from one description are various keys'); if (DESCRIPTORS) { let count = 0; // eslint-disable-next-line no-unused-vars for (const key in object) count++; assert.ok(count === 0, 'object[Symbol()] is not enumerable'); } }); QUnit.test('Well-known Symbols', assert => { const wks = [ 'hasInstance', 'isConcatSpreadable', 'iterator', 'match', 'matchAll', 'replace', 'search', 'species', 'split', 'toPrimitive', 'toStringTag', 'unscopables', ]; for (const name of wks) { assert.ok(name in Symbol, `Symbol.${ name } available`); assert.ok(Object(Symbol[name]) instanceof Symbol, `Symbol.${ name } is symbol`); if (DESCRIPTORS) { const descriptor = getOwnPropertyDescriptor(Symbol, name); assert.ok(!descriptor.enumerble, 'non-enumerable'); assert.ok(!descriptor.writable, 'non-writable'); assert.ok(!descriptor.configurable, 'non-configurable'); } } }); QUnit.test('Global symbol registry', assert => { assert.isFunction(Symbol.for, 'Symbol.for is function'); assert.nonEnumerable(Symbol, 'for'); assert.strictEqual(Symbol.for.length, 1, 'Symbol.for arity is 1'); if (NATIVE) assert.strictEqual(Symbol.for.name, 'for', 'Symbol.for.name is "for"'); assert.looksNative(Symbol.for, 'Symbol.for looks like native'); assert.isFunction(Symbol.keyFor, 'Symbol.keyFor is function'); assert.nonEnumerable(Symbol, 'keyFor'); assert.strictEqual(Symbol.keyFor.length, 1, 'Symbol.keyFor arity is 1'); assert.strictEqual(Symbol.keyFor.name, 'keyFor', 'Symbol.keyFor.name is "keyFor"'); assert.looksNative(Symbol.keyFor, 'Symbol.keyFor looks like native'); const symbol = Symbol.for('foo'); assert.strictEqual(Symbol.for('foo'), symbol); assert.strictEqual(Symbol.keyFor(symbol), 'foo'); assert.throws(() => Symbol.keyFor('foo'), 'throws on non-symbol'); }); QUnit.test('Symbol#@@toPrimitive', assert => { const symbol = Symbol(); assert.isFunction(Symbol.prototype[Symbol.toPrimitive]); assert.same(symbol, symbol[Symbol.toPrimitive](), 'works'); }); QUnit.test('Symbol#@@toStringTag', assert => { assert.ok(Symbol.prototype[Symbol.toStringTag] === 'Symbol', 'Symbol::@@toStringTag is `Symbol`'); }); QUnit.test('Object.getOwnPropertySymbols', assert => { assert.isFunction(getOwnPropertySymbols); assert.nonEnumerable(Object, 'getOwnPropertySymbols'); assert.strictEqual(getOwnPropertySymbols.length, 1, 'arity is 1'); assert.name(getOwnPropertySymbols, 'getOwnPropertySymbols'); assert.looksNative(getOwnPropertySymbols); const prototype = { q: 1, w: 2, e: 3 }; prototype[Symbol()] = 42; prototype[Symbol()] = 43; assert.deepEqual(getOwnPropertyNames(prototype).sort(), ['e', 'q', 'w']); assert.strictEqual(getOwnPropertySymbols(prototype).length, 2); const object = create(prototype); object.a = 1; object.s = 2; object.d = 3; object[Symbol()] = 44; assert.deepEqual(getOwnPropertyNames(object).sort(), ['a', 'd', 's']); assert.strictEqual(getOwnPropertySymbols(object).length, 1); assert.strictEqual(getOwnPropertySymbols(Object.prototype).length, 0); const primitives = [42, 'foo', false]; for (const value of primitives) { assert.notThrows(() => getOwnPropertySymbols(value), `accept ${ typeof value }`); } }); if (JSON) { QUnit.test('Symbols & JSON.stringify', assert => { assert.strictEqual(JSON.stringify([ 1, Symbol('foo'), false, Symbol('bar'), {}, ]), '[1,null,false,null,{}]', 'array value'); assert.strictEqual(JSON.stringify({ symbol: Symbol('symbol'), }), '{}', 'object value'); if (DESCRIPTORS) { const object = { bar: 2 }; object[Symbol('symbol')] = 1; assert.strictEqual(JSON.stringify(object), '{"bar":2}', 'object key'); } assert.strictEqual(JSON.stringify(Symbol('symbol')), undefined, 'symbol value'); if (typeof Symbol() === 'symbol') { assert.strictEqual(JSON.stringify(Object(Symbol('symbol'))), '{}', 'boxed symbol'); } assert.strictEqual(JSON.stringify(undefined, () => 42), '42', 'replacer works with top-level undefined'); }); } if (DESCRIPTORS) { QUnit.test('Symbols & descriptors', assert => { const d = Symbol('d'); const e = Symbol('e'); const f = Symbol('f'); const i = Symbol('i'); const j = Symbol('j'); const prototype = { g: 'g' }; prototype[i] = 'i'; defineProperty(prototype, 'h', { value: 'h', }); defineProperty(prototype, 'j', { value: 'j', }); const object = create(prototype); object.a = 'a'; object[d] = 'd'; defineProperty(object, 'b', { value: 'b', }); defineProperty(object, 'c', { value: 'c', enumerable: true, }); defineProperty(object, e, { configurable: true, writable: true, value: 'e', }); const descriptor = { value: 'f', enumerable: true, }; defineProperty(object, f, descriptor); assert.strictEqual(descriptor.enumerable, true, 'defineProperty not changes descriptor object'); assert.deepEqual(getOwnPropertyDescriptor(object, 'a'), { configurable: true, writable: true, enumerable: true, value: 'a', }, 'getOwnPropertyDescriptor a'); assert.deepEqual(getOwnPropertyDescriptor(object, 'b'), { configurable: false, writable: false, enumerable: false, value: 'b', }, 'getOwnPropertyDescriptor b'); assert.deepEqual(getOwnPropertyDescriptor(object, 'c'), { configurable: false, writable: false, enumerable: true, value: 'c', }, 'getOwnPropertyDescriptor c'); assert.deepEqual(getOwnPropertyDescriptor(object, d), { configurable: true, writable: true, enumerable: true, value: 'd', }, 'getOwnPropertyDescriptor d'); assert.deepEqual(getOwnPropertyDescriptor(object, e), { configurable: true, writable: true, enumerable: false, value: 'e', }, 'getOwnPropertyDescriptor e'); assert.deepEqual(getOwnPropertyDescriptor(object, f), { configurable: false, writable: false, enumerable: true, value: 'f', }, 'getOwnPropertyDescriptor f'); assert.strictEqual(getOwnPropertyDescriptor(object, 'g'), undefined, 'getOwnPropertyDescriptor g'); assert.strictEqual(getOwnPropertyDescriptor(object, 'h'), undefined, 'getOwnPropertyDescriptor h'); assert.strictEqual(getOwnPropertyDescriptor(object, i), undefined, 'getOwnPropertyDescriptor i'); assert.strictEqual(getOwnPropertyDescriptor(object, j), undefined, 'getOwnPropertyDescriptor j'); assert.strictEqual(getOwnPropertyDescriptor(object, 'k'), undefined, 'getOwnPropertyDescriptor k'); assert.strictEqual(getOwnPropertyDescriptor(Object.prototype, 'toString').enumerable, false, 'getOwnPropertyDescriptor on Object.prototype'); assert.strictEqual(getOwnPropertyDescriptor(Object.prototype, d), undefined, 'getOwnPropertyDescriptor on Object.prototype missed symbol'); assert.strictEqual(keys(object).length, 2, 'Object.keys'); assert.strictEqual(getOwnPropertyNames(object).length, 3, 'Object.getOwnPropertyNames'); assert.strictEqual(getOwnPropertySymbols(object).length, 3, 'Object.getOwnPropertySymbols'); assert.strictEqual(ownKeys(object).length, 6, 'Reflect.ownKeys'); delete object[e]; object[e] = 'e'; assert.deepEqual(getOwnPropertyDescriptor(object, e), { configurable: true, writable: true, enumerable: true, value: 'e', }, 'redefined non-enum key'); }); QUnit.test('Symbols & Object.defineProperties', assert => { const c = Symbol('c'); const d = Symbol('d'); const descriptors = { a: { value: 'a', }, }; descriptors[c] = { value: 'c', }; defineProperty(descriptors, 'b', { value: { value: 'b', }, }); defineProperty(descriptors, d, { value: { value: 'd', }, }); const object = defineProperties({}, descriptors); assert.strictEqual(object.a, 'a', 'a'); assert.strictEqual(object.b, undefined, 'b'); assert.strictEqual(object[c], 'c', 'c'); assert.strictEqual(object[d], undefined, 'd'); }); QUnit.test('Symbols & Object.create', assert => { const c = Symbol('c'); const d = Symbol('d'); const descriptors = { a: { value: 'a', }, }; descriptors[c] = { value: 'c', }; defineProperty(descriptors, 'b', { value: { value: 'b', }, }); defineProperty(descriptors, d, { value: { value: 'd', }, }); const object = create(null, descriptors); assert.strictEqual(object.a, 'a', 'a'); assert.strictEqual(object.b, undefined, 'b'); assert.strictEqual(object[c], 'c', 'c'); assert.strictEqual(object[d], undefined, 'd'); }); const constructors = ['Map', 'Set', 'Promise']; for (const name of constructors) { QUnit.test(`${ name }@@species`, assert => { assert.strictEqual(GLOBAL[name][Symbol.species], GLOBAL[name], `${ name }@@species === ${ name }`); const Subclass = create(GLOBAL[name]); assert.strictEqual(Subclass[Symbol.species], Subclass, `${ name } subclass`); }); } QUnit.test('Array@@species', assert => { assert.strictEqual(Array[Symbol.species], Array, 'Array@@species === Array'); const Subclass = create(Array); assert.strictEqual(Subclass[Symbol.species], Subclass, 'Array subclass'); }); QUnit.test('Symbol.sham flag', assert => { assert.same(Symbol.sham, typeof Symbol() === 'symbol' ? undefined : true); }); } core-js-3.6.1/tests/tests/es.typed-array.constructors.js000066400000000000000000000305611360057567700233700ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE, TYPED_ARRAYS } from '../helpers/constants'; import { createIterable } from '../helpers/helpers'; const Symbol = GLOBAL.Symbol || {}; const { keys, getOwnPropertyDescriptor, getPrototypeOf, defineProperty, assign } = Object; if (DESCRIPTORS) { for (const name in TYPED_ARRAYS) { const bytes = TYPED_ARRAYS[name]; const TypedArray = GLOBAL[name]; QUnit.test(`${ name } constructor`, assert => { assert.isFunction(TypedArray); assert.arity(TypedArray, 3); assert.name(TypedArray, name); // Safari 5 bug if (NATIVE) assert.looksNative(TypedArray); assert.same(TypedArray.BYTES_PER_ELEMENT, bytes, `${ name }.BYTES_PER_ELEMENT`); let array = new TypedArray(4); assert.same(array.BYTES_PER_ELEMENT, bytes, '#BYTES_PER_ELEMENT'); assert.same(array.byteOffset, 0, `${ name }#byteOffset, passed number`); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed number'); assert.arrayEqual(array, [0, 0, 0, 0], 'correct values, passed number'); assert.notThrows(() => { // throws in IE / Edge / FF array = new TypedArray('0x4'); assert.same(array.byteOffset, 0, '#byteOffset, passed string'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed string'); assert.arrayEqual(array, [0, 0, 0, 0], 'correct values, passed string'); return true; }, 'passed string'); assert.notThrows(() => { // throws in IE / Edge / FF array = new TypedArray(true); assert.same(array.byteOffset, 0, '#byteOffset, passed boolean'); assert.same(array.byteLength, 1 * bytes, '#byteLength, passed boolean'); assert.arrayEqual(array, [0], 'correct values, passed boolean'); return true; }, 'passed boolean'); assert.notThrows(() => { array = new TypedArray(); assert.same(array.byteOffset, 0, '#byteOffset, without arguments'); assert.same(array.byteLength, 0, '#byteLength, without arguments'); assert.arrayEqual(array, [], 'correct values, without arguments'); return true; }, 'without arguments'); assert.notThrows(() => { array = new TypedArray(undefined); assert.same(array.byteOffset, 0, '#byteOffset, passed undefined'); assert.same(array.byteLength, 0, '#byteLength, passed undefined'); assert.arrayEqual(array, [], 'correct values, passed undefined'); return true; }, 'passed undefined'); assert.notThrows(() => { array = new TypedArray(-0); assert.same(array.byteOffset, 0, '#byteOffset, passed -0'); assert.same(array.byteLength, 0, '#byteLength, passed -0'); assert.arrayEqual(array, [], 'correct values, passed -0'); return true; }, 'passed -0'); assert.notThrows(() => { array = new TypedArray(NaN); assert.same(array.byteOffset, 0, '#byteOffset, passed NaN'); assert.same(array.byteLength, 0, '#byteLength, passed NaN'); assert.arrayEqual(array, [], 'correct values, passed NaN'); return true; }, 'passed NaN'); assert.notThrows(() => { array = new TypedArray(1.5); assert.same(array.byteOffset, 0, '#byteOffset, passed 1.5'); assert.same(array.byteLength, 1 * bytes, '#byteLength, passed 1.5'); assert.arrayEqual(array, [0], 'correct values, passed 1.5'); return true; }, 'passed 1.5'); if (NATIVE) assert.throws(() => new TypedArray(-1), RangeError, 'throws on -1'); assert.notThrows(() => { array = new TypedArray(null); assert.same(array.byteOffset, 0, '#byteOffset, passed null'); assert.same(array.byteLength, 0, '#byteLength, passed null'); assert.arrayEqual(array, [], 'correct values, passed null'); return true; }, 'passed null'); array = new TypedArray([1, 2, 3, 4]); assert.same(array.byteOffset, 0, '#byteOffset, passed array'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed array'); assert.arrayEqual(array, [1, 2, 3, 4], 'correct values, passed array'); array = new TypedArray({ 0: 1, 1: 2, 2: 3, 3: 4, length: 4, }); assert.same(array.byteOffset, 0, '#byteOffset, passed array-like'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed array-like'); assert.arrayEqual(array, [1, 2, 3, 4], 'correct values, passed array-like'); assert.notThrows(() => { // throws in IE / Edge array = new TypedArray({}); assert.same(array.byteOffset, 0, '#byteOffset, passed empty object (also array-like case)'); assert.same(array.byteLength, 0, '#byteLength, passed empty object (also array-like case)'); assert.arrayEqual(array, [], 'correct values, passed empty object (also array-like case)'); return true; }, 'passed empty object (also array-like case)'); assert.notThrows(() => { array = new TypedArray(createIterable([1, 2, 3, 4])); assert.same(array.byteOffset, 0, '#byteOffset, passed iterable'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed iterable'); assert.arrayEqual(array, [1, 2, 3, 4], 'correct values, passed iterable'); return true; }, 'passed iterable'); array = new TypedArray(new TypedArray([1, 2, 3, 4])); assert.same(array.byteOffset, 0, '#byteOffset, passed typed array'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed typed array'); assert.arrayEqual(array, [1, 2, 3, 4], 'correct values, passed typed array'); const fake = new TypedArray([1, 2, 3, 4]); fake[Symbol.iterator] = function () { return createIterable([4, 3, 2, 1])[Symbol.iterator](); }; array = new TypedArray(fake); assert.same(array.byteOffset, 0, '#byteOffset, passed typed array with custom iterator'); assert.same(array.byteLength, 4 * bytes, '#byteLength, passed typed array with custom iterator'); // https://code.google.com/p/v8/issues/detail?id=4552 assert.arrayEqual(array, [1, 2, 3, 4], 'correct values, passed typed array with custom iterator'); array = new TypedArray(new ArrayBuffer(8)); assert.same(array.byteOffset, 0, '#byteOffset, passed buffer'); assert.same(array.byteLength, 8, '#byteLength, passed buffer'); assert.same(array.length, 8 / bytes, 'correct length, passed buffer'); array = new TypedArray(new ArrayBuffer(16), 8); assert.same(array.byteOffset, 8, '#byteOffset, passed buffer and byteOffset'); assert.same(array.byteLength, 8, '#byteLength, passed buffer and byteOffset'); assert.same(array.length, 8 / bytes, 'correct length, passed buffer and byteOffset'); array = new TypedArray(new ArrayBuffer(24), 8, 8 / bytes); assert.same(array.byteOffset, 8, '#byteOffset, passed buffer, byteOffset and length'); assert.same(array.byteLength, 8, '#byteLength, passed buffer, byteOffset and length'); assert.same(array.length, 8 / bytes, 'correct length, passed buffer, byteOffset and length'); array = new TypedArray(new ArrayBuffer(8), undefined); assert.same(array.byteOffset, 0, '#byteOffset, passed buffer and undefined'); assert.same(array.byteLength, 8, '#byteLength, passed buffer and undefined'); assert.same(array.length, 8 / bytes, 'correct length, passed buffer and undefined'); array = new TypedArray(new ArrayBuffer(16), 8, undefined); assert.same(array.byteOffset, 8, '#byteOffset, passed buffer, byteOffset and undefined'); assert.same(array.byteLength, 8, '#byteLength, passed buffer, byteOffset and undefined'); assert.same(array.length, 8 / bytes, 'correct length, passed buffer, byteOffset and undefined'); array = new TypedArray(new ArrayBuffer(8), 8); assert.same(array.byteOffset, 8, '#byteOffset, passed buffer and byteOffset with buffer length'); assert.same(array.byteLength, 0, '#byteLength, passed buffer and byteOffset with buffer length'); assert.arrayEqual(array, [], 'correct values, passed buffer and byteOffset with buffer length'); // FF bug - TypeError instead of RangeError assert.throws(() => new TypedArray(new ArrayBuffer(8), -1), RangeError, 'If offset < 0, throw a RangeError exception'); if (bytes !== 1) { // FF bug - TypeError instead of RangeError assert.throws(() => new TypedArray(new ArrayBuffer(8), 3), RangeError, 'If offset modulo elementSize ≠ 0, throw a RangeError exception'); } if (NATIVE) { if (bytes !== 1) { // fails in Opera 12 assert.throws(() => new TypedArray(new ArrayBuffer(9)), RangeError, 'If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception'); } assert.throws(() => new TypedArray(new ArrayBuffer(8), 16), RangeError, 'If newByteLength < 0, throw a RangeError exception'); assert.throws(() => new TypedArray(new ArrayBuffer(24), 8, 24), RangeError, 'If offset+newByteLength > bufferByteLength, throw a RangeError exception'); } else { // FF bug - TypeError instead of RangeError assert.throws(() => new TypedArray(new ArrayBuffer(8), 16), 'If newByteLength < 0, throw a RangeError exception'); assert.throws(() => new TypedArray(new ArrayBuffer(24), 8, 24), 'If offset+newByteLength > bufferByteLength, throw a RangeError exception'); } assert.throws(() => TypedArray(1), TypeError, 'throws without `new`'); assert.same(TypedArray[Symbol.species], TypedArray, '@@species'); }); QUnit.test(`${ name } descriptors`, assert => { const array = new TypedArray(2); const descriptor = getOwnPropertyDescriptor(array, 0); const base = NATIVE ? { writable: true, enumerable: true, configurable: false, } : { writable: descriptor.writable, enumerable: true, configurable: descriptor.configurable, }; assert.deepEqual(getOwnPropertyDescriptor(array, 0), assign({ value: 0, }, base), 'Object.getOwnPropertyDescriptor'); if (NATIVE) { // fails in old WebKit assert.arrayEqual(keys(array), ['0', '1'], 'Object.keys'); const results = []; for (const key in array) results.push(key); // fails in old WebKit assert.arrayEqual(results, ['0', '1'], 'for-in'); defineProperty(array, 0, { value: 1, writable: true, enumerable: true, configurable: false, }); array[0] = array[1] = 2.5; assert.deepEqual(getOwnPropertyDescriptor(array, 0), assign({ value: array[1], }, base), 'Object.defineProperty, valid descriptor #1'); defineProperty(array, 0, { value: 1, }); array[0] = array[1] = 3.5; assert.deepEqual(getOwnPropertyDescriptor(array, 0), assign({ value: array[1], }, base), 'Object.defineProperty, valid descriptor #2'); assert.throws(() => defineProperty(array, 0, { value: 2, writable: false, enumerable: true, configurable: false, }), 'Object.defineProperty, invalid descriptor #1'); assert.throws(() => defineProperty(array, 0, { value: 2, writable: true, enumerable: false, configurable: false, }), 'Object.defineProperty, invalid descriptor #2'); assert.throws(() => defineProperty(array, 0, { get() { return 2; }, }), 'Object.defineProperty, invalid descriptor #3'); } assert.throws(() => defineProperty(array, 0, { value: 2, get() { return 2; }, }), 'Object.defineProperty, invalid descriptor #4'); }); QUnit.test(`${ name } @@toStringTag`, assert => { const TypedArrayPrototype = getPrototypeOf(TypedArray.prototype); const descriptor = getOwnPropertyDescriptor(TypedArrayPrototype, Symbol.toStringTag); const getter = descriptor.get; assert.isFunction(getter); assert.same(getter.call(new Int8Array(1)), 'Int8Array'); assert.same(getter.call(new TypedArray(1)), name); assert.same(getter.call([]), undefined); assert.same(getter.call({}), undefined); assert.same(getter.call(), undefined); }); QUnit.test(`${ name }.sham`, assert => { if (TypedArray.sham) assert.ok(true, `${ name }.sham flag exists`); else assert.ok(true, `${ name }.sham flag missed`); }); } } core-js-3.6.1/tests/tests/es.typed-array.copy-within.js000066400000000000000000000036721360057567700230750ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.copyWithin', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { copyWithin } = TypedArray.prototype; assert.isFunction(copyWithin, `${ name }::copyWithin is function`); assert.arity(copyWithin, 2, `${ name }::copyWithin arity is 2`); assert.name(copyWithin, 'copyWithin', `${ name }::copyWithin name is 'copyWithin'`); assert.looksNative(copyWithin, `${ name }::copyWithin looks native`); const array = new TypedArray(5); assert.strictEqual(array.copyWithin(0), array, 'return this'); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(0, 3), [4, 5, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(1, 3), [1, 4, 5, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(1, 2), [1, 3, 4, 5, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(2, 2), [1, 2, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(0, 3, 4), [4, 2, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(1, 3, 4), [1, 4, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(1, 2, 4), [1, 3, 4, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(0, -2), [4, 5, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(0, -2, -1), [4, 2, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(-4, -3, -2), [1, 3, 3, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(-4, -3, -1), [1, 3, 4, 4, 5]); assert.arrayEqual(new TypedArray([1, 2, 3, 4, 5]).copyWithin(-4, -3), [1, 3, 4, 5, 5]); assert.throws(() => copyWithin.call([0], 1), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.every.js000066400000000000000000000033601360057567700217470ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.every', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { every } = TypedArray.prototype; assert.isFunction(every, `${ name }::every is function`); assert.arity(every, 1, `${ name }::every arity is 1`); assert.name(every, 'every', `${ name }::every name is 'every'`); assert.looksNative(every, `${ name }::every looks native`); const array = new TypedArray([1]); const context = {}; array.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(new TypedArray([1, 2, 3]).every(it => typeof it === 'number')); assert.ok(new TypedArray([1, 2, 3]).every(it => it < 4)); assert.ok(!new TypedArray([1, 2, 3]).every(it => it < 3)); assert.ok(!new TypedArray([1, 2, 3]).every(it => typeof it === 'string')); assert.ok(new TypedArray([1, 2, 3]).every(function () { return +this === 1; }, 1)); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).every((value, key) => { values += value; keys += key; return true; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => every.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.fill.js000066400000000000000000000023021360057567700215360ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.fill', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { fill } = TypedArray.prototype; assert.isFunction(fill, `${ name }::fill is function`); assert.arity(fill, 1, `${ name }::fill arity is 1`); assert.name(fill, 'fill', `${ name }::fill name is 'fill'`); assert.looksNative(fill, `${ name }::fill looks native`); const array = new TypedArray(5); assert.strictEqual(array.fill(5), array, 'return this'); assert.arrayEqual(new TypedArray(5).fill(5), [5, 5, 5, 5, 5], 'basic'); assert.arrayEqual(new TypedArray(5).fill(5, 1), [0, 5, 5, 5, 5], 'start index'); assert.arrayEqual(new TypedArray(5).fill(5, 1, 4), [0, 5, 5, 5, 0], 'end index'); assert.arrayEqual(new TypedArray(5).fill(5, 6, 1), [0, 0, 0, 0, 0], 'start > end'); assert.arrayEqual(new TypedArray(5).fill(5, -3, 4), [0, 0, 5, 5, 0], 'negative start index'); assert.throws(() => fill.call([0], 1), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.filter.js000066400000000000000000000031051360057567700220770ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.filter', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { filter } = TypedArray.prototype; assert.isFunction(filter, `${ name }::filter is function`); assert.arity(filter, 1, `${ name }::filter arity is 1`); assert.name(filter, 'filter', `${ name }::filter name is 'filter'`); assert.looksNative(filter, `${ name }::filter looks native`); const array = new TypedArray([1]); const context = {}; array.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); const instance = new TypedArray([1, 2, 3, 4, 5, 6, 7, 8, 9]).filter(it => it % 2); assert.ok(instance instanceof TypedArray, 'correct instance'); assert.arrayEqual(instance, [1, 3, 5, 7, 9], 'works'); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).filter((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => filter.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.find-index.js000066400000000000000000000030611360057567700226400ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.findIndex', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { findIndex } = TypedArray.prototype; assert.isFunction(findIndex, `${ name }::findIndex is function`); assert.arity(findIndex, 1, `${ name }::findIndex arity is 1`); assert.name(findIndex, 'findIndex', `${ name }::findIndex name is 'findIndex'`); assert.looksNative(findIndex, `${ name }::findIndex looks native`); const array = new TypedArray([1]); const context = {}; array.findIndex(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new TypedArray([1, 2, 3]).findIndex(it => !(it % 2)), 1); assert.same(new TypedArray([1, 2, 3]).findIndex(it => it === 4), -1); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).findIndex((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => findIndex.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.find.js000066400000000000000000000027431360057567700215410ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.find', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { find } = TypedArray.prototype; assert.isFunction(find, `${ name }::find is function`); assert.arity(find, 1, `${ name }::find arity is 1`); assert.name(find, 'find', `${ name }::find name is 'find'`); assert.looksNative(find, `${ name }::find looks native`); const array = new TypedArray([1]); const context = {}; array.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new TypedArray([1, 2, 3]).find(it => !(it % 2)), 2); assert.same(new TypedArray([1, 2, 3]).find(it => it === 4), undefined); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).find((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => find.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.for-each.js000066400000000000000000000027141360057567700223030ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.forEach', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { forEach } = TypedArray.prototype; assert.isFunction(forEach, `${ name }::forEach is function`); assert.arity(forEach, 1, `${ name }::forEach arity is 1`); assert.name(forEach, 'forEach', `${ name }::forEach name is 'forEach'`); assert.looksNative(forEach, `${ name }::forEach looks native`); const array = new TypedArray([1]); const context = {}; array.forEach(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new TypedArray([1, 2, 3]).forEach(it => it % 2), undefined); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).forEach((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => forEach.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.from.js000066400000000000000000000041121360057567700215540ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE, TYPED_ARRAYS } from '../helpers/constants'; import { createIterable } from '../helpers/helpers'; if (DESCRIPTORS) QUnit.test('%TypedArray%.from', assert => { // we can't implement %TypedArray% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; assert.isFunction(TypedArray.from, `${ name }.from is function`); assert.arity(TypedArray.from, 1, `${ name }.from arity is 1`); assert.name(TypedArray.from, 'from', `${ name }.from name is 'from'`); assert.looksNative(TypedArray.from, `${ name }.from looks native`); let instance = TypedArray.from([1, 2, 3]); assert.ok(instance instanceof TypedArray, 'correct instance with array'); assert.arrayEqual(instance, [1, 2, 3], 'correct elements with array'); instance = TypedArray.from({ 0: 1, 1: 2, 2: 3, length: 3, }); assert.ok(instance instanceof TypedArray, 'correct instance with array-like'); assert.arrayEqual(instance, [1, 2, 3], 'correct elements with array-like'); instance = TypedArray.from(createIterable([1, 2, 3])); assert.ok(instance instanceof TypedArray, 'correct instance with iterable'); assert.arrayEqual(instance, [1, 2, 3], 'correct elements with iterable'); assert.arrayEqual(TypedArray.from([1, 2, 3], it => it * it), [1, 4, 9], 'accept callback'); const context = {}; TypedArray.from([1], function (value, key) { assert.same(arguments.length, 2, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.throws(() => TypedArray.from.call(undefined, []), "isn't generic #1"); if (NATIVE) { assert.throws(() => TypedArray.from.call(Array, []), "isn't generic #2"); assert.notThrows(() => TypedArray.from({ length: -1, 0: 1, }, () => { throw new Error(); }), 'uses ToLength'); } } }); core-js-3.6.1/tests/tests/es.typed-array.includes.js000066400000000000000000000020511360057567700224170ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.includes', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { includes } = TypedArray.prototype; assert.isFunction(includes, `${ name }::includes is function`); assert.arity(includes, 1, `${ name }::includes arity is 1`); assert.name(includes, 'includes', `${ name }::includes name is 'includes'`); assert.looksNative(includes, `${ name }::includes looks native`); assert.same(new TypedArray([1, 1, 1]).includes(1), true); assert.same(new TypedArray([1, 2, 3]).includes(1, 1), false); assert.same(new TypedArray([1, 2, 3]).includes(2, 1), true); assert.same(new TypedArray([1, 2, 3]).includes(2, -1), false); assert.same(new TypedArray([1, 2, 3]).includes(2, -2), true); assert.throws(() => includes.call([1], 1), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.index-of.js000066400000000000000000000020101360057567700223150ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.indexOf', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { indexOf } = TypedArray.prototype; assert.isFunction(indexOf, `${ name }::indexOf is function`); assert.arity(indexOf, 1, `${ name }::indexOf arity is 1`); assert.name(indexOf, 'indexOf', `${ name }::indexOf name is 'indexOf'`); assert.looksNative(indexOf, `${ name }::indexOf looks native`); assert.same(new TypedArray([1, 1, 1]).indexOf(1), 0); assert.same(new TypedArray([1, 2, 3]).indexOf(1, 1), -1); assert.same(new TypedArray([1, 2, 3]).indexOf(2, 1), 1); assert.same(new TypedArray([1, 2, 3]).indexOf(2, -1), -1); assert.same(new TypedArray([1, 2, 3]).indexOf(2, -2), 1); assert.throws(() => indexOf.call([1], 1), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.iterator.js000066400000000000000000000121361360057567700224470ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE, TYPED_ARRAYS } from '../helpers/constants'; const Symbol = GLOBAL.Symbol || {}; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.keys', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { keys } = TypedArray.prototype; assert.isFunction(keys, `${ name }::keys is function`); assert.arity(keys, 0, `${ name }::keys arity is 0`); assert.name(keys, 'keys', `${ name }::keys name is 'keys'`); assert.looksNative(keys, `${ name }::keys looks native`); const iterator = new TypedArray([1, 2, 3]).keys(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 0, done: false, }, 'step 1'); assert.deepEqual(iterator.next(), { value: 1, done: false, }, 'step 2'); assert.deepEqual(iterator.next(), { value: 2, done: false, }, 'step 3'); assert.deepEqual(iterator.next(), { value: undefined, done: true, }, 'done'); if (NATIVE) assert.throws(() => keys.call([1, 2]), "isn't generic"); } }); if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.values', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { values } = TypedArray.prototype; assert.isFunction(values, `${ name }::values is function`); assert.arity(values, 0, `${ name }::values arity is 0`); assert.name(values, 'values', `${ name }::values name is 'values'`); assert.looksNative(values, `${ name }::values looks native`); const iterator = new TypedArray([1, 2, 3]).values(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 1, done: false, }, 'step 1'); assert.deepEqual(iterator.next(), { value: 2, done: false, }, 'step 2'); assert.deepEqual(iterator.next(), { value: 3, done: false, }, 'step 3'); assert.deepEqual(iterator.next(), { value: undefined, done: true, }, 'done'); if (NATIVE) assert.throws(() => values.call([1, 2]), "isn't generic"); } }); if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.entries', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { entries } = TypedArray.prototype; assert.isFunction(entries, `${ name }::entries is function`); assert.arity(entries, 0, `${ name }::entries arity is 0`); assert.name(entries, 'entries', `${ name }::entries name is 'entries'`); assert.looksNative(entries, `${ name }::entries looks native`); const iterator = new TypedArray([1, 2, 3]).entries(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: [0, 1], done: false, }, 'step 1'); assert.deepEqual(iterator.next(), { value: [1, 2], done: false, }, 'step 2'); assert.deepEqual(iterator.next(), { value: [2, 3], done: false, }, 'step 3'); assert.deepEqual(iterator.next(), { value: undefined, done: true, }, 'done'); if (NATIVE) assert.throws(() => entries.call([1, 2]), "isn't generic"); } }); if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.@@iterator', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; assert.isIterable(TypedArray.prototype, `${ name } is itrable`); assert.arity(TypedArray.prototype[Symbol.iterator], 0, `${ name }::@@iterator arity is 0`); assert.name(TypedArray.prototype[Symbol.iterator], 'values', `${ name }::@@iterator name is 'values'`); assert.looksNative(TypedArray.prototype[Symbol.iterator], `${ name }::@@iterator looks native`); assert.strictEqual(TypedArray.prototype[Symbol.iterator], TypedArray.prototype.values); const iterator = new TypedArray([1, 2, 3])[Symbol.iterator](); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Array Iterator'); assert.deepEqual(iterator.next(), { value: 1, done: false, }, 'step 1'); assert.deepEqual(iterator.next(), { value: 2, done: false, }, 'step 2'); assert.deepEqual(iterator.next(), { value: 3, done: false, }, 'step 3'); assert.deepEqual(iterator.next(), { value: undefined, done: true, }, 'done'); if (NATIVE) assert.throws(() => TypedArray.prototype[Symbol.iterator].call([1, 2]), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.join.js000066400000000000000000000015051360057567700215530ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.join', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { join } = TypedArray.prototype; assert.isFunction(join, `${ name }::join is function`); assert.arity(join, 1, `${ name }::join arity is 1`); assert.name(join, 'join', `${ name }::join name is 'join'`); assert.looksNative(join, `${ name }::join looks native`); assert.same(new TypedArray([1, 2, 3]).join('|'), '1|2|3', 'works #1'); assert.same(new TypedArray([1, 2, 3]).join(), '1,2,3', 'works #2'); assert.throws(() => join.call([1, 2, 3]), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.last-index-of.js000066400000000000000000000021201360057567700232600ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.lastIndexOf', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { lastIndexOf } = TypedArray.prototype; assert.isFunction(lastIndexOf, `${ name }::lastIndexOf is function`); assert.arity(lastIndexOf, 1, `${ name }::lastIndexOf arity is 1`); assert.name(lastIndexOf, 'lastIndexOf', `${ name }::lastIndexOf name is 'lastIndexOf'`); assert.looksNative(lastIndexOf, `${ name }::lastIndexOf looks native`); assert.same(new TypedArray([1, 1, 1]).lastIndexOf(1), 2); assert.same(new TypedArray([1, 2, 3]).lastIndexOf(3, 1), -1); assert.same(new TypedArray([1, 2, 3]).lastIndexOf(2, 1), 1); assert.same(new TypedArray([1, 2, 3]).lastIndexOf(2, -3), -1); assert.same(new TypedArray([1, 2, 3]).lastIndexOf(2, -2), 1); assert.throws(() => lastIndexOf.call([1], 1), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.map.js000066400000000000000000000030121360057567700213640ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.map', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { map } = TypedArray.prototype; assert.isFunction(map, `${ name }::map is function`); assert.arity(map, 1, `${ name }::map arity is 1`); assert.name(map, 'map', `${ name }::map name is 'map'`); assert.looksNative(map, `${ name }::map looks native`); const array = new TypedArray([1]); const context = {}; array.map(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); const instance = new TypedArray([1, 2, 3, 4, 5]).map(it => it * 2); assert.ok(instance instanceof TypedArray, 'correct instance'); assert.arrayEqual(instance, [2, 4, 6, 8, 10], 'works'); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).map((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => map.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.of.js000066400000000000000000000025151360057567700212220ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArray%.of', assert => { // we can't implement %TypedArray% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; assert.isFunction(TypedArray.of, `${ name }.of is function`); assert.arity(TypedArray.of, 0, `${ name }.of arity is 0`); assert.name(TypedArray.of, 'of', `${ name }.of name is 'of'`); assert.looksNative(TypedArray.of, `${ name }.of looks native`); let instance = TypedArray.of(); assert.ok(instance instanceof TypedArray, 'correct instance with 0 arguments'); assert.arrayEqual(instance, [], 'correct elements with 0 arguments'); instance = TypedArray.of(1); assert.ok(instance instanceof TypedArray, 'correct instance with 1 argument'); assert.arrayEqual(instance, [1], 'correct elements with 1 argument'); instance = TypedArray.of(1, 2, 3); assert.ok(instance instanceof TypedArray, 'correct instance with several arguments'); assert.arrayEqual(instance, [1, 2, 3], 'correct elements with several arguments'); assert.throws(() => TypedArray.of.call(undefined, 1), "isn't generic #1"); if (NATIVE) assert.throws(() => TypedArray.of.call(Array, 1), "isn't generic #2"); } }); core-js-3.6.1/tests/tests/es.typed-array.reduce-right.js000066400000000000000000000040061360057567700231750ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.reduceRight', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { reduceRight } = TypedArray.prototype; assert.isFunction(reduceRight, `${ name }::reduceRight is function`); assert.arity(reduceRight, 1, `${ name }::reduceRight arity is 1`); assert.name(reduceRight, 'reduceRight', `${ name }::reduceRight name is 'reduceRight'`); assert.looksNative(reduceRight, `${ name }::reduceRight looks native`); const array = new TypedArray([1]); const accumulator = {}; array.reduceRight(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same(new TypedArray([1, 2, 3]).reduceRight(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new TypedArray([1, 2]).reduceRight((memo, value, key) => { assert.same(memo, 2, 'correct default accumulator'); assert.same(value, 1, 'correct start value without initial accumulator'); assert.same(key, 0, 'correct start index without initial accumulator'); }); assert.same(new TypedArray([1, 2, 3]).reduceRight((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).reduceRight((memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '321', 'correct order #1'); assert.same(keys, '210', 'correct order #2'); assert.throws(() => reduceRight.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.reduce.js000066400000000000000000000036541360057567700220720ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.reduce', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { reduce } = TypedArray.prototype; assert.isFunction(reduce, `${ name }::reduce is function`); assert.arity(reduce, 1, `${ name }::reduce arity is 1`); assert.name(reduce, 'reduce', `${ name }::reduce name is 'reduce'`); assert.looksNative(reduce, `${ name }::reduce looks native`); const array = new TypedArray([1]); const accumulator = {}; array.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); }, accumulator); assert.same(new TypedArray([1, 2, 3]).reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new TypedArray([1, 2]).reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 1, 'correct start index without initial accumulator'); }); assert.same(new TypedArray([1, 2, 3]).reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).reduce((memo, value, key) => { values += value; keys += key; }, 0); assert.same(values, '123', 'correct order #1'); assert.same(keys, '012', 'correct order #2'); assert.throws(() => reduce.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.reverse.js000066400000000000000000000017441360057567700222740ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.reverse', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { reverse } = TypedArray.prototype; assert.isFunction(reverse, `${ name }::reverse is function`); assert.arity(reverse, 0, `${ name }::reverse arity is 0`); assert.name(reverse, 'reverse', `${ name }::reverse name is 'reverse'`); assert.looksNative(reverse, `${ name }::reverse looks native`); const array = new TypedArray([1, 2]); assert.same(array.reverse(), array, 'return this'); assert.arrayEqual(new TypedArray([1, 2, 3, 4]).reverse(), [4, 3, 2, 1], 'works #1'); assert.arrayEqual(new TypedArray([1, 2, 3]).reverse(), [3, 2, 1], 'works #2'); assert.throws(() => reverse.call([1, 2]), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.set.js000066400000000000000000000027041360057567700214110ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.set', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { set } = TypedArray.prototype; assert.isFunction(set, `${ name }::set is function`); if (NATIVE) assert.arity(set, 1, `${ name }::set arity is 1`); assert.name(set, 'set', `${ name }::set name is 'set'`); assert.looksNative(set, `${ name }::set looks native`); assert.same(new TypedArray(1).set([1]), undefined, 'void'); const array1 = new TypedArray([1, 2, 3, 4, 5]); const array2 = new TypedArray(5); array2.set(array1); assert.arrayEqual(array2, [1, 2, 3, 4, 5]); assert.throws(() => array2.set(array1, 1)); assert.throws(() => array2.set(array1, -1)); array2.set(new TypedArray([99, 98]), 2); assert.arrayEqual(array2, [1, 2, 99, 98, 5]); array2.set(new TypedArray([99, 98, 97]), 2); assert.arrayEqual(array2, [1, 2, 99, 98, 97]); assert.throws(() => array2.set(new TypedArray([99, 98, 97, 96]), 2)); assert.throws(() => array2.set([101, 102, 103, 104], 4)); const array3 = new TypedArray(2); array3.set({ length: 2, 0: 1, 1: 2 }); assert.arrayEqual(array3, [1, 2]); assert.throws(() => set.call([1, 2, 3], [1]), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.slice.js000066400000000000000000000023661360057567700217210ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.slice', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { slice } = TypedArray.prototype; assert.isFunction(slice, `${ name }::slice is function`); assert.arity(slice, 2, `${ name }::slice arity is 0`); assert.name(slice, 'slice', `${ name }::slice name is 'slice'`); assert.looksNative(slice, `${ name }::slice looks native`); const array = new TypedArray([1, 2, 3, 4, 5]); assert.ok(array.slice() !== array, 'returns new array'); assert.ok(array.slice() instanceof TypedArray, 'correct instance'); assert.ok(array.slice().buffer !== array.buffer, 'with new buffer'); assert.arrayEqual(array.slice(), array); assert.arrayEqual(array.slice(1, 3), [2, 3]); assert.arrayEqual(array.slice(1, undefined), [2, 3, 4, 5]); assert.arrayEqual(array.slice(1, -1), [2, 3, 4]); assert.arrayEqual(array.slice(-2, -1), [4]); assert.arrayEqual(array.slice(-2, -3), []); assert.throws(() => slice.call([1, 2], 1), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.some.js000066400000000000000000000033111360057567700215540ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.some', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { some } = TypedArray.prototype; assert.isFunction(some, `${ name }::some is function`); assert.arity(some, 1, `${ name }::some arity is 1`); assert.name(some, 'some', `${ name }::some name is 'some'`); assert.looksNative(some, `${ name }::some looks native`); const array = new TypedArray([1]); const context = {}; array.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 0, 'correct index in callback'); assert.same(that, array, 'correct link to array in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(new TypedArray([1, 2, 3]).some(it => typeof it === 'number')); assert.ok(new TypedArray([1, 2, 3]).some(it => it < 3)); assert.ok(!new TypedArray([1, 2, 3]).some(it => it < 0)); assert.ok(!new TypedArray([1, 2, 3]).some(it => typeof it === 'string')); assert.ok(new TypedArray([1, 2, 3]).some(function () { return +this === 1; }, 1)); let values = ''; let keys = ''; new TypedArray([1, 2, 3]).some((value, key) => { values += value; keys += key; }); assert.same(values, '123'); assert.same(keys, '012'); assert.throws(() => some.call([0], () => { /* empty */ }), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.subarray.js000066400000000000000000000030651360057567700224470ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.subarray', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { subarray } = TypedArray.prototype; assert.isFunction(subarray, `${ name }::subarray is function`); if (NATIVE) assert.arity(subarray, 2, `${ name }::subarray arity is 2`); assert.name(subarray, 'subarray', `${ name }::subarray name is 'subarray'`); assert.looksNative(subarray, `${ name }::subarray looks native`); const array1 = new TypedArray([1, 2, 3, 4, 5]); const array2 = array1.subarray(3); assert.ok(array1 !== array2, 'creates new array'); assert.ok(array2 instanceof TypedArray, `instance ${ name }`); assert.same(array1.buffer, array2.buffer, 'with the same buffer'); assert.arrayEqual(array2, [4, 5]); assert.arrayEqual(array1.subarray(1, 3), [2, 3]); assert.arrayEqual(array1.subarray(-3), [3, 4, 5]); assert.arrayEqual(array1.subarray(-3, -1), [3, 4]); assert.arrayEqual(array1.subarray(3, 2), []); assert.arrayEqual(array1.subarray(-2, -3), []); assert.arrayEqual(array1.subarray(4, 1), []); assert.arrayEqual(array1.subarray(-1, -4), []); assert.arrayEqual(array1.subarray(1).subarray(1), [3, 4, 5]); assert.arrayEqual(array1.subarray(1, 4).subarray(1, 2), [3]); assert.throws(() => subarray.call([1, 2, 3], 1), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.to-locale-string.js000066400000000000000000000016261360057567700240030ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.toLocaleString', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { toLocaleString } = TypedArray.prototype; assert.isFunction(toLocaleString, `${ name }::toLocaleString is function`); assert.arity(toLocaleString, 0, `${ name }::toLocaleString arity is 0`); assert.name(toLocaleString, 'toLocaleString', `${ name }::toLocaleString name is 'toLocaleString'`); assert.looksNative(toLocaleString, `${ name }::toLocaleString looks native`); assert.same(new TypedArray([1, 2, 3]).toLocaleString(), [1, 2, 3].toLocaleString(), 'works'); assert.throws(() => toLocaleString.call([1, 2, 3]), "isn't generic"); } }); core-js-3.6.1/tests/tests/es.typed-array.to-string.js000066400000000000000000000014521360057567700225430ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, TYPED_ARRAYS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.toString', assert => { // we can't implement %TypedArrayPrototype% in all engines, so run all tests for each typed array constructor for (const name in TYPED_ARRAYS) { const TypedArray = GLOBAL[name]; const { toString } = TypedArray.prototype; assert.isFunction(toString, `${ name }::toString is function`); assert.arity(toString, 0, `${ name }::toString arity is 0`); assert.name(toString, 'toString', `${ name }::toString name is 'toString'`); assert.looksNative(toString, `${ name }::toString looks native`); assert.same(new TypedArray([1, 2, 3]).toString(), '1,2,3', 'works'); assert.same(toString.call([1, 2, 3]), '1,2,3', 'generic'); } }); core-js-3.6.1/tests/tests/es.typed.conversions.float32.js000066400000000000000000000074741360057567700233340ustar00rootroot00000000000000import { DESCRIPTORS, LITTLE_ENDIAN } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('Float32 conversions', assert => { const float32array = new Float32Array(1); const uint8array = new Uint8Array(float32array.buffer); const dataview = new DataView(float32array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0, 0, 0, 0]], [-0, -0, [0, 0, 0, 128]], [1, 1, [0, 0, 128, 63]], [-1, -1, [0, 0, 128, 191]], [1.1, 1.100000023841858, [205, 204, 140, 63]], [-1.1, -1.100000023841858, [205, 204, 140, 191]], [1.9, 1.899999976158142, [51, 51, 243, 63]], [-1.9, -1.899999976158142, [51, 51, 243, 191]], [127, 127, [0, 0, 254, 66]], [-127, -127, [0, 0, 254, 194]], [128, 128, [0, 0, 0, 67]], [-128, -128, [0, 0, 0, 195]], [255, 255, [0, 0, 127, 67]], [-255, -255, [0, 0, 127, 195]], [255.1, 255.10000610351562, [154, 25, 127, 67]], [255.9, 255.89999389648438, [102, 230, 127, 67]], [256, 256, [0, 0, 128, 67]], [32767, 32767, [0, 254, 255, 70]], [-32767, -32767, [0, 254, 255, 198]], [32768, 32768, [0, 0, 0, 71]], [-32768, -32768, [0, 0, 0, 199]], [65535, 65535, [0, 255, 127, 71]], [65536, 65536, [0, 0, 128, 71]], [65537, 65537, [128, 0, 128, 71]], [65536.54321, 65536.546875, [70, 0, 128, 71]], [-65536.54321, -65536.546875, [70, 0, 128, 199]], [2147483647, 2147483648, [0, 0, 0, 79]], [-2147483647, -2147483648, [0, 0, 0, 207]], [2147483648, 2147483648, [0, 0, 0, 79]], [-2147483648, -2147483648, [0, 0, 0, 207]], [2147483649, 2147483648, [0, 0, 0, 79]], [-2147483649, -2147483648, [0, 0, 0, 207]], [4294967295, 4294967296, [0, 0, 128, 79]], [4294967296, 4294967296, [0, 0, 128, 79]], [4294967297, 4294967296, [0, 0, 128, 79]], [9007199254740991, 9007199254740992, [0, 0, 0, 90]], [-9007199254740991, -9007199254740992, [0, 0, 0, 218]], [9007199254740992, 9007199254740992, [0, 0, 0, 90]], [-9007199254740992, -9007199254740992, [0, 0, 0, 218]], [9007199254740994, 9007199254740992, [0, 0, 0, 90]], [-9007199254740994, -9007199254740992, [0, 0, 0, 218]], [Infinity, Infinity, [0, 0, 128, 127]], [-Infinity, -Infinity, [0, 0, 128, 255]], [1.7976931348623157e+308, Infinity, [0, 0, 128, 127]], [-1.7976931348623157e+308, -Infinity, [0, 0, 128, 255]], [5e-324, 0, [0, 0, 0, 0]], [-5e-324, -0, [0, 0, 0, 128]], ]; for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; float32array[0] = value; assert.same(float32array[0], conversion, `Float32Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Float32Array ${ toString(value) } -> [${ representation }]`); dataview.setFloat32(0, value); assert.arrayEqual(uint8array, big, `dataview.setFloat32(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getFloat32(0), conversion, `dataview{${ big }}.getFloat32(0) -> ${ toString(conversion) }`); dataview.setFloat32(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setFloat32(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getFloat32(0, false), conversion, `dataview{${ big }}.getFloat32(0, false) -> ${ toString(conversion) }`); dataview.setFloat32(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setFloat32(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getFloat32(0, true), conversion, `dataview{${ little }}.getFloat32(0, true) -> ${ toString(conversion) }`); } float32array[0] = NaN; assert.same(float32array[0], NaN, 'NaN -> NaN'); }); core-js-3.6.1/tests/tests/es.typed.conversions.float64.js000066400000000000000000000107661360057567700233370ustar00rootroot00000000000000import { DESCRIPTORS, LITTLE_ENDIAN } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('Float64 conversions', assert => { const float64array = new Float64Array(1); const uint8array = new Uint8Array(float64array.buffer); const dataview = new DataView(float64array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0, 0, 0, 0, 0, 0, 0, 0]], [-0, -0, [0, 0, 0, 0, 0, 0, 0, 128]], [1, 1, [0, 0, 0, 0, 0, 0, 240, 63]], [-1, -1, [0, 0, 0, 0, 0, 0, 240, 191]], [1.1, 1.1, [154, 153, 153, 153, 153, 153, 241, 63]], [-1.1, -1.1, [154, 153, 153, 153, 153, 153, 241, 191]], [1.9, 1.9, [102, 102, 102, 102, 102, 102, 254, 63]], [-1.9, -1.9, [102, 102, 102, 102, 102, 102, 254, 191]], [127, 127, [0, 0, 0, 0, 0, 192, 95, 64]], [-127, -127, [0, 0, 0, 0, 0, 192, 95, 192]], [128, 128, [0, 0, 0, 0, 0, 0, 96, 64]], [-128, -128, [0, 0, 0, 0, 0, 0, 96, 192]], [255, 255, [0, 0, 0, 0, 0, 224, 111, 64]], [-255, -255, [0, 0, 0, 0, 0, 224, 111, 192]], [255.1, 255.1, [51, 51, 51, 51, 51, 227, 111, 64]], [255.9, 255.9, [205, 204, 204, 204, 204, 252, 111, 64]], [256, 256, [0, 0, 0, 0, 0, 0, 112, 64]], [32767, 32767, [0, 0, 0, 0, 192, 255, 223, 64]], [-32767, -32767, [0, 0, 0, 0, 192, 255, 223, 192]], [32768, 32768, [0, 0, 0, 0, 0, 0, 224, 64]], [-32768, -32768, [0, 0, 0, 0, 0, 0, 224, 192]], [65535, 65535, [0, 0, 0, 0, 224, 255, 239, 64]], [65536, 65536, [0, 0, 0, 0, 0, 0, 240, 64]], [65537, 65537, [0, 0, 0, 0, 16, 0, 240, 64]], [65536.54321, 65536.54321, [14, 248, 252, 176, 8, 0, 240, 64]], [-65536.54321, -65536.54321, [14, 248, 252, 176, 8, 0, 240, 192]], [2147483647, 2147483647, [0, 0, 192, 255, 255, 255, 223, 65]], [-2147483647, -2147483647, [0, 0, 192, 255, 255, 255, 223, 193]], [2147483648, 2147483648, [0, 0, 0, 0, 0, 0, 224, 65]], [-2147483648, -2147483648, [0, 0, 0, 0, 0, 0, 224, 193]], [2147483649, 2147483649, [0, 0, 32, 0, 0, 0, 224, 65]], [-2147483649, -2147483649, [0, 0, 32, 0, 0, 0, 224, 193]], [4294967295, 4294967295, [0, 0, 224, 255, 255, 255, 239, 65]], [4294967296, 4294967296, [0, 0, 0, 0, 0, 0, 240, 65]], [4294967297, 4294967297, [0, 0, 16, 0, 0, 0, 240, 65]], [9007199254740991, 9007199254740991, [255, 255, 255, 255, 255, 255, 63, 67]], [-9007199254740991, -9007199254740991, [255, 255, 255, 255, 255, 255, 63, 195]], [9007199254740992, 9007199254740992, [0, 0, 0, 0, 0, 0, 64, 67]], [-9007199254740992, -9007199254740992, [0, 0, 0, 0, 0, 0, 64, 195]], [9007199254740994, 9007199254740994, [1, 0, 0, 0, 0, 0, 64, 67]], [-9007199254740994, -9007199254740994, [1, 0, 0, 0, 0, 0, 64, 195]], [Infinity, Infinity, [0, 0, 0, 0, 0, 0, 240, 127]], [-Infinity, -Infinity, [0, 0, 0, 0, 0, 0, 240, 255]], [-1.7976931348623157e+308, -1.7976931348623157e+308, [255, 255, 255, 255, 255, 255, 239, 255]], [1.7976931348623157e+308, 1.7976931348623157e+308, [255, 255, 255, 255, 255, 255, 239, 127]], [5e-324, 5e-324, [1, 0, 0, 0, 0, 0, 0, 0]], [-5e-324, -5e-324, [1, 0, 0, 0, 0, 0, 0, 128]], ]; for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; float64array[0] = value; assert.same(float64array[0], conversion, `Float64Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Float64Array ${ toString(value) } -> [${ representation }]`); dataview.setFloat64(0, value); assert.arrayEqual(uint8array, big, `dataview.setFloat64(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getFloat64(0), conversion, `dataview{${ big }}.getFloat64(0) -> ${ toString(conversion) }`); dataview.setFloat64(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setFloat64(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getFloat64(0, false), conversion, `dataview{${ big }}.getFloat64(0, false) -> ${ toString(conversion) }`); dataview.setFloat64(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setFloat64(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getFloat64(0, true), conversion, `dataview{${ little }}.getFloat64(0, true) -> ${ toString(conversion) }`); } float64array[0] = NaN; assert.same(float64array[0], NaN, 'NaN -> NaN'); }); core-js-3.6.1/tests/tests/es.typed.conversions.int16.js000066400000000000000000000063171360057567700230160ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, LITTLE_ENDIAN, NATIVE } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('Int16 conversions', assert => { const int16array = new Int16Array(1); const uint8array = new Uint8Array(int16array.buffer); const dataview = new DataView(int16array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } let data = [ [0, 0, [0, 0]], [-0, 0, [0, 0]], [1, 1, [1, 0]], [-1, -1, [255, 255]], [1.1, 1, [1, 0]], [-1.1, -1, [255, 255]], [1.9, 1, [1, 0]], [-1.9, -1, [255, 255]], [127, 127, [127, 0]], [-127, -127, [129, 255]], [128, 128, [128, 0]], [-128, -128, [128, 255]], [255, 255, [255, 0]], [-255, -255, [1, 255]], [255.1, 255, [255, 0]], [255.9, 255, [255, 0]], [256, 256, [0, 1]], [32767, 32767, [255, 127]], [-32767, -32767, [1, 128]], [32768, -32768, [0, 128]], [-32768, -32768, [0, 128]], [65535, -1, [255, 255]], [65536, 0, [0, 0]], [65537, 1, [1, 0]], [65536.54321, 0, [0, 0]], [-65536.54321, 0, [0, 0]], [2147483647, -1, [255, 255]], [-2147483647, 1, [1, 0]], [2147483648, 0, [0, 0]], [-2147483648, 0, [0, 0]], [4294967296, 0, [0, 0]], [9007199254740992, 0, [0, 0]], [-9007199254740992, 0, [0, 0]], [Infinity, 0, [0, 0]], [-Infinity, 0, [0, 0]], [-1.7976931348623157e+308, 0, [0, 0]], [1.7976931348623157e+308, 0, [0, 0]], [5e-324, 0, [0, 0]], [-5e-324, 0, [0, 0]], [NaN, 0, [0, 0]], ]; // Android 4.3- bug if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) { data = data.concat([ [2147483649, 1, [1, 0]], [-2147483649, -1, [255, 255]], [4294967295, -1, [255, 255]], [4294967297, 1, [1, 0]], [9007199254740991, -1, [255, 255]], [-9007199254740991, 1, [1, 0]], [9007199254740994, 2, [2, 0]], [-9007199254740994, -2, [254, 255]], ]); } for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; int16array[0] = value; assert.same(int16array[0], conversion, `Int16Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Int16Array ${ toString(value) } -> [${ representation }]`); dataview.setInt16(0, value); assert.arrayEqual(uint8array, big, `dataview.setInt16(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getInt16(0), conversion, `dataview{${ big }}.getInt16(0) -> ${ toString(conversion) }`); dataview.setInt16(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setInt16(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getInt16(0, false), conversion, `dataview{${ big }}.getInt16(0, false) -> ${ toString(conversion) }`); dataview.setInt16(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setInt16(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getInt16(0, true), conversion, `dataview{${ little }}.getInt16(0, true) -> ${ toString(conversion) }`); } }); core-js-3.6.1/tests/tests/es.typed.conversions.int32.js000066400000000000000000000067171360057567700230200ustar00rootroot00000000000000import { DESCRIPTORS, LITTLE_ENDIAN } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('Int32 conversions', assert => { const int32array = new Int32Array(1); const uint8array = new Uint8Array(int32array.buffer); const dataview = new DataView(int32array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0, 0, 0, 0]], [-0, 0, [0, 0, 0, 0]], [1, 1, [1, 0, 0, 0]], [-1, -1, [255, 255, 255, 255]], [1.1, 1, [1, 0, 0, 0]], [-1.1, -1, [255, 255, 255, 255]], [1.9, 1, [1, 0, 0, 0]], [-1.9, -1, [255, 255, 255, 255]], [127, 127, [127, 0, 0, 0]], [-127, -127, [129, 255, 255, 255]], [128, 128, [128, 0, 0, 0]], [-128, -128, [128, 255, 255, 255]], [255, 255, [255, 0, 0, 0]], [-255, -255, [1, 255, 255, 255]], [255.1, 255, [255, 0, 0, 0]], [255.9, 255, [255, 0, 0, 0]], [256, 256, [0, 1, 0, 0]], [32767, 32767, [255, 127, 0, 0]], [-32767, -32767, [1, 128, 255, 255]], [32768, 32768, [0, 128, 0, 0]], [-32768, -32768, [0, 128, 255, 255]], [65535, 65535, [255, 255, 0, 0]], [65536, 65536, [0, 0, 1, 0]], [65537, 65537, [1, 0, 1, 0]], [65536.54321, 65536, [0, 0, 1, 0]], [-65536.54321, -65536, [0, 0, 255, 255]], [2147483647, 2147483647, [255, 255, 255, 127]], [-2147483647, -2147483647, [1, 0, 0, 128]], [2147483648, -2147483648, [0, 0, 0, 128]], [-2147483648, -2147483648, [0, 0, 0, 128]], [2147483649, -2147483647, [1, 0, 0, 128]], [-2147483649, 2147483647, [255, 255, 255, 127]], [4294967295, -1, [255, 255, 255, 255]], [4294967296, 0, [0, 0, 0, 0]], [4294967297, 1, [1, 0, 0, 0]], [9007199254740991, -1, [255, 255, 255, 255]], [-9007199254740991, 1, [1, 0, 0, 0]], [9007199254740992, 0, [0, 0, 0, 0]], [-9007199254740992, 0, [0, 0, 0, 0]], [9007199254740994, 2, [2, 0, 0, 0]], [-9007199254740994, -2, [254, 255, 255, 255]], [Infinity, 0, [0, 0, 0, 0]], [-Infinity, 0, [0, 0, 0, 0]], [-1.7976931348623157e+308, 0, [0, 0, 0, 0]], [1.7976931348623157e+308, 0, [0, 0, 0, 0]], [5e-324, 0, [0, 0, 0, 0]], [-5e-324, 0, [0, 0, 0, 0]], [NaN, 0, [0, 0, 0, 0]], ]; for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; int32array[0] = value; assert.same(int32array[0], conversion, `Int32Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Int32Array ${ toString(value) } -> [${ representation }]`); dataview.setInt32(0, value); assert.arrayEqual(uint8array, big, `dataview.setInt32(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getInt32(0), conversion, `dataview{${ big }}.getInt32(0) -> ${ toString(conversion) }`); dataview.setInt32(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setInt32(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getInt32(0, false), conversion, `dataview{${ big }}.getInt32(0, false) -> ${ toString(conversion) }`); dataview.setInt32(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setInt32(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getInt32(0, true), conversion, `dataview{${ little }}.getInt32(0, true) -> ${ toString(conversion) }`); } }); core-js-3.6.1/tests/tests/es.typed.conversions.int8.js000066400000000000000000000047011360057567700227320ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, LITTLE_ENDIAN, NATIVE } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('Int8 conversions', assert => { const int8array = new Int8Array(1); const uint8array = new Uint8Array(int8array.buffer); const dataview = new DataView(int8array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } let data = [ [0, 0, [0]], [-0, 0, [0]], [1, 1, [1]], [-1, -1, [255]], [1.1, 1, [1]], [-1.1, -1, [255]], [1.9, 1, [1]], [-1.9, -1, [255]], [127, 127, [127]], [-127, -127, [129]], [128, -128, [128]], [-128, -128, [128]], [255, -1, [255]], [-255, 1, [1]], [255.1, -1, [255]], [255.9, -1, [255]], [256, 0, [0]], [32767, -1, [255]], [-32767, 1, [1]], [32768, 0, [0]], [-32768, 0, [0]], [65535, -1, [255]], [65536, 0, [0]], [65537, 1, [1]], [65536.54321, 0, [0]], [-65536.54321, 0, [0]], [2147483647, -1, [255]], [-2147483647, 1, [1]], [2147483648, 0, [0]], [-2147483648, 0, [0]], [4294967296, 0, [0]], [9007199254740992, 0, [0]], [-9007199254740992, 0, [0]], [Infinity, 0, [0]], [-Infinity, 0, [0]], [-1.7976931348623157e+308, 0, [0]], [1.7976931348623157e+308, 0, [0]], [5e-324, 0, [0]], [-5e-324, 0, [0]], [NaN, 0, [0]], ]; // Android 4.3- bug if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) { data = data.concat([ [2147483649, 1, [1]], [-2147483649, -1, [255]], [4294967295, -1, [255]], [4294967297, 1, [1]], [9007199254740991, -1, [255]], [-9007199254740991, 1, [1]], [9007199254740994, 2, [2]], [-9007199254740994, -2, [254]], ]); } for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; int8array[0] = value; assert.same(int8array[0], conversion, `Int8Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Int8Array ${ toString(value) } -> [${ representation }]`); dataview.setInt8(0, value); assert.arrayEqual(uint8array, big, `dataview.setInt8(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getInt8(0), conversion, `dataview{${ big }}.getInt8(0) -> ${ toString(conversion) }`); } }); core-js-3.6.1/tests/tests/es.typed.conversions.uint16.js000066400000000000000000000063771360057567700232110ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, LITTLE_ENDIAN, NATIVE } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('Uint16 conversions', assert => { const uint16array = new Uint16Array(1); const uint8array = new Uint8Array(uint16array.buffer); const dataview = new DataView(uint16array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } let data = [ [0, 0, [0, 0]], [-0, 0, [0, 0]], [1, 1, [1, 0]], [-1, 65535, [255, 255]], [1.1, 1, [1, 0]], [-1.1, 65535, [255, 255]], [1.9, 1, [1, 0]], [-1.9, 65535, [255, 255]], [127, 127, [127, 0]], [-127, 65409, [129, 255]], [128, 128, [128, 0]], [-128, 65408, [128, 255]], [255, 255, [255, 0]], [-255, 65281, [1, 255]], [255.1, 255, [255, 0]], [255.9, 255, [255, 0]], [256, 256, [0, 1]], [32767, 32767, [255, 127]], [-32767, 32769, [1, 128]], [32768, 32768, [0, 128]], [-32768, 32768, [0, 128]], [65535, 65535, [255, 255]], [65536, 0, [0, 0]], [65537, 1, [1, 0]], [65536.54321, 0, [0, 0]], [-65536.54321, 0, [0, 0]], [2147483647, 65535, [255, 255]], [-2147483647, 1, [1, 0]], [2147483648, 0, [0, 0]], [-2147483648, 0, [0, 0]], [4294967296, 0, [0, 0]], [9007199254740992, 0, [0, 0]], [-9007199254740992, 0, [0, 0]], [Infinity, 0, [0, 0]], [-Infinity, 0, [0, 0]], [-1.7976931348623157e+308, 0, [0, 0]], [1.7976931348623157e+308, 0, [0, 0]], [5e-324, 0, [0, 0]], [-5e-324, 0, [0, 0]], [NaN, 0, [0, 0]], ]; // Android 4.3- bug if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) { data = data.concat([ [2147483649, 1, [1, 0]], [-2147483649, 65535, [255, 255]], [4294967295, 65535, [255, 255]], [4294967297, 1, [1, 0]], [9007199254740991, 65535, [255, 255]], [-9007199254740991, 1, [1, 0]], [9007199254740994, 2, [2, 0]], [-9007199254740994, 65534, [254, 255]], ]); } for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; uint16array[0] = value; assert.same(uint16array[0], conversion, `Uint16Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Uint16Array ${ toString(value) } -> [${ representation }]`); dataview.setUint16(0, value); assert.arrayEqual(uint8array, big, `dataview.setUint16(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getUint16(0), conversion, `dataview{${ big }}.getUint16(0) -> ${ toString(conversion) }`); dataview.setUint16(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setUint16(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getUint16(0, false), conversion, `dataview{${ big }}.getUint16(0, false) -> ${ toString(conversion) }`); dataview.setUint16(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setUint16(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getUint16(0, true), conversion, `dataview{${ little }}.getUint16(0, true) -> ${ toString(conversion) }`); } }); core-js-3.6.1/tests/tests/es.typed.conversions.uint32.js000066400000000000000000000070521360057567700231760ustar00rootroot00000000000000import { DESCRIPTORS, LITTLE_ENDIAN } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('Uint32 conversions', assert => { const uint32array = new Uint32Array(1); const uint8array = new Uint8Array(uint32array.buffer); const dataview = new DataView(uint32array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0, 0, 0, 0]], [-0, 0, [0, 0, 0, 0]], [1, 1, [1, 0, 0, 0]], [-1, 4294967295, [255, 255, 255, 255]], [1.1, 1, [1, 0, 0, 0]], [-1.1, 4294967295, [255, 255, 255, 255]], [1.9, 1, [1, 0, 0, 0]], [-1.9, 4294967295, [255, 255, 255, 255]], [127, 127, [127, 0, 0, 0]], [-127, 4294967169, [129, 255, 255, 255]], [128, 128, [128, 0, 0, 0]], [-128, 4294967168, [128, 255, 255, 255]], [255, 255, [255, 0, 0, 0]], [-255, 4294967041, [1, 255, 255, 255]], [255.1, 255, [255, 0, 0, 0]], [255.9, 255, [255, 0, 0, 0]], [256, 256, [0, 1, 0, 0]], [32767, 32767, [255, 127, 0, 0]], [-32767, 4294934529, [1, 128, 255, 255]], [32768, 32768, [0, 128, 0, 0]], [-32768, 4294934528, [0, 128, 255, 255]], [65535, 65535, [255, 255, 0, 0]], [65536, 65536, [0, 0, 1, 0]], [65537, 65537, [1, 0, 1, 0]], [65536.54321, 65536, [0, 0, 1, 0]], [-65536.54321, 4294901760, [0, 0, 255, 255]], [2147483647, 2147483647, [255, 255, 255, 127]], [-2147483647, 2147483649, [1, 0, 0, 128]], [2147483648, 2147483648, [0, 0, 0, 128]], [-2147483648, 2147483648, [0, 0, 0, 128]], [2147483649, 2147483649, [1, 0, 0, 128]], [-2147483649, 2147483647, [255, 255, 255, 127]], [4294967295, 4294967295, [255, 255, 255, 255]], [4294967296, 0, [0, 0, 0, 0]], [4294967297, 1, [1, 0, 0, 0]], [9007199254740991, 4294967295, [255, 255, 255, 255]], [-9007199254740991, 1, [1, 0, 0, 0]], [9007199254740992, 0, [0, 0, 0, 0]], [-9007199254740992, 0, [0, 0, 0, 0]], [9007199254740994, 2, [2, 0, 0, 0]], [-9007199254740994, 4294967294, [254, 255, 255, 255]], [Infinity, 0, [0, 0, 0, 0]], [-Infinity, 0, [0, 0, 0, 0]], [-1.7976931348623157e+308, 0, [0, 0, 0, 0]], [1.7976931348623157e+308, 0, [0, 0, 0, 0]], [5e-324, 0, [0, 0, 0, 0]], [-5e-324, 0, [0, 0, 0, 0]], [NaN, 0, [0, 0, 0, 0]], ]; for (const [value, conversion, little] of data) { const big = little.slice().reverse(); const representation = LITTLE_ENDIAN ? little : big; uint32array[0] = value; assert.same(uint32array[0], conversion, `Uint32Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, representation, `Uint32Array ${ toString(value) } -> [${ representation }]`); dataview.setUint32(0, value); assert.arrayEqual(uint8array, big, `dataview.setUint32(0, ${ toString(value) }) -> [${ big }]`); assert.same(viewFrom(big).getUint32(0), conversion, `dataview{${ big }}.getUint32(0) -> ${ toString(conversion) }`); dataview.setUint32(0, value, false); assert.arrayEqual(uint8array, big, `dataview.setUint32(0, ${ toString(value) }, false) -> [${ big }]`); assert.same(viewFrom(big).getUint32(0, false), conversion, `dataview{${ big }}.getUint32(0, false) -> ${ toString(conversion) }`); dataview.setUint32(0, value, true); assert.arrayEqual(uint8array, little, `dataview.setUint32(0, ${ toString(value) }, true) -> [${ little }]`); assert.same(viewFrom(little).getUint32(0, true), conversion, `dataview{${ little }}.getUint32(0, true) -> ${ toString(conversion) }`); } }); core-js-3.6.1/tests/tests/es.typed.conversions.uint8-clamped.js000066400000000000000000000035451360057567700245270ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('Uint8Clamped conversions', assert => { const uint8clamped = new Uint8ClampedArray(1); const uint8array = new Uint8Array(uint8clamped.buffer); function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } const data = [ [0, 0, [0]], [-0, 0, [0]], [1, 1, [1]], [-1, 0, [0]], [1.1, 1, [1]], [-1.1, 0, [0]], [1.9, 2, [2]], [-1.9, 0, [0]], [127, 127, [127]], [-127, 0, [0]], [128, 128, [128]], [-128, 0, [0]], [255, 255, [255]], [-255, 0, [0]], [255.1, 255, [255]], [255.9, 255, [255]], [256, 255, [255]], [32767, 255, [255]], [-32767, 0, [0]], [32768, 255, [255]], [-32768, 0, [0]], [65535, 255, [255]], [65536, 255, [255]], [65537, 255, [255]], [65536.54321, 255, [255]], [-65536.54321, 0, [0]], [2147483647, 255, [255]], [-2147483647, 0, [0]], [2147483648, 255, [255]], [-2147483648, 0, [0]], [2147483649, 255, [255]], [-2147483649, 0, [0]], [4294967295, 255, [255]], [4294967296, 255, [255]], [4294967297, 255, [255]], [9007199254740991, 255, [255]], [-9007199254740991, 0, [0]], [9007199254740992, 255, [255]], [-9007199254740992, 0, [0]], [9007199254740994, 255, [255]], [-9007199254740994, 0, [0]], [Infinity, 255, [255]], [-Infinity, 0, [0]], [-1.7976931348623157e+308, 0, [0]], [1.7976931348623157e+308, 255, [255]], [5e-324, 0, [0]], [-5e-324, 0, [0]], [NaN, 0, [0]], ]; for (const [value, conversion, little] of data) { uint8clamped[0] = value; assert.same(uint8clamped[0], conversion, `Uint8ClampedArray ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, little, `Uint8ClampedArray ${ toString(value) } -> [${ little }]`); } }); core-js-3.6.1/tests/tests/es.typed.conversions.uint8.js000066400000000000000000000044461360057567700231250ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('Uint8 conversions', assert => { const uint8array = new Uint8Array(1); const dataview = new DataView(uint8array.buffer); function viewFrom(it) { return new DataView(new Uint8Array(it).buffer); } function toString(it) { return it === 0 && 1 / it === -Infinity ? '-0' : it; } let data = [ [0, 0, [0]], [-0, 0, [0]], [1, 1, [1]], [-1, 255, [255]], [1.1, 1, [1]], [-1.1, 255, [255]], [1.9, 1, [1]], [-1.9, 255, [255]], [127, 127, [127]], [-127, 129, [129]], [128, 128, [128]], [-128, 128, [128]], [255, 255, [255]], [-255, 1, [1]], [255.1, 255, [255]], [255.9, 255, [255]], [256, 0, [0]], [32767, 255, [255]], [-32767, 1, [1]], [32768, 0, [0]], [-32768, 0, [0]], [65535, 255, [255]], [65536, 0, [0]], [65537, 1, [1]], [65536.54321, 0, [0]], [-65536.54321, 0, [0]], [2147483647, 255, [255]], [-2147483647, 1, [1]], [2147483648, 0, [0]], [-2147483648, 0, [0]], [4294967296, 0, [0]], [9007199254740992, 0, [0]], [-9007199254740992, 0, [0]], [Infinity, 0, [0]], [-Infinity, 0, [0]], [-1.7976931348623157e+308, 0, [0]], [1.7976931348623157e+308, 0, [0]], [5e-324, 0, [0]], [-5e-324, 0, [0]], [NaN, 0, [0]], ]; // Android 4.3- bug if (NATIVE || !/Android [2-4]/.test(GLOBAL.navigator && navigator.userAgent)) { data = data.concat([ [2147483649, 1, [1]], [-2147483649, 255, [255]], [4294967295, 255, [255]], [4294967297, 1, [1]], [9007199254740991, 255, [255]], [-9007199254740991, 1, [1]], [9007199254740994, 2, [2]], [-9007199254740994, 254, [254]], ]); } for (const [value, conversion, little] of data) { uint8array[0] = value; assert.same(uint8array[0], conversion, `Uint8Array ${ toString(value) } -> ${ toString(conversion) }`); assert.arrayEqual(uint8array, little, `Uint8Array ${ toString(value) } -> [${ little }]`); dataview.setUint8(0, value); assert.arrayEqual(uint8array, little, `dataview.setUint8(0, ${ toString(value) }) -> [${ little }]`); assert.same(viewFrom(little).getUint8(0), conversion, `dataview{${ little }}.getUint8(0) -> ${ toString(conversion) }`); } }); core-js-3.6.1/tests/tests/es.weak-map.js000066400000000000000000000154301360057567700200600ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants'; import { createIterable, nativeSubclass } from '../helpers/helpers'; const Symbol = GLOBAL.Symbol || {}; const { freeze, keys, getOwnPropertyNames, getOwnPropertySymbols } = Object; const { ownKeys } = GLOBAL.Reflect || {}; QUnit.test('WeakMap', assert => { assert.isFunction(WeakMap); assert.name(WeakMap, 'WeakMap'); assert.arity(WeakMap, 0); assert.looksNative(WeakMap); assert.ok('delete' in WeakMap.prototype, 'delete in WeakMap.prototype'); assert.ok('get' in WeakMap.prototype, 'get in WeakMap.prototype'); assert.ok('has' in WeakMap.prototype, 'has in WeakMap.prototype'); assert.ok('set' in WeakMap.prototype, 'set in WeakMap.prototype'); assert.ok(new WeakMap() instanceof WeakMap, 'new WeakMap instanceof WeakMap'); let object = {}; assert.strictEqual(new WeakMap(createIterable([[object, 42]])).get(object), 42, 'Init from iterable'); let weakmap = new WeakMap(); const frozen = freeze({}); weakmap.set(frozen, 42); assert.strictEqual(weakmap.get(frozen), 42, 'Support frozen objects'); weakmap = new WeakMap(); weakmap.set(frozen, 42); assert.strictEqual(weakmap.has(frozen), true, 'works with frozen objects, #1'); assert.strictEqual(weakmap.get(frozen), 42, 'works with frozen objects, #2'); weakmap.delete(frozen); assert.strictEqual(weakmap.has(frozen), false, 'works with frozen objects, #3'); assert.strictEqual(weakmap.get(frozen), undefined, 'works with frozen objects, #4'); let done = false; try { new WeakMap(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.ok(done, '.return #throw'); assert.ok(!('clear' in WeakMap.prototype), 'should not contains `.clear` method'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; new WeakMap(array); assert.ok(done); object = {}; new WeakMap().set(object, 1); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(WeakMap); assert.ok(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.ok(new Subclass() instanceof WeakMap, 'correct subclassing with native classes #2'); object = {}; assert.same(new Subclass().set(object, 2).get(object), 2, 'correct subclassing with native classes #3'); } }); QUnit.test('WeakMap#delete', assert => { assert.isFunction(WeakMap.prototype.delete); if (NATIVE) assert.name(WeakMap.prototype.delete, 'delete'); if (NATIVE) assert.arity(WeakMap.prototype.delete, 1); assert.looksNative(WeakMap.prototype.delete); assert.nonEnumerable(WeakMap.prototype, 'delete'); const a = {}; const b = {}; const weakmap = new WeakMap(); weakmap.set(a, 42); weakmap.set(b, 21); assert.ok(weakmap.has(a) && weakmap.has(b), 'WeakMap has values before .delete()'); weakmap.delete(a); assert.ok(!weakmap.has(a) && weakmap.has(b), 'WeakMap hasn`t value after .delete()'); assert.notThrows(() => !weakmap.delete(1), 'return false on primitive'); const object = {}; weakmap.set(object, 42); freeze(object); assert.ok(weakmap.has(object), 'works with frozen objects #1'); weakmap.delete(object); assert.ok(!weakmap.has(object), 'works with frozen objects #2'); }); QUnit.test('WeakMap#get', assert => { assert.isFunction(WeakMap.prototype.get); assert.name(WeakMap.prototype.get, 'get'); if (NATIVE) assert.arity(WeakMap.prototype.get, 1); assert.looksNative(WeakMap.prototype.get); assert.nonEnumerable(WeakMap.prototype, 'get'); const weakmap = new WeakMap(); assert.strictEqual(weakmap.get({}), undefined, 'WeakMap .get() before .set() return undefined'); let object = {}; weakmap.set(object, 42); assert.strictEqual(weakmap.get(object), 42, 'WeakMap .get() return value'); weakmap.delete(object); assert.strictEqual(weakmap.get(object), undefined, 'WeakMap .get() after .delete() return undefined'); assert.notThrows(() => weakmap.get(1) === undefined, 'return undefined on primitive'); object = {}; weakmap.set(object, 42); freeze(object); assert.same(weakmap.get(object), 42, 'works with frozen objects #1'); weakmap.delete(object); assert.same(weakmap.get(object), undefined, 'works with frozen objects #2'); }); QUnit.test('WeakMap#has', assert => { assert.isFunction(WeakMap.prototype.has); assert.name(WeakMap.prototype.has, 'has'); if (NATIVE) assert.arity(WeakMap.prototype.has, 1); assert.looksNative(WeakMap.prototype.has); assert.nonEnumerable(WeakMap.prototype, 'has'); const weakmap = new WeakMap(); assert.ok(!weakmap.has({}), 'WeakMap .has() before .set() return false'); let object = {}; weakmap.set(object, 42); assert.ok(weakmap.has(object), 'WeakMap .has() return true'); weakmap.delete(object); assert.ok(!weakmap.has(object), 'WeakMap .has() after .delete() return false'); assert.notThrows(() => !weakmap.has(1), 'return false on primitive'); object = {}; weakmap.set(object, 42); freeze(object); assert.ok(weakmap.has(object), 'works with frozen objects #1'); weakmap.delete(object); assert.ok(!weakmap.has(object), 'works with frozen objects #2'); }); QUnit.test('WeakMap#set', assert => { assert.isFunction(WeakMap.prototype.set); assert.name(WeakMap.prototype.set, 'set'); assert.arity(WeakMap.prototype.set, 2); assert.looksNative(WeakMap.prototype.set); assert.nonEnumerable(WeakMap.prototype, 'set'); const weakmap = new WeakMap(); const object = {}; weakmap.set(object, 33); assert.same(weakmap.get(object), 33, 'works with object as keys'); assert.ok(weakmap.set({}, 42) === weakmap, 'chaining'); assert.throws(() => new WeakMap().set(42, 42), 'throws with primitive keys'); const object1 = freeze({}); const object2 = {}; weakmap.set(object1, 42); weakmap.set(object2, 42); freeze(object); assert.same(weakmap.get(object1), 42, 'works with frozen objects #1'); assert.same(weakmap.get(object2), 42, 'works with frozen objects #2'); weakmap.delete(object1); weakmap.delete(object2); assert.same(weakmap.get(object1), undefined, 'works with frozen objects #3'); assert.same(weakmap.get(object2), undefined, 'works with frozen objects #4'); }); QUnit.test('WeakMap#@@toStringTag', assert => { assert.strictEqual(WeakMap.prototype[Symbol.toStringTag], 'WeakMap', 'WeakMap::@@toStringTag is `WeakMap`'); assert.strictEqual(String(new WeakMap()), '[object WeakMap]', 'correct stringification'); }); core-js-3.6.1/tests/tests/es.weak-set.js000066400000000000000000000104121360057567700200710ustar00rootroot00000000000000import { DESCRIPTORS, GLOBAL, NATIVE } from '../helpers/constants'; import { createIterable, nativeSubclass } from '../helpers/helpers'; const Symbol = GLOBAL.Symbol || {}; const { freeze, keys, getOwnPropertyNames, getOwnPropertySymbols } = Object; const { ownKeys } = GLOBAL.Reflect || {}; QUnit.test('WeakSet', assert => { assert.isFunction(WeakSet); assert.name(WeakSet, 'WeakSet'); assert.arity(WeakSet, 0); assert.looksNative(WeakSet); assert.ok('add' in WeakSet.prototype, 'add in WeakSet.prototype'); assert.ok('delete' in WeakSet.prototype, 'delete in WeakSet.prototype'); assert.ok('has' in WeakSet.prototype, 'has in WeakSet.prototype'); assert.ok(new WeakSet() instanceof WeakSet, 'new WeakSet instanceof WeakSet'); let object = {}; assert.ok(new WeakSet(createIterable([object])).has(object), 'Init from iterable'); const weakset = new WeakSet(); const frozen = freeze({}); weakset.add(frozen); assert.strictEqual(weakset.has(frozen), true, 'works with frozen objects, #1'); weakset.delete(frozen); assert.strictEqual(weakset.has(frozen), false, 'works with frozen objects, #2'); let done = false; try { new WeakSet(createIterable([null, 1, 2], { return() { return done = true; }, })); } catch { /* empty */ } assert.ok(done, '.return #throw'); assert.ok(!('clear' in WeakSet.prototype), 'should not contains `.clear` method'); const array = []; done = false; array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; return [][Symbol.iterator].call(this); }; new WeakSet(array); assert.ok(done); object = {}; new WeakSet().add(object); if (DESCRIPTORS) { const results = []; for (const key in object) results.push(key); assert.arrayEqual(results, []); assert.arrayEqual(keys(object), []); } assert.arrayEqual(getOwnPropertyNames(object), []); if (getOwnPropertySymbols) assert.arrayEqual(getOwnPropertySymbols(object), []); if (ownKeys) assert.arrayEqual(ownKeys(object), []); if (nativeSubclass) { const Subclass = nativeSubclass(WeakSet); assert.ok(new Subclass() instanceof Subclass, 'correct subclassing with native classes #1'); assert.ok(new Subclass() instanceof WeakSet, 'correct subclassing with native classes #2'); object = {}; assert.ok(new Subclass().add(object).has(object), 'correct subclassing with native classes #3'); } }); QUnit.test('WeakSet#add', assert => { assert.isFunction(WeakSet.prototype.add); assert.name(WeakSet.prototype.add, 'add'); assert.arity(WeakSet.prototype.add, 1); assert.looksNative(WeakSet.prototype.add); assert.nonEnumerable(WeakSet.prototype, 'add'); const weakset = new WeakSet(); assert.ok(weakset.add({}) === weakset, 'chaining'); assert.throws(() => new WeakSet().add(42), 'throws with primitive keys'); }); QUnit.test('WeakSet#delete', assert => { assert.isFunction(WeakSet.prototype.delete); if (NATIVE) assert.arity(WeakSet.prototype.delete, 1); assert.looksNative(WeakSet.prototype.delete); assert.nonEnumerable(WeakSet.prototype, 'delete'); const a = {}; const b = {}; const weakset = new WeakSet().add(a).add(b); assert.ok(weakset.has(a) && weakset.has(b), 'WeakSet has values before .delete()'); weakset.delete(a); assert.ok(!weakset.has(a) && weakset.has(b), 'WeakSet has`nt value after .delete()'); assert.notThrows(() => !weakset.delete(1), 'return false on primitive'); }); QUnit.test('WeakSet#has', assert => { assert.isFunction(WeakSet.prototype.has); assert.name(WeakSet.prototype.has, 'has'); assert.arity(WeakSet.prototype.has, 1); assert.looksNative(WeakSet.prototype.has); assert.nonEnumerable(WeakSet.prototype, 'has'); const weakset = new WeakSet(); assert.ok(!weakset.has({}), 'WeakSet has`nt value'); const object = {}; weakset.add(object); assert.ok(weakset.has(object), 'WeakSet has value after .add()'); weakset.delete(object); assert.ok(!weakset.has(object), 'WeakSet hasn`t value after .delete()'); assert.notThrows(() => !weakset.has(1), 'return false on primitive'); }); QUnit.test('WeakSet::@@toStringTag', assert => { assert.strictEqual(WeakSet.prototype[Symbol.toStringTag], 'WeakSet', 'WeakSet::@@toStringTag is `WeakSet`'); assert.strictEqual(String(new WeakSet()), '[object WeakSet]', 'correct stringification'); }); core-js-3.6.1/tests/tests/esnext.aggregate-error.js000066400000000000000000000010551360057567700223300ustar00rootroot00000000000000QUnit.test('AggregateError', assert => { assert.isFunction(AggregateError); assert.arity(AggregateError, 2); assert.name(AggregateError, 'AggregateError'); assert.looksNative(AggregateError); assert.ok(new AggregateError([1]) instanceof AggregateError); assert.ok(new AggregateError([1]) instanceof Error); assert.ok(AggregateError([1]) instanceof AggregateError); assert.ok(AggregateError([1]) instanceof Error); assert.same(AggregateError([1], 'foo').message, 'foo'); assert.deepEqual(AggregateError([1, 2, 3]).errors, [1, 2, 3]); }); core-js-3.6.1/tests/tests/esnext.array.is-template-object.js000066400000000000000000000015451360057567700240640ustar00rootroot00000000000000QUnit.test('Array.isTemplateObject', assert => { const { isTemplateObject } = Array; const { freeze } = Object; assert.isFunction(isTemplateObject); assert.arity(isTemplateObject, 1); assert.name(isTemplateObject, 'isTemplateObject'); assert.looksNative(isTemplateObject); assert.nonEnumerable(Array, 'isTemplateObject'); assert.ok(!isTemplateObject(undefined)); assert.ok(!isTemplateObject(null)); assert.ok(!isTemplateObject({})); assert.ok(!isTemplateObject(function () { return arguments; }())); assert.ok(!isTemplateObject([])); assert.ok(!isTemplateObject(freeze([]))); const template = (() => { try { // eslint-disable-next-line no-template-curly-in-string return Function('return (it => it)`qwe${ 123 }asd`')(); } catch { /* empty */ } })(); if (template) assert.ok(isTemplateObject(template)); }); core-js-3.6.1/tests/tests/esnext.array.last-index.js000066400000000000000000000006171360057567700224430ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('Array#lastIndex', assert => { const descriptor = Object.getOwnPropertyDescriptor(Array.prototype, 'lastIndex'); assert.isFunction(descriptor.get); assert.same(descriptor.enumerable, false); assert.same(descriptor.configurable, true); assert.same([1, 2, 3].lastIndex, 2); assert.same([].lastIndex, 0); }); core-js-3.6.1/tests/tests/esnext.array.last-item.js000066400000000000000000000011211360057567700222610ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; if (DESCRIPTORS) QUnit.test('Array#lastItem', assert => { const descriptor = Object.getOwnPropertyDescriptor(Array.prototype, 'lastItem'); assert.isFunction(descriptor.get); assert.isFunction(descriptor.set); assert.same(descriptor.enumerable, false); assert.same(descriptor.configurable, true); assert.same([1, 2, 3].lastItem, 3); assert.same([].lastItem, undefined); let array = [1, 2, 3]; array.lastItem = 4; assert.deepEqual(array, [1, 2, 4]); array = []; array.lastItem = 5; assert.deepEqual(array, [5]); }); core-js-3.6.1/tests/tests/esnext.async-iterator.as-indexed-pairs.js000066400000000000000000000016711360057567700253570ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; QUnit.test('AsyncIterator#asIndexedPairs', assert => { assert.expect(10); const async = assert.async(); const { asIndexedPairs } = AsyncIterator.prototype; assert.isFunction(asIndexedPairs); assert.arity(asIndexedPairs, 0); assert.name(asIndexedPairs, 'asIndexedPairs'); assert.looksNative(asIndexedPairs); assert.nonEnumerable(AsyncIterator.prototype, 'asIndexedPairs'); asIndexedPairs.call(createIterator(['a', 'b', 'c'])).toArray().then(it => { assert.same(it.toString(), '0,a,1,b,2,c', 'basic functionality'); async(); }); assert.throws(() => asIndexedPairs.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => asIndexedPairs.call(null, () => { /* empty */ }), TypeError); assert.throws(() => asIndexedPairs.call({}, () => { /* empty */ }), TypeError); assert.throws(() => asIndexedPairs.call([], () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.async-iterator.constructor.js000066400000000000000000000026241360057567700246060ustar00rootroot00000000000000const { getPrototypeOf } = Object; QUnit.test('AsyncIterator', assert => { assert.isFunction(AsyncIterator); assert.arity(AsyncIterator, 0); assert.name(AsyncIterator, 'AsyncIterator'); assert.looksNative(AsyncIterator); const asyncGenerator = (() => { try { return Function('return async function*(){}()')(); } catch { /* empty */ } })(); if (asyncGenerator) { const proto = getPrototypeOf(getPrototypeOf(getPrototypeOf(asyncGenerator))); if (proto !== Object.prototype && proto !== null) { assert.ok(asyncGenerator instanceof AsyncIterator, 'AsyncGenerator'); } } assert.ok(AsyncIterator.from([1, 2, 3]) instanceof AsyncIterator, 'Async From Proxy'); assert.ok(AsyncIterator.from([1, 2, 3]).drop(1) instanceof AsyncIterator, 'Async Drop Proxy'); assert.ok(new AsyncIterator() instanceof AsyncIterator, 'constructor'); assert.throws(() => AsyncIterator(), 'throws w/o `new`'); }); QUnit.test('AsyncIterator#constructor', assert => { assert.strictEqual(AsyncIterator.prototype.constructor, AsyncIterator, 'AsyncIterator#constructor is AsyncIterator'); }); QUnit.test('AsyncIterator#@@toStringTag', assert => { assert.strictEqual(AsyncIterator.prototype[Symbol.toStringTag], 'AsyncIterator', 'AsyncIterator::@@toStringTag is `AsyncIterator`'); assert.strictEqual(String(AsyncIterator.from([1, 2, 3])), '[object AsyncIterator]', 'correct stringification'); }); core-js-3.6.1/tests/tests/esnext.async-iterator.drop.js000066400000000000000000000022521360057567700231620ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; QUnit.test('AsyncIterator#drop', assert => { assert.expect(14); const async = assert.async(); const { drop } = AsyncIterator.prototype; assert.isFunction(drop); assert.arity(drop, 1); assert.name(drop, 'drop'); assert.looksNative(drop); assert.nonEnumerable(AsyncIterator.prototype, 'drop'); drop.call(createIterator([1, 2, 3]), 1).toArray().then(it => { assert.arrayEqual(it, [2, 3], 'basic functionality'); return drop.call(createIterator([1, 2, 3]), 1.5).toArray(); }).then(it => { assert.arrayEqual(it, [2, 3], 'float'); return drop.call(createIterator([1, 2, 3]), 4).toArray(); }).then(it => { assert.arrayEqual(it, [], 'big'); return drop.call(createIterator([1, 2, 3]), 0).toArray(); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'zero'); }).then(() => async()); assert.throws(() => drop.call(undefined, 1), TypeError); assert.throws(() => drop.call(null, 1), TypeError); assert.throws(() => drop.call({}, 1), TypeError); assert.throws(() => drop.call([], 1), TypeError); assert.throws(() => drop.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); }); core-js-3.6.1/tests/tests/esnext.async-iterator.every.js000066400000000000000000000031371360057567700233530ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#every', assert => { assert.expect(18); const async = assert.async(); const { every } = AsyncIterator.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.looksNative(every); assert.nonEnumerable(AsyncIterator.prototype, 'every'); every.call(createIterator([1, 2, 3]), it => typeof it === 'number').then(result => { assert.ok(result, 'basic functionality, +'); return every.call(createIterator([1, 2, 3]), it => it === 2); }).then(result => { assert.ok(!result, 'basic functionality, -'); return every.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); }).then(() => { return every.call(createIterator([1]), () => { throw 42; }); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call([], () => { /* empty */ }), TypeError); assert.throws(() => every.call(createIterator([1]), undefined), TypeError); assert.throws(() => every.call(createIterator([1]), null), TypeError); assert.throws(() => every.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.async-iterator.filter.js000066400000000000000000000027721360057567700235120ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#filter', assert => { assert.expect(17); const async = assert.async(); const { filter } = AsyncIterator.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.looksNative(filter); assert.nonEnumerable(AsyncIterator.prototype, 'filter'); filter.call(createIterator([1, 2, 3]), it => it % 2).toArray().then(it => { assert.arrayEqual(it, [1, 3], 'basic functionality'); return filter.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }).toArray(); }).then(() => { return filter.call(createIterator([1]), () => { throw 42; }).toArray(); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call([], () => { /* empty */ }), TypeError); assert.throws(() => filter.call(createIterator([1]), undefined), TypeError); assert.throws(() => filter.call(createIterator([1]), null), TypeError); assert.throws(() => filter.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.async-iterator.find.js000066400000000000000000000031151360057567700231350ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#find', assert => { assert.expect(18); const async = assert.async(); const { find } = AsyncIterator.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.looksNative(find); assert.nonEnumerable(AsyncIterator.prototype, 'find'); find.call(createIterator([2, 3, 4]), it => it % 2).then(result => { assert.same(result, 3, 'basic functionality, +'); return find.call(createIterator([1, 2, 3]), it => it === 4); }).then(result => { assert.same(result, undefined, 'basic functionality, -'); return find.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); }).then(() => { return find.call(createIterator([1]), () => { throw 42; }); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call([], () => { /* empty */ }), TypeError); assert.throws(() => find.call(createIterator([1]), undefined), TypeError); assert.throws(() => find.call(createIterator([1]), null), TypeError); assert.throws(() => find.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.async-iterator.flat-map.js000066400000000000000000000032131360057567700237150ustar00rootroot00000000000000import { createIterator, createIterable } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#flatMap', assert => { assert.expect(17); const async = assert.async(); const { flatMap } = AsyncIterator.prototype; assert.isFunction(flatMap); assert.arity(flatMap, 1); assert.name(flatMap, 'flatMap'); assert.looksNative(flatMap); assert.nonEnumerable(AsyncIterator.prototype, 'flatMap'); flatMap.call(createIterator([1, [], 2, createIterable([3, 4]), [5, 6], 'ab']), it => typeof it == 'number' ? [-it] : it).toArray().then(it => { assert.arrayEqual(it, [-1, -2, 3, 4, 5, 6, 'a', 'b'], 'basic functionality'); return flatMap.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); return [arg]; }).toArray(); }).then(() => { return flatMap.call(createIterator([1]), () => { throw 42; }).toArray(); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => flatMap.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(null, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call({}, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call([], () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(createIterator([1]), undefined), TypeError); assert.throws(() => flatMap.call(createIterator([1]), null), TypeError); assert.throws(() => flatMap.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.async-iterator.for-each.js000066400000000000000000000030211360057567700236750ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#forEach', assert => { assert.expect(17); const async = assert.async(); const { forEach } = AsyncIterator.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.name(forEach, 'forEach'); assert.looksNative(forEach); assert.nonEnumerable(AsyncIterator.prototype, 'forEach'); const array = []; forEach.call(createIterator([1, 2, 3]), it => array.push(it)).then(() => { assert.arrayEqual(array, [1, 2, 3], 'basic functionality'); return forEach.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); }).then(() => { return forEach.call(createIterator([1]), () => { throw 42; }); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => forEach.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(null, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call({}, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call([], () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(createIterator([1]), undefined), TypeError); assert.throws(() => forEach.call(createIterator([1]), null), TypeError); assert.throws(() => forEach.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.async-iterator.from.js000066400000000000000000000016711360057567700231650ustar00rootroot00000000000000QUnit.test('AsyncIterator.from', assert => { assert.expect(12); const async = assert.async(); const { from } = AsyncIterator; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(AsyncIterator, 'from'); assert.ok(AsyncIterator.from([].values()) instanceof AsyncIterator, 'proxy, iterator'); assert.ok(AsyncIterator.from([]) instanceof AsyncIterator, 'proxy, iterable'); AsyncIterator.from([1, 2, 3]).toArray().then(result => { assert.arrayEqual(result, [1, 2, 3], 'just a proxy'); async(); }); const asyncIterator = Object.assign(new AsyncIterator(), { next: () => { /* empty */ }, }); assert.same(AsyncIterator.from(asyncIterator), asyncIterator, 'does not wrap AsyncIterator instanses'); assert.throws(() => from(undefined), TypeError); assert.throws(() => from(null), TypeError); assert.throws(() => from({}), TypeError); }); core-js-3.6.1/tests/tests/esnext.async-iterator.map.js000066400000000000000000000027101360057567700227720ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#map', assert => { assert.expect(17); const async = assert.async(); const { map } = AsyncIterator.prototype; assert.isFunction(map); assert.arity(map, 1); assert.name(map, 'map'); assert.looksNative(map); assert.nonEnumerable(AsyncIterator.prototype, 'map'); map.call(createIterator([1, 2, 3]), it => it ** 2).toArray().then(it => { assert.arrayEqual(it, [1, 4, 9], 'basic functionality'); return map.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }).toArray(); }).then(() => { return map.call(createIterator([1]), () => { throw 42; }).toArray(); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); assert.throws(() => map.call({}, () => { /* empty */ }), TypeError); assert.throws(() => map.call([], () => { /* empty */ }), TypeError); assert.throws(() => map.call(createIterator([1]), undefined), TypeError); assert.throws(() => map.call(createIterator([1]), null), TypeError); assert.throws(() => map.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.async-iterator.reduce.js000066400000000000000000000035051360057567700234670ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#reduce', assert => { assert.expect(20); const async = assert.async(); const { reduce } = AsyncIterator.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.looksNative(reduce); assert.nonEnumerable(AsyncIterator.prototype, 'reduce'); reduce.call(createIterator([1, 2, 3]), (a, b) => a + b, 1).then(it => { assert.same(it, 7, 'basic functionality, initial'); return reduce.call(createIterator([2]), function (a, b) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(a, 1, 'argument 1'); assert.same(b, 2, 'argument 2'); }, 1); }).then(() => { return reduce.call(createIterator([1, 2, 3]), (a, b) => a + b); }).then(it => { assert.same(it, 6, 'basic functionality, no initial'); return reduce.call(createIterator([]), (a, b) => a + b); }).catch(() => { assert.ok(true, 'reduce an empty interble with no initial'); return reduce.call(createIterator([1]), () => { throw 42; }, 1); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call({}, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call([], () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), undefined, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), null, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), {}, 1), TypeError); }); core-js-3.6.1/tests/tests/esnext.async-iterator.some.js000066400000000000000000000030761360057567700231660ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('AsyncIterator#some', assert => { assert.expect(18); const async = assert.async(); const { some } = AsyncIterator.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.looksNative(some); assert.nonEnumerable(AsyncIterator.prototype, 'some'); some.call(createIterator([1, 2, 3]), it => it === 2).then(result => { assert.ok(result, 'basic functionality, +'); return some.call(createIterator([1, 2, 3]), it => it === 4); }).then(result => { assert.ok(!result, 'basic functionality, -'); return some.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); }).then(() => { return some.call(createIterator([1]), () => { throw 42; }); }).catch(error => { assert.same(error, 42, 'rejection on a callback error'); }).then(() => async()); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call([], () => { /* empty */ }), TypeError); assert.throws(() => some.call(createIterator([1]), undefined), TypeError); assert.throws(() => some.call(createIterator([1]), null), TypeError); assert.throws(() => some.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.async-iterator.take.js000066400000000000000000000022471360057567700231460ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; QUnit.test('AsyncIterator#take', assert => { assert.expect(14); const async = assert.async(); const { take } = AsyncIterator.prototype; assert.isFunction(take); assert.arity(take, 1); assert.name(take, 'take'); assert.looksNative(take); assert.nonEnumerable(AsyncIterator.prototype, 'take'); take.call(createIterator([1, 2, 3]), 2).toArray().then(it => { assert.arrayEqual(it, [1, 2], 'basic functionality'); return take.call(createIterator([1, 2, 3]), 1.5).toArray(); }).then(it => { assert.arrayEqual(it, [1], 'float'); return take.call(createIterator([1, 2, 3]), 4).toArray(); }).then(it => { assert.arrayEqual(it, [1, 2, 3], 'big'); return take.call(createIterator([1, 2, 3]), 0).toArray(); }).then(it => { assert.arrayEqual(it, [], 'zero'); }).then(() => async()); assert.throws(() => take.call(undefined, 1), TypeError); assert.throws(() => take.call(null, 1), TypeError); assert.throws(() => take.call({}, 1), TypeError); assert.throws(() => take.call([], 1), TypeError); assert.throws(() => take.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); }); core-js-3.6.1/tests/tests/esnext.async-iterator.to-array.js000066400000000000000000000013221360057567700237510ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; QUnit.test('AsyncIterator#toArray', assert => { assert.expect(10); const async = assert.async(); const { toArray } = AsyncIterator.prototype; assert.isFunction(toArray); assert.arity(toArray, 0); assert.name(toArray, 'toArray'); assert.looksNative(toArray); assert.nonEnumerable(AsyncIterator.prototype, 'toArray'); toArray.call(createIterator([1, 2, 3])).then(it => { assert.arrayEqual(it, [1, 2, 3]); async(); }); assert.throws(() => toArray.call(undefined), TypeError); assert.throws(() => toArray.call(null), TypeError); assert.throws(() => toArray.call({}), TypeError); assert.throws(() => toArray.call([]), TypeError); }); core-js-3.6.1/tests/tests/esnext.composite-key.js000066400000000000000000000037031360057567700220450ustar00rootroot00000000000000/* eslint-disable no-self-compare */ import { FREEZING } from '../helpers/constants'; const { getPrototypeOf, isFrozen } = Object; QUnit.test('compositeKey', assert => { assert.isFunction(compositeKey); assert.name(compositeKey, 'compositeKey'); assert.looksNative(compositeKey); const key = compositeKey({}); assert.same(typeof key, 'object'); assert.same({}.toString.call(key), '[object Object]'); assert.same(getPrototypeOf(key), null); if (FREEZING) assert.ok(isFrozen(key)); const a = ['a']; const b = ['b']; const c = ['c']; assert.ok(compositeKey(a) === compositeKey(a)); assert.ok(compositeKey(a) !== compositeKey(['a'])); assert.ok(compositeKey(a) !== compositeKey(a, 1)); assert.ok(compositeKey(a) !== compositeKey(a, b)); assert.ok(compositeKey(a, 1) === compositeKey(a, 1)); assert.ok(compositeKey(a, b) === compositeKey(a, b)); assert.ok(compositeKey(a, b) !== compositeKey(b, a)); assert.ok(compositeKey(a, b, c) === compositeKey(a, b, c)); assert.ok(compositeKey(a, b, c) !== compositeKey(c, b, a)); assert.ok(compositeKey(a, b, c) !== compositeKey(a, c, b)); assert.ok(compositeKey(a, b, c, 1) !== compositeKey(a, b, c)); assert.ok(compositeKey(a, b, c, 1) === compositeKey(a, b, c, 1)); assert.ok(compositeKey(1, a) === compositeKey(1, a)); assert.ok(compositeKey(1, a) !== compositeKey(a, 1)); assert.ok(compositeKey(1, a, 2, b) === compositeKey(1, a, 2, b)); assert.ok(compositeKey(1, a, 2, b) !== compositeKey(1, a, b, 2)); assert.ok(compositeKey(1, 2, a, b) === compositeKey(1, 2, a, b)); assert.ok(compositeKey(1, 2, a, b) !== compositeKey(1, a, b, 2)); assert.ok(compositeKey(a, a) === compositeKey(a, a)); assert.ok(compositeKey(a, a) !== compositeKey(a, ['a'])); assert.ok(compositeKey(a, a) !== compositeKey(a, b)); assert.throws(() => compositeKey(), TypeError); assert.throws(() => compositeKey(1, 2), TypeError); assert.throws(() => compositeKey('foo', null, true), TypeError); }); core-js-3.6.1/tests/tests/esnext.composite-symbol.js000066400000000000000000000037711360057567700225670ustar00rootroot00000000000000/* eslint-disable no-self-compare */ QUnit.test('compositeSymbol', assert => { assert.isFunction(compositeSymbol); assert.name(compositeSymbol, 'compositeSymbol'); assert.looksNative(compositeSymbol); assert.ok(Object(compositeSymbol({})) instanceof Symbol); const a = ['a']; const b = ['b']; const c = ['c']; assert.ok(compositeSymbol(a) === compositeSymbol(a)); assert.ok(compositeSymbol(a) !== compositeSymbol(['a'])); assert.ok(compositeSymbol(a) !== compositeSymbol(a, 1)); assert.ok(compositeSymbol(a) !== compositeSymbol(a, b)); assert.ok(compositeSymbol(a, 1) === compositeSymbol(a, 1)); assert.ok(compositeSymbol(a, b) === compositeSymbol(a, b)); assert.ok(compositeSymbol(a, b) !== compositeSymbol(b, a)); assert.ok(compositeSymbol(a, b, c) === compositeSymbol(a, b, c)); assert.ok(compositeSymbol(a, b, c) !== compositeSymbol(c, b, a)); assert.ok(compositeSymbol(a, b, c) !== compositeSymbol(a, c, b)); assert.ok(compositeSymbol(a, b, c, 1) !== compositeSymbol(a, b, c)); assert.ok(compositeSymbol(a, b, c, 1) === compositeSymbol(a, b, c, 1)); assert.ok(compositeSymbol(1, a) === compositeSymbol(1, a)); assert.ok(compositeSymbol(1, a) !== compositeSymbol(a, 1)); assert.ok(compositeSymbol(1, a, 2, b) === compositeSymbol(1, a, 2, b)); assert.ok(compositeSymbol(1, a, 2, b) !== compositeSymbol(1, a, b, 2)); assert.ok(compositeSymbol(1, 2, a, b) === compositeSymbol(1, 2, a, b)); assert.ok(compositeSymbol(1, 2, a, b) !== compositeSymbol(1, a, b, 2)); assert.ok(compositeSymbol(a, a) === compositeSymbol(a, a)); assert.ok(compositeSymbol(a, a) !== compositeSymbol(a, ['a'])); assert.ok(compositeSymbol(a, a) !== compositeSymbol(a, b)); assert.ok(compositeSymbol() === compositeSymbol()); assert.ok(compositeSymbol(1, 2) === compositeSymbol(1, 2)); assert.ok(compositeSymbol(1, 2) !== compositeSymbol(2, 1)); assert.ok(compositeSymbol('foo', null, true) === compositeSymbol('foo', null, true)); assert.ok(compositeSymbol('string') === Symbol.for('string')); }); core-js-3.6.1/tests/tests/esnext.iterator.as-indexed-pairs.js000066400000000000000000000013701360057567700242400ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; QUnit.test('Iterator#asIndexedPairs', assert => { const { asIndexedPairs } = Iterator.prototype; assert.isFunction(asIndexedPairs); assert.arity(asIndexedPairs, 0); assert.name(asIndexedPairs, 'asIndexedPairs'); assert.looksNative(asIndexedPairs); assert.nonEnumerable(Iterator.prototype, 'asIndexedPairs'); assert.arrayEqual(asIndexedPairs.call(createIterator(['a', 'b', 'c'])).toArray().toString(), '0,a,1,b,2,c', 'basic functionality'); assert.throws(() => asIndexedPairs.call(undefined, TypeError)); assert.throws(() => asIndexedPairs.call(null, TypeError)); assert.throws(() => asIndexedPairs.call({}, TypeError)); assert.throws(() => asIndexedPairs.call([], TypeError)); }); core-js-3.6.1/tests/tests/esnext.iterator.constructor.js000066400000000000000000000032101360057567700234630ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; const { getPrototypeOf } = Object; QUnit.test('Iterator', assert => { assert.isFunction(Iterator); assert.arity(Iterator, 0); assert.name(Iterator, 'Iterator'); assert.looksNative(Iterator); const generator = (() => { try { return Function('return function*(){}()')(); } catch { /* empty */ } })(); if (generator) { const proto = getPrototypeOf(getPrototypeOf(getPrototypeOf(generator))); if (proto !== Object.prototype && proto !== null) { assert.ok(generator instanceof Iterator, 'Generator'); } } assert.ok(''[Symbol.iterator]() instanceof Iterator, 'String Iterator'); assert.ok([].values() instanceof Iterator, 'Array Iterator'); assert.ok(new Set().values() instanceof Iterator, 'Set Iterator'); assert.ok('abc'.matchAll(/./g) instanceof Iterator, 'MatchAll Iterator'); assert.ok(Iterator.from(createIterator([1, 2, 3])) instanceof Iterator, 'From Proxy'); assert.ok([].values().drop(1) instanceof Iterator, 'Drop Proxy'); assert.ok(new Iterator() instanceof Iterator, 'constructor'); assert.throws(() => Iterator(), 'throws w/o `new`'); }); QUnit.test('Iterator#constructor', assert => { assert.strictEqual(Iterator.prototype.constructor, Iterator, 'Iterator#constructor is Iterator'); }); QUnit.test('Iterator#@@toStringTag', assert => { assert.strictEqual(Iterator.prototype[Symbol.toStringTag], 'Iterator', 'Iterator::@@toStringTag is `Iterator`'); assert.strictEqual(String(Iterator.from({ next: () => ({ done: Math.random() > 0.9, value: Math.random() * 10 | 0 }), })), '[object Iterator]', 'correct stringification'); }); core-js-3.6.1/tests/tests/esnext.iterator.drop.js000066400000000000000000000017171360057567700220540ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; QUnit.test('Iterator#drop', assert => { const { drop } = Iterator.prototype; assert.isFunction(drop); assert.arity(drop, 1); assert.name(drop, 'drop'); assert.looksNative(drop); assert.nonEnumerable(Iterator.prototype, 'drop'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 1).toArray(), [2, 3], 'basic functionality'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 1.5).toArray(), [2, 3], 'float'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 4).toArray(), [], 'big'); assert.arrayEqual(drop.call(createIterator([1, 2, 3]), 0).toArray(), [1, 2, 3], 'zero'); assert.throws(() => drop.call(undefined, 1), TypeError); assert.throws(() => drop.call(null, 1), TypeError); assert.throws(() => drop.call({}, 1), TypeError); assert.throws(() => drop.call([], 1), TypeError); assert.throws(() => drop.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); }); core-js-3.6.1/tests/tests/esnext.iterator.every.js000066400000000000000000000024001360057567700222300ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#every', assert => { const { every } = Iterator.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.looksNative(every); assert.nonEnumerable(Iterator.prototype, 'every'); assert.ok(every.call(createIterator([1, 2, 3]), it => typeof it == 'number'), 'basic functionality #1'); assert.ok(!every.call(createIterator([1, 2, 3]), it => it % 2), 'basic functionality #2'); every.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call([], () => { /* empty */ }), TypeError); assert.throws(() => every.call(createIterator([1]), undefined), TypeError); assert.throws(() => every.call(createIterator([1]), null), TypeError); assert.throws(() => every.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.iterator.filter.js000066400000000000000000000022741360057567700223740ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#filter', assert => { const { filter } = Iterator.prototype; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.looksNative(filter); assert.nonEnumerable(Iterator.prototype, 'filter'); assert.arrayEqual(filter.call(createIterator([1, 2, 3]), it => it % 2).toArray(), [1, 3], 'basic functionality'); filter.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call([], () => { /* empty */ }), TypeError); assert.throws(() => filter.call(createIterator([1]), undefined), TypeError); assert.throws(() => filter.call(createIterator([1]), null), TypeError); assert.throws(() => filter.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.iterator.find.js000066400000000000000000000022101360057567700220150ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#find', assert => { const { find } = Iterator.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.looksNative(find); assert.nonEnumerable(Iterator.prototype, 'find'); assert.same(find.call(createIterator([1, 2, 3]), it => !(it % 2)), 2, 'basic functionality'); find.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call([], () => { /* empty */ }), TypeError); assert.throws(() => find.call(createIterator([1]), undefined), TypeError); assert.throws(() => find.call(createIterator([1]), null), TypeError); assert.throws(() => find.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.iterator.flat-map.js000066400000000000000000000026731360057567700226130ustar00rootroot00000000000000import { createIterator, createIterable } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#flatMap', assert => { const { flatMap } = Iterator.prototype; assert.isFunction(flatMap); assert.arity(flatMap, 1); assert.name(flatMap, 'flatMap'); assert.looksNative(flatMap); assert.nonEnumerable(Iterator.prototype, 'flatMap'); assert.arrayEqual( flatMap.call(createIterator([1, [], 2, createIterable([3, 4]), [5, 6], 'ab']), it => typeof it == 'number' ? [-it] : it).toArray(), [-1, -2, 3, 4, 5, 6, 'a', 'b'], 'basic functionality', ); flatMap.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); return [arg]; }).toArray(); assert.throws(() => flatMap.call([], () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(null, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call({}, () => { /* empty */ }), TypeError); assert.throws(() => flatMap.call(createIterator([1]), it => it).next(), TypeError); assert.throws(() => flatMap.call(createIterator([1]), undefined), TypeError); assert.throws(() => flatMap.call(createIterator([1]), null), TypeError); assert.throws(() => flatMap.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.iterator.for-each.js000066400000000000000000000023561360057567700225740ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#forEach', assert => { const { forEach } = Iterator.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.name(forEach, 'forEach'); assert.looksNative(forEach); assert.nonEnumerable(Iterator.prototype, 'forEach'); const array = []; forEach.call(createIterator([1, 2, 3]), it => array.push(it)); assert.arrayEqual(array, [1, 2, 3], 'basic functionality'); forEach.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); assert.throws(() => forEach.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(null, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call({}, () => { /* empty */ }), TypeError); assert.throws(() => forEach.call([], () => { /* empty */ }), TypeError); assert.throws(() => forEach.call(createIterator([1]), undefined), TypeError); assert.throws(() => forEach.call(createIterator([1]), null), TypeError); assert.throws(() => forEach.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.iterator.from.js000066400000000000000000000013301360057567700220420ustar00rootroot00000000000000import { createIterable, createIterator } from '../helpers/helpers'; QUnit.test('Iterator.from', assert => { const { from } = Iterator; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(Iterator, 'from'); assert.ok(Iterator.from(createIterator([1, 2, 3])) instanceof Iterator, 'proxy, iterator'); assert.ok(Iterator.from(createIterable([1, 2, 3])) instanceof Iterator, 'proxy, iterable'); assert.arrayEqual(Iterator.from(createIterable([1, 2, 3])).toArray(), [1, 2, 3], 'just a proxy'); assert.throws(() => from(undefined), TypeError); assert.throws(() => from(null), TypeError); assert.throws(() => from({}), TypeError); }); core-js-3.6.1/tests/tests/esnext.iterator.map.js000066400000000000000000000022271360057567700216620ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#map', assert => { const { map } = Iterator.prototype; assert.isFunction(map); assert.arity(map, 1); assert.name(map, 'map'); assert.looksNative(map); assert.nonEnumerable(Iterator.prototype, 'map'); assert.arrayEqual(map.call(createIterator([1, 2, 3]), it => it ** 2).toArray(), [1, 4, 9], 'basic functionality'); map.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }).toArray(); assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); assert.throws(() => map.call({}, () => { /* empty */ }), TypeError); assert.throws(() => map.call([], () => { /* empty */ }), TypeError); assert.throws(() => map.call(createIterator([1]), undefined), TypeError); assert.throws(() => map.call(createIterator([1]), null), TypeError); assert.throws(() => map.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.iterator.reduce.js000066400000000000000000000024761360057567700223620ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#reduce', assert => { const { reduce } = Iterator.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.looksNative(reduce); assert.nonEnumerable(Iterator.prototype, 'reduce'); assert.same(reduce.call(createIterator([1, 2, 3]), (a, b) => a + b, 1), 7, 'basic functionality'); assert.same(reduce.call(createIterator([1, 2, 3]), (a, b) => a + b), 6, 'basic functionality, no init'); reduce.call(createIterator([2]), function (a, b) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 2, 'arguments length'); assert.same(a, 1, 'argument 1'); assert.same(b, 2, 'argument 2'); }, 1); assert.throws(() => reduce.call(undefined, (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call(null, (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call({}, (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call([], (a, b) => a + b, 0), TypeError); assert.throws(() => reduce.call(createIterator([1]), undefined, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), null, 1), TypeError); assert.throws(() => reduce.call(createIterator([1]), {}, 1), TypeError); }); core-js-3.6.1/tests/tests/esnext.iterator.some.js000066400000000000000000000023561360057567700220530ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; import { STRICT_THIS } from '../helpers/constants'; QUnit.test('Iterator#some', assert => { const { some } = Iterator.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.looksNative(some); assert.nonEnumerable(Iterator.prototype, 'some'); assert.ok(some.call(createIterator([1, 2, 3]), it => it % 2), 'basic functionality #1'); assert.ok(!some.call(createIterator([1, 2, 3]), it => typeof it == 'string'), 'basic functionality #2'); some.call(createIterator([1]), function (arg) { assert.same(this, STRICT_THIS, 'this'); assert.same(arguments.length, 1, 'arguments length'); assert.same(arg, 1, 'argument'); }); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call([], () => { /* empty */ }), TypeError); assert.throws(() => some.call(createIterator([1]), undefined), TypeError); assert.throws(() => some.call(createIterator([1]), null), TypeError); assert.throws(() => some.call(createIterator([1]), {}), TypeError); }); core-js-3.6.1/tests/tests/esnext.iterator.take.js000066400000000000000000000017141360057567700220310ustar00rootroot00000000000000import { createIterator } from '../helpers/helpers'; QUnit.test('Iterator#take', assert => { const { take } = Iterator.prototype; assert.isFunction(take); assert.arity(take, 1); assert.name(take, 'take'); assert.looksNative(take); assert.nonEnumerable(Iterator.prototype, 'take'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 2).toArray(), [1, 2], 'basic functionality'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 1.5).toArray(), [1], 'float'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 4).toArray(), [1, 2, 3], 'big'); assert.arrayEqual(take.call(createIterator([1, 2, 3]), 0).toArray(), [], 'zero'); assert.throws(() => take.call(undefined, 1), TypeError); assert.throws(() => take.call(null, 1), TypeError); assert.throws(() => take.call({}, 1), TypeError); assert.throws(() => take.call([], 1), TypeError); assert.throws(() => take.call(createIterator([1, 2, 3]), -1), RangeError, 'negative'); }); core-js-3.6.1/tests/tests/esnext.iterator.to-array.js000066400000000000000000000016301360057567700226400ustar00rootroot00000000000000import { createIterable, createIterator } from '../helpers/helpers'; QUnit.test('Iterator#toArray', assert => { const { toArray } = Iterator.prototype; assert.isFunction(toArray); assert.arity(toArray, 0); assert.name(toArray, 'toArray'); assert.looksNative(toArray); assert.nonEnumerable(Iterator.prototype, 'toArray'); assert.arrayEqual([1, 2, 3].values().toArray(), [1, 2, 3]); assert.arrayEqual(new Set([1, 2, 3]).values().toArray(), [1, 2, 3]); assert.arrayEqual(Iterator.from('123').toArray(), ['1', '2', '3']); assert.arrayEqual(Iterator.from(createIterable([1, 2, 3])).toArray(), [1, 2, 3]); assert.arrayEqual(toArray.call(createIterator([1, 2, 3])), [1, 2, 3]); assert.throws(() => toArray.call(undefined), TypeError); assert.throws(() => toArray.call(null), TypeError); assert.throws(() => toArray.call({}), TypeError); assert.throws(() => toArray.call([]), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.delete-all.js000066400000000000000000000021471360057567700220420ustar00rootroot00000000000000QUnit.test('Map#deleteAll', assert => { const { deleteAll } = Map.prototype; const { from } = Array; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.looksNative(deleteAll); assert.nonEnumerable(Map.prototype, 'deleteAll'); let set = new Map([[1, 2], [2, 3], [3, 4]]); assert.same(set.deleteAll(1, 2), true); assert.deepEqual(from(set), [[3, 4]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.same(set.deleteAll(3, 4), false); assert.deepEqual(from(set), [[1, 2], [2, 3]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.same(set.deleteAll(4, 5), false); assert.deepEqual(from(set), [[1, 2], [2, 3], [3, 4]]); set = new Map([[1, 2], [2, 3], [3, 4]]); assert.same(set.deleteAll(), true); assert.deepEqual(from(set), [[1, 2], [2, 3], [3, 4]]); assert.notThrows(() => !deleteAll.call({ delete() { /* empty */ } }, 1, 2, 3)); assert.throws(() => deleteAll.call({}, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(null, 1, 2, 3), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.every.js000066400000000000000000000027261360057567700211670ustar00rootroot00000000000000QUnit.test('Map#every', assert => { const { every } = Map.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.looksNative(every); assert.nonEnumerable(Map.prototype, 'every'); let map = new Map([[9, 1]]); const context = {}; map.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 9, 'correct index in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); map = new Map([[0, 1], [1, 2], [2, 3]]); assert.ok(map.every(it => typeof it === 'number')); assert.ok(map.every(it => it < 4)); assert.ok(!map.every(it => it < 3)); assert.ok(!map.every(it => typeof it === 'string')); assert.ok(map.every(function () { return +this === 1; }, 1)); let result = ''; map.every((value, key) => result += key); assert.ok(result === '012'); assert.ok(map.every((value, key, that) => that === map)); assert.throws(() => every.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call([], () => { /* empty */ }), TypeError); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.filter.js000066400000000000000000000025701360057567700213170ustar00rootroot00000000000000QUnit.test('Map#filter', assert => { const { filter } = Map.prototype; const { from } = Array; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.looksNative(filter); assert.nonEnumerable(Map.prototype, 'filter'); const map = new Map([[1, 2]]); const context = {}; map.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(new Map().filter(it => it) instanceof Map); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).filter(it => typeof it === 'number')), [ ['a', 1], [1, 2], ['b', 3], [3, 4], [4, 5], ]); assert.throws(() => filter.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call([], () => { /* empty */ }), TypeError); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.find-key.js000066400000000000000000000022701360057567700215350ustar00rootroot00000000000000QUnit.test('Map#findKey', assert => { const { findKey } = Map.prototype; assert.isFunction(findKey); assert.arity(findKey, 1); assert.name(findKey, 'findKey'); assert.looksNative(findKey); assert.nonEnumerable(Map.prototype, 'findKey'); const set = new Map([[1, 2]]); const context = {}; set.findKey(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Map([[1, 2], [2, 3], [3, 4]]).findKey(it => it % 2), 2); assert.same(new Map().findKey(it => it === 42), undefined); assert.throws(() => findKey.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => findKey.call({}, () => { /* empty */ }), TypeError); assert.throws(() => findKey.call([], () => { /* empty */ }), TypeError); assert.throws(() => findKey.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => findKey.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.find.js000066400000000000000000000022101360057567700207410ustar00rootroot00000000000000QUnit.test('Map#find', assert => { const { find } = Map.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.looksNative(find); assert.nonEnumerable(Map.prototype, 'find'); const set = new Map([[1, 2]]); const context = {}; set.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Map([[1, 2], [2, 3], [3, 4]]).find(it => it % 2), 3); assert.same(new Map().find(it => it === 42), undefined); assert.throws(() => find.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call([], () => { /* empty */ }), TypeError); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.from.js000066400000000000000000000020101360057567700207620ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Map.from', assert => { const { from } = Map; const toArray = Array.from; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(Map, 'from'); assert.ok(Map.from() instanceof Map); assert.deepEqual(toArray(Map.from([])), []); assert.deepEqual(toArray(Map.from([[1, 2]])), [[1, 2]]); assert.deepEqual(toArray(Map.from([[1, 2], [2, 3], [1, 4]])), [[1, 4], [2, 3]]); assert.deepEqual(toArray(Map.from(createIterable([[1, 2], [2, 3], [1, 4]]))), [[1, 4], [2, 3]]); const pair = [1, 2]; const context = {}; Map.from([pair], function (element, index) { assert.same(element, pair); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from([1, 2])); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.6.1/tests/tests/esnext.map.group-by.js000066400000000000000000000015221360057567700215720ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Map.groupBy', assert => { const { groupBy } = Map; const toArray = Array.from; assert.isFunction(groupBy); assert.arity(groupBy, 2); assert.name(groupBy, 'groupBy'); assert.looksNative(groupBy); assert.nonEnumerable(Map, 'groupBy'); assert.ok(Map.groupBy([], it => it) instanceof Map); assert.deepEqual(toArray(Map.groupBy([], it => it)), []); assert.deepEqual(toArray(Map.groupBy([1, 2], it => it ** 2)), [[1, [1]], [4, [2]]]); assert.deepEqual(toArray(Map.groupBy([1, 2, 1], it => it ** 2)), [[1, [1, 1]], [4, [2]]]); assert.deepEqual(toArray(Map.groupBy(createIterable([1, 2]), it => it ** 2)), [[1, [1]], [4, [2]]]); const element = {}; Map.groupBy([element], it => assert.same(it, element)); assert.throws(() => groupBy([1, 2], it => it)); }); core-js-3.6.1/tests/tests/esnext.map.includes.js000066400000000000000000000016241360057567700216370ustar00rootroot00000000000000QUnit.test('Map#includes', assert => { const { includes } = Map.prototype; assert.isFunction(includes); assert.name(includes, 'includes'); assert.arity(includes, 1); assert.looksNative(includes); assert.nonEnumerable(Map.prototype, 'includes'); const object = {}; const map = new Map([[1, 1], [2, 2], [3, 3], [4, -0], [5, object], [6, NaN]]); assert.ok(map.includes(1)); assert.ok(map.includes(-0)); assert.ok(map.includes(0)); assert.ok(map.includes(object)); assert.ok(!map.includes(4)); assert.ok(!map.includes(-0.5)); assert.ok(!map.includes({})); assert.ok(map.includes(NaN)); assert.throws(() => includes.call(new Set(), 1), TypeError); assert.throws(() => includes.call({}, 1), TypeError); assert.throws(() => includes.call([], 1), TypeError); assert.throws(() => includes.call(undefined, 1), TypeError); assert.throws(() => includes.call(null, 1), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.key-by.js000066400000000000000000000014451360057567700212320ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Map.keyBy', assert => { const { keyBy } = Map; const toArray = Array.from; assert.isFunction(keyBy); assert.arity(keyBy, 2); assert.name(keyBy, 'keyBy'); assert.looksNative(keyBy); assert.nonEnumerable(Map, 'keyBy'); assert.ok(Map.keyBy([], it => it) instanceof Map); assert.deepEqual(toArray(Map.keyBy([], it => it)), []); assert.deepEqual(toArray(Map.keyBy([1, 2], it => it ** 2)), [[1, 1], [4, 2]]); assert.deepEqual(toArray(Map.keyBy([1, 2, 1], it => it ** 2)), [[1, 1], [4, 2]]); assert.deepEqual(toArray(Map.keyBy(createIterable([1, 2]), it => it ** 2)), [[1, 1], [4, 2]]); const element = {}; Map.keyBy([element], it => assert.same(it, element)); assert.throws(() => keyBy([1, 2], it => it)); }); core-js-3.6.1/tests/tests/esnext.map.key-of.js000066400000000000000000000016321360057567700212220ustar00rootroot00000000000000QUnit.test('Map#keyOf', assert => { const { keyOf } = Map.prototype; assert.isFunction(keyOf); assert.name(keyOf, 'keyOf'); assert.arity(keyOf, 1); assert.looksNative(keyOf); assert.nonEnumerable(Map.prototype, 'keyOf'); const object = {}; const map = new Map([[1, 1], [2, 2], [3, 3], [4, -0], [5, object], [6, NaN]]); assert.same(map.keyOf(1), 1); assert.same(map.keyOf(-0), 4); assert.same(map.keyOf(0), 4); assert.same(map.keyOf(object), 5); assert.same(map.keyOf(4), undefined); assert.same(map.keyOf(-0.5), undefined); assert.same(map.keyOf({}), undefined); assert.same(map.keyOf(NaN), undefined); assert.throws(() => keyOf.call(new Set(), 1), TypeError); assert.throws(() => keyOf.call({}, 1), TypeError); assert.throws(() => keyOf.call([], 1), TypeError); assert.throws(() => keyOf.call(undefined, 1), TypeError); assert.throws(() => keyOf.call(null, 1), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.map-keys.js000066400000000000000000000027371360057567700215650ustar00rootroot00000000000000QUnit.test('Map#mapKeys', assert => { const { mapKeys } = Map.prototype; const { from } = Array; assert.isFunction(mapKeys); assert.arity(mapKeys, 1); assert.name(mapKeys, 'mapKeys'); assert.looksNative(mapKeys); assert.nonEnumerable(Map.prototype, 'mapKeys'); const map = new Map([[1, 2]]); const context = {}; map.mapKeys(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(new Map().mapKeys(it => it) instanceof Map); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).mapKeys((value, key) => `${ key }${ value }`)), [ ['a1', 1], ['12', 2], ['b3', 3], ['2q', 'q'], ['c[object Object]', {}], ['34', 4], ['dtrue', true], ['45', 5], ]); assert.throws(() => mapKeys.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call({}, () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call([], () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => mapKeys.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.map-values.js000066400000000000000000000030011360057567700220720ustar00rootroot00000000000000QUnit.test('Map#mapValues', assert => { const { mapValues } = Map.prototype; const { from } = Array; assert.isFunction(mapValues); assert.arity(mapValues, 1); assert.name(mapValues, 'mapValues'); assert.looksNative(mapValues); assert.nonEnumerable(Map.prototype, 'mapValues'); const map = new Map([[1, 2]]); const context = {}; map.mapValues(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(new Map().mapValues(it => it) instanceof Map); assert.deepEqual(from(new Map([ ['a', 1], [1, 2], ['b', 3], [2, 'q'], ['c', {}], [3, 4], ['d', true], [4, 5], ]).mapValues((value, key) => `${ key }${ value }`)), [ ['a', 'a1'], [1, '12'], ['b', 'b3'], [2, '2q'], ['c', 'c[object Object]'], [3, '34'], ['d', 'dtrue'], [4, '45'], ]); assert.throws(() => mapValues.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call({}, () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call([], () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => mapValues.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.merge.js000066400000000000000000000017211360057567700211260ustar00rootroot00000000000000QUnit.test('Map#merge', assert => { const { merge } = Map.prototype; const { from } = Array; assert.isFunction(merge); assert.arity(merge, 1); assert.name(merge, 'merge'); assert.looksNative(merge); assert.nonEnumerable(Map.prototype, 'merge'); const map = new Map([[1, 2]]); const result = map.merge([[3, 4]]); assert.ok(result === map); assert.ok(result instanceof Map); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[5, 6]])), [[1, 2], [3, 4], [5, 6]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[3, 5], [5, 6]])), [[1, 2], [3, 5], [5, 6]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([])), [[1, 2], [3, 4]]); assert.deepEqual(from(new Map([[1, 2], [3, 4]]).merge([[3, 5]], [[5, 6]])), [[1, 2], [3, 5], [5, 6]]); assert.throws(() => merge.call({}, [[1, 2]]), TypeError); assert.throws(() => merge.call(undefined, [[1, 2]]), TypeError); assert.throws(() => merge.call(null, [[1, 2]]), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.of.js000066400000000000000000000010421360057567700204270ustar00rootroot00000000000000QUnit.test('Map.of', assert => { const { of } = Map; const toArray = Array.from; assert.isFunction(of); assert.arity(of, 0); assert.name(of, 'of'); assert.looksNative(of); assert.nonEnumerable(Map, 'of'); assert.ok(Map.of() instanceof Map); assert.deepEqual(toArray(Map.of([1, 2])), [[1, 2]]); assert.deepEqual(toArray(Map.of([1, 2], [2, 3], [1, 4])), [[1, 4], [2, 3]]); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.6.1/tests/tests/esnext.map.reduce.js000066400000000000000000000036551360057567700213060ustar00rootroot00000000000000QUnit.test('Map#reduce', assert => { const { reduce } = Map.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.looksNative(reduce); assert.nonEnumerable(Map.prototype, 'reduce'); const set = new Map([['a', 1]]); const accumulator = {}; set.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 'a', 'correct index in callback'); assert.same(that, set, 'correct link to set in callback'); }, accumulator); assert.same(new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new Map([ ['a', 1], ['b', 2], ]).reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 'b', 'correct start index without initial accumulator'); }); assert.same(new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new Map([ ['a', 1], ['b', 2], ['c', 3], ]).reduce((memo, value, key, s) => { s.delete('b'); values += value; keys += key; }, 0); assert.same(values, '13', 'correct order #1'); assert.same(keys, 'ac', 'correct order #2'); assert.throws(() => reduce.call(new Set(), () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call({}, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call([], () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.some.js000066400000000000000000000027371360057567700210020ustar00rootroot00000000000000QUnit.test('Map#some', assert => { const { some } = Map.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.looksNative(some); assert.nonEnumerable(Map.prototype, 'some'); let map = new Map([[9, 1]]); const context = {}; map.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 9, 'correct index in callback'); assert.same(that, map, 'correct link to map in callback'); assert.same(this, context, 'correct callback context'); }, context); map = new Map([[0, 1], [1, '2'], [2, 3]]); assert.ok(map.some(it => typeof it === 'number')); assert.ok(map.some(it => it < 3)); assert.ok(!map.some(it => it < 0)); assert.ok(map.some(it => typeof it === 'string')); assert.ok(!map.some(function () { return +this !== 1; }, 1)); let result = ''; map.some((value, key) => { result += key; return false; }); assert.same(result, '012'); assert.ok(map.some((value, key, that) => that === map)); assert.throws(() => some.call(new Set(), () => { /* empty */ }), TypeError); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call([], () => { /* empty */ }), TypeError); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.update-or-insert.js000066400000000000000000000033131360057567700232300ustar00rootroot00000000000000QUnit.test('Map#updateOrInsert', assert => { const { updateOrInsert } = Map.prototype; assert.isFunction(updateOrInsert); assert.arity(updateOrInsert, 2); assert.name(updateOrInsert, 'upsert'); assert.looksNative(updateOrInsert); assert.nonEnumerable(Map.prototype, 'upsert'); const map = new Map([['a', 2]]); assert.same(map.updateOrInsert('a', function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.ok(false, 'should not be called'); return 3; }), 4, 'returns a correct value'); assert.same(map.updateOrInsert('b', value => { assert.ok(false, 'should not be called'); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.size, 2, 'correct size'); assert.same(map.get('a'), 4, 'correct result #1'); assert.same(map.get('b'), 3, 'correct result #2'); assert.same(new Map([['a', 2]]).updateOrInsert('b', null, () => 3), 3); assert.same(new Map([['a', 2]]).updateOrInsert('a', value => value ** 2), 4); assert.throws(() => new Map().updateOrInsert('a'), TypeError); assert.throws(() => updateOrInsert.call({}, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call([], 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call(undefined, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => updateOrInsert.call(null, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.update.js000066400000000000000000000035501360057567700213130ustar00rootroot00000000000000QUnit.test('Map#update', assert => { const { update } = Map.prototype; assert.isFunction(update); assert.arity(update, 2); assert.name(update, 'update'); assert.looksNative(update); assert.nonEnumerable(Map.prototype, 'update'); let map = new Map([[9, 2]]); assert.same(map.update(9, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 9, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); return value * 2; }), map, 'returns this'); assert.same(map.size, 1, 'correct size'); assert.same(map.get(9), 4, 'correct result'); map = new Map([[4, 5]]); map.update(9, function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); assert.same(key, 9, 'correct key in callback'); assert.same(that, map, 'correct link to map in callback'); return value * 2; }, function (key, that) { assert.same(arguments.length, 2, 'correct number of thunk arguments'); assert.same(key, 9, 'correct key in thunk'); assert.same(that, map, 'correct link to map in thunk'); return 2; }); assert.same(map.size, 2, 'correct size'); assert.same(map.get(4), 5, 'correct result #1'); assert.same(map.get(9), 4, 'correct result #2'); assert.throws(() => new Map([[9, 2]]).update(9), TypeError); assert.throws(() => new Map().update(9, () => { /* empty */ }), TypeError); assert.throws(() => update.call({}, () => { /* empty */ }), TypeError); assert.throws(() => update.call([], () => { /* empty */ }), TypeError); assert.throws(() => update.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => update.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.map.upsert.js000066400000000000000000000031231360057567700213470ustar00rootroot00000000000000QUnit.test('Map#upsert', assert => { const { upsert } = Map.prototype; assert.isFunction(upsert); assert.arity(upsert, 2); assert.name(upsert, 'upsert'); assert.looksNative(upsert); assert.nonEnumerable(Map.prototype, 'upsert'); const map = new Map([['a', 2]]); assert.same(map.upsert('a', function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.ok(false, 'should not be called'); return 3; }), 4, 'returns a correct value'); assert.same(map.upsert('b', value => { assert.ok(false, 'should not be called'); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.size, 2, 'correct size'); assert.same(map.get('a'), 4, 'correct result #1'); assert.same(map.get('b'), 3, 'correct result #2'); assert.same(new Map([['a', 2]]).upsert('b', null, () => 3), 3); assert.same(new Map([['a', 2]]).upsert('a', value => value ** 2), 4); assert.throws(() => new Map().upsert('a'), TypeError); assert.throws(() => upsert.call({}, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call([], 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(undefined, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(null, 'a', () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.math.clamp.js000066400000000000000000000005021360057567700212730ustar00rootroot00000000000000QUnit.test('Math.clamp', assert => { const { clamp } = Math; assert.isFunction(clamp); assert.name(clamp, 'clamp'); assert.arity(clamp, 3); assert.looksNative(clamp); assert.nonEnumerable(Math, 'clamp'); assert.same(clamp(2, 4, 6), 4); assert.same(clamp(4, 2, 6), 4); assert.same(clamp(6, 2, 4), 4); }); core-js-3.6.1/tests/tests/esnext.math.deg-per-rad.js000066400000000000000000000003751360057567700222760ustar00rootroot00000000000000QUnit.test('Math.DEG_PER_RAD', assert => { const { DEG_PER_RAD } = Math; assert.ok('DEG_PER_RAD' in Math, 'DEG_PER_RAD in Math'); assert.nonEnumerable(Math, 'DEG_PER_RAD'); assert.strictEqual(DEG_PER_RAD, Math.PI / 180, 'Is Math.PI / 180'); }); core-js-3.6.1/tests/tests/esnext.math.degrees.js000066400000000000000000000006071360057567700216230ustar00rootroot00000000000000QUnit.test('Math.degrees', assert => { const { degrees } = Math; assert.isFunction(degrees); assert.name(degrees, 'degrees'); assert.arity(degrees, 1); assert.looksNative(degrees); assert.nonEnumerable(Math, 'degrees'); assert.same(degrees(0), 0); assert.same(degrees(Math.PI / 2), 90); assert.same(degrees(Math.PI), 180); assert.same(degrees(3 * Math.PI / 2), 270); }); core-js-3.6.1/tests/tests/esnext.math.fscale.js000066400000000000000000000007661360057567700214500ustar00rootroot00000000000000QUnit.test('Math.fscale', assert => { const { fscale, fround, PI } = Math; assert.isFunction(fscale); assert.name(fscale, 'fscale'); assert.arity(fscale, 5); assert.looksNative(fscale); assert.nonEnumerable(Math, 'fscale'); assert.same(fscale(3, 1, 2, 1, 2), 3); assert.same(fscale(0, 3, 5, 8, 10), 5); assert.same(fscale(1, 1, 1, 1, 1), NaN); assert.same(fscale(-1, -1, -1, -1, -1), NaN); assert.strictEqual(fscale(3, 1, 2, 1, PI), fround((3 - 1) * (PI - 1) / (2 - 1) + 1)); }); core-js-3.6.1/tests/tests/esnext.math.iaddh.js000066400000000000000000000006471360057567700212620ustar00rootroot00000000000000QUnit.test('Math.iaddh', assert => { const { iaddh } = Math; assert.isFunction(iaddh); assert.name(iaddh, 'iaddh'); assert.arity(iaddh, 4); assert.looksNative(iaddh); assert.nonEnumerable(Math, 'iaddh'); assert.same(iaddh(0, 2, 1, 0), 2); assert.same(iaddh(0, 4, 1, 1), 5); assert.same(iaddh(2, 4, 1, 1), 5); assert.same(iaddh(0xFFFFFFFF, 4, 1, 1), 6); assert.same(iaddh(1, 4, 0xFFFFFFFF, 1), 6); }); core-js-3.6.1/tests/tests/esnext.math.imulh.js000066400000000000000000000005551360057567700213250ustar00rootroot00000000000000QUnit.test('Math.imulh', assert => { const { imulh } = Math; assert.isFunction(imulh); assert.name(imulh, 'imulh'); assert.arity(imulh, 2); assert.looksNative(imulh); assert.nonEnumerable(Math, 'imulh'); assert.same(imulh(0xFFFFFFFF, 7), -1); assert.same(imulh(0xFFFFFFF, 77), 4); assert.same(imulh(1, 7), 0); assert.same(imulh(-1, 7), -1); }); core-js-3.6.1/tests/tests/esnext.math.isubh.js000066400000000000000000000006471360057567700213230ustar00rootroot00000000000000QUnit.test('Math.isubh', assert => { const { isubh } = Math; assert.isFunction(isubh); assert.name(isubh, 'isubh'); assert.arity(isubh, 4); assert.looksNative(isubh); assert.nonEnumerable(Math, 'isubh'); assert.same(isubh(0, 2, 1, 0), 1); assert.same(isubh(0, 4, 1, 1), 2); assert.same(isubh(2, 4, 1, 1), 3); assert.same(isubh(0xFFFFFFFF, 4, 1, 1), 3); assert.same(isubh(1, 4, 0xFFFFFFFF, 1), 2); }); core-js-3.6.1/tests/tests/esnext.math.rad-per-deg.js000066400000000000000000000003751360057567700222760ustar00rootroot00000000000000QUnit.test('Math.RAD_PER_DEG', assert => { const { RAD_PER_DEG } = Math; assert.ok('RAD_PER_DEG' in Math, 'RAD_PER_DEG in Math'); assert.nonEnumerable(Math, 'RAD_PER_DEG'); assert.strictEqual(RAD_PER_DEG, 180 / Math.PI, 'Is 180 / Math.PI'); }); core-js-3.6.1/tests/tests/esnext.math.radians.js000066400000000000000000000006071360057567700216260ustar00rootroot00000000000000QUnit.test('Math.radians', assert => { const { radians } = Math; assert.isFunction(radians); assert.name(radians, 'radians'); assert.arity(radians, 1); assert.looksNative(radians); assert.nonEnumerable(Math, 'radians'); assert.same(radians(0), 0); assert.same(radians(90), Math.PI / 2); assert.same(radians(180), Math.PI); assert.same(radians(270), 3 * Math.PI / 2); }); core-js-3.6.1/tests/tests/esnext.math.scale.js000066400000000000000000000006061360057567700212730ustar00rootroot00000000000000QUnit.test('Math.scale', assert => { const { scale } = Math; assert.isFunction(scale); assert.name(scale, 'scale'); assert.arity(scale, 5); assert.looksNative(scale); assert.nonEnumerable(Math, 'scale'); assert.same(scale(3, 1, 2, 1, 2), 3); assert.same(scale(0, 3, 5, 8, 10), 5); assert.same(scale(1, 1, 1, 1, 1), NaN); assert.same(scale(-1, -1, -1, -1, -1), NaN); }); core-js-3.6.1/tests/tests/esnext.math.seeded-prng.js000066400000000000000000000025261360057567700224040ustar00rootroot00000000000000QUnit.test('Math.seededPRNG', assert => { const { seededPRNG } = Math; assert.isFunction(seededPRNG); assert.name(seededPRNG, 'seededPRNG'); assert.arity(seededPRNG, 1); assert.looksNative(seededPRNG); assert.nonEnumerable(Math, 'seededPRNG'); for (const gen of [seededPRNG({ seed: 42 }), seededPRNG({ seed: 42 })]) { assert.deepEqual(gen.next(), { value: 0.16461519912315087, done: false }); assert.deepEqual(gen.next(), { value: 0.2203933906000046, done: false }); assert.deepEqual(gen.next(), { value: 0.8249682894209105, done: false }); assert.deepEqual(gen.next(), { value: 0.10750079537509083, done: false }); assert.deepEqual(gen.next(), { value: 0.004673248161257476, done: false }); } for (const gen of [seededPRNG({ seed: 43 }), seededPRNG({ seed: 43 })]) { assert.deepEqual(gen.next(), { value: 0.1923438591811283, done: false }); assert.deepEqual(gen.next(), { value: 0.7896811578326683, done: false }); assert.deepEqual(gen.next(), { value: 0.9518230761883996, done: false }); assert.deepEqual(gen.next(), { value: 0.1414634102410296, done: false }); assert.deepEqual(gen.next(), { value: 0.7379838030207752, done: false }); } assert.throws(() => seededPRNG(), TypeError); assert.throws(() => seededPRNG(5), TypeError); assert.throws(() => seededPRNG({ seed: null }), TypeError); }); core-js-3.6.1/tests/tests/esnext.math.signbit.js000066400000000000000000000012731360057567700216440ustar00rootroot00000000000000QUnit.test('Math.signbit', assert => { const { signbit } = Math; assert.isFunction(signbit); assert.name(signbit, 'signbit'); assert.arity(signbit, 1); assert.looksNative(signbit); assert.nonEnumerable(Math, 'signbit'); assert.strictEqual(signbit(NaN), false); assert.strictEqual(signbit(), false); assert.strictEqual(signbit(-0), true); assert.strictEqual(signbit(0), false); assert.strictEqual(signbit(Infinity), false); assert.strictEqual(signbit(-Infinity), true); assert.strictEqual(signbit(13510798882111488), false); assert.strictEqual(signbit(-13510798882111488), true); assert.strictEqual(signbit(42.5), false); assert.strictEqual(signbit(-42.5), true); }); core-js-3.6.1/tests/tests/esnext.math.umulh.js000066400000000000000000000005531360057567700213370ustar00rootroot00000000000000QUnit.test('Math.umulh', assert => { const { umulh } = Math; assert.isFunction(umulh); assert.name(umulh, 'umulh'); assert.arity(umulh, 2); assert.looksNative(umulh); assert.nonEnumerable(Math, 'umulh'); assert.same(umulh(0xFFFFFFFF, 7), 6); assert.same(umulh(0xFFFFFFF, 77), 4); assert.same(umulh(1, 7), 0); assert.same(umulh(-1, 7), 6); }); core-js-3.6.1/tests/tests/esnext.number.from-string.js000066400000000000000000000040151360057567700230100ustar00rootroot00000000000000QUnit.test('Number.fromString', assert => { const { fromString } = Number; assert.isFunction(fromString); assert.name(fromString, 'fromString'); assert.arity(fromString, 2); assert.looksNative(fromString); assert.nonEnumerable(Number, 'fromString'); assert.throws(() => fromString(undefined), TypeError, 'The first argument should be a string #1'); assert.throws(() => fromString(Object('10')), TypeError, 'The first argument should be a string #1'); assert.throws(() => fromString(''), SyntaxError, 'Empty string'); assert.same(fromString('-10', 2), -2, 'Works with negative numbers'); assert.throws(() => fromString('-'), SyntaxError, '-'); assert.same(fromString('10'), 10, 'Default radix is 10 #1'); assert.same(fromString('10', undefined), 10, 'Default radix is 10 #2'); for (let radix = 2; radix <= 36; ++radix) { assert.same(fromString('10', radix), radix, `Radix ${ radix }`); } assert.throws(() => fromString('10', -4294967294), RangeError, 'Radix uses ToInteger #1'); assert.same(fromString('10', 2.5), 2, 'Radix uses ToInteger #2'); assert.same(fromString('42'), 42); assert.same(fromString('42', 10), 42); assert.throws(() => fromString('0xc0ffee'), SyntaxError); assert.throws(() => fromString('0o755'), SyntaxError); assert.throws(() => fromString('0b00101010'), SyntaxError); assert.throws(() => fromString('C0FFEE', 16), SyntaxError); assert.same(fromString('c0ffee', 16), 12648430); assert.same(fromString('755', 8), 493); assert.throws(() => fromString(''), SyntaxError); assert.throws(() => fromString(' '), SyntaxError); assert.throws(() => fromString(' 1'), SyntaxError); assert.throws(() => fromString(' \n '), SyntaxError); assert.throws(() => fromString('x'), SyntaxError); assert.throws(() => fromString('1234', 0), RangeError); assert.throws(() => fromString('1234', 1), RangeError); assert.throws(() => fromString('1234', 37), RangeError); assert.throws(() => fromString('010'), SyntaxError); assert.throws(() => fromString('1_000_000_000'), SyntaxError); }); core-js-3.6.1/tests/tests/esnext.object.iterate-entries.js000066400000000000000000000014321360057567700236230ustar00rootroot00000000000000QUnit.test('Object.iterateEntries', assert => { const { iterateEntries } = Object; assert.isFunction(iterateEntries); assert.name(iterateEntries, 'iterateEntries'); assert.arity(iterateEntries, 1); assert.looksNative(iterateEntries); assert.nonEnumerable(Object, 'iterateEntries'); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateEntries(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: ['q', 1], done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: ['e', 3], done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/tests/esnext.object.iterate-keys.js000066400000000000000000000013651360057567700231320ustar00rootroot00000000000000QUnit.test('Object.iterateKeys', assert => { const { iterateKeys } = Object; assert.isFunction(iterateKeys); assert.name(iterateKeys, 'iterateKeys'); assert.arity(iterateKeys, 1); assert.looksNative(iterateKeys); assert.nonEnumerable(Object, 'iterateKeys'); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateKeys(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: 'q', done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: 'e', done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/tests/esnext.object.iterate-values.js000066400000000000000000000014031360057567700234470ustar00rootroot00000000000000QUnit.test('Object.iterateValues', assert => { const { iterateValues } = Object; assert.isFunction(iterateValues); assert.name(iterateValues, 'iterateValues'); assert.arity(iterateValues, 1); assert.looksNative(iterateValues); assert.nonEnumerable(Object, 'iterateValues'); const object = { q: 1, w: 2, e: 3, }; const iterator = iterateValues(object); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'Object Iterator'); assert.deepEqual(iterator.next(), { value: 1, done: false, }); delete object.w; assert.deepEqual(iterator.next(), { value: 3, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/tests/esnext.observable.js000066400000000000000000000042671360057567700214070ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('Observable', assert => { assert.isFunction(Observable); assert.arity(Observable, 1); assert.name(Observable, 'Observable'); assert.looksNative(Observable); assert.throws(() => Observable(() => { /* empty */ }), 'throws w/o `new`'); const observable = new Observable(function (subscriptionObserver) { assert.same(typeof subscriptionObserver, 'object', 'Subscription observer is object'); assert.same(subscriptionObserver.constructor, Object); const { next, error, complete } = subscriptionObserver; assert.isFunction(next); assert.isFunction(error); assert.isFunction(complete); assert.arity(next, 1); assert.arity(error, 1); assert.arity(complete, 0); if (STRICT) { assert.same(this, undefined, 'correct executor context'); } }); observable.subscribe({}); assert.ok(observable instanceof Observable); }); QUnit.test('Observable#subscribe', assert => { assert.isFunction(Observable.prototype.subscribe); assert.arity(Observable.prototype.subscribe, 1); assert.name(Observable.prototype.subscribe, 'subscribe'); assert.looksNative(Observable.prototype.subscribe); const subscription = new Observable(() => { /* empty */ }).subscribe({}); assert.same(typeof subscription, 'object', 'Subscription is object'); assert.same(subscription.constructor, Object); assert.isFunction(subscription.unsubscribe); assert.arity(subscription.unsubscribe, 0); }); QUnit.test('Observable#constructor', assert => { assert.same(Observable.prototype.constructor, Observable); }); QUnit.test('Observable#@@observable', assert => { assert.isFunction(Observable.prototype[Symbol.observable]); const observable = new Observable(() => { /* empty*/ }); assert.same(observable[Symbol.observable](), observable); }); QUnit.test('Observable.of', assert => { assert.isFunction(Observable.of); assert.arity(Observable.of, 0); assert.name(Observable.of, 'of'); assert.looksNative(Observable.of); }); QUnit.test('Observable.from', assert => { assert.isFunction(Observable.from); assert.arity(Observable.from, 1); assert.name(Observable.from, 'from'); assert.looksNative(Observable.from); }); core-js-3.6.1/tests/tests/esnext.promise.any.js000066400000000000000000000026531360057567700215240ustar00rootroot00000000000000QUnit.test('Promise.any', assert => { assert.isFunction(Promise.any); assert.arity(Promise.any, 1); assert.looksNative(Promise.any); assert.nonEnumerable(Promise, 'any'); assert.ok(Promise.any([1, 2, 3]) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.any, resolved', assert => { assert.expect(1); const async = assert.async(); Promise.any([ Promise.resolve(1), Promise.reject(2), Promise.resolve(3), ]).then(it => { assert.same(it, 1, 'resolved with a correct value'); async(); }); }); QUnit.test('Promise.any, rejected #1', assert => { assert.expect(2); const async = assert.async(); Promise.any([ Promise.reject(1), Promise.reject(2), Promise.reject(3), ]).catch(error => { assert.ok(error instanceof AggregateError, 'instanceof AggregateError'); assert.deepEqual(error.errors, [1, 2, 3], 'rejected with a correct value'); async(); }); }); QUnit.test('Promise.any, rejected #2', assert => { assert.expect(1); const async = assert.async(); Promise.any().catch(() => { assert.ok(true, 'rejected as expected'); async(); }); }); QUnit.test('Promise.any, rejected #3', assert => { assert.expect(2); const async = assert.async(); Promise.any([]).catch(error => { assert.ok(error instanceof AggregateError, 'instanceof AggregateError'); assert.deepEqual(error.errors, [], 'rejected with a correct value'); async(); }); }); core-js-3.6.1/tests/tests/esnext.promise.try.js000066400000000000000000000013071360057567700215460ustar00rootroot00000000000000QUnit.test('Promise.try', assert => { assert.isFunction(Promise.try); assert.arity(Promise.try, 1); assert.looksNative(Promise.try); assert.nonEnumerable(Promise, 'try'); assert.ok(Promise.try(() => 42) instanceof Promise, 'returns a promise'); }); QUnit.test('Promise.try, resolved', assert => { assert.expect(1); const async = assert.async(); Promise.try(() => 42).then(it => { assert.same(it, 42, 'resolved with a correct value'); async(); }); }); QUnit.test('Promise.try, rejected', assert => { assert.expect(1); const async = assert.async(); Promise.try(() => { throw new Error(); }).catch(() => { assert.ok(true, 'rejected as expected'); async(); }); }); core-js-3.6.1/tests/tests/esnext.reflect.define-metadata.js000066400000000000000000000010241360057567700237020ustar00rootroot00000000000000QUnit.test('Reflect.defineMetadata', assert => { const { defineMetadata } = Reflect; assert.isFunction(defineMetadata); assert.arity(defineMetadata, 3); assert.name(defineMetadata, 'defineMetadata'); assert.looksNative(defineMetadata); assert.nonEnumerable(Reflect, 'defineMetadata'); assert.throws(() => defineMetadata('key', 'value', undefined, undefined), TypeError); assert.same(defineMetadata('key', 'value', {}, undefined), undefined); assert.same(defineMetadata('key', 'value', {}, 'name'), undefined); }); core-js-3.6.1/tests/tests/esnext.reflect.delete-metadata.js000066400000000000000000000017071360057567700237220ustar00rootroot00000000000000QUnit.test('Reflect.deleteMetadata', assert => { const { defineMetadata, hasOwnMetadata, deleteMetadata } = Reflect; const { create } = Object; assert.isFunction(deleteMetadata); assert.arity(deleteMetadata, 2); assert.name(deleteMetadata, 'deleteMetadata'); assert.looksNative(deleteMetadata); assert.nonEnumerable(Reflect, 'deleteMetadata'); assert.throws(() => deleteMetadata('key', undefined, undefined), TypeError); assert.same(deleteMetadata('key', {}, undefined), false); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(deleteMetadata('key', object, undefined), true); const prototype = {}; defineMetadata('key', 'value', prototype, undefined); assert.same(deleteMetadata('key', create(prototype), undefined), false); object = {}; defineMetadata('key', 'value', object, undefined); deleteMetadata('key', object, undefined); assert.same(hasOwnMetadata('key', object, undefined), false); }); core-js-3.6.1/tests/tests/esnext.reflect.get-metadata-keys.js000066400000000000000000000045601360057567700242100ustar00rootroot00000000000000QUnit.test('Reflect.getMetadataKeys', assert => { const { defineMetadata, getMetadataKeys } = Reflect; const { create } = Object; assert.isFunction(getMetadataKeys); assert.arity(getMetadataKeys, 1); assert.name(getMetadataKeys, 'getMetadataKeys'); assert.looksNative(getMetadataKeys); assert.nonEnumerable(Reflect, 'getMetadataKeys'); assert.throws(() => getMetadataKeys(undefined, undefined), TypeError); assert.deepEqual(getMetadataKeys({}, undefined), []); let object = {}; defineMetadata('key', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key']); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); defineMetadata('key0', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, undefined); object = create(prototype); defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1', 'key2']); object = {}; assert.deepEqual(getMetadataKeys({}, 'name'), []); object = {}; defineMetadata('key', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); object = {}; defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); defineMetadata('key0', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, 'name'); object = create(prototype); defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1', 'key2']); }); core-js-3.6.1/tests/tests/esnext.reflect.get-metadata.js000066400000000000000000000021251360057567700232320ustar00rootroot00000000000000QUnit.test('Reflect.getMetadata', assert => { const { defineMetadata, getMetadata } = Reflect; const { create } = Object; assert.isFunction(getMetadata); assert.arity(getMetadata, 2); assert.name(getMetadata, 'getMetadata'); assert.looksNative(getMetadata); assert.nonEnumerable(Reflect, 'getMetadata'); assert.throws(() => getMetadata('key', undefined, undefined), TypeError); assert.same(getMetadata('key', {}, undefined), undefined); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(getMetadata('key', object, undefined), 'value'); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(getMetadata('key', object, undefined), 'value'); assert.same(getMetadata('key', {}, 'name'), undefined); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(getMetadata('key', object, 'name'), 'value'); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(getMetadata('key', object, 'name'), 'value'); }); core-js-3.6.1/tests/tests/esnext.reflect.get-own-matadata.js000066400000000000000000000022061360057567700240270ustar00rootroot00000000000000QUnit.test('Reflect.getOwnMetadata', assert => { const { defineMetadata, getOwnMetadata } = Reflect; const { create } = Object; assert.isFunction(getOwnMetadata); assert.arity(getOwnMetadata, 2); assert.name(getOwnMetadata, 'getOwnMetadata'); assert.looksNative(getOwnMetadata); assert.nonEnumerable(Reflect, 'getOwnMetadata'); assert.throws(() => getOwnMetadata('key', undefined, undefined), TypeError); assert.same(getOwnMetadata('key', {}, undefined), undefined); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(getOwnMetadata('key', object, undefined), 'value'); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(getOwnMetadata('key', object, undefined), undefined); assert.same(getOwnMetadata('key', {}, 'name'), undefined); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(getOwnMetadata('key', object, 'name'), 'value'); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(getOwnMetadata('key', object, 'name'), undefined); }); core-js-3.6.1/tests/tests/esnext.reflect.get-own-metadata-keys.js000066400000000000000000000046221360057567700250100ustar00rootroot00000000000000QUnit.test('Reflect.getOwnMetadataKeys', assert => { const { defineMetadata, getOwnMetadataKeys } = Reflect; const { create } = Object; assert.isFunction(getOwnMetadataKeys); assert.arity(getOwnMetadataKeys, 1); assert.name(getOwnMetadataKeys, 'getOwnMetadataKeys'); assert.looksNative(getOwnMetadataKeys); assert.nonEnumerable(Reflect, 'getOwnMetadataKeys'); assert.throws(() => getOwnMetadataKeys(undefined, undefined), TypeError); assert.deepEqual(getOwnMetadataKeys({}, undefined), []); let object = {}; defineMetadata('key', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key']); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), []); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); defineMetadata('key0', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, undefined); object = create(prototype); defineMetadata('key0', 'value', object, undefined); defineMetadata('key1', 'value', object, undefined); assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); object = {}; assert.deepEqual(getOwnMetadataKeys({}, 'name'), []); object = {}; defineMetadata('key', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key']); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), []); object = {}; defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); defineMetadata('key0', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); prototype = {}; defineMetadata('key2', 'value', prototype, 'name'); object = create(prototype); defineMetadata('key0', 'value', object, 'name'); defineMetadata('key1', 'value', object, 'name'); assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); }); core-js-3.6.1/tests/tests/esnext.reflect.has-metadata.js000066400000000000000000000021011360057567700232200ustar00rootroot00000000000000QUnit.test('Reflect.hasMetadata', assert => { const { defineMetadata, hasMetadata } = Reflect; const { create } = Object; assert.isFunction(hasMetadata); assert.arity(hasMetadata, 2); assert.name(hasMetadata, 'hasMetadata'); assert.looksNative(hasMetadata); assert.nonEnumerable(Reflect, 'hasMetadata'); assert.throws(() => hasMetadata('key', undefined, undefined), TypeError); assert.same(hasMetadata('key', {}, undefined), false); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(hasMetadata('key', object, undefined), true); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(hasMetadata('key', object, undefined), true); assert.same(hasMetadata('key', {}, 'name'), false); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(hasMetadata('key', object, 'name'), true); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(hasMetadata('key', object, 'name'), true); }); core-js-3.6.1/tests/tests/esnext.reflect.has-own-metadata.js000066400000000000000000000021601360057567700240260ustar00rootroot00000000000000QUnit.test('Reflect.hasOwnMetadata', assert => { const { defineMetadata, hasOwnMetadata } = Reflect; const { create } = Object; assert.isFunction(hasOwnMetadata); assert.arity(hasOwnMetadata, 2); assert.name(hasOwnMetadata, 'hasOwnMetadata'); assert.looksNative(hasOwnMetadata); assert.nonEnumerable(Reflect, 'hasOwnMetadata'); assert.throws(() => hasOwnMetadata('key', undefined, undefined), TypeError); assert.same(hasOwnMetadata('key', {}, undefined), false); let object = {}; defineMetadata('key', 'value', object, undefined); assert.same(hasOwnMetadata('key', object, undefined), true); let prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, undefined); assert.same(hasOwnMetadata('key', object, undefined), false); assert.same(hasOwnMetadata('key', {}, 'name'), false); object = {}; defineMetadata('key', 'value', object, 'name'); assert.same(hasOwnMetadata('key', object, 'name'), true); prototype = {}; object = create(prototype); defineMetadata('key', 'value', prototype, 'name'); assert.same(hasOwnMetadata('key', object, 'name'), false); }); core-js-3.6.1/tests/tests/esnext.reflect.metadata.js000066400000000000000000000012221360057567700224520ustar00rootroot00000000000000QUnit.test('Reflect.metadata', assert => { const { metadata, hasOwnMetadata } = Reflect; assert.isFunction(metadata); assert.arity(metadata, 2); assert.name(metadata, 'metadata'); assert.looksNative(metadata); assert.isFunction(metadata('key', 'value')); assert.nonEnumerable(Reflect, 'metadata'); const decorator = metadata('key', 'value'); assert.throws(() => decorator(undefined, 'name'), TypeError); let target = function () { /* empty */ }; decorator(target); assert.same(hasOwnMetadata('key', target, undefined), true); target = {}; decorator(target, 'name'); assert.same(hasOwnMetadata('key', target, 'name'), true); }); core-js-3.6.1/tests/tests/esnext.set.add-all.js000066400000000000000000000014611360057567700213440ustar00rootroot00000000000000QUnit.test('Set#addAll', assert => { const { addAll } = Set.prototype; const { from } = Array; assert.isFunction(addAll); assert.arity(addAll, 0); assert.name(addAll, 'addAll'); assert.looksNative(addAll); assert.nonEnumerable(Set.prototype, 'addAll'); const set = new Set([1]); assert.same(set.addAll(2), set); assert.deepEqual(from(new Set([1, 2, 3]).addAll(4, 5)), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).addAll(3, 4)), [1, 2, 3, 4]); assert.deepEqual(from(new Set([1, 2, 3]).addAll()), [1, 2, 3]); assert.notThrows(() => addAll.call({ add() { /* empty */ } }, 1, 2, 3)); assert.throws(() => addAll.call({}, 1, 2, 3), TypeError); assert.throws(() => addAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => addAll.call(null, 1, 2, 3), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.delete-all.js000066400000000000000000000017761360057567700220670ustar00rootroot00000000000000QUnit.test('Set#deleteAll', assert => { const { deleteAll } = Set.prototype; const { from } = Array; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.looksNative(deleteAll); assert.nonEnumerable(Set.prototype, 'deleteAll'); let set = new Set([1, 2, 3]); assert.same(set.deleteAll(1, 2), true); assert.deepEqual(from(set), [3]); set = new Set([1, 2, 3]); assert.same(set.deleteAll(3, 4), false); assert.deepEqual(from(set), [1, 2]); set = new Set([1, 2, 3]); assert.same(set.deleteAll(4, 5), false); assert.deepEqual(from(set), [1, 2, 3]); set = new Set([1, 2, 3]); assert.same(set.deleteAll(), true); assert.deepEqual(from(set), [1, 2, 3]); assert.notThrows(() => !deleteAll.call({ delete() { /* empty */ } }, 1, 2, 3)); assert.throws(() => deleteAll.call({}, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(undefined, 1, 2, 3), TypeError); assert.throws(() => deleteAll.call(null, 1, 2, 3), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.difference.js000066400000000000000000000016601360057567700221410ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Set#difference', assert => { const { difference } = Set.prototype; const { from } = Array; assert.isFunction(difference); assert.arity(difference, 1); assert.name(difference, 'difference'); assert.looksNative(difference); assert.nonEnumerable(Set.prototype, 'difference'); const set = new Set([1]); assert.ok(set.difference([2]) !== set); assert.deepEqual(from(new Set([1, 2, 3]).difference([4, 5])), [1, 2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).difference([3, 4])), [1, 2]); assert.deepEqual(from(new Set([1, 2, 3]).difference(createIterable([3, 4]))), [1, 2]); assert.throws(() => new Set([1, 2, 3]).difference(), TypeError); assert.throws(() => difference.call({}, [1, 2, 3]), TypeError); assert.throws(() => difference.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => difference.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.every.js000066400000000000000000000025021360057567700211750ustar00rootroot00000000000000QUnit.test('Set#every', assert => { const { every } = Set.prototype; assert.isFunction(every); assert.arity(every, 1); assert.name(every, 'every'); assert.looksNative(every); assert.nonEnumerable(Set.prototype, 'every'); const set = new Set([1]); const context = {}; set.every(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Set([1, 2, 3]).every(it => typeof it === 'number'), true); assert.same(new Set(['1', '2', '3']).some(it => typeof it === 'number'), false); assert.same(new Set([1, '2', 3]).every(it => typeof it === 'number'), false); assert.same(new Set().every(it => typeof it === 'number'), true); assert.throws(() => every.call(new Map(), () => { /* empty */ }), TypeError); assert.throws(() => every.call({}, () => { /* empty */ }), TypeError); assert.throws(() => every.call([], () => { /* empty */ }), TypeError); assert.throws(() => every.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => every.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.filter.js000066400000000000000000000023501360057567700213310ustar00rootroot00000000000000QUnit.test('Set#filter', assert => { const { filter } = Set.prototype; const { from } = Array; assert.isFunction(filter); assert.arity(filter, 1); assert.name(filter, 'filter'); assert.looksNative(filter); assert.nonEnumerable(Set.prototype, 'filter'); const set = new Set([1]); const context = {}; set.filter(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(new Set().filter(it => it) instanceof Set); assert.deepEqual(from(new Set([1, 2, 3, 'q', {}, 4, true, 5]).filter(it => typeof it === 'number')), [1, 2, 3, 4, 5]); assert.throws(() => filter.call(new Map(), () => { /* empty */ }), TypeError); assert.throws(() => filter.call({}, () => { /* empty */ }), TypeError); assert.throws(() => filter.call([], () => { /* empty */ }), TypeError); assert.throws(() => filter.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => filter.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.find.js000066400000000000000000000021641360057567700207670ustar00rootroot00000000000000QUnit.test('Set#find', assert => { const { find } = Set.prototype; assert.isFunction(find); assert.arity(find, 1); assert.name(find, 'find'); assert.looksNative(find); assert.nonEnumerable(Set.prototype, 'find'); const set = new Set([1]); const context = {}; set.find(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Set([2, 3, 4]).find(it => it % 2), 3); assert.same(new Set().find(it => it === 42), undefined); assert.throws(() => find.call(new Map(), () => { /* empty */ }), TypeError); assert.throws(() => find.call({}, () => { /* empty */ }), TypeError); assert.throws(() => find.call([], () => { /* empty */ }), TypeError); assert.throws(() => find.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => find.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.from.js000066400000000000000000000016741360057567700210170ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Set.from', assert => { const { from } = Set; const toArray = Array.from; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(Set, 'from'); assert.ok(Set.from() instanceof Set); assert.deepEqual(toArray(Set.from([])), []); assert.deepEqual(toArray(Set.from([1])), [1]); assert.deepEqual(toArray(Set.from([1, 2, 3, 2, 1])), [1, 2, 3]); assert.deepEqual(toArray(Set.from(createIterable([1, 2, 3, 2, 1]))), [1, 2, 3]); const context = {}; Set.from([1], function (element, index) { assert.same(element, 1); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from(1)); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.6.1/tests/tests/esnext.set.intersection.js000066400000000000000000000017171360057567700225600ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Set#intersection', assert => { const { intersection } = Set.prototype; const { from } = Array; assert.isFunction(intersection); assert.arity(intersection, 1); assert.name(intersection, 'intersection'); assert.looksNative(intersection); assert.nonEnumerable(Set.prototype, 'intersection'); const set = new Set([1]); assert.ok(set.intersection([2]) !== set); assert.deepEqual(from(new Set([1, 2, 3]).intersection([4, 5])), []); assert.deepEqual(from(new Set([1, 2, 3]).intersection([2, 3, 4])), [2, 3]); assert.deepEqual(from(new Set([1, 2, 3]).intersection(createIterable([2, 3, 4]))), [2, 3]); assert.throws(() => new Set([1, 2, 3]).intersection(), TypeError); assert.throws(() => intersection.call({}, [1, 2, 3]), TypeError); assert.throws(() => intersection.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => intersection.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.is-disjoint-from.js000066400000000000000000000017461360057567700232510ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Set#isDisjointFrom', assert => { const { isDisjointFrom } = Set.prototype; assert.isFunction(isDisjointFrom); assert.arity(isDisjointFrom, 1); assert.name(isDisjointFrom, 'isDisjointFrom'); assert.looksNative(isDisjointFrom); assert.nonEnumerable(Set.prototype, 'isDisjointFrom'); assert.ok(new Set([1]).isDisjointFrom([2])); assert.ok(!new Set([1]).isDisjointFrom([1])); assert.ok(new Set([1, 2, 3]).isDisjointFrom([4, 5, 6])); assert.ok(!new Set([1, 2, 3]).isDisjointFrom([5, 4, 3])); assert.ok(new Set([1]).isDisjointFrom(createIterable([2]))); assert.ok(!new Set([1]).isDisjointFrom(createIterable([1]))); assert.throws(() => new Set([1, 2, 3]).isDisjointFrom(), TypeError); assert.throws(() => isDisjointFrom.call({}, [1, 2, 3]), TypeError); assert.throws(() => isDisjointFrom.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isDisjointFrom.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.is-subset-of.js000066400000000000000000000022321360057567700223630ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Set#isSubsetOf', assert => { const { isSubsetOf } = Set.prototype; assert.isFunction(isSubsetOf); assert.arity(isSubsetOf, 1); assert.name(isSubsetOf, 'isSubsetOf'); assert.looksNative(isSubsetOf); assert.nonEnumerable(Set.prototype, 'isSubsetOf'); assert.ok(new Set([1]).isSubsetOf([1, 2, 3])); assert.ok(!new Set([1]).isSubsetOf([2, 3, 4])); assert.ok(new Set([1, 2, 3]).isSubsetOf([5, 4, 3, 2, 1])); assert.ok(!new Set([1, 2, 3]).isSubsetOf([5, 4, 3, 2])); assert.ok(new Set([1]).isSubsetOf(createIterable([1, 2, 3]))); assert.ok(!new Set([1]).isSubsetOf(createIterable([2, 3, 4]))); assert.ok(new Set([1]).isSubsetOf({ has: () => true })); assert.ok(!new Set([1]).isSubsetOf({ has: () => false })); assert.ok(isSubsetOf.call('ab', ['a', 'b', 'c'])); assert.ok(!isSubsetOf.call('ab', ['a'])); assert.throws(() => new Set([1, 2, 3]).isSubsetOf(), TypeError); assert.throws(() => isSubsetOf.call({}, [1, 2, 3]), TypeError); assert.throws(() => isSubsetOf.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isSubsetOf.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.is-superset-of.js000066400000000000000000000017431360057567700227360ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Set#isSupersetOf', assert => { const { isSupersetOf } = Set.prototype; assert.isFunction(isSupersetOf); assert.arity(isSupersetOf, 1); assert.name(isSupersetOf, 'isSupersetOf'); assert.looksNative(isSupersetOf); assert.nonEnumerable(Set.prototype, 'isSupersetOf'); assert.ok(new Set([1, 2, 3]).isSupersetOf([1])); assert.ok(!new Set([2, 3, 4]).isSupersetOf([1])); assert.ok(new Set([5, 4, 3, 2, 1]).isSupersetOf([1, 2, 3])); assert.ok(!new Set([5, 4, 3, 2]).isSupersetOf([1, 2, 3])); assert.ok(new Set([1, 2, 3]).isSupersetOf(createIterable([1]))); assert.ok(!new Set([2, 3, 4]).isSupersetOf(createIterable([1]))); assert.throws(() => new Set([1, 2, 3]).isSupersetOf(), TypeError); assert.throws(() => isSupersetOf.call({}, [1, 2, 3]), TypeError); assert.throws(() => isSupersetOf.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => isSupersetOf.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.join.js000066400000000000000000000012471360057567700210070ustar00rootroot00000000000000QUnit.test('Set#join', assert => { const { join } = Set.prototype; assert.isFunction(join); assert.arity(join, 1); assert.name(join, 'join'); assert.looksNative(join); assert.nonEnumerable(Set.prototype, 'join'); assert.strictEqual(new Set([1, 2, 3]).join(), '1,2,3'); assert.strictEqual(new Set([1, 2, 3]).join(undefined), '1,2,3'); assert.strictEqual(new Set([1, 2, 3]).join('|'), '1|2|3'); assert.throws(() => join.call(new Map()), TypeError); assert.throws(() => join.call({}), TypeError); assert.throws(() => join.call([]), TypeError); assert.throws(() => join.call(undefined), TypeError); assert.throws(() => join.call(null), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.map.js000066400000000000000000000023261360057567700206240ustar00rootroot00000000000000QUnit.test('Set#map', assert => { const { map } = Set.prototype; const { from } = Array; assert.isFunction(map); assert.arity(map, 1); assert.name(map, 'map'); assert.looksNative(map); assert.nonEnumerable(Set.prototype, 'map'); const set = new Set([1]); const context = {}; set.map(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.ok(new Set().map(it => it) instanceof Set); assert.deepEqual(from(new Set([1, 2, 3]).map(it => it ** 2)), [1, 4, 9]); assert.deepEqual(from(new Set([1, 2, 3]).map(it => it % 2)), [1, 0]); assert.throws(() => map.call(new Map(), () => { /* empty */ }), TypeError); assert.throws(() => map.call({}, () => { /* empty */ }), TypeError); assert.throws(() => map.call([], () => { /* empty */ }), TypeError); assert.throws(() => map.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => map.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.of.js000066400000000000000000000010101360057567700204400ustar00rootroot00000000000000QUnit.test('Set.of', assert => { const { of } = Set; const toArray = Array.from; assert.isFunction(of); assert.arity(of, 0); assert.name(of, 'of'); assert.looksNative(of); assert.nonEnumerable(Set, 'of'); assert.ok(Set.of() instanceof Set); assert.deepEqual(toArray(Set.of(1)), [1]); assert.deepEqual(toArray(Set.of(1, 2, 3, 2, 1)), [1, 2, 3]); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.6.1/tests/tests/esnext.set.reduce.js000066400000000000000000000034231360057567700213150ustar00rootroot00000000000000QUnit.test('Set#reduce', assert => { const { reduce } = Set.prototype; assert.isFunction(reduce); assert.arity(reduce, 1); assert.name(reduce, 'reduce'); assert.looksNative(reduce); assert.nonEnumerable(Set.prototype, 'reduce'); const set = new Set([1]); const accumulator = {}; set.reduce(function (memo, value, key, that) { assert.same(arguments.length, 4, 'correct number of callback arguments'); assert.same(memo, accumulator, 'correct callback accumulator'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct index in callback'); assert.same(that, set, 'correct link to set in callback'); }, accumulator); assert.same(new Set([1, 2, 3]).reduce(((a, b) => a + b), 1), 7, 'works with initial accumulator'); new Set([1, 2]).reduce((memo, value, key) => { assert.same(memo, 1, 'correct default accumulator'); assert.same(value, 2, 'correct start value without initial accumulator'); assert.same(key, 2, 'correct start index without initial accumulator'); }); assert.same(new Set([1, 2, 3]).reduce((a, b) => a + b), 6, 'works without initial accumulator'); let values = ''; let keys = ''; new Set([1, 2, 3]).reduce((memo, value, key, s) => { s.delete(2); values += value; keys += key; }, 0); assert.same(values, '13', 'correct order #1'); assert.same(keys, '13', 'correct order #2'); assert.throws(() => reduce.call(new Map(), () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call({}, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call([], () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(undefined, () => { /* empty */ }, 1), TypeError); assert.throws(() => reduce.call(null, () => { /* empty */ }, 1), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.some.js000066400000000000000000000024611360057567700210120ustar00rootroot00000000000000QUnit.test('Set#some', assert => { const { some } = Set.prototype; assert.isFunction(some); assert.arity(some, 1); assert.name(some, 'some'); assert.looksNative(some); assert.nonEnumerable(Set.prototype, 'some'); const set = new Set([1]); const context = {}; set.some(function (value, key, that) { assert.same(arguments.length, 3, 'correct number of callback arguments'); assert.same(value, 1, 'correct value in callback'); assert.same(key, 1, 'correct key in callback'); assert.same(that, set, 'correct link to set in callback'); assert.same(this, context, 'correct callback context'); }, context); assert.same(new Set([1, 2, 3]).some(it => typeof it === 'number'), true); assert.same(new Set(['1', '2', '3']).some(it => typeof it === 'number'), false); assert.same(new Set([1, '2', 3]).some(it => typeof it === 'number'), true); assert.same(new Set().some(it => typeof it === 'number'), false); assert.throws(() => some.call(new Map(), () => { /* empty */ }), TypeError); assert.throws(() => some.call({}, () => { /* empty */ }), TypeError); assert.throws(() => some.call([], () => { /* empty */ }), TypeError); assert.throws(() => some.call(undefined, () => { /* empty */ }), TypeError); assert.throws(() => some.call(null, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.symmetric-difference.js000066400000000000000000000021141360057567700241460ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Set#symmetricDifference', assert => { const { symmetricDifference } = Set.prototype; const { from } = Array; assert.isFunction(symmetricDifference); assert.arity(symmetricDifference, 1); assert.name(symmetricDifference, 'symmetricDifference'); assert.looksNative(symmetricDifference); assert.nonEnumerable(Set.prototype, 'symmetricDifference'); const set = new Set([1]); assert.ok(set.symmetricDifference([2]) !== set); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference([4, 5])), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference([3, 4])), [1, 2, 4]); assert.deepEqual(from(new Set([1, 2, 3]).symmetricDifference(createIterable([3, 4]))), [1, 2, 4]); assert.throws(() => new Set([1, 2, 3]).symmetricDifference(), TypeError); assert.throws(() => symmetricDifference.call({}, [1, 2, 3]), TypeError); assert.throws(() => symmetricDifference.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => symmetricDifference.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/tests/esnext.set.union.js000066400000000000000000000015621360057567700212000ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('Set#union', assert => { const { union } = Set.prototype; const { from } = Array; assert.isFunction(union); assert.arity(union, 1); assert.name(union, 'union'); assert.looksNative(union); assert.nonEnumerable(Set.prototype, 'union'); const set = new Set([1]); assert.ok(set.union([2]) !== set); assert.deepEqual(from(new Set([1, 2, 3]).union([4, 5])), [1, 2, 3, 4, 5]); assert.deepEqual(from(new Set([1, 2, 3]).union([3, 4])), [1, 2, 3, 4]); assert.deepEqual(from(new Set([1, 2, 3]).union(createIterable([3, 4]))), [1, 2, 3, 4]); assert.throws(() => new Set([1, 2, 3]).union(), TypeError); assert.throws(() => union.call({}, [1, 2, 3]), TypeError); assert.throws(() => union.call(undefined, [1, 2, 3]), TypeError); assert.throws(() => union.call(null, [1, 2, 3]), TypeError); }); core-js-3.6.1/tests/tests/esnext.string.at.js000066400000000000000000000111641360057567700211660ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('String#at', assert => { const { at } = String.prototype; assert.isFunction(at); assert.arity(at, 1); assert.name(at, 'at'); assert.looksNative(at); assert.nonEnumerable(String.prototype, 'at'); // String that starts with a BMP symbol assert.strictEqual('abc\uD834\uDF06def'.at(-Infinity), ''); assert.strictEqual('abc\uD834\uDF06def'.at(-1), ''); assert.strictEqual('abc\uD834\uDF06def'.at(-0), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at(+0), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at(1), 'b'); assert.strictEqual('abc\uD834\uDF06def'.at(3), '\uD834\uDF06'); assert.strictEqual('abc\uD834\uDF06def'.at(4), '\uDF06'); assert.strictEqual('abc\uD834\uDF06def'.at(5), 'd'); assert.strictEqual('abc\uD834\uDF06def'.at(42), ''); assert.strictEqual('abc\uD834\uDF06def'.at(Infinity), ''); assert.strictEqual('abc\uD834\uDF06def'.at(null), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at(undefined), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at(), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at(false), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at(NaN), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at(''), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at('_'), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at('1'), 'b'); assert.strictEqual('abc\uD834\uDF06def'.at([]), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at({}), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at(-0.9), 'a'); assert.strictEqual('abc\uD834\uDF06def'.at(1.9), 'b'); assert.strictEqual('abc\uD834\uDF06def'.at(7.9), 'f'); assert.strictEqual('abc\uD834\uDF06def'.at(2 ** 32), ''); // String that starts with an astral symbol assert.strictEqual('\uD834\uDF06def'.at(-Infinity), ''); assert.strictEqual('\uD834\uDF06def'.at(-1), ''); assert.strictEqual('\uD834\uDF06def'.at(-0), '\uD834\uDF06'); assert.strictEqual('\uD834\uDF06def'.at(0), '\uD834\uDF06'); assert.strictEqual('\uD834\uDF06def'.at(1), '\uDF06'); assert.strictEqual('\uD834\uDF06def'.at(2), 'd'); assert.strictEqual('\uD834\uDF06def'.at(3), 'e'); assert.strictEqual('\uD834\uDF06def'.at(4), 'f'); assert.strictEqual('\uD834\uDF06def'.at(42), ''); assert.strictEqual('\uD834\uDF06def'.at(Infinity), ''); assert.strictEqual('\uD834\uDF06def'.at(null), '\uD834\uDF06'); assert.strictEqual('\uD834\uDF06def'.at(undefined), '\uD834\uDF06'); assert.strictEqual('\uD834\uDF06def'.at(), '\uD834\uDF06'); assert.strictEqual('\uD834\uDF06def'.at(false), '\uD834\uDF06'); assert.strictEqual('\uD834\uDF06def'.at(NaN), '\uD834\uDF06'); assert.strictEqual('\uD834\uDF06def'.at(''), '\uD834\uDF06'); assert.strictEqual('\uD834\uDF06def'.at('_'), '\uD834\uDF06'); assert.strictEqual('\uD834\uDF06def'.at('1'), '\uDF06'); // Lone high surrogates assert.strictEqual('\uD834abc'.at(-Infinity), ''); assert.strictEqual('\uD834abc'.at(-1), ''); assert.strictEqual('\uD834abc'.at(-0), '\uD834'); assert.strictEqual('\uD834abc'.at(0), '\uD834'); assert.strictEqual('\uD834abc'.at(1), 'a'); assert.strictEqual('\uD834abc'.at(42), ''); assert.strictEqual('\uD834abc'.at(Infinity), ''); assert.strictEqual('\uD834abc'.at(null), '\uD834'); assert.strictEqual('\uD834abc'.at(undefined), '\uD834'); assert.strictEqual('\uD834abc'.at(), '\uD834'); assert.strictEqual('\uD834abc'.at(false), '\uD834'); assert.strictEqual('\uD834abc'.at(NaN), '\uD834'); assert.strictEqual('\uD834abc'.at(''), '\uD834'); assert.strictEqual('\uD834abc'.at('_'), '\uD834'); assert.strictEqual('\uD834abc'.at('1'), 'a'); // Lone low surrogates assert.strictEqual('\uDF06abc'.at(-Infinity), ''); assert.strictEqual('\uDF06abc'.at(-1), ''); assert.strictEqual('\uDF06abc'.at(-0), '\uDF06'); assert.strictEqual('\uDF06abc'.at(0), '\uDF06'); assert.strictEqual('\uDF06abc'.at(1), 'a'); assert.strictEqual('\uDF06abc'.at(42), ''); assert.strictEqual('\uDF06abc'.at(Infinity), ''); assert.strictEqual('\uDF06abc'.at(null), '\uDF06'); assert.strictEqual('\uDF06abc'.at(undefined), '\uDF06'); assert.strictEqual('\uDF06abc'.at(), '\uDF06'); assert.strictEqual('\uDF06abc'.at(false), '\uDF06'); assert.strictEqual('\uDF06abc'.at(NaN), '\uDF06'); assert.strictEqual('\uDF06abc'.at(''), '\uDF06'); assert.strictEqual('\uDF06abc'.at('_'), '\uDF06'); assert.strictEqual('\uDF06abc'.at('1'), 'a'); assert.strictEqual(at.call(42, 0), '4'); assert.strictEqual(at.call(42, 1), '2'); assert.strictEqual(at.call({ toString() { return 'abc'; }, }, 2), 'c'); if (STRICT) { assert.throws(() => at.call(null, 0), TypeError); assert.throws(() => at.call(undefined, 0), TypeError); } }); core-js-3.6.1/tests/tests/esnext.string.code-points.js000066400000000000000000000026561360057567700230140ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('String#codePoints', assert => { const { codePoints } = String.prototype; assert.isFunction(codePoints); assert.arity(codePoints, 0); assert.name(codePoints, 'codePoints'); assert.looksNative(codePoints); assert.nonEnumerable(String.prototype, 'codePoints'); let iterator = 'qwe'.codePoints(); assert.isIterator(iterator); assert.isIterable(iterator); assert.strictEqual(iterator[Symbol.toStringTag], 'String Iterator'); assert.strictEqual(String(iterator), '[object String Iterator]'); assert.deepEqual(iterator.next(), { value: { codePoint: 113, position: 0 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 119, position: 1 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 101, position: 2 }, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); iterator = '𠮷𠮷𠮷'.codePoints(); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 0 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 2 }, done: false, }); assert.deepEqual(iterator.next(), { value: { codePoint: 134071, position: 4 }, done: false, }); assert.deepEqual(iterator.next(), { value: undefined, done: true, }); }); core-js-3.6.1/tests/tests/esnext.string.replace-all.js000066400000000000000000000032411360057567700227400ustar00rootroot00000000000000import { STRICT } from '../helpers/constants'; QUnit.test('String#replaceAll', assert => { const { replaceAll } = String.prototype; assert.isFunction(replaceAll); assert.arity(replaceAll, 2); assert.name(replaceAll, 'replaceAll'); assert.looksNative(replaceAll); assert.nonEnumerable(String.prototype, 'replaceAll'); assert.same('q=query+string+parameters'.replaceAll('+', ' '), 'q=query string parameters'); assert.same('foo'.replaceAll('o', {}), 'f[object Object][object Object]'); assert.same('[object Object]x[object Object]'.replaceAll({}, 'y'), 'yxy'); assert.same(replaceAll.call({}, 'bject', 'lolo'), '[ololo Ololo]'); assert.same('aba'.replaceAll('b', (search, i, string) => { assert.same(search, 'b', '`search` is `b`'); assert.same(i, 1, '`i` is 1'); assert.same(string, 'aba', '`string` is `aba`'); return 'c'; }), 'aca'); const searcher = { [Symbol.replace](O, replaceValue) { assert.same(this, searcher, '`this` is `searcher`'); assert.same(String(O), 'aba', '`O` is `aba`'); assert.same(String(replaceValue), 'c', '`replaceValue` is `c`'); return 'foo'; }, }; assert.same('aba'.replaceAll(searcher, 'c'), 'foo'); assert.same('aba'.replaceAll('b'), 'aundefineda'); assert.same('xxx'.replaceAll('', '_'), '_x_x_x_'); if (STRICT) { assert.throws(() => replaceAll.call(null, 'a', 'b'), TypeError); assert.throws(() => replaceAll.call(undefined, 'a', 'b'), TypeError); } assert.throws(() => 'b.b.b.b.b'.replaceAll(/\./, 'a'), TypeError); assert.same('b.b.b.b.b'.replaceAll(/\./g, 'a'), 'babababab'); const object = {}; assert.same('[object Object]'.replaceAll(object, 'a'), 'a'); }); core-js-3.6.1/tests/tests/esnext.symbol.async-dispose.js000066400000000000000000000011171360057567700233370ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Symbol.asyncDispose', assert => { assert.ok('asyncDispose' in Symbol, 'Symbol.asyncDispose available'); assert.nonEnumerable(Symbol, 'asyncDispose'); assert.ok(Object(Symbol.asyncDispose) instanceof Symbol, 'Symbol.asyncDispose is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'asyncDispose'); assert.ok(!descriptor.enumerble, 'non-enumerable'); assert.ok(!descriptor.writable, 'non-writable'); assert.ok(!descriptor.configurable, 'non-configurable'); } }); core-js-3.6.1/tests/tests/esnext.symbol.dispose.js000066400000000000000000000010541360057567700222240ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Symbol.dispose', assert => { assert.ok('dispose' in Symbol, 'Symbol.dispose available'); assert.nonEnumerable(Symbol, 'dispose'); assert.ok(Object(Symbol.dispose) instanceof Symbol, 'Symbol.dispose is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'dispose'); assert.ok(!descriptor.enumerble, 'non-enumerable'); assert.ok(!descriptor.writable, 'non-writable'); assert.ok(!descriptor.configurable, 'non-configurable'); } }); core-js-3.6.1/tests/tests/esnext.symbol.observable.js000066400000000000000000000011011360057567700226730ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Symbol.observable', assert => { assert.ok('observable' in Symbol, 'Symbol.observable available'); assert.nonEnumerable(Symbol, 'observable'); assert.ok(Object(Symbol.observable) instanceof Symbol, 'Symbol.observable is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'observable'); assert.ok(!descriptor.enumerble, 'non-enumerable'); assert.ok(!descriptor.writable, 'non-writable'); assert.ok(!descriptor.configurable, 'non-configurable'); } }); core-js-3.6.1/tests/tests/esnext.symbol.pattern-match.js000066400000000000000000000011171360057567700233250ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Symbol.patternMatch', assert => { assert.ok('patternMatch' in Symbol, 'Symbol.patternMatch available'); assert.nonEnumerable(Symbol, 'patternMatch'); assert.ok(Object(Symbol.patternMatch) instanceof Symbol, 'Symbol.patternMatch is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'patternMatch'); assert.ok(!descriptor.enumerble, 'non-enumerable'); assert.ok(!descriptor.writable, 'non-writable'); assert.ok(!descriptor.configurable, 'non-configurable'); } }); core-js-3.6.1/tests/tests/esnext.symbol.replace-all.js000066400000000000000000000011041360057567700227330ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Symbol.replaceAll', assert => { assert.ok('replaceAll' in Symbol, 'Symbol.replaceAll is available'); assert.nonEnumerable(Symbol, 'replaceAll'); assert.ok(Object(Symbol.replaceAll) instanceof Symbol, 'Symbol.replaceAll is symbol'); if (DESCRIPTORS) { const descriptor = Object.getOwnPropertyDescriptor(Symbol, 'replaceAll'); assert.ok(!descriptor.enumerble, 'non-enumerable'); assert.ok(!descriptor.writable, 'non-writable'); assert.ok(!descriptor.configurable, 'non-configurable'); } }); core-js-3.6.1/tests/tests/esnext.weak-map.delete-all.js000066400000000000000000000027551360057567700227740ustar00rootroot00000000000000QUnit.test('WeakMap#deleteAll', assert => { const { deleteAll } = WeakMap.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.looksNative(deleteAll); assert.nonEnumerable(WeakMap.prototype, 'deleteAll'); const a = []; const b = []; const c = []; const d = []; const e = []; let set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.same(set.deleteAll(a, b), true); assert.ok(!set.has(a)); assert.ok(!set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.same(set.deleteAll(c, d), false); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(!set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.same(set.deleteAll(d, e), false); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakMap([[a, 1], [b, 2], [c, 3]]); assert.same(set.deleteAll(), true); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); assert.notThrows(() => !deleteAll.call({ delete() { /* empty */ } }, a, b, c)); assert.throws(() => deleteAll.call({}, a, b, c), TypeError); assert.throws(() => deleteAll.call(undefined, a, b, c), TypeError); assert.throws(() => deleteAll.call(null, a, b, c), TypeError); }); core-js-3.6.1/tests/tests/esnext.weak-map.from.js000066400000000000000000000015721360057567700217230ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('WeakMap.from', assert => { const { from } = WeakMap; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(WeakMap, 'from'); assert.ok(WeakMap.from() instanceof WeakMap); const array = []; assert.same(WeakMap.from([[array, 2]]).get(array), 2); assert.same(WeakMap.from(createIterable([[array, 2]])).get(array), 2); const pair = [{}, 1]; const context = {}; WeakMap.from([pair], function (element, index) { assert.same(element, pair); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from([{}, 1])); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.6.1/tests/tests/esnext.weak-map.of.js000066400000000000000000000007331360057567700213620ustar00rootroot00000000000000QUnit.test('WeakMap.of', assert => { const { of } = WeakMap; assert.isFunction(of); assert.arity(of, 0); assert.name(of, 'of'); assert.looksNative(of); assert.nonEnumerable(WeakMap, 'of'); const array = []; assert.ok(WeakMap.of() instanceof WeakMap); assert.same(WeakMap.of([array, 2]).get(array), 2); assert.throws(() => of(1)); let arg = null; function F(it) { return arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.6.1/tests/tests/esnext.weak-map.upsert.js000066400000000000000000000031101360057567700222700ustar00rootroot00000000000000QUnit.test('WeakMap#upsert', assert => { const { upsert } = WeakMap.prototype; assert.isFunction(upsert); assert.arity(upsert, 2); assert.name(upsert, 'upsert'); assert.looksNative(upsert); assert.nonEnumerable(WeakMap.prototype, 'upsert'); const a = {}; const b = {}; const map = new WeakMap([[a, 2]]); assert.same(map.upsert(a, function (value) { assert.same(arguments.length, 1, 'correct number of callback arguments'); assert.same(value, 2, 'correct value in callback'); return value ** 2; }, () => { assert.ok(false, 'should not be called'); return 3; }), 4, 'returns a correct value'); assert.same(map.upsert(b, value => { assert.ok(false, 'should not be called'); return value ** 2; }, function () { assert.same(arguments.length, 0, 'correct number of callback arguments'); return 3; }), 3, 'returns a correct value'); assert.same(map.get(a), 4, 'correct result #1'); assert.same(map.get(b), 3, 'correct result #2'); assert.same(new WeakMap([[a, 2]]).upsert(b, null, () => 3), 3); assert.same(new WeakMap([[a, 2]]).upsert(a, value => value ** 2), 4); assert.throws(() => new WeakMap().upsert(a), TypeError); assert.throws(() => upsert.call({}, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call([], a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(undefined, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); assert.throws(() => upsert.call(null, a, () => { /* empty */ }, () => { /* empty */ }), TypeError); }); core-js-3.6.1/tests/tests/esnext.weak-set.add-all.js000066400000000000000000000016101360057567700222650ustar00rootroot00000000000000QUnit.test('WeakSet#addAll', assert => { const { addAll } = WeakSet.prototype; assert.isFunction(addAll); assert.arity(addAll, 0); assert.name(addAll, 'addAll'); assert.looksNative(addAll); assert.nonEnumerable(WeakSet.prototype, 'addAll'); const a = []; const b = []; const c = []; let set = new WeakSet([a]); assert.same(set.addAll(b), set); set = new WeakSet([a]).addAll(b, c); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(set.has(c)); set = new WeakSet([a]).addAll(a, b); assert.ok(set.has(a)); assert.ok(set.has(b)); set = new WeakSet([a]).addAll(); assert.ok(set.has(a)); assert.notThrows(() => addAll.call({ add() { /* empty */ } }, a, b, c)); assert.throws(() => addAll.call({}, a, b, c), TypeError); assert.throws(() => addAll.call(undefined, a, b, c), TypeError); assert.throws(() => addAll.call(null, a, b, c), TypeError); }); core-js-3.6.1/tests/tests/esnext.weak-set.delete-all.js000066400000000000000000000026611360057567700230060ustar00rootroot00000000000000QUnit.test('WeakSet#deleteAll', assert => { const { deleteAll } = WeakSet.prototype; assert.isFunction(deleteAll); assert.arity(deleteAll, 0); assert.name(deleteAll, 'deleteAll'); assert.looksNative(deleteAll); assert.nonEnumerable(WeakSet.prototype, 'deleteAll'); const a = []; const b = []; const c = []; const d = []; const e = []; let set = new WeakSet([a, b, c]); assert.same(set.deleteAll(a, b), true); assert.ok(!set.has(a)); assert.ok(!set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakSet([a, b, c]); assert.same(set.deleteAll(c, d), false); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(!set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakSet([a, b, c]); assert.same(set.deleteAll(d, e), false); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); set = new WeakSet([a, b, c]); assert.same(set.deleteAll(), true); assert.ok(set.has(a)); assert.ok(set.has(b)); assert.ok(set.has(c)); assert.ok(!set.has(d)); assert.ok(!set.has(e)); assert.notThrows(() => !deleteAll.call({ delete() { /* empty */ } }, a, b, c)); assert.throws(() => deleteAll.call({}, a, b, c), TypeError); assert.throws(() => deleteAll.call(undefined, a, b, c), TypeError); assert.throws(() => deleteAll.call(null, a, b, c), TypeError); }); core-js-3.6.1/tests/tests/esnext.weak-set.from.js000066400000000000000000000015421360057567700217360ustar00rootroot00000000000000import { createIterable } from '../helpers/helpers'; QUnit.test('WeakSet.from', assert => { const { from } = WeakSet; assert.isFunction(from); assert.arity(from, 1); assert.name(from, 'from'); assert.looksNative(from); assert.nonEnumerable(WeakSet, 'from'); assert.ok(WeakSet.from() instanceof WeakSet); const array = []; assert.ok(WeakSet.from([array]).has(array)); assert.ok(WeakSet.from(createIterable([array])).has(array)); const object = {}; const context = {}; WeakSet.from([object], function (element, index) { assert.same(element, object); assert.same(index, 0); assert.same(this, context); return element; }, context); assert.throws(() => from({})); let arg = null; function F(it) { return arg = it; } from.call(F, createIterable([1, 2, 3]), it => it ** 2); assert.deepEqual(arg, [1, 4, 9]); }); core-js-3.6.1/tests/tests/esnext.weak-set.of.js000066400000000000000000000007121360057567700213750ustar00rootroot00000000000000QUnit.test('WeakSet.of', assert => { const { of } = WeakSet; assert.isFunction(of); assert.arity(of, 0); assert.name(of, 'of'); assert.looksNative(of); assert.nonEnumerable(WeakSet, 'of'); const array = []; assert.ok(WeakSet.of() instanceof WeakSet); assert.ok(WeakSet.of(array).has(array)); assert.throws(() => of(1)); let arg = null; function F(it) { arg = it; } of.call(F, 1, 2, 3); assert.deepEqual(arg, [1, 2, 3]); }); core-js-3.6.1/tests/tests/index.js000066400000000000000000000242661360057567700170660ustar00rootroot00000000000000/* eslint-disable import/first */ QUnit.module('ES'); import './es.array.concat'; import './es.array.copy-within'; import './es.array.every'; import './es.array.fill'; import './es.array.filter'; import './es.array.find-index'; import './es.array.find'; import './es.array.for-each'; import './es.array.flat'; import './es.array.flat-map'; import './es.array.from'; import './es.array.includes'; import './es.array.index-of'; import './es.array.is-array'; import './es.array.iterator'; import './es.array.join'; import './es.array.last-index-of'; import './es.array.map'; import './es.array.of'; import './es.array.reduce-right'; import './es.array.reduce'; import './es.array.reverse'; import './es.array.slice'; import './es.array.some'; import './es.array.sort'; import './es.array.splice'; import './es.date.now'; import './es.date.to-iso-string'; import './es.date.to-json'; import './es.date.to-primitive'; import './es.date.to-string'; import './es.function.bind'; import './es.function.has-instance'; import './es.function.name'; import './es.global-this'; import './es.json.stringify'; import './es.map'; import './es.math.acosh'; import './es.math.asinh'; import './es.math.atanh'; import './es.math.cbrt'; import './es.math.clz32'; import './es.math.cosh'; import './es.math.expm1'; import './es.math.fround'; import './es.math.hypot'; import './es.math.imul'; import './es.math.log10'; import './es.math.log1p'; import './es.math.log2'; import './es.math.sign'; import './es.math.sinh'; import './es.math.tanh'; import './es.math.trunc'; import './es.number.constructor'; import './es.number.epsilon'; import './es.number.is-finite'; import './es.number.is-integer'; import './es.number.is-nan'; import './es.number.is-safe-integer'; import './es.number.max-safe-integer'; import './es.number.min-safe-integer'; import './es.number.parse-float'; import './es.number.parse-int'; import './es.number.to-fixed'; import './es.number.to-precision'; import './es.object.assign'; import './es.object.create'; import './es.object.define-getter'; import './es.object.define-properties'; import './es.object.define-property'; import './es.object.define-setter'; import './es.object.entries'; import './es.object.from-entries'; import './es.object.freeze'; import './es.object.get-own-property-descriptor'; import './es.object.get-own-property-descriptors'; import './es.object.get-own-property-names'; import './es.object.get-prototype-of'; import './es.object.is-extensible'; import './es.object.is-frozen'; import './es.object.is-sealed'; import './es.object.is'; import './es.object.keys'; import './es.object.lookup-getter'; import './es.object.lookup-setter'; import './es.object.prevent-extensions'; import './es.object.seal'; import './es.object.set-prototype-of'; import './es.object.to-string'; import './es.object.values'; import './es.parse-float'; import './es.parse-int'; import './es.promise'; import './es.promise.all-settled'; import './es.promise.finally'; import './es.reflect.apply'; import './es.reflect.construct'; import './es.reflect.define-property'; import './es.reflect.delete-property'; import './es.reflect.get-own-property-descriptor'; import './es.reflect.get-prototype-of'; import './es.reflect.get'; import './es.reflect.has'; import './es.reflect.is-extensible'; import './es.reflect.own-keys'; import './es.reflect.prevent-extensions'; import './es.reflect.set-prototype-of'; import './es.reflect.set'; import './es.regexp.constructor'; import './es.regexp.exec'; import './es.regexp.flags'; import './es.regexp.sticky'; import './es.regexp.test'; import './es.regexp.to-string'; import './es.set'; import './es.string.anchor'; import './es.string.big'; import './es.string.blink'; import './es.string.bold'; import './es.string.code-point-at'; import './es.string.ends-with'; import './es.string.fixed'; import './es.string.fontcolor'; import './es.string.fontsize'; import './es.string.from-code-point'; import './es.string.includes'; import './es.string.italics'; import './es.string.iterator'; import './es.string.link'; import './es.string.match'; import './es.string.match-all'; import './es.string.pad-end'; import './es.string.pad-start'; import './es.string.raw'; import './es.string.repeat'; import './es.string.replace'; import './es.string.search'; import './es.string.small'; import './es.string.split'; import './es.string.starts-with'; import './es.string.strike'; import './es.string.sub'; import './es.string.sup'; import './es.string.trim'; import './es.string.trim-start'; import './es.string.trim-end'; import './es.symbol'; import './es.symbol.async-iterator'; import './es.symbol.description'; import './es.array-buffer.constructor'; import './es.array-buffer.is-view'; import './es.array-buffer.slice'; import './es.data-view'; import './es.typed.conversions.float32'; import './es.typed.conversions.float64'; import './es.typed.conversions.int16'; import './es.typed.conversions.int32'; import './es.typed.conversions.int8'; import './es.typed.conversions.uint16'; import './es.typed.conversions.uint32'; import './es.typed.conversions.uint8-clamped'; import './es.typed.conversions.uint8'; import './es.typed-array.constructors'; import './es.typed-array.copy-within'; import './es.typed-array.every'; import './es.typed-array.fill'; import './es.typed-array.filter'; import './es.typed-array.find-index'; import './es.typed-array.find'; import './es.typed-array.for-each'; import './es.typed-array.from'; import './es.typed-array.includes'; import './es.typed-array.index-of'; import './es.typed-array.iterator'; import './es.typed-array.join'; import './es.typed-array.last-index-of'; import './es.typed-array.map'; import './es.typed-array.of'; import './es.typed-array.reduce-right'; import './es.typed-array.reduce'; import './es.typed-array.reverse'; import './es.typed-array.set'; import './es.typed-array.slice'; import './es.typed-array.some'; import './es.typed-array.subarray'; import './es.typed-array.to-locale-string'; import './es.typed-array.to-string'; import './es.weak-map'; import './es.weak-set'; QUnit.module('ESNext'); import './esnext.aggregate-error'; import './esnext.array.is-template-object'; import './esnext.array.last-item'; import './esnext.array.last-index'; import './esnext.async-iterator.constructor'; import './esnext.async-iterator.as-indexed-pairs'; import './esnext.async-iterator.drop'; import './esnext.async-iterator.every'; import './esnext.async-iterator.filter'; import './esnext.async-iterator.find'; import './esnext.async-iterator.flat-map'; import './esnext.async-iterator.for-each'; import './esnext.async-iterator.from'; import './esnext.async-iterator.map'; import './esnext.async-iterator.reduce'; import './esnext.async-iterator.some'; import './esnext.async-iterator.take'; import './esnext.async-iterator.to-array'; import './esnext.composite-key'; import './esnext.composite-symbol'; import './esnext.iterator.constructor'; import './esnext.iterator.as-indexed-pairs'; import './esnext.iterator.drop'; import './esnext.iterator.every'; import './esnext.iterator.filter'; import './esnext.iterator.find'; import './esnext.iterator.flat-map'; import './esnext.iterator.for-each'; import './esnext.iterator.from'; import './esnext.iterator.map'; import './esnext.iterator.reduce'; import './esnext.iterator.some'; import './esnext.iterator.take'; import './esnext.iterator.to-array'; import './esnext.map.from'; import './esnext.map.of'; import './esnext.math.clamp'; import './esnext.math.deg-per-rad'; import './esnext.math.degrees'; import './esnext.math.fscale'; import './esnext.math.iaddh'; import './esnext.math.imulh'; import './esnext.math.isubh'; import './esnext.math.rad-per-deg'; import './esnext.math.radians'; import './esnext.math.scale'; import './esnext.math.signbit'; import './esnext.math.umulh'; import './esnext.math.seeded-prng'; import './esnext.number.from-string'; import './esnext.object.iterate-entries'; import './esnext.object.iterate-keys'; import './esnext.object.iterate-values'; import './esnext.observable'; import './esnext.promise.any'; import './esnext.promise.try'; import './esnext.reflect.define-metadata'; import './esnext.reflect.delete-metadata'; import './esnext.reflect.get-metadata-keys'; import './esnext.reflect.get-metadata'; import './esnext.reflect.get-own-matadata'; import './esnext.reflect.get-own-metadata-keys'; import './esnext.reflect.has-metadata'; import './esnext.reflect.has-own-metadata'; import './esnext.reflect.metadata'; import './esnext.map.delete-all'; import './esnext.map.every'; import './esnext.map.filter'; import './esnext.map.find'; import './esnext.map.find-key'; import './esnext.map.group-by'; import './esnext.map.includes'; import './esnext.map.key-by'; import './esnext.map.key-of'; import './esnext.map.map-keys'; import './esnext.map.map-values'; import './esnext.map.merge'; import './esnext.map.reduce'; import './esnext.map.some'; import './esnext.map.update'; import './esnext.map.update-or-insert'; import './esnext.map.upsert'; import './esnext.set.add-all'; import './esnext.set.delete-all'; import './esnext.set.difference'; import './esnext.set.every'; import './esnext.set.filter'; import './esnext.set.find'; import './esnext.set.from'; import './esnext.set.intersection'; import './esnext.set.is-disjoint-from'; import './esnext.set.is-subset-of'; import './esnext.set.is-superset-of'; import './esnext.set.join'; import './esnext.set.map'; import './esnext.set.of'; import './esnext.set.reduce'; import './esnext.set.some'; import './esnext.set.symmetric-difference'; import './esnext.set.union'; import './esnext.string.at'; import './esnext.string.code-points'; import './esnext.string.replace-all'; import './esnext.symbol.async-dispose'; import './esnext.symbol.dispose'; import './esnext.symbol.observable'; import './esnext.symbol.pattern-match'; import './esnext.symbol.replace-all'; import './esnext.weak-map.delete-all'; import './esnext.weak-map.from'; import './esnext.weak-map.of'; import './esnext.weak-map.upsert'; import './esnext.weak-set.add-all'; import './esnext.weak-set.delete-all'; import './esnext.weak-set.from'; import './esnext.weak-set.of'; QUnit.module('Web'); import './web.dom-collections.for-each'; import './web.dom-collections.iterator'; import './web.immediate'; import './web.queue-microtask'; import './web.timers'; import './web.url'; import './web.url-search-params'; core-js-3.6.1/tests/tests/web.dom-collections.for-each.js000066400000000000000000000011551360057567700233010ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants'; QUnit.test('forEach method on iterable DOM collections', assert => { let absent = true; const collections = [ 'NodeList', 'DOMTokenList', ]; for (const name of collections) { const Collection = GLOBAL[name]; if (Collection) { absent = false; assert.isFunction(Collection.prototype.forEach, `${ name }::forEach is a function`); assert.same(Collection.prototype.forEach, Array.prototype.forEach, `${ name }::forEach is equal of Array::forEach`); } } if (absent) { assert.ok(true, 'DOM collections are absent'); } }); core-js-3.6.1/tests/tests/web.dom-collections.iterator.js000066400000000000000000000043501360057567700234460ustar00rootroot00000000000000import { GLOBAL } from '../helpers/constants'; const Symbol = GLOBAL.Symbol || {}; QUnit.test('Iterable DOM collections', assert => { let absent = true; let collections = [ 'CSSRuleList', 'CSSStyleDeclaration', 'CSSValueList', 'ClientRectList', 'DOMRectList', 'DOMStringList', 'DOMTokenList', 'DataTransferItemList', 'FileList', 'HTMLAllCollection', 'HTMLCollection', 'HTMLFormElement', 'HTMLSelectElement', 'MediaList', 'MimeTypeArray', 'NamedNodeMap', 'NodeList', 'PaintRequestList', 'Plugin', 'PluginArray', 'SVGLengthList', 'SVGNumberList', 'SVGPathSegList', 'SVGPointList', 'SVGStringList', 'SVGTransformList', 'SourceBufferList', 'StyleSheetList', 'TextTrackCueList', 'TextTrackList', 'TouchList', ]; for (const name of collections) { const Collection = GLOBAL[name]; if (Collection) { assert.same(Collection.prototype[Symbol.toStringTag], name, `${ name }::@@toStringTag is '${ name }'`); assert.isFunction(Collection.prototype[Symbol.iterator], `${ name }::@@iterator is function`); absent = false; } } if (GLOBAL.NodeList && GLOBAL.document && document.querySelectorAll && document.querySelectorAll('div') instanceof NodeList) { assert.isFunction(document.querySelectorAll('div')[Symbol.iterator], 'works with document.querySelectorAll'); } collections = [ 'NodeList', 'DOMTokenList', ]; for (const name of collections) { const Collection = GLOBAL[name]; if (Collection) { assert.isFunction(Collection.prototype.values, `${ name }::values is function`); assert.same(Collection.prototype.values, Array.prototype.values, `${ name }::values is equal of Array::values`); assert.isFunction(Collection.prototype.keys, `${ name }::keys is function`); assert.same(Collection.prototype.keys, Array.prototype.keys, `${ name }::keys is equal of Array::keys`); assert.isFunction(Collection.prototype.entries, `${ name }::entries is function`); assert.same(Collection.prototype.entries, Array.prototype.entries, `${ name }::entries is equal of Array::entries`); } } if (absent) { assert.ok(true, 'DOM collections are absent'); } }); core-js-3.6.1/tests/tests/web.immediate.js000066400000000000000000000023511360057567700204600ustar00rootroot00000000000000import { timeLimitedPromise } from '../helpers/helpers'; QUnit.test('setImmediate / clearImmediate', assert => { let called = false; assert.expect(8); assert.isFunction(setImmediate, 'setImmediate is function'); assert.isFunction(clearImmediate, 'clearImmediate is function'); assert.name(setImmediate, 'setImmediate'); assert.name(clearImmediate, 'clearImmediate'); timeLimitedPromise(1e3, resolve => { setImmediate(() => { called = true; resolve(); }); }).then(() => { assert.ok(true, 'setImmediate works'); }).catch(() => { assert.ok(false, 'setImmediate works'); }).then(assert.async()); assert.strictEqual(called, false, 'setImmediate is async'); timeLimitedPromise(1e3, resolve => { setImmediate((a, b) => { resolve(a + b); }, 'a', 'b'); }).then(it => { assert.strictEqual(it, 'ab', 'setImmediate works with additional args'); }).catch(() => { assert.ok(false, 'setImmediate works with additional args'); }).then(assert.async()); timeLimitedPromise(50, resolve => { clearImmediate(setImmediate(resolve)); }).then(() => { assert.ok(false, 'clearImmediate works'); }).catch(() => { assert.ok(true, 'clearImmediate works'); }).then(assert.async()); }); core-js-3.6.1/tests/tests/web.queue-microtask.js000066400000000000000000000010541360057567700216370ustar00rootroot00000000000000QUnit.test('queueMicrotask', assert => { assert.expect(5); assert.isFunction(queueMicrotask); assert.arity(queueMicrotask, 1); assert.name(queueMicrotask, 'queueMicrotask'); assert.looksNative(queueMicrotask); const async = assert.async(); let done = false; let after = false; queueMicrotask(() => { if (!done) { done = true; assert.ok(after, 'works'); async(); } }); setTimeout(() => { if (!done) { done = true; assert.ok(false, 'fails'); async(); } }, 3e3); after = true; }); core-js-3.6.1/tests/tests/web.timers.js000066400000000000000000000025521360057567700200300ustar00rootroot00000000000000import { timeLimitedPromise } from '../helpers/helpers'; QUnit.test('setTimeout / clearTimeout', assert => { assert.expect(2); timeLimitedPromise(1e3, resolve => { setTimeout((a, b) => { resolve(a + b); }, 10, 'a', 'b'); }).then(it => { assert.strictEqual(it, 'ab', 'setTimeout works with additional args'); }).catch(() => { assert.ok(false, 'setTimeout works with additional args'); }).then(assert.async()); timeLimitedPromise(50, resolve => { clearTimeout(setTimeout(resolve, 10)); }).then(() => { assert.ok(false, 'clearImmediate works with wraped setTimeout'); }).catch(() => { assert.ok(true, 'clearImmediate works with wraped setTimeout'); }).then(assert.async()); }); QUnit.test('setInterval / clearInterval', assert => { assert.expect(1); timeLimitedPromise(1e4, (resolve, reject) => { let i = 0; const interval = setInterval((a, b) => { if (a + b !== 'ab' || i > 2) reject({ a, b, i }); if (i++ === 2) { clearInterval(interval); setTimeout(resolve, 30); } }, 5, 'a', 'b'); }).then(() => { assert.ok(true, 'setInterval & clearInterval works with additional args'); }).catch(error => { if (!error) error = {}; assert.ok(false, `setInterval & clearInterval works with additional args: ${ error.a }, ${ error.b }, times: ${ error.i }`); }).then(assert.async()); }); core-js-3.6.1/tests/tests/web.url-search-params.js000066400000000000000000000707771360057567700220710ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import { createIterable } from '../helpers/helpers'; QUnit.test('URLSearchParams', assert => { assert.isFunction(URLSearchParams); assert.arity(URLSearchParams, 0); assert.name(URLSearchParams, 'URLSearchParams'); assert.looksNative(URLSearchParams); assert.same(String(new URLSearchParams()), ''); assert.same(String(new URLSearchParams('')), ''); assert.same(String(new URLSearchParams('a=b')), 'a=b'); assert.same(String(new URLSearchParams(new URLSearchParams('a=b'))), 'a=b'); assert.same(String(new URLSearchParams([])), ''); assert.same(String(new URLSearchParams([[1, 2], ['a', 'b']])), '1=2&a=b'); assert.same(String(new URLSearchParams(createIterable([createIterable(['a', 'b']), createIterable(['c', 'd'])]))), 'a=b&c=d'); assert.same(String(new URLSearchParams({})), ''); assert.same(String(new URLSearchParams({ 1: 2, a: 'b' })), '1=2&a=b'); assert.same(String(new URLSearchParams('?a=b')), 'a=b', 'leading ? should be ignored'); assert.same(String(new URLSearchParams('??a=b')), '%3Fa=b'); assert.same(String(new URLSearchParams('?')), ''); assert.same(String(new URLSearchParams('??')), '%3F='); assert.same(String(new URLSearchParams('a=b c')), 'a=b+c'); assert.same(String(new URLSearchParams('a=b&b=c&a=d')), 'a=b&b=c&a=d'); assert.same(String(new URLSearchParams('a==')), 'a=%3D'); assert.same(String(new URLSearchParams('a=b=')), 'a=b%3D'); assert.same(String(new URLSearchParams('a=b=c')), 'a=b%3Dc'); assert.same(String(new URLSearchParams('a==b')), 'a=%3Db'); let params = new URLSearchParams('a=b'); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.has('b'), false, 'search params object has not got name "b"'); params = new URLSearchParams('a=b&c'); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.has('c'), true, 'search params object has name "c"'); params = new URLSearchParams('&a&&& &&&&&a+b=& c&m%c3%b8%c3%b8'); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.has('a b'), true, 'search params object has name "a b"'); assert.same(params.has(' '), true, 'search params object has name " "'); assert.same(params.has('c'), false, 'search params object did not have the name "c"'); assert.same(params.has(' c'), true, 'search params object has name " c"'); assert.same(params.has('møø'), true, 'search params object has name "møø"'); params = new URLSearchParams('a=b+c'); assert.same(params.get('a'), 'b c', 'parse +'); params = new URLSearchParams('a+b=c'); assert.same(params.get('a b'), 'c', 'parse +'); params = new URLSearchParams('a=b c'); assert.same(params.get('a'), 'b c', 'parse " "'); params = new URLSearchParams('a b=c'); assert.same(params.get('a b'), 'c', 'parse " "'); params = new URLSearchParams('a=b%20c'); assert.same(params.get('a'), 'b c', 'parse %20'); params = new URLSearchParams('a%20b=c'); assert.same(params.get('a b'), 'c', 'parse %20'); params = new URLSearchParams('a=b\0c'); assert.same(params.get('a'), 'b\0c', 'parse \\0'); params = new URLSearchParams('a\0b=c'); assert.same(params.get('a\0b'), 'c', 'parse \\0'); params = new URLSearchParams('a=b%00c'); assert.same(params.get('a'), 'b\0c', 'parse %00'); params = new URLSearchParams('a%00b=c'); assert.same(params.get('a\0b'), 'c', 'parse %00'); params = new URLSearchParams('a=b\u2384'); assert.same(params.get('a'), 'b\u2384', 'parse \u2384'); params = new URLSearchParams('a\u2384b=c'); assert.same(params.get('a\u2384b'), 'c', 'parse \u2384'); params = new URLSearchParams('a=b%e2%8e%84'); assert.same(params.get('a'), 'b\u2384', 'parse %e2%8e%84'); params = new URLSearchParams('a%e2%8e%84b=c'); assert.same(params.get('a\u2384b'), 'c', 'parse %e2%8e%84'); params = new URLSearchParams('a=b\uD83D\uDCA9c'); assert.same(params.get('a'), 'b\uD83D\uDCA9c', 'parse \uD83D\uDCA9'); params = new URLSearchParams('a\uD83D\uDCA9b=c'); assert.same(params.get('a\uD83D\uDCA9b'), 'c', 'parse \uD83D\uDCA9'); params = new URLSearchParams('a=b%f0%9f%92%a9c'); assert.same(params.get('a'), 'b\uD83D\uDCA9c', 'parse %f0%9f%92%a9'); params = new URLSearchParams('a%f0%9f%92%a9b=c'); assert.same(params.get('a\uD83D\uDCA9b'), 'c', 'parse %f0%9f%92%a9'); params = new URLSearchParams(); params.set('query', '+15555555555'); assert.same(params.toString(), 'query=%2B15555555555'); assert.same(params.get('query'), '+15555555555', 'parse encoded +'); params = new URLSearchParams(params.toString()); assert.same(params.get('query'), '+15555555555', 'parse encoded +'); const testData = [ { input: '?a=%', output: [['a', '%']], name: 'handling %' }, { input: { '+': '%C2' }, output: [['+', '%C2']], name: 'object with +' }, { input: { c: 'x', a: '?' }, output: [['c', 'x'], ['a', '?']], name: 'object with two keys' }, { input: [['c', 'x'], ['a', '?']], output: [['c', 'x'], ['a', '?']], name: 'array with two keys' }, // eslint-disable-next-line max-len // !!! { input: { 'a\0b': '42', 'c\uD83D': '23', dሴ: 'foo' }, output: [['a\0b', '42'], ['c\uFFFD', '23'], ['d\u1234', 'foo']], name: 'object with NULL, non-ASCII, and surrogate keys' }, ]; for (const { input, output, name } of testData) { params = new URLSearchParams(input); let i = 0; params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey, `construct with ${ name }`); assert.same(value, reqValue, `construct with ${ name }`); }); } assert.throws(() => { URLSearchParams(''); }, 'throws w/o `new`'); assert.throws(() => { new URLSearchParams([[1, 2, 3]]); }, 'sequence elements must be pairs #1'); assert.throws(() => { new URLSearchParams([createIterable([createIterable([1, 2, 3])])]); }, 'sequence elements must be pairs #2'); assert.throws(() => { new URLSearchParams([[1]]); }, 'sequence elements must be pairs #3'); assert.throws(() => { new URLSearchParams([createIterable([createIterable([1])])]); }, 'sequence elements must be pairs #4'); }); QUnit.test('URLSearchParams#append', assert => { const { append } = URLSearchParams.prototype; assert.isFunction(append); assert.arity(append, 2); assert.name(append, 'append'); assert.enumerable(URLSearchParams.prototype, 'append'); assert.looksNative(append); assert.same(new URLSearchParams().append('a', 'b'), undefined, 'void'); let params = new URLSearchParams(); params.append('a', 'b'); assert.same(String(params), 'a=b'); params.append('a', 'b'); assert.same(String(params), 'a=b&a=b'); params.append('a', 'c'); assert.same(String(params), 'a=b&a=b&a=c'); params = new URLSearchParams(); params.append('', ''); assert.same(String(params), '='); params.append('', ''); assert.same(String(params), '=&='); params = new URLSearchParams(); params.append(undefined, undefined); assert.same(String(params), 'undefined=undefined'); params.append(undefined, undefined); assert.same(String(params), 'undefined=undefined&undefined=undefined'); params = new URLSearchParams(); params.append(null, null); assert.same(String(params), 'null=null'); params.append(null, null); assert.same(String(params), 'null=null&null=null'); params = new URLSearchParams(); params.append('first', 1); params.append('second', 2); params.append('third', ''); params.append('first', 10); assert.ok(params.has('first'), 'search params object has name "first"'); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); assert.same(params.get('second'), '2', 'search params object has name "second" with value "2"'); assert.same(params.get('third'), '', 'search params object has name "third" with value ""'); params.append('first', 10); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); assert.throws(() => { return new URLSearchParams('').append(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#delete', assert => { const $delete = URLSearchParams.prototype.delete; assert.isFunction($delete); assert.arity($delete, 1); assert.enumerable(URLSearchParams.prototype, 'delete'); assert.looksNative($delete); let params = new URLSearchParams('a=b&c=d'); params.delete('a'); assert.same(String(params), 'c=d'); params = new URLSearchParams('a=a&b=b&a=a&c=c'); params.delete('a'); assert.same(String(params), 'b=b&c=c'); params = new URLSearchParams('a=a&=&b=b&c=c'); params.delete(''); assert.same(String(params), 'a=a&b=b&c=c'); params = new URLSearchParams('a=a&null=null&b=b'); params.delete(null); assert.same(String(params), 'a=a&b=b'); params = new URLSearchParams('a=a&undefined=undefined&b=b'); params.delete(undefined); assert.same(String(params), 'a=a&b=b'); params = new URLSearchParams(); params.append('first', 1); assert.same(params.has('first'), true, 'search params object has name "first"'); assert.same(params.get('first'), '1', 'search params object has name "first" with value "1"'); params.delete('first'); assert.same(params.has('first'), false, 'search params object has no "first" name'); params.append('first', 1); params.append('first', 10); params.delete('first'); assert.same(params.has('first'), false, 'search params object has no "first" name'); if (DESCRIPTORS) { let url = new URL('http://example.com/?param1¶m2'); url.searchParams.delete('param1'); url.searchParams.delete('param2'); assert.same(String(url), 'http://example.com/', 'url.href does not have ?'); assert.same(url.search, '', 'url.search does not have ?'); url = new URL('http://example.com/?'); url.searchParams.delete('param1'); // assert.same(String(url), 'http://example.com/', 'url.href does not have ?'); // Safari bug assert.same(url.search, '', 'url.search does not have ?'); } assert.throws(() => { return new URLSearchParams('').delete(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#get', assert => { const { get } = URLSearchParams.prototype; assert.isFunction(get); assert.arity(get, 1); assert.name(get, 'get'); assert.enumerable(URLSearchParams.prototype, 'get'); assert.looksNative(get); let params = new URLSearchParams('a=b&c=d'); assert.same(params.get('a'), 'b'); assert.same(params.get('c'), 'd'); assert.same(params.get('e'), null); params = new URLSearchParams('a=b&c=d&a=e'); assert.same(params.get('a'), 'b'); params = new URLSearchParams('=b&c=d'); assert.same(params.get(''), 'b'); params = new URLSearchParams('a=&c=d&a=e'); assert.same(params.get('a'), ''); params = new URLSearchParams('first=second&third&&'); assert.same(params.has('first'), true, 'Search params object has name "first"'); assert.same(params.get('first'), 'second', 'Search params object has name "first" with value "second"'); assert.same(params.get('third'), '', 'Search params object has name "third" with the empty value.'); assert.same(params.get('fourth'), null, 'Search params object has no "fourth" name and value.'); assert.same(new URLSearchParams('a=b c').get('a'), 'b c'); assert.same(new URLSearchParams('a b=c').get('a b'), 'c'); assert.same(new URLSearchParams('a=b%20c').get('a'), 'b c', 'parse %20'); assert.same(new URLSearchParams('a%20b=c').get('a b'), 'c', 'parse %20'); assert.same(new URLSearchParams('a=b\0c').get('a'), 'b\0c', 'parse \\0'); assert.same(new URLSearchParams('a\0b=c').get('a\0b'), 'c', 'parse \\0'); assert.same(new URLSearchParams('a=b%2Bc').get('a'), 'b+c', 'parse %2B'); assert.same(new URLSearchParams('a%2Bb=c').get('a+b'), 'c', 'parse %2B'); assert.same(new URLSearchParams('a=b%00c').get('a'), 'b\0c', 'parse %00'); assert.same(new URLSearchParams('a%00b=c').get('a\0b'), 'c', 'parse %00'); assert.same(new URLSearchParams('a==').get('a'), '=', 'parse ='); assert.same(new URLSearchParams('a=b=').get('a'), 'b=', 'parse ='); assert.same(new URLSearchParams('a=b=c').get('a'), 'b=c', 'parse ='); assert.same(new URLSearchParams('a==b').get('a'), '=b', 'parse ='); assert.same(new URLSearchParams('a=b\u2384').get('a'), 'b\u2384', 'parse \\u2384'); assert.same(new URLSearchParams('a\u2384b=c').get('a\u2384b'), 'c', 'parse \\u2384'); assert.same(new URLSearchParams('a=b%e2%8e%84').get('a'), 'b\u2384', 'parse %e2%8e%84'); assert.same(new URLSearchParams('a%e2%8e%84b=c').get('a\u2384b'), 'c', 'parse %e2%8e%84'); assert.same(new URLSearchParams('a=b\uD83D\uDCA9c').get('a'), 'b\uD83D\uDCA9c', 'parse \\uD83D\\uDCA9'); assert.same(new URLSearchParams('a\uD83D\uDCA9b=c').get('a\uD83D\uDCA9b'), 'c', 'parse \\uD83D\\uDCA9'); assert.same(new URLSearchParams('a=b%f0%9f%92%a9c').get('a'), 'b\uD83D\uDCA9c', 'parse %f0%9f%92%a9'); assert.same(new URLSearchParams('a%f0%9f%92%a9b=c').get('a\uD83D\uDCA9b'), 'c', 'parse %f0%9f%92%a9'); assert.same(new URLSearchParams('=').get(''), '', 'parse ='); assert.throws(() => { return new URLSearchParams('').get(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#getAll', assert => { const { getAll } = URLSearchParams.prototype; assert.isFunction(getAll); assert.arity(getAll, 1); assert.name(getAll, 'getAll'); assert.enumerable(URLSearchParams.prototype, 'getAll'); assert.looksNative(getAll); let params = new URLSearchParams('a=b&c=d'); assert.arrayEqual(params.getAll('a'), ['b']); assert.arrayEqual(params.getAll('c'), ['d']); assert.arrayEqual(params.getAll('e'), []); params = new URLSearchParams('a=b&c=d&a=e'); assert.arrayEqual(params.getAll('a'), ['b', 'e']); params = new URLSearchParams('=b&c=d'); assert.arrayEqual(params.getAll(''), ['b']); params = new URLSearchParams('a=&c=d&a=e'); assert.arrayEqual(params.getAll('a'), ['', 'e']); params = new URLSearchParams('a=1&a=2&a=3&a'); assert.arrayEqual(params.getAll('a'), ['1', '2', '3', ''], 'search params object has expected name "a" values'); params.set('a', 'one'); assert.arrayEqual(params.getAll('a'), ['one'], 'search params object has expected name "a" values'); assert.throws(() => { return new URLSearchParams('').getAll(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#has', assert => { const { has } = URLSearchParams.prototype; assert.isFunction(has); assert.arity(has, 1); assert.name(has, 'has'); assert.enumerable(URLSearchParams.prototype, 'has'); assert.looksNative(has); let params = new URLSearchParams('a=b&c=d'); assert.same(params.has('a'), true); assert.same(params.has('c'), true); assert.same(params.has('e'), false); params = new URLSearchParams('a=b&c=d&a=e'); assert.same(params.has('a'), true); params = new URLSearchParams('=b&c=d'); assert.same(params.has(''), true); params = new URLSearchParams('null=a'); assert.same(params.has(null), true); params = new URLSearchParams('a=b&c=d&&'); params.append('first', 1); params.append('first', 2); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.has('c'), true, 'search params object has name "c"'); assert.same(params.has('first'), true, 'search params object has name "first"'); assert.same(params.has('d'), false, 'search params object has no name "d"'); params.delete('first'); assert.same(params.has('first'), false, 'search params object has no name "first"'); assert.throws(() => { return new URLSearchParams('').has(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#set', assert => { const { set } = URLSearchParams.prototype; assert.isFunction(set); assert.arity(set, 2); assert.name(set, 'set'); assert.enumerable(URLSearchParams.prototype, 'set'); assert.looksNative(set); let params = new URLSearchParams('a=b&c=d'); params.set('a', 'B'); assert.same(String(params), 'a=B&c=d'); params = new URLSearchParams('a=b&c=d&a=e'); params.set('a', 'B'); assert.same(String(params), 'a=B&c=d'); params.set('e', 'f'); assert.same(String(params), 'a=B&c=d&e=f'); params = new URLSearchParams('a=1&a=2&a=3'); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.get('a'), '1', 'search params object has name "a" with value "1"'); params.set('first', 4); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.get('a'), '1', 'search params object has name "a" with value "1"'); assert.same(String(params), 'a=1&a=2&a=3&first=4'); params.set('a', 4); assert.same(params.has('a'), true, 'search params object has name "a"'); assert.same(params.get('a'), '4', 'search params object has name "a" with value "4"'); assert.same(String(params), 'a=4&first=4'); assert.throws(() => { return new URLSearchParams('').set(); }, 'throws w/o arguments'); }); QUnit.test('URLSearchParams#sort', assert => { const { sort } = URLSearchParams.prototype; assert.isFunction(sort); assert.arity(sort, 0); assert.name(sort, 'sort'); assert.enumerable(URLSearchParams.prototype, 'sort'); assert.looksNative(sort); let params = new URLSearchParams('a=1&b=4&a=3&b=2'); params.sort(); assert.same(String(params), 'a=1&a=3&b=4&b=2'); params.delete('a'); params.append('a', '0'); params.append('b', '0'); params.sort(); assert.same(String(params), 'a=0&b=4&b=2&b=0'); const testData = [ { input: 'z=b&a=b&z=a&a=a', output: [['a', 'b'], ['a', 'a'], ['z', 'b'], ['z', 'a']], }, { input: '\uFFFD=x&\uFFFC&\uFFFD=a', output: [['\uFFFC', ''], ['\uFFFD', 'x'], ['\uFFFD', 'a']], }, { input: 'ffi&🌈', // 🌈 > code point, but < code unit because two code units output: [['🌈', ''], ['ffi', '']], }, { input: 'é&e\uFFFD&e\u0301', output: [['e\u0301', ''], ['e\uFFFD', ''], ['é', '']], }, { input: 'z=z&a=a&z=y&a=b&z=x&a=c&z=w&a=d&z=v&a=e&z=u&a=f&z=t&a=g', // eslint-disable-next-line max-len output: [['a', 'a'], ['a', 'b'], ['a', 'c'], ['a', 'd'], ['a', 'e'], ['a', 'f'], ['a', 'g'], ['z', 'z'], ['z', 'y'], ['z', 'x'], ['z', 'w'], ['z', 'v'], ['z', 'u'], ['z', 't']], }, { input: 'bbb&bb&aaa&aa=x&aa=y', output: [['aa', 'x'], ['aa', 'y'], ['aaa', ''], ['bb', ''], ['bbb', '']], }, { input: 'z=z&=f&=t&=x', output: [['', 'f'], ['', 't'], ['', 'x'], ['z', 'z']], }, { input: 'a🌈&a💩', output: [['a🌈', ''], ['a💩', '']], }, ]; for (const { input, output } of testData) { let i = 0; params = new URLSearchParams(input); params.sort(); params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey); assert.same(value, reqValue); }); i = 0; const url = new URL(`?${ input }`, 'https://example/'); params = url.searchParams; params.sort(); params.forEach((value, key) => { const [reqKey, reqValue] = output[i++]; assert.same(key, reqKey); assert.same(value, reqValue); }); } if (DESCRIPTORS) { const url = new URL('http://example.com/?'); url.searchParams.sort(); assert.same(url.href, 'http://example.com/', 'Sorting non-existent params removes ? from URL'); assert.same(url.search, '', 'Sorting non-existent params removes ? from URL'); } }); QUnit.test('URLSearchParams#toString', assert => { const { toString } = URLSearchParams.prototype; assert.isFunction(toString); assert.arity(toString, 0); assert.name(toString, 'toString'); assert.looksNative(toString); let params = new URLSearchParams(); params.append('a', 'b c'); assert.same(String(params), 'a=b+c'); params.delete('a'); params.append('a b', 'c'); assert.same(String(params), 'a+b=c'); params = new URLSearchParams(); params.append('a', ''); assert.same(String(params), 'a='); params.append('a', ''); assert.same(String(params), 'a=&a='); params.append('', 'b'); assert.same(String(params), 'a=&a=&=b'); params.append('', ''); assert.same(String(params), 'a=&a=&=b&='); params.append('', ''); assert.same(String(params), 'a=&a=&=b&=&='); params = new URLSearchParams(); params.append('', 'b'); assert.same(String(params), '=b'); params.append('', 'b'); assert.same(String(params), '=b&=b'); params = new URLSearchParams(); params.append('', ''); assert.same(String(params), '='); params.append('', ''); assert.same(String(params), '=&='); params = new URLSearchParams(); params.append('a', 'b+c'); assert.same(String(params), 'a=b%2Bc'); params.delete('a'); params.append('a+b', 'c'); assert.same(String(params), 'a%2Bb=c'); params = new URLSearchParams(); params.append('=', 'a'); assert.same(String(params), '%3D=a'); params.append('b', '='); assert.same(String(params), '%3D=a&b=%3D'); params = new URLSearchParams(); params.append('&', 'a'); assert.same(String(params), '%26=a'); params.append('b', '&'); assert.same(String(params), '%26=a&b=%26'); params = new URLSearchParams(); params.append('a', '\r'); assert.same(String(params), 'a=%0D'); params = new URLSearchParams(); params.append('a', '\n'); assert.same(String(params), 'a=%0A'); params = new URLSearchParams(); params.append('a', '\r\n'); assert.same(String(params), 'a=%0D%0A'); params = new URLSearchParams(); params.append('a', 'b%c'); assert.same(String(params), 'a=b%25c'); params.delete('a'); params.append('a%b', 'c'); assert.same(String(params), 'a%25b=c'); params = new URLSearchParams(); params.append('a', 'b\0c'); assert.same(String(params), 'a=b%00c'); params.delete('a'); params.append('a\0b', 'c'); assert.same(String(params), 'a%00b=c'); params = new URLSearchParams(); params.append('a', 'b\uD83D\uDCA9c'); assert.same(String(params), 'a=b%F0%9F%92%A9c'); params.delete('a'); params.append('a\uD83D\uDCA9b', 'c'); assert.same(String(params), 'a%F0%9F%92%A9b=c'); params = new URLSearchParams('a=b&c=d&&e&&'); assert.same(String(params), 'a=b&c=d&e='); params = new URLSearchParams('a = b &a=b&c=d%20'); assert.same(String(params), 'a+=+b+&a=b&c=d+'); params = new URLSearchParams('a=&a=b'); assert.same(String(params), 'a=&a=b'); }); QUnit.test('URLSearchParams#forEach', assert => { const { forEach } = URLSearchParams.prototype; assert.isFunction(forEach); assert.arity(forEach, 1); assert.name(forEach, 'forEach'); assert.enumerable(URLSearchParams.prototype, 'forEach'); assert.looksNative(forEach); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let result = ''; params.forEach((value, key, that) => { assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); assert.same(that, params); result += key; }); assert.same(result, 'abc'); new URL('http://a.b/c').searchParams.forEach(() => { assert.ok(false, 'should not be called'); }); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); params = url.searchParams; result = ''; params.forEach((val, key) => { url.search = 'x=1&y=2&z=3'; result += key + val; }); assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); result = ''; params.forEach((value, key) => { params.delete('b'); result += key + value; }); assert.same(result, 'a1c3'); }); QUnit.test('URLSearchParams#entries', assert => { const { entries } = URLSearchParams.prototype; assert.isFunction(entries); assert.arity(entries, 0); assert.name(entries, 'entries'); assert.enumerable(URLSearchParams.prototype, 'entries'); assert.looksNative(entries); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let iterator = params.entries(); let result = ''; let entry; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); result += key; } assert.same(result, 'abc'); assert.ok(new URL('http://a.b/c').searchParams.entries().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams.entries(); result = ''; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; url.search = 'x=1&y=2&z=3'; result += key + value; } assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.entries(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const [key, value] = entry.value; result += key + value; } assert.same(result, 'a1c3'); }); QUnit.test('URLSearchParams#keys', assert => { const { keys } = URLSearchParams.prototype; assert.isFunction(keys); assert.arity(keys, 0); assert.name(keys, 'keys'); assert.enumerable(URLSearchParams.prototype, 'keys'); assert.looksNative(keys); let iterator = new URLSearchParams('a=1&b=2&c=3').keys(); let result = ''; let entry; while (!(entry = iterator.next()).done) { result += entry.value; } assert.same(result, 'abc'); assert.ok(new URL('http://a.b/c').searchParams.keys().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams.keys(); result = ''; while (!(entry = iterator.next()).done) { const key = entry.value; url.search = 'x=1&y=2&z=3'; result += key; } assert.same(result, 'ayz'); } // fails in Chrome 66- const params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.keys(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const key = entry.value; result += key; } assert.same(result, 'ac'); }); QUnit.test('URLSearchParams#values', assert => { const { values } = URLSearchParams.prototype; assert.isFunction(values); assert.arity(values, 0); assert.name(values, 'values'); assert.enumerable(URLSearchParams.prototype, 'values'); assert.looksNative(values); let iterator = new URLSearchParams('a=1&b=2&c=3').values(); let result = ''; let entry; while (!(entry = iterator.next()).done) { result += entry.value; } assert.same(result, '123'); assert.ok(new URL('http://a.b/c').searchParams.values().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=a&b=b&c=c&d=d'); iterator = url.searchParams.keys(); result = ''; while (!(entry = iterator.next()).done) { const { value } = entry; url.search = 'x=x&y=y&z=z'; result += value; } assert.same(result, 'ayz'); } // fails in Chrome 66- const params = new URLSearchParams('a=1&b=2&c=3'); iterator = params.values(); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const key = entry.value; result += key; } assert.same(result, '13'); }); QUnit.test('URLSearchParams#@@iterator', assert => { const entries = URLSearchParams.prototype[Symbol.iterator]; assert.isFunction(entries); assert.arity(entries, 0); assert.name(entries, 'entries'); assert.looksNative(entries); assert.same(entries, URLSearchParams.prototype.entries); const expectedValues = { a: '1', b: '2', c: '3' }; let params = new URLSearchParams('a=1&b=2&c=3'); let iterator = params[Symbol.iterator](); let result = ''; let entry; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; assert.same(params.get(key), expectedValues[key]); assert.same(value, expectedValues[key]); result += key; } assert.same(result, 'abc'); assert.ok(new URL('http://a.b/c').searchParams[Symbol.iterator]().next().done, 'should be finished'); // fails in Chrome 66- if (DESCRIPTORS) { const url = new URL('http://a.b/c?a=1&b=2&c=3&d=4'); iterator = url.searchParams[Symbol.iterator](); result = ''; while (!(entry = iterator.next()).done) { const [key, value] = entry.value; url.search = 'x=1&y=2&z=3'; result += key + value; } assert.same(result, 'a1y2z3'); } // fails in Chrome 66- params = new URLSearchParams('a=1&b=2&c=3'); iterator = params[Symbol.iterator](); result = ''; while (!(entry = iterator.next()).done) { params.delete('b'); const [key, value] = entry.value; result += key + value; } assert.same(result, 'a1c3'); }); QUnit.test('URLSearchParams#@@toStringTag', assert => { const params = new URLSearchParams('a=b'); assert.same(({}).toString.call(params), '[object URLSearchParams]'); }); core-js-3.6.1/tests/tests/web.url.js000066400000000000000000000675111360057567700173350ustar00rootroot00000000000000import { DESCRIPTORS } from '../helpers/constants'; import urlTestData from '../wpt-url-resources/urltestdata'; import settersTestData from '../wpt-url-resources/setters'; import toASCIITestData from '../wpt-url-resources/toascii'; const { hasOwnProperty } = Object.prototype; QUnit.test('URL constructor', assert => { assert.isFunction(URL); assert.arity(URL, 1); assert.name(URL, 'URL'); assert.looksNative(URL); assert.same(String(new URL('http://www.domain.com/a/b')), 'http://www.domain.com/a/b'); assert.same(String(new URL('/c/d', 'http://www.domain.com/a/b')), 'http://www.domain.com/c/d'); assert.same(String(new URL('b/c', 'http://www.domain.com/a/b')), 'http://www.domain.com/a/b/c'); assert.same(String(new URL('b/c', new URL('http://www.domain.com/a/b'))), 'http://www.domain.com/a/b/c'); assert.same(String(new URL({ toString: () => 'https://example.org/' })), 'https://example.org/'); assert.same(String(new URL('nonspecial://example.com/')), 'nonspecial://example.com/'); assert.same(String(new URL('https://測試')), 'https://xn--g6w251d/', 'unicode parsing'); assert.same(String(new URL('https://xxпривет.тест')), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(new URL('https://xxПРИВЕТ.тест')), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(new URL('http://Example.com/', 'https://example.org/')), 'http://example.com/'); assert.same(String(new URL('https://Example.com/', 'https://example.org/')), 'https://example.com/'); assert.same(String(new URL('nonspecial://Example.com/', 'https://example.org/')), 'nonspecial://Example.com/'); assert.same(String(new URL('http:Example.com/', 'https://example.org/')), 'http://example.com/'); assert.same(String(new URL('https:Example.com/', 'https://example.org/')), 'https://example.org/Example.com/'); assert.same(String(new URL('nonspecial:Example.com/', 'https://example.org/')), 'nonspecial:Example.com/'); assert.same(String(new URL('http://0300.168.0xF0')), 'http://192.168.0.240/'); assert.same(String(new URL('http://[20:0:0:1:0:0:0:ff]')), 'http://[20:0:0:1::ff]/'); // assert.same(String(new URL('http://257.168.0xF0')), 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // TypeError in Chrome and Safari assert.same(String(new URL('http://0300.168.0xG0')), 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); assert.same(String(new URL('file:///var/log/system.log')), 'file:///var/log/system.log', 'file scheme'); // assert.same(String(new URL('file://nnsc.nsf.net/bar/baz')), 'file://nnsc.nsf.net/bar/baz', 'file scheme'); // 'file:///bar/baz' in FF // assert.same(String(new URL('file://localhost/bar/baz')), 'file:///bar/baz', 'file scheme'); // 'file://localhost/bar/baz' in Chrome assert.throws(() => new URL(), 'TypeError: Failed to construct \'URL\': 1 argument required, but only 0 present.'); assert.throws(() => new URL(''), 'TypeError: Failed to construct \'URL\': Invalid URL'); assert.throws(() => new URL('', 'about:blank'), 'TypeError: Failed to construct \'URL\': Invalid URL'); assert.throws(() => new URL('abc'), 'TypeError: Failed to construct \'URL\': Invalid URL'); assert.throws(() => new URL('//abc'), 'TypeError: Failed to construct \'URL\': Invalid URL'); assert.throws(() => new URL('http:///www.domain.com/', 'abc'), 'TypeError: Failed to construct \'URL\': Invalid base URL'); assert.throws(() => new URL('http:///www.domain.com/', null), 'TypeError: Failed to construct \'URL\': Invalid base URL'); assert.throws(() => new URL('//abc', null), 'TypeError: Failed to construct \'URL\': Invalid base URL'); assert.throws(() => new URL('http://[20:0:0:1:0:0:0:ff'), 'incorrect IPv6'); assert.throws(() => new URL('http://[20:0:0:1:0:0:0:fg]'), 'incorrect IPv6'); // assert.throws(() => new URL('http://a%b'), 'forbidden host code point'); // no error in FF assert.throws(() => new URL('1http://zloirock.ru'), 'incorrect scheme'); }); QUnit.test('URL#href', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'href')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'href'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.href, 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.href, 'http://zloirock.ru/?foo=bar'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://測試'; assert.same(url.href, 'https://xn--g6w251d/', 'unicode parsing'); assert.same(String(url), 'https://xn--g6w251d/', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://xxпривет.тест'; assert.same(url.href, 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(url), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.href = 'https://xxПРИВЕТ.тест'; assert.same(url.href, 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); assert.same(String(url), 'https://xn--xx-flcmn5bht.xn--e1aybc/', 'unicode parsing'); url = new URL('http://zloirock.ru/'); url.href = 'http://0300.168.0xF0'; assert.same(url.href, 'http://192.168.0.240/'); assert.same(String(url), 'http://192.168.0.240/'); url = new URL('http://zloirock.ru/'); url.href = 'http://[20:0:0:1:0:0:0:ff]'; assert.same(url.href, 'http://[20:0:0:1::ff]/'); assert.same(String(url), 'http://[20:0:0:1::ff]/'); // url = new URL('http://zloirock.ru/'); // url.href = 'http://257.168.0xF0'; // TypeError and Safari // assert.same(url.href, 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // `F` instead of `f` in Chrome // assert.same(String(url), 'http://257.168.0xf0/', 'incorrect IPv4 parsed as host'); // `F` instead of `f` in Chrome url = new URL('http://zloirock.ru/'); url.href = 'http://0300.168.0xG0'; assert.same(url.href, 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); assert.same(String(url), 'http://0300.168.0xg0/', 'incorrect IPv4 parsed as host'); url = new URL('http://192.168.0.240/'); url.href = 'file:///var/log/system.log'; assert.same(url.href, 'file:///var/log/system.log', 'file -> ip'); assert.same(String(url), 'file:///var/log/system.log', 'file -> ip'); url = new URL('file:///var/log/system.log'); url.href = 'http://0300.168.0xF0'; assert.same(url.href, 'http://192.168.0.240/', 'file -> http'); assert.same(String(url), 'http://192.168.0.240/', 'file -> http'); // assert.throws(() => new URL('http://zloirock.ru/').href = undefined, 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = '', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'abc', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = '//abc', 'incorrect URL'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://[20:0:0:1:0:0:0:ff', 'incorrect IPv6'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://[20:0:0:1:0:0:0:fg]', 'incorrect IPv6'); // no error in Chrome // assert.throws(() => new URL('http://zloirock.ru/').href = 'http://a%b', 'forbidden host code point'); // no error in Chrome and FF // assert.throws(() => new URL('http://zloirock.ru/').href = '1http://zloirock.ru', 'incorrect scheme'); // no error in Chrome } }); QUnit.test('URL#origin', assert => { const url = new URL('http://es6.zloirock.ru/tests.html'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'origin')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'origin'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); } assert.same(url.origin, 'http://es6.zloirock.ru'); assert.same(new URL('https://測試/tests').origin, 'https://xn--g6w251d'); }); QUnit.test('URL#protocol', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'protocol')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'protocol'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.protocol, 'http:'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.protocol = 'https'; assert.same(url.protocol, 'https:'); assert.same(String(url), 'https://zloirock.ru/'); // https://nodejs.org/api/url.html#url_special_schemes // url = new URL('http://zloirock.ru/'); // url.protocol = 'fish'; // assert.same(url.protocol, 'http:'); // assert.same(url.href, 'http://zloirock.ru/'); // assert.same(String(url), 'http://zloirock.ru/'); url = new URL('http://zloirock.ru/'); url.protocol = '1http'; assert.same(url.protocol, 'http:'); assert.same(url.href, 'http://zloirock.ru/', 'incorrect scheme'); assert.same(String(url), 'http://zloirock.ru/', 'incorrect scheme'); } }); QUnit.test('URL#username', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'username')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'username'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.username, ''); url = new URL('http://username@zloirock.ru/'); assert.same(url.username, 'username'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.username = 'username'; assert.same(url.username, 'username'); assert.same(String(url), 'http://username@zloirock.ru/'); } }); QUnit.test('URL#password', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'password')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'password'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.password, ''); url = new URL('http://username:password@zloirock.ru/'); assert.same(url.password, 'password'); // url = new URL('http://:password@zloirock.ru/'); // TypeError in FF // assert.same(url.password, 'password'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.username = 'username'; url.password = 'password'; assert.same(url.password, 'password'); assert.same(String(url), 'http://username:password@zloirock.ru/'); // url = new URL('http://zloirock.ru/'); // url.password = 'password'; // assert.same(url.password, 'password'); // '' in FF // assert.same(String(url), 'http://:password@zloirock.ru/'); // 'http://zloirock.ru/' in FF } }); QUnit.test('URL#host', assert => { let url = new URL('http://zloirock.ru:81/path'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'host')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'host'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.host, 'zloirock.ru:81'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru:81/path'); url.host = 'example.com:82'; assert.same(url.host, 'example.com:82'); assert.same(String(url), 'http://example.com:82/path'); // url = new URL('http://zloirock.ru:81/path'); // url.host = 'other?domain.com'; // assert.same(String(url), 'http://other:81/path'); // 'http://other/?domain.com/path' in Safari url = new URL('https://www.mydomain.com:8080/path/'); url.host = 'www.otherdomain.com:80'; assert.same(url.href, 'https://www.otherdomain.com:80/path/', 'set default port for another protocol'); // url = new URL('https://www.mydomain.com:8080/path/'); // url.host = 'www.otherdomain.com:443'; // assert.same(url.href, 'https://www.otherdomain.com/path/', 'set default port'); url = new URL('http://zloirock.ru/foo'); url.host = '測試'; assert.same(url.host, 'xn--g6w251d', 'unicode parsing'); assert.same(String(url), 'http://xn--g6w251d/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = 'xxпривет.тест'; assert.same(url.host, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = 'xxПРИВЕТ.тест'; assert.same(url.host, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.host = '0300.168.0xF0'; assert.same(url.host, '192.168.0.240'); assert.same(String(url), 'http://192.168.0.240/foo'); // url = new URL('http://zloirock.ru/foo'); // url.host = '[20:0:0:1:0:0:0:ff]'; // assert.same(url.host, '[20:0:0:1::ff]'); // ':0' in Chrome, 'zloirock.ru' in Safari // assert.same(String(url), 'http://[20:0:0:1::ff]/foo'); // 'http://[20:0/foo' in Chrome, 'http://zloirock.ru/foo' in Safari // url = new URL('file:///var/log/system.log'); // url.host = 'nnsc.nsf.net'; // does not work in FF // assert.same(url.hostname, 'nnsc.nsf.net', 'file'); // assert.same(String(url), 'file://nnsc.nsf.net/var/log/system.log', 'file'); // url = new URL('http://zloirock.ru/'); // url.host = '[20:0:0:1:0:0:0:ff'; // assert.same(url.host, 'zloirock.ru', 'incorrect IPv6'); // ':0' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0/' in Chrome // url = new URL('http://zloirock.ru/'); // url.host = '[20:0:0:1:0:0:0:fg]'; // assert.same(url.host, 'zloirock.ru', 'incorrect IPv6'); // ':0' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0/' in Chrome // url = new URL('http://zloirock.ru/'); // url.host = 'a%b'; // assert.same(url.host, 'zloirock.ru', 'forbidden host code point'); // '' in Chrome, 'a%b' in FF // assert.same(String(url), 'http://zloirock.ru/', 'forbidden host code point'); // 'http://a%25b/' in Chrome, 'http://a%b/' in FF } }); QUnit.test('URL#hostname', assert => { let url = new URL('http://zloirock.ru:81/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'hostname')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'hostname'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.hostname, 'zloirock.ru'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru:81/'); url.hostname = 'example.com'; assert.same(url.hostname, 'example.com'); assert.same(String(url), 'http://example.com:81/'); // url = new URL('http://zloirock.ru:81/'); // url.hostname = 'example.com:82'; // assert.same(url.hostname, 'example.com'); // '' in Chrome // assert.same(String(url), 'http://example.com:81/'); // 'ttp://example.com:82:81/' in Chrome url = new URL('http://zloirock.ru/foo'); url.hostname = '測試'; assert.same(url.hostname, 'xn--g6w251d', 'unicode parsing'); assert.same(String(url), 'http://xn--g6w251d/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = 'xxпривет.тест'; assert.same(url.hostname, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = 'xxПРИВЕТ.тест'; assert.same(url.hostname, 'xn--xx-flcmn5bht.xn--e1aybc', 'unicode parsing'); assert.same(String(url), 'http://xn--xx-flcmn5bht.xn--e1aybc/foo', 'unicode parsing'); url = new URL('http://zloirock.ru/foo'); url.hostname = '0300.168.0xF0'; assert.same(url.hostname, '192.168.0.240'); assert.same(String(url), 'http://192.168.0.240/foo'); // url = new URL('http://zloirock.ru/foo'); // url.hostname = '[20:0:0:1:0:0:0:ff]'; // assert.same(url.hostname, '[20:0:0:1::ff]'); // 'zloirock.ru' in Safari // assert.same(String(url), 'http://[20:0:0:1::ff]/foo'); // 'http://zloirock.ru/foo' in Safari // url = new URL('file:///var/log/system.log'); // url.hostname = 'nnsc.nsf.net'; // does not work in FF // assert.same(url.hostname, 'nnsc.nsf.net', 'file'); // assert.same(String(url), 'file://nnsc.nsf.net/var/log/system.log', 'file'); // url = new URL('http://zloirock.ru/'); // url.hostname = '[20:0:0:1:0:0:0:ff'; // assert.same(url.hostname, 'zloirock.ru', 'incorrect IPv6'); // '' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0:0:1:0:0:0:ff' in Chrome // url = new URL('http://zloirock.ru/'); // url.hostname = '[20:0:0:1:0:0:0:fg]'; // assert.same(url.hostname, 'zloirock.ru', 'incorrect IPv6'); // '' in Chrome // assert.same(String(url), 'http://zloirock.ru/', 'incorrect IPv6'); // 'http://[20:0:0:1:0:0:0:ff/' in Chrome // url = new URL('http://zloirock.ru/'); // url.hostname = 'a%b'; // assert.same(url.hostname, 'zloirock.ru', 'forbidden host code point'); // '' in Chrome, 'a%b' in FF // assert.same(String(url), 'http://zloirock.ru/', 'forbidden host code point'); // 'http://a%25b/' in Chrome, 'http://a%b/' in FF } }); QUnit.test('URL#port', assert => { let url = new URL('http://zloirock.ru:1337/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'port')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'port'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.port, '1337'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.port = 80; assert.same(url.port, ''); assert.same(String(url), 'http://zloirock.ru/'); url.port = 1337; assert.same(url.port, '1337'); assert.same(String(url), 'http://zloirock.ru:1337/'); // url.port = 'abcd'; // assert.same(url.port, '1337'); // '0' in Chrome // assert.same(String(url), 'http://zloirock.ru:1337/'); // 'http://zloirock.ru:0/' in Chrome // url.port = '5678abcd'; // assert.same(url.port, '5678'); // '1337' in FF // assert.same(String(url), 'http://zloirock.ru:5678/'); // 'http://zloirock.ru:1337/"' in FF url.port = 1234.5678; assert.same(url.port, '1234'); assert.same(String(url), 'http://zloirock.ru:1234/'); // url.port = 1e10; // assert.same(url.port, '1234'); // '0' in Chrome // assert.same(String(url), 'http://zloirock.ru:1234/'); // 'http://zloirock.ru:0/' in Chrome } }); QUnit.test('URL#pathname', assert => { let url = new URL('http://zloirock.ru/foo/bar'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'pathname')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'pathname'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.pathname, '/foo/bar'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.pathname = 'bar/baz'; assert.same(url.pathname, '/bar/baz'); assert.same(String(url), 'http://zloirock.ru/bar/baz'); } }); QUnit.test('URL#search', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'search')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'search'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.search, ''); url = new URL('http://zloirock.ru/?foo=bar'); assert.same(url.search, '?foo=bar'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/?'); assert.same(url.search, ''); assert.same(String(url), 'http://zloirock.ru/?'); url.search = 'foo=bar'; assert.same(url.search, '?foo=bar'); assert.same(String(url), 'http://zloirock.ru/?foo=bar'); url.search = '?bar=baz'; assert.same(url.search, '?bar=baz'); assert.same(String(url), 'http://zloirock.ru/?bar=baz'); url.search = ''; assert.same(url.search, ''); assert.same(String(url), 'http://zloirock.ru/'); } }); QUnit.test('URL#searchParams', assert => { let url = new URL('http://zloirock.ru/?foo=bar&bar=baz'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'searchParams')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'searchParams'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); } assert.ok(url.searchParams instanceof URLSearchParams); assert.same(url.searchParams.get('foo'), 'bar'); assert.same(url.searchParams.get('bar'), 'baz'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/'); url.searchParams.append('foo', 'bar'); assert.same(String(url), 'http://zloirock.ru/?foo=bar'); url = new URL('http://zloirock.ru/'); url.search = 'foo=bar'; assert.same(url.searchParams.get('foo'), 'bar'); url = new URL('http://zloirock.ru/?foo=bar&bar=baz'); url.search = ''; assert.same(url.searchParams.has('foo'), false); } }); QUnit.test('URL#hash', assert => { let url = new URL('http://zloirock.ru/'); if (DESCRIPTORS) { assert.ok(!hasOwnProperty.call(url, 'hash')); const descriptor = Object.getOwnPropertyDescriptor(URL.prototype, 'hash'); assert.same(descriptor.enumerable, true); assert.same(descriptor.configurable, true); assert.same(typeof descriptor.get, 'function'); assert.same(typeof descriptor.set, 'function'); } assert.same(url.hash, ''); url = new URL('http://zloirock.ru/#foo'); assert.same(url.hash, '#foo'); url = new URL('http://zloirock.ru/#'); assert.same(url.hash, ''); assert.same(String(url), 'http://zloirock.ru/#'); if (DESCRIPTORS) { url = new URL('http://zloirock.ru/#'); url.hash = 'foo'; assert.same(url.hash, '#foo'); assert.same(String(url), 'http://zloirock.ru/#foo'); url.hash = ''; assert.same(url.hash, ''); assert.same(String(url), 'http://zloirock.ru/'); // url.hash = '#'; // assert.same(url.hash, ''); // assert.same(String(url), 'http://zloirock.ru/'); // 'http://zloirock.ru/#' in FF url.hash = '#foo'; assert.same(url.hash, '#foo'); assert.same(String(url), 'http://zloirock.ru/#foo'); url.hash = '#foo#bar'; assert.same(url.hash, '#foo#bar'); assert.same(String(url), 'http://zloirock.ru/#foo#bar'); url = new URL('http://zloirock.ru/'); url.hash = 'абa'; assert.same(url.hash, '#%D0%B0%D0%B1a'); // url = new URL('http://zloirock.ru/'); // url.hash = '\udc01\ud802a'; // assert.same(url.hash, '#%EF%BF%BD%EF%BF%BDa', 'unmatched surrogates'); } }); QUnit.test('URL#toJSON', assert => { const { toJSON } = URL.prototype; assert.isFunction(toJSON); assert.arity(toJSON, 0); assert.name(toJSON, 'toJSON'); assert.enumerable(URL.prototype, 'toJSON'); assert.looksNative(toJSON); const url = new URL('http://zloirock.ru/'); assert.same(url.toJSON(), 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.toJSON(), 'http://zloirock.ru/?foo=bar'); } }); QUnit.test('URL#toString', assert => { const { toString } = URL.prototype; assert.isFunction(toString); assert.arity(toString, 0); assert.name(toString, 'toString'); assert.enumerable(URL.prototype, 'toString'); assert.looksNative(toString); const url = new URL('http://zloirock.ru/'); assert.same(url.toString(), 'http://zloirock.ru/'); if (DESCRIPTORS) { url.searchParams.append('foo', 'bar'); assert.same(url.toString(), 'http://zloirock.ru/?foo=bar'); } }); QUnit.test('URL#@@toStringTag', assert => { const url = new URL('http://zloirock.ru/'); assert.same(({}).toString.call(url), '[object URL]'); }); QUnit.test('URL.sham', assert => { assert.same(URL.sham, DESCRIPTORS ? undefined : true); }); // `core-js` URL implementation pass all (exclude some encoding-ralated) tests // from the next 3 test cases, but URLs from all of popular browsers fail a serious part of tests. // Replacing all of them does not looks like a good idea, so next test cases disabled by default. // see https://github.com/web-platform-tests/wpt/blob/master/url QUnit.skip('WPT URL constructor tests', assert => { for (const expected of urlTestData) { if (typeof expected == 'string') continue; const name = `Parsing: <${ expected.input }> against <${ expected.base }>`; if (expected.failure) { assert.throws(() => new URL(expected.input, expected.base || 'about:blank'), name); } else { const url = new URL(expected.input, expected.base || 'about:blank'); assert.same(url.href, expected.href, `${ name }: href`); assert.same(url.protocol, expected.protocol, `${ name }: protocol`); assert.same(url.username, expected.username, `${ name }: username`); assert.same(url.password, expected.password, `${ name }: password`); assert.same(url.host, expected.host, `${ name }: host`); assert.same(url.hostname, expected.hostname, `${ name }: hostname`); assert.same(url.port, expected.port, `${ name }: port`); assert.same(url.pathname, expected.pathname, `${ name }: pathname`); assert.same(url.search, expected.search, `${ name }: search`); if ('searchParams' in expected) { assert.same(url.searchParams.toString(), expected.searchParams, `${ name }: searchParams`); } assert.same(url.hash, expected.hash, `${ name }: hash`); if ('origin' in expected) { assert.same(url.origin, expected.origin, `${ name }: origin`); } } } }); // see https://github.com/web-platform-tests/wpt/blob/master/url if (DESCRIPTORS) QUnit.skip('WPT URL setters tests', assert => { for (const setter in settersTestData) { const testCases = settersTestData[setter]; for (const { href, newValue, comment, expected } of testCases) { let name = `Setting <${ href }>.${ setter } = '${ newValue }'.`; if (comment) name += ` ${ comment }`; const url = new URL(href); url[setter] = newValue; for (const attribute in expected) { assert.same(url[attribute], expected[attribute], name); } } } }); // see https://github.com/web-platform-tests/wpt/blob/master/url QUnit.skip('WPT conversion to ASCII tests', assert => { for (const { comment, input, output } of toASCIITestData) { let name = `Parsing: <${ input }>`; if (comment) name += ` ${ comment }`; if (output === null) { assert.throws(() => new URL(`https://${ input }/x`), name); } else { const url = new URL(`https://${ input }/x`); assert.same(url.host, output, name); assert.same(url.hostname, output, name); assert.same(url.pathname, '/x', name); assert.same(url.href, `https://${ output }/x`, name); } } }); core-js-3.6.1/tests/worker.html000066400000000000000000000001171360057567700164430ustar00rootroot00000000000000 core-js-3.6.1/tests/worker/000077500000000000000000000000001360057567700155565ustar00rootroot00000000000000core-js-3.6.1/tests/worker/runner.js000066400000000000000000000003611360057567700174250ustar00rootroot00000000000000'use strict'; importScripts('../../packages/core-js-bundle/index.js'); postMessage(typeof core !== 'undefined'); setImmediate(() => { postMessage('setImmediate'); }); Promise.resolve().then(() => { postMessage('Promise.resolve'); }); core-js-3.6.1/tests/worker/test.js000066400000000000000000000004421360057567700170730ustar00rootroot00000000000000'use strict'; const worker = new Worker('./worker/runner.js'); worker.addEventListener('error', e => { // eslint-disable-next-line no-console console.error(e); }); worker.addEventListener('message', message => { // eslint-disable-next-line no-console console.log(message.data); }); core-js-3.6.1/tests/wpt-url-resources/000077500000000000000000000000001360057567700176675ustar00rootroot00000000000000core-js-3.6.1/tests/wpt-url-resources/setters.js000066400000000000000000001260431360057567700217240ustar00rootroot00000000000000/* eslint-disable no-script-url */ export default { protocol: [ { comment: 'The empty string is not a valid scheme. Setter leaves the URL unchanged.', href: 'a://example.net', newValue: '', expected: { href: 'a://example.net', protocol: 'a:', }, }, { href: 'a://example.net', newValue: 'b', expected: { href: 'b://example.net', protocol: 'b:', }, }, { href: 'javascript:alert(1)', newValue: 'defuse', expected: { href: 'defuse:alert(1)', protocol: 'defuse:', }, }, { comment: 'Upper-case ASCII is lower-cased', href: 'a://example.net', newValue: 'B', expected: { href: 'b://example.net', protocol: 'b:', }, }, { comment: 'Non-ASCII is rejected', href: 'a://example.net', newValue: 'é', expected: { href: 'a://example.net', protocol: 'a:', }, }, { comment: 'No leading digit', href: 'a://example.net', newValue: '0b', expected: { href: 'a://example.net', protocol: 'a:', }, }, { comment: 'No leading punctuation', href: 'a://example.net', newValue: '+b', expected: { href: 'a://example.net', protocol: 'a:', }, }, { href: 'a://example.net', newValue: 'bC0+-.', expected: { href: 'bc0+-.://example.net', protocol: 'bc0+-.:', }, }, { comment: 'Only some punctuation is acceptable', href: 'a://example.net', newValue: 'b,c', expected: { href: 'a://example.net', protocol: 'a:', }, }, { comment: 'Non-ASCII is rejected', href: 'a://example.net', newValue: 'bé', expected: { href: 'a://example.net', protocol: 'a:', }, }, { comment: 'Can’t switch from URL containing username/password/port to file', href: 'http://test@example.net', newValue: 'file', expected: { href: 'http://test@example.net/', protocol: 'http:', }, }, { href: 'wss://x:x@example.net:1234', newValue: 'file', expected: { href: 'wss://x:x@example.net:1234/', protocol: 'wss:', }, }, { comment: 'Can’t switch from file URL with no host', href: 'file://localhost/', newValue: 'http', expected: { href: 'file:///', protocol: 'file:', }, }, { href: 'file:', newValue: 'wss', expected: { href: 'file:///', protocol: 'file:', }, }, { comment: 'Can’t switch from special scheme to non-special', href: 'http://example.net', newValue: 'b', expected: { href: 'http://example.net/', protocol: 'http:', }, }, { href: 'file://hi/path', newValue: 's', expected: { href: 'file://hi/path', protocol: 'file:', }, }, { href: 'https://example.net', newValue: 's', expected: { href: 'https://example.net/', protocol: 'https:', }, }, { href: 'ftp://example.net', newValue: 'test', expected: { href: 'ftp://example.net/', protocol: 'ftp:', }, }, { comment: 'Cannot-be-a-base URL doesn’t have a host, but URL in a special scheme must.', href: 'mailto:me@example.net', newValue: 'http', expected: { href: 'mailto:me@example.net', protocol: 'mailto:', }, }, { comment: 'Can’t switch from non-special scheme to special', href: 'ssh://me@example.net', newValue: 'http', expected: { href: 'ssh://me@example.net', protocol: 'ssh:', }, }, { href: 'ssh://me@example.net', newValue: 'file', expected: { href: 'ssh://me@example.net', protocol: 'ssh:', }, }, { href: 'ssh://example.net', newValue: 'file', expected: { href: 'ssh://example.net', protocol: 'ssh:', }, }, { href: 'nonsense:///test', newValue: 'https', expected: { href: 'nonsense:///test', protocol: 'nonsense:', }, }, { comment: "Stuff after the first ':' is ignored", href: 'http://example.net', newValue: 'https:foo : bar', expected: { href: 'https://example.net/', protocol: 'https:', }, }, { comment: "Stuff after the first ':' is ignored", href: 'data:text/html,

Test', newValue: 'view-source+data:foo : bar', expected: { href: 'view-source+data:text/html,

Test', protocol: 'view-source+data:', }, }, { comment: 'Port is set to null if it is the default for new scheme.', href: 'http://foo.com:443/', newValue: 'https', expected: { href: 'https://foo.com/', protocol: 'https:', port: '', }, }, ], username: [ { comment: 'No host means no username', href: 'file:///home/you/index.html', newValue: 'me', expected: { href: 'file:///home/you/index.html', username: '', }, }, { comment: 'No host means no username', href: 'unix:/run/foo.socket', newValue: 'me', expected: { href: 'unix:/run/foo.socket', username: '', }, }, { comment: 'Cannot-be-a-base means no username', href: 'mailto:you@example.net', newValue: 'me', expected: { href: 'mailto:you@example.net', username: '', }, }, { href: 'javascript:alert(1)', newValue: 'wario', expected: { href: 'javascript:alert(1)', username: '', }, }, { href: 'http://example.net', newValue: 'me', expected: { href: 'http://me@example.net/', username: 'me', }, }, { href: 'http://:secret@example.net', newValue: 'me', expected: { href: 'http://me:secret@example.net/', username: 'me', }, }, { href: 'http://me@example.net', newValue: '', expected: { href: 'http://example.net/', username: '', }, }, { href: 'http://me:secret@example.net', newValue: '', expected: { href: 'http://:secret@example.net/', username: '', }, }, { comment: 'UTF-8 percent encoding with the userinfo encode set.', href: 'http://example.net', newValue: "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé", expected: { href: "http://%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9@example.net/", username: "%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9", }, }, { comment: 'Bytes already percent-encoded are left as-is.', href: 'http://example.net', newValue: '%c3%89té', expected: { href: 'http://%c3%89t%C3%A9@example.net/', username: '%c3%89t%C3%A9', }, }, { href: 'sc:///', newValue: 'x', expected: { href: 'sc:///', username: '', }, }, { href: 'javascript://x/', newValue: 'wario', expected: { href: 'javascript://wario@x/', username: 'wario', }, }, { href: 'file://test/', newValue: 'test', expected: { href: 'file://test/', username: '', }, }, ], password: [ { comment: 'No host means no password', href: 'file:///home/me/index.html', newValue: 'secret', expected: { href: 'file:///home/me/index.html', password: '', }, }, { comment: 'No host means no password', href: 'unix:/run/foo.socket', newValue: 'secret', expected: { href: 'unix:/run/foo.socket', password: '', }, }, { comment: 'Cannot-be-a-base means no password', href: 'mailto:me@example.net', newValue: 'secret', expected: { href: 'mailto:me@example.net', password: '', }, }, { href: 'http://example.net', newValue: 'secret', expected: { href: 'http://:secret@example.net/', password: 'secret', }, }, { href: 'http://me@example.net', newValue: 'secret', expected: { href: 'http://me:secret@example.net/', password: 'secret', }, }, { href: 'http://:secret@example.net', newValue: '', expected: { href: 'http://example.net/', password: '', }, }, { href: 'http://me:secret@example.net', newValue: '', expected: { href: 'http://me@example.net/', password: '', }, }, { comment: 'UTF-8 percent encoding with the userinfo encode set.', href: 'http://example.net', newValue: "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé", expected: { href: "http://:%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9@example.net/", password: "%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9", }, }, { comment: 'Bytes already percent-encoded are left as-is.', href: 'http://example.net', newValue: '%c3%89té', expected: { href: 'http://:%c3%89t%C3%A9@example.net/', password: '%c3%89t%C3%A9', }, }, { href: 'sc:///', newValue: 'x', expected: { href: 'sc:///', password: '', }, }, { href: 'javascript://x/', newValue: 'bowser', expected: { href: 'javascript://:bowser@x/', password: 'bowser', }, }, { href: 'file://test/', newValue: 'test', expected: { href: 'file://test/', password: '', }, }, ], host: [ { comment: 'Non-special scheme', href: 'sc://x/', newValue: '\u0000', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { href: 'sc://x/', newValue: '\u0009', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '\u000A', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '\u000D', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: ' ', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { href: 'sc://x/', newValue: '#', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '/', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '?', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '@', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { href: 'sc://x/', newValue: 'ß', expected: { href: 'sc://%C3%9F/', host: '%C3%9F', hostname: '%C3%9F', }, }, { comment: 'IDNA Nontransitional_Processing', href: 'https://x/', newValue: 'ß', expected: { href: 'https://xn--zca/', host: 'xn--zca', hostname: 'xn--zca', }, }, { comment: 'Cannot-be-a-base means no host', href: 'mailto:me@example.net', newValue: 'example.com', expected: { href: 'mailto:me@example.net', host: '', }, }, { comment: 'Cannot-be-a-base means no password', href: 'data:text/plain,Stuff', newValue: 'example.net', expected: { href: 'data:text/plain,Stuff', host: '', }, }, { href: 'http://example.net', newValue: 'example.com:8080', expected: { href: 'http://example.com:8080/', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Port number is unchanged if not specified in the new value', href: 'http://example.net:8080', newValue: 'example.com', expected: { href: 'http://example.com:8080/', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Port number is unchanged if not specified', href: 'http://example.net:8080', newValue: 'example.com:', expected: { href: 'http://example.com:8080/', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'The empty host is not valid for special schemes', href: 'http://example.net', newValue: '', expected: { href: 'http://example.net/', host: 'example.net', }, }, { comment: 'The empty host is OK for non-special schemes', href: 'view-source+http://example.net/foo', newValue: '', expected: { href: 'view-source+http:///foo', host: '', }, }, { comment: 'Path-only URLs can gain a host', href: 'a:/foo', newValue: 'example.net', expected: { href: 'a://example.net/foo', host: 'example.net', }, }, { comment: 'IPv4 address syntax is normalized', href: 'http://example.net', newValue: '0x7F000001:8080', expected: { href: 'http://127.0.0.1:8080/', host: '127.0.0.1:8080', hostname: '127.0.0.1', port: '8080', }, }, { comment: 'IPv6 address syntax is normalized', href: 'http://example.net', newValue: '[::0:01]:2', expected: { href: 'http://[::1]:2/', host: '[::1]:2', hostname: '[::1]', port: '2', }, }, { comment: 'Default port number is removed', href: 'http://example.net', newValue: 'example.com:80', expected: { href: 'http://example.com/', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Default port number is removed', href: 'https://example.net', newValue: 'example.com:443', expected: { href: 'https://example.com/', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Default port number is only removed for the relevant scheme', href: 'https://example.net', newValue: 'example.com:80', expected: { href: 'https://example.com:80/', host: 'example.com:80', hostname: 'example.com', port: '80', }, }, { comment: 'Port number is removed if new port is scheme default and existing URL has a non-default port', href: 'http://example.net:8080', newValue: 'example.com:80', expected: { href: 'http://example.com/', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a / delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com/stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a / delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com:8080/stuff', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Stuff after a ? delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com?stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a ? delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com:8080?stuff', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Stuff after a # delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com#stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a # delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com:8080#stuff', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Stuff after a \\ delimiter is ignored for special schemes', href: 'http://example.net/path', newValue: 'example.com\\stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a \\ delimiter is ignored for special schemes', href: 'http://example.net/path', newValue: 'example.com:8080\\stuff', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: '\\ is not a delimiter for non-special schemes, but still forbidden in hosts', href: 'view-source+http://example.net/path', newValue: 'example.com\\stuff', expected: { href: 'view-source+http://example.net/path', host: 'example.net', hostname: 'example.net', port: '', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'view-source+http://example.net/path', newValue: 'example.com:8080stuff2', expected: { href: 'view-source+http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'http://example.net/path', newValue: 'example.com:8080stuff2', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'http://example.net/path', newValue: 'example.com:8080+2', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Port numbers are 16 bit integers', href: 'http://example.net/path', newValue: 'example.com:65535', expected: { href: 'http://example.com:65535/path', host: 'example.com:65535', hostname: 'example.com', port: '65535', }, }, { comment: 'Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though.', href: 'http://example.net/path', newValue: 'example.com:65536', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Broken IPv6', href: 'http://example.net/', newValue: '[google.com]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.3.4x]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.3.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'file://y/', newValue: 'x:123', expected: { href: 'file://y/', host: 'y', hostname: 'y', port: '', }, }, { href: 'file://y/', newValue: 'loc%41lhost', expected: { href: 'file:///', host: '', hostname: '', port: '', }, }, { href: 'file://hi/x', newValue: '', expected: { href: 'file:///x', host: '', hostname: '', port: '', }, }, { href: 'sc://test@test/', newValue: '', expected: { href: 'sc://test@test/', host: 'test', hostname: 'test', username: 'test', }, }, { href: 'sc://test:12/', newValue: '', expected: { href: 'sc://test:12/', host: 'test:12', hostname: 'test', port: '12', }, }, ], hostname: [ { comment: 'Non-special scheme', href: 'sc://x/', newValue: '\u0000', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { href: 'sc://x/', newValue: '\u0009', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '\u000A', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '\u000D', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: ' ', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { href: 'sc://x/', newValue: '#', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '/', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '?', expected: { href: 'sc:///', host: '', hostname: '', }, }, { href: 'sc://x/', newValue: '@', expected: { href: 'sc://x/', host: 'x', hostname: 'x', }, }, { comment: 'Cannot-be-a-base means no host', href: 'mailto:me@example.net', newValue: 'example.com', expected: { href: 'mailto:me@example.net', host: '', }, }, { comment: 'Cannot-be-a-base means no password', href: 'data:text/plain,Stuff', newValue: 'example.net', expected: { href: 'data:text/plain,Stuff', host: '', }, }, { href: 'http://example.net:8080', newValue: 'example.com', expected: { href: 'http://example.com:8080/', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'The empty host is not valid for special schemes', href: 'http://example.net', newValue: '', expected: { href: 'http://example.net/', host: 'example.net', }, }, { comment: 'The empty host is OK for non-special schemes', href: 'view-source+http://example.net/foo', newValue: '', expected: { href: 'view-source+http:///foo', host: '', }, }, { comment: 'Path-only URLs can gain a host', href: 'a:/foo', newValue: 'example.net', expected: { href: 'a://example.net/foo', host: 'example.net', }, }, { comment: 'IPv4 address syntax is normalized', href: 'http://example.net:8080', newValue: '0x7F000001', expected: { href: 'http://127.0.0.1:8080/', host: '127.0.0.1:8080', hostname: '127.0.0.1', port: '8080', }, }, { comment: 'IPv6 address syntax is normalized', href: 'http://example.net', newValue: '[::0:01]', expected: { href: 'http://[::1]/', host: '[::1]', hostname: '[::1]', port: '', }, }, { comment: 'Stuff after a : delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com:8080', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a : delimiter is ignored', href: 'http://example.net:8080/path', newValue: 'example.com:', expected: { href: 'http://example.com:8080/path', host: 'example.com:8080', hostname: 'example.com', port: '8080', }, }, { comment: 'Stuff after a / delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com/stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a ? delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com?stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a # delimiter is ignored', href: 'http://example.net/path', newValue: 'example.com#stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: 'Stuff after a \\ delimiter is ignored for special schemes', href: 'http://example.net/path', newValue: 'example.com\\stuff', expected: { href: 'http://example.com/path', host: 'example.com', hostname: 'example.com', port: '', }, }, { comment: '\\ is not a delimiter for non-special schemes, but still forbidden in hosts', href: 'view-source+http://example.net/path', newValue: 'example.com\\stuff', expected: { href: 'view-source+http://example.net/path', host: 'example.net', hostname: 'example.net', port: '', }, }, { comment: 'Broken IPv6', href: 'http://example.net/', newValue: '[google.com]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.3.4x]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.3.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.2.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'http://example.net/', newValue: '[::1.]', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', }, }, { href: 'file://y/', newValue: 'x:123', expected: { href: 'file://y/', host: 'y', hostname: 'y', port: '', }, }, { href: 'file://y/', newValue: 'loc%41lhost', expected: { href: 'file:///', host: '', hostname: '', port: '', }, }, { href: 'file://hi/x', newValue: '', expected: { href: 'file:///x', host: '', hostname: '', port: '', }, }, { href: 'sc://test@test/', newValue: '', expected: { href: 'sc://test@test/', host: 'test', hostname: 'test', username: 'test', }, }, { href: 'sc://test:12/', newValue: '', expected: { href: 'sc://test:12/', host: 'test:12', hostname: 'test', port: '12', }, }, ], port: [ { href: 'http://example.net', newValue: '8080', expected: { href: 'http://example.net:8080/', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Port number is removed if empty is the new value', href: 'http://example.net:8080', newValue: '', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', port: '', }, }, { comment: 'Default port number is removed', href: 'http://example.net:8080', newValue: '80', expected: { href: 'http://example.net/', host: 'example.net', hostname: 'example.net', port: '', }, }, { comment: 'Default port number is removed', href: 'https://example.net:4433', newValue: '443', expected: { href: 'https://example.net/', host: 'example.net', hostname: 'example.net', port: '', }, }, { comment: 'Default port number is only removed for the relevant scheme', href: 'https://example.net', newValue: '80', expected: { href: 'https://example.net:80/', host: 'example.net:80', hostname: 'example.net', port: '80', }, }, { comment: 'Stuff after a / delimiter is ignored', href: 'http://example.net/path', newValue: '8080/stuff', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Stuff after a ? delimiter is ignored', href: 'http://example.net/path', newValue: '8080?stuff', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Stuff after a # delimiter is ignored', href: 'http://example.net/path', newValue: '8080#stuff', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Stuff after a \\ delimiter is ignored for special schemes', href: 'http://example.net/path', newValue: '8080\\stuff', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'view-source+http://example.net/path', newValue: '8080stuff2', expected: { href: 'view-source+http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'http://example.net/path', newValue: '8080stuff2', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Anything other than ASCII digit stops the port parser in a setter but is not an error', href: 'http://example.net/path', newValue: '8080+2', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Port numbers are 16 bit integers', href: 'http://example.net/path', newValue: '65535', expected: { href: 'http://example.net:65535/path', host: 'example.net:65535', hostname: 'example.net', port: '65535', }, }, { comment: 'Port numbers are 16 bit integers, overflowing is an error', href: 'http://example.net:8080/path', newValue: '65536', expected: { href: 'http://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { comment: 'Port numbers are 16 bit integers, overflowing is an error', href: 'non-special://example.net:8080/path', newValue: '65536', expected: { href: 'non-special://example.net:8080/path', host: 'example.net:8080', hostname: 'example.net', port: '8080', }, }, { href: 'file://test/', newValue: '12', expected: { href: 'file://test/', port: '', }, }, { href: 'file://localhost/', newValue: '12', expected: { href: 'file:///', port: '', }, }, { href: 'non-base:value', newValue: '12', expected: { href: 'non-base:value', port: '', }, }, { href: 'sc:///', newValue: '12', expected: { href: 'sc:///', port: '', }, }, { href: 'sc://x/', newValue: '12', expected: { href: 'sc://x:12/', port: '12', }, }, { href: 'javascript://x/', newValue: '12', expected: { href: 'javascript://x:12/', port: '12', }, }, ], pathname: [ { comment: 'Cannot-be-a-base don’t have a path', href: 'mailto:me@example.net', newValue: '/foo', expected: { href: 'mailto:me@example.net', pathname: 'me@example.net', }, }, { href: 'unix:/run/foo.socket?timeout=10', newValue: '/var/log/../run/bar.socket', expected: { href: 'unix:/var/run/bar.socket?timeout=10', pathname: '/var/run/bar.socket', }, }, { href: 'https://example.net#nav', newValue: 'home', expected: { href: 'https://example.net/home#nav', pathname: '/home', }, }, { href: 'https://example.net#nav', newValue: '../home', expected: { href: 'https://example.net/home#nav', pathname: '/home', }, }, { comment: "\\ is a segment delimiter for 'special' URLs", href: 'http://example.net/home?lang=fr#nav', newValue: '\\a\\%2E\\b\\%2e.\\c', expected: { href: 'http://example.net/a/c?lang=fr#nav', pathname: '/a/c', }, }, { comment: "\\ is *not* a segment delimiter for non-'special' URLs", href: 'view-source+http://example.net/home?lang=fr#nav', newValue: '\\a\\%2E\\b\\%2e.\\c', expected: { href: 'view-source+http://example.net/\\a\\%2E\\b\\%2e.\\c?lang=fr#nav', pathname: '/\\a\\%2E\\b\\%2e.\\c', }, }, { comment: 'UTF-8 percent encoding with the default encode set. Tabs and newlines are removed.', href: 'a:/', newValue: "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé", expected: { href: "a:/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9", pathname: "/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9", }, }, { comment: 'Bytes already percent-encoded are left as-is, including %2E outside dotted segments.', href: 'http://example.net', newValue: '%2e%2E%c3%89té', expected: { href: 'http://example.net/%2e%2E%c3%89t%C3%A9', pathname: '/%2e%2E%c3%89t%C3%A9', }, }, { comment: '? needs to be encoded', href: 'http://example.net', newValue: '?', expected: { href: 'http://example.net/%3F', pathname: '/%3F', }, }, { comment: '# needs to be encoded', href: 'http://example.net', newValue: '#', expected: { href: 'http://example.net/%23', pathname: '/%23', }, }, { comment: '? needs to be encoded, non-special scheme', href: 'sc://example.net', newValue: '?', expected: { href: 'sc://example.net/%3F', pathname: '/%3F', }, }, { comment: '# needs to be encoded, non-special scheme', href: 'sc://example.net', newValue: '#', expected: { href: 'sc://example.net/%23', pathname: '/%23', }, }, { comment: 'File URLs and (back)slashes', href: 'file://monkey/', newValue: '\\\\', expected: { href: 'file://monkey/', pathname: '/', }, }, { comment: 'File URLs and (back)slashes', href: 'file:///unicorn', newValue: '//\\/', expected: { href: 'file:///', pathname: '/', }, }, { comment: 'File URLs and (back)slashes', href: 'file:///unicorn', newValue: '//monkey/..//', expected: { href: 'file:///', pathname: '/', }, }, ], search: [ { href: 'https://example.net#nav', newValue: 'lang=fr', expected: { href: 'https://example.net/?lang=fr#nav', search: '?lang=fr', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: 'lang=fr', expected: { href: 'https://example.net/?lang=fr#nav', search: '?lang=fr', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '?lang=fr', expected: { href: 'https://example.net/?lang=fr#nav', search: '?lang=fr', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '??lang=fr', expected: { href: 'https://example.net/??lang=fr#nav', search: '??lang=fr', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '?', expected: { href: 'https://example.net/?#nav', search: '', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '', expected: { href: 'https://example.net/#nav', search: '', }, }, { href: 'https://example.net?lang=en-US', newValue: '', expected: { href: 'https://example.net/', search: '', }, }, { href: 'https://example.net', newValue: '', expected: { href: 'https://example.net/', search: '', }, }, /* URI malformed { comment: 'UTF-8 percent encoding with the query encode set. Tabs and newlines are removed.', href: 'a:/', newValue: "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé", expected: { href: "a:/?%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9", search: "?%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9", }, }, */ { comment: 'Bytes already percent-encoded are left as-is', href: 'http://example.net', newValue: '%c3%89té', expected: { href: 'http://example.net/?%c3%89t%C3%A9', search: '?%c3%89t%C3%A9', }, }, ], hash: [ { href: 'https://example.net', newValue: 'main', expected: { href: 'https://example.net/#main', hash: '#main', }, }, { href: 'https://example.net#nav', newValue: 'main', expected: { href: 'https://example.net/#main', hash: '#main', }, }, { href: 'https://example.net?lang=en-US', newValue: '##nav', expected: { href: 'https://example.net/?lang=en-US##nav', hash: '##nav', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '#main', expected: { href: 'https://example.net/?lang=en-US#main', hash: '#main', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '#', expected: { href: 'https://example.net/?lang=en-US#', hash: '', }, }, { href: 'https://example.net?lang=en-US#nav', newValue: '', expected: { href: 'https://example.net/?lang=en-US', hash: '', }, }, { href: 'http://example.net', newValue: '#foo bar', expected: { href: 'http://example.net/#foo%20bar', hash: '#foo%20bar', }, }, { href: 'http://example.net', newValue: '#foo"bar', expected: { href: 'http://example.net/#foo%22bar', hash: '#foo%22bar', }, }, { href: 'http://example.net', newValue: '#foobar', expected: { href: 'http://example.net/#foo%3Ebar', hash: '#foo%3Ebar', }, }, { href: 'http://example.net', newValue: '#foo`bar', expected: { href: 'http://example.net/#foo%60bar', hash: '#foo%60bar', }, }, { comment: 'Simple percent-encoding; nuls, tabs, and newlines are removed', href: 'a:/', newValue: "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé", expected: { href: "a:/#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9", hash: "#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9", }, }, { comment: 'Bytes already percent-encoded are left as-is', href: 'http://example.net', newValue: '%c3%89té', expected: { href: 'http://example.net/#%c3%89t%C3%A9', hash: '#%c3%89t%C3%A9', }, }, { href: 'javascript:alert(1)', newValue: 'castle', expected: { href: 'javascript:alert(1)#castle', hash: '#castle', }, }, ], }; core-js-3.6.1/tests/wpt-url-resources/toascii.js000066400000000000000000000106041360057567700216610ustar00rootroot00000000000000/* eslint-disable max-len */ export default [ { comment: 'Label with hyphens in 3rd and 4th position', input: 'aa--', output: 'aa--', }, { input: 'a†--', output: 'xn--a---kp0a', }, { input: 'ab--c', output: 'ab--c', }, { comment: 'Label with leading hyphen', input: '-x', output: '-x', }, { input: '-†', output: 'xn----xhn', }, { input: '-x.xn--nxa', output: '-x.xn--nxa', }, { input: '-x.β', output: '-x.xn--nxa', }, { comment: 'Label with trailing hyphen', input: 'x-.xn--nxa', output: 'x-.xn--nxa', }, { input: 'x-.β', output: 'x-.xn--nxa', }, { comment: 'Empty labels', input: 'x..xn--nxa', output: 'x..xn--nxa', }, { input: 'x..β', output: 'x..xn--nxa', }, { comment: 'Invalid Punycode', input: 'xn--a', output: null, }, { input: 'xn--a.xn--nxa', output: null, }, { input: 'xn--a.β', output: null, }, { comment: 'Valid Punycode', input: 'xn--nxa.xn--nxa', output: 'xn--nxa.xn--nxa', }, { comment: 'Mixed', input: 'xn--nxa.β', output: 'xn--nxa.xn--nxa', }, { input: 'ab--c.xn--nxa', output: 'ab--c.xn--nxa', }, { input: 'ab--c.β', output: 'ab--c.xn--nxa', }, { comment: 'CheckJoiners is true', input: '\u200D.example', output: null, }, { input: 'xn--1ug.example', output: null, }, { comment: 'CheckBidi is true', input: 'يa', output: null, }, { input: 'xn--a-yoc', output: null, }, { comment: 'processing_option is Nontransitional_Processing', input: 'ශ්‍රී', output: 'xn--10cl1a0b660p', }, { input: 'نامه‌ای', output: 'xn--mgba3gch31f060k', }, { comment: 'U+FFFD', input: '\uFFFD.com', output: null, }, { comment: 'U+FFFD character encoded in Punycode', input: 'xn--zn7c.com', output: null, }, { comment: 'Label longer than 63 code points', input: 'x01234567890123456789012345678901234567890123456789012345678901x', output: 'x01234567890123456789012345678901234567890123456789012345678901x', }, { input: 'x01234567890123456789012345678901234567890123456789012345678901†', output: 'xn--x01234567890123456789012345678901234567890123456789012345678901-6963b', }, { input: 'x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa', output: 'x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa', }, { input: 'x01234567890123456789012345678901234567890123456789012345678901x.β', output: 'x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa', }, { comment: 'Domain excluding TLD longer than 253 code points', input: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.x', output: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.x', }, { input: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa', output: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa', }, { input: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.β', output: '01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa', }, ]; core-js-3.6.1/tests/wpt-url-resources/urltestdata.js000066400000000000000000004103131360057567700225630ustar00rootroot00000000000000/* eslint-disable no-script-url */ export default [ '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/segments.js', { input: 'http://example\t.\norg', base: 'http://example.org/foo/bar', href: 'http://example.org/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://user:pass@foo:21/bar;par?b#c', base: 'http://example.org/foo/bar', href: 'http://user:pass@foo:21/bar;par?b#c', origin: 'http://foo:21', protocol: 'http:', username: 'user', password: 'pass', host: 'foo:21', hostname: 'foo', port: '21', pathname: '/bar;par', search: '?b', hash: '#c', }, { input: 'https://test:@test', base: 'about:blank', href: 'https://test@test/', origin: 'https://test', protocol: 'https:', username: 'test', password: '', host: 'test', hostname: 'test', port: '', pathname: '/', search: '', hash: '', }, { input: 'https://:@test', base: 'about:blank', href: 'https://test/', origin: 'https://test', protocol: 'https:', username: '', password: '', host: 'test', hostname: 'test', port: '', pathname: '/', search: '', hash: '', }, { input: 'non-special://test:@test/x', base: 'about:blank', href: 'non-special://test@test/x', origin: 'null', protocol: 'non-special:', username: 'test', password: '', host: 'test', hostname: 'test', port: '', pathname: '/x', search: '', hash: '', }, { input: 'non-special://:@test/x', base: 'about:blank', href: 'non-special://test/x', origin: 'null', protocol: 'non-special:', username: '', password: '', host: 'test', hostname: 'test', port: '', pathname: '/x', search: '', hash: '', }, { input: 'http:foo.com', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/foo.com', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/foo.com', search: '', hash: '', }, { input: '\t :foo.com \n', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:foo.com', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:foo.com', search: '', hash: '', }, { input: ' foo.com ', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/foo.com', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/foo.com', search: '', hash: '', }, { input: 'a:\t foo.com', base: 'http://example.org/foo/bar', href: 'a: foo.com', origin: 'null', protocol: 'a:', username: '', password: '', host: '', hostname: '', port: '', pathname: ' foo.com', search: '', hash: '', }, { input: 'http://f:21/ b ? d # e ', base: 'http://example.org/foo/bar', href: 'http://f:21/%20b%20?%20d%20#%20e', origin: 'http://f:21', protocol: 'http:', username: '', password: '', host: 'f:21', hostname: 'f', port: '21', pathname: '/%20b%20', search: '?%20d%20', hash: '#%20e', }, { input: 'lolscheme:x x#x x', base: 'about:blank', href: 'lolscheme:x x#x%20x', protocol: 'lolscheme:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'x x', search: '', hash: '#x%20x', }, { input: 'http://f:/c', base: 'http://example.org/foo/bar', href: 'http://f/c', origin: 'http://f', protocol: 'http:', username: '', password: '', host: 'f', hostname: 'f', port: '', pathname: '/c', search: '', hash: '', }, { input: 'http://f:0/c', base: 'http://example.org/foo/bar', href: 'http://f:0/c', origin: 'http://f:0', protocol: 'http:', username: '', password: '', host: 'f:0', hostname: 'f', port: '0', pathname: '/c', search: '', hash: '', }, { input: 'http://f:00000000000000/c', base: 'http://example.org/foo/bar', href: 'http://f:0/c', origin: 'http://f:0', protocol: 'http:', username: '', password: '', host: 'f:0', hostname: 'f', port: '0', pathname: '/c', search: '', hash: '', }, { input: 'http://f:00000000000000000000080/c', base: 'http://example.org/foo/bar', href: 'http://f/c', origin: 'http://f', protocol: 'http:', username: '', password: '', host: 'f', hostname: 'f', port: '', pathname: '/c', search: '', hash: '', }, { input: 'http://f:b/c', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://f: /c', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://f:\n/c', base: 'http://example.org/foo/bar', href: 'http://f/c', origin: 'http://f', protocol: 'http:', username: '', password: '', host: 'f', hostname: 'f', port: '', pathname: '/c', search: '', hash: '', }, { input: 'http://f:fifty-two/c', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://f:999999/c', base: 'http://example.org/foo/bar', failure: true, }, { input: 'non-special://f:999999/c', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://f: 21 / b ? d # e ', base: 'http://example.org/foo/bar', failure: true, }, { input: '', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '', }, { input: ' \t', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '', }, { input: ':foo.com/', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:foo.com/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:foo.com/', search: '', hash: '', }, { input: ':foo.com\\', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:foo.com/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:foo.com/', search: '', hash: '', }, { input: ':', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:', search: '', hash: '', }, { input: ':a', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:a', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:a', search: '', hash: '', }, { input: ':/', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:/', search: '', hash: '', }, { input: ':\\', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:/', search: '', hash: '', }, { input: ':#', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:#', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:', search: '', hash: '', }, { input: '#', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar#', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '', }, { input: '#/', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar#/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '#/', }, { input: '#\\', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar#\\', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '#\\', }, { input: '#;?', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar#;?', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '#;?', }, { input: '?', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar?', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '', }, { input: '/', base: 'http://example.org/foo/bar', href: 'http://example.org/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/', search: '', hash: '', }, { input: ':23', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:23', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:23', search: '', hash: '', }, { input: '/:23', base: 'http://example.org/foo/bar', href: 'http://example.org/:23', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/:23', search: '', hash: '', }, { input: '::', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/::', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/::', search: '', hash: '', }, { input: '::23', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/::23', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/::23', search: '', hash: '', }, { input: 'foo://', base: 'http://example.org/foo/bar', href: 'foo://', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '', search: '', hash: '', }, { input: 'http://a:b@c:29/d', base: 'http://example.org/foo/bar', href: 'http://a:b@c:29/d', origin: 'http://c:29', protocol: 'http:', username: 'a', password: 'b', host: 'c:29', hostname: 'c', port: '29', pathname: '/d', search: '', hash: '', }, { input: 'http::@c:29', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/:@c:29', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/:@c:29', search: '', hash: '', }, { input: 'http://&a:foo(b]c@d:2/', base: 'http://example.org/foo/bar', href: 'http://&a:foo(b%5Dc@d:2/', origin: 'http://d:2', protocol: 'http:', username: '&a', password: 'foo(b%5Dc', host: 'd:2', hostname: 'd', port: '2', pathname: '/', search: '', hash: '', }, { input: 'http://::@c@d:2', base: 'http://example.org/foo/bar', href: 'http://:%3A%40c@d:2/', origin: 'http://d:2', protocol: 'http:', username: '', password: '%3A%40c', host: 'd:2', hostname: 'd', port: '2', pathname: '/', search: '', hash: '', }, { input: 'http://foo.com:b@d/', base: 'http://example.org/foo/bar', href: 'http://foo.com:b@d/', origin: 'http://d', protocol: 'http:', username: 'foo.com', password: 'b', host: 'd', hostname: 'd', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://foo.com/\\@', base: 'http://example.org/foo/bar', href: 'http://foo.com//@', origin: 'http://foo.com', protocol: 'http:', username: '', password: '', host: 'foo.com', hostname: 'foo.com', port: '', pathname: '//@', search: '', hash: '', }, { input: 'http:\\\\foo.com\\', base: 'http://example.org/foo/bar', href: 'http://foo.com/', origin: 'http://foo.com', protocol: 'http:', username: '', password: '', host: 'foo.com', hostname: 'foo.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:\\\\a\\b:c\\d@foo.com\\', base: 'http://example.org/foo/bar', href: 'http://a/b:c/d@foo.com/', origin: 'http://a', protocol: 'http:', username: '', password: '', host: 'a', hostname: 'a', port: '', pathname: '/b:c/d@foo.com/', search: '', hash: '', }, { input: 'foo:/', base: 'http://example.org/foo/bar', href: 'foo:/', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'foo:/bar.com/', base: 'http://example.org/foo/bar', href: 'foo:/bar.com/', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/bar.com/', search: '', hash: '', }, { input: 'foo://///////', base: 'http://example.org/foo/bar', href: 'foo://///////', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '///////', search: '', hash: '', }, { input: 'foo://///////bar.com/', base: 'http://example.org/foo/bar', href: 'foo://///////bar.com/', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '///////bar.com/', search: '', hash: '', }, { input: 'foo:////://///', base: 'http://example.org/foo/bar', href: 'foo:////://///', origin: 'null', protocol: 'foo:', username: '', password: '', host: '', hostname: '', port: '', pathname: '//://///', search: '', hash: '', }, { input: 'c:/foo', base: 'http://example.org/foo/bar', href: 'c:/foo', origin: 'null', protocol: 'c:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/foo', search: '', hash: '', }, { input: '//foo/bar', base: 'http://example.org/foo/bar', href: 'http://foo/bar', origin: 'http://foo', protocol: 'http:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/bar', search: '', hash: '', }, { input: 'http://foo/path;a??e#f#g', base: 'http://example.org/foo/bar', href: 'http://foo/path;a??e#f#g', origin: 'http://foo', protocol: 'http:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/path;a', search: '??e', hash: '#f#g', }, { input: 'http://foo/abcd?efgh?ijkl', base: 'http://example.org/foo/bar', href: 'http://foo/abcd?efgh?ijkl', origin: 'http://foo', protocol: 'http:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/abcd', search: '?efgh?ijkl', hash: '', }, { input: 'http://foo/abcd#foo?bar', base: 'http://example.org/foo/bar', href: 'http://foo/abcd#foo?bar', origin: 'http://foo', protocol: 'http:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/abcd', search: '', hash: '#foo?bar', }, { input: '[61:24:74]:98', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/[61:24:74]:98', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/[61:24:74]:98', search: '', hash: '', }, { input: 'http:[61:27]/:foo', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/[61:27]/:foo', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/[61:27]/:foo', search: '', hash: '', }, { input: 'http://[1::2]:3:4', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://2001::1', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://2001::1]', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://2001::1]:80', base: 'http://example.org/foo/bar', failure: true, }, { input: 'http://[2001::1]', base: 'http://example.org/foo/bar', href: 'http://[2001::1]/', origin: 'http://[2001::1]', protocol: 'http:', username: '', password: '', host: '[2001::1]', hostname: '[2001::1]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://[::127.0.0.1]', base: 'http://example.org/foo/bar', href: 'http://[::7f00:1]/', origin: 'http://[::7f00:1]', protocol: 'http:', username: '', password: '', host: '[::7f00:1]', hostname: '[::7f00:1]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://[0:0:0:0:0:0:13.1.68.3]', base: 'http://example.org/foo/bar', href: 'http://[::d01:4403]/', origin: 'http://[::d01:4403]', protocol: 'http:', username: '', password: '', host: '[::d01:4403]', hostname: '[::d01:4403]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://[2001::1]:80', base: 'http://example.org/foo/bar', href: 'http://[2001::1]/', origin: 'http://[2001::1]', protocol: 'http:', username: '', password: '', host: '[2001::1]', hostname: '[2001::1]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/example.com/', base: 'http://example.org/foo/bar', href: 'http://example.org/example.com/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'ftp:/example.com/', base: 'http://example.org/foo/bar', href: 'ftp://example.com/', origin: 'ftp://example.com', protocol: 'ftp:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'https:/example.com/', base: 'http://example.org/foo/bar', href: 'https://example.com/', origin: 'https://example.com', protocol: 'https:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'madeupscheme:/example.com/', base: 'http://example.org/foo/bar', href: 'madeupscheme:/example.com/', origin: 'null', protocol: 'madeupscheme:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'file:/example.com/', base: 'http://example.org/foo/bar', href: 'file:///example.com/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'file://example:1/', base: 'about:blank', failure: true, }, { input: 'file://example:test/', base: 'about:blank', failure: true, }, { input: 'file://example%/', base: 'about:blank', failure: true, }, { input: 'file://[example]/', base: 'about:blank', failure: true, }, { input: 'ftps:/example.com/', base: 'http://example.org/foo/bar', href: 'ftps:/example.com/', origin: 'null', protocol: 'ftps:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'ws:/example.com/', base: 'http://example.org/foo/bar', href: 'ws://example.com/', origin: 'ws://example.com', protocol: 'ws:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'wss:/example.com/', base: 'http://example.org/foo/bar', href: 'wss://example.com/', origin: 'wss://example.com', protocol: 'wss:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'data:/example.com/', base: 'http://example.org/foo/bar', href: 'data:/example.com/', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'javascript:/example.com/', base: 'http://example.org/foo/bar', href: 'javascript:/example.com/', origin: 'null', protocol: 'javascript:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'mailto:/example.com/', base: 'http://example.org/foo/bar', href: 'mailto:/example.com/', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'http:example.com/', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/example.com/', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/example.com/', search: '', hash: '', }, { input: 'ftp:example.com/', base: 'http://example.org/foo/bar', href: 'ftp://example.com/', origin: 'ftp://example.com', protocol: 'ftp:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'https:example.com/', base: 'http://example.org/foo/bar', href: 'https://example.com/', origin: 'https://example.com', protocol: 'https:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'madeupscheme:example.com/', base: 'http://example.org/foo/bar', href: 'madeupscheme:example.com/', origin: 'null', protocol: 'madeupscheme:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'ftps:example.com/', base: 'http://example.org/foo/bar', href: 'ftps:example.com/', origin: 'null', protocol: 'ftps:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'ws:example.com/', base: 'http://example.org/foo/bar', href: 'ws://example.com/', origin: 'ws://example.com', protocol: 'ws:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'wss:example.com/', base: 'http://example.org/foo/bar', href: 'wss://example.com/', origin: 'wss://example.com', protocol: 'wss:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'data:example.com/', base: 'http://example.org/foo/bar', href: 'data:example.com/', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'javascript:example.com/', base: 'http://example.org/foo/bar', href: 'javascript:example.com/', origin: 'null', protocol: 'javascript:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'mailto:example.com/', base: 'http://example.org/foo/bar', href: 'mailto:example.com/', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: '/a/b/c', base: 'http://example.org/foo/bar', href: 'http://example.org/a/b/c', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/a/b/c', search: '', hash: '', }, { input: '/a/ /c', base: 'http://example.org/foo/bar', href: 'http://example.org/a/%20/c', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/a/%20/c', search: '', hash: '', }, { input: '/a%2fc', base: 'http://example.org/foo/bar', href: 'http://example.org/a%2fc', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/a%2fc', search: '', hash: '', }, { input: '/a/%2f/c', base: 'http://example.org/foo/bar', href: 'http://example.org/a/%2f/c', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/a/%2f/c', search: '', hash: '', }, { input: '#β', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar#%CE%B2', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', hash: '#%CE%B2', }, { input: 'data:text/html,test#test', base: 'http://example.org/foo/bar', href: 'data:text/html,test#test', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'text/html,test', search: '', hash: '#test', }, { input: 'tel:1234567890', base: 'http://example.org/foo/bar', href: 'tel:1234567890', origin: 'null', protocol: 'tel:', username: '', password: '', host: '', hostname: '', port: '', pathname: '1234567890', search: '', hash: '', }, '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/file.html', { input: 'file:c:\\foo\\bar.html', base: 'file:///tmp/mock/path', href: 'file:///c:/foo/bar.html', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:/foo/bar.html', search: '', hash: '', }, { input: ' File:c|////foo\\bar.html', base: 'file:///tmp/mock/path', href: 'file:///c:////foo/bar.html', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:////foo/bar.html', search: '', hash: '', }, { input: 'C|/foo/bar', base: 'file:///tmp/mock/path', href: 'file:///C:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/foo/bar', search: '', hash: '', }, { input: '/C|\\foo\\bar', base: 'file:///tmp/mock/path', href: 'file:///C:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/foo/bar', search: '', hash: '', }, { input: '//C|/foo/bar', base: 'file:///tmp/mock/path', href: 'file:///C:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/foo/bar', search: '', hash: '', }, { input: '//server/file', base: 'file:///tmp/mock/path', href: 'file://server/file', protocol: 'file:', username: '', password: '', host: 'server', hostname: 'server', port: '', pathname: '/file', search: '', hash: '', }, { input: '\\\\server\\file', base: 'file:///tmp/mock/path', href: 'file://server/file', protocol: 'file:', username: '', password: '', host: 'server', hostname: 'server', port: '', pathname: '/file', search: '', hash: '', }, { input: '/\\server/file', base: 'file:///tmp/mock/path', href: 'file://server/file', protocol: 'file:', username: '', password: '', host: 'server', hostname: 'server', port: '', pathname: '/file', search: '', hash: '', }, { input: 'file:///foo/bar.txt', base: 'file:///tmp/mock/path', href: 'file:///foo/bar.txt', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/foo/bar.txt', search: '', hash: '', }, { input: 'file:///home/me', base: 'file:///tmp/mock/path', href: 'file:///home/me', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/home/me', search: '', hash: '', }, { input: '//', base: 'file:///tmp/mock/path', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '///', base: 'file:///tmp/mock/path', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '///test', base: 'file:///tmp/mock/path', href: 'file:///test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '', hash: '', }, { input: 'file://test', base: 'file:///tmp/mock/path', href: 'file://test/', protocol: 'file:', username: '', password: '', host: 'test', hostname: 'test', port: '', pathname: '/', search: '', hash: '', }, { input: 'file://localhost', base: 'file:///tmp/mock/path', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file://localhost/', base: 'file:///tmp/mock/path', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file://localhost/test', base: 'file:///tmp/mock/path', href: 'file:///test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '', hash: '', }, { input: 'test', base: 'file:///tmp/mock/path', href: 'file:///tmp/mock/test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/tmp/mock/test', search: '', hash: '', }, { input: 'file:test', base: 'file:///tmp/mock/path', href: 'file:///tmp/mock/test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/tmp/mock/test', search: '', hash: '', }, '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/path.js', { input: 'http://example.com/././foo', base: 'about:blank', href: 'http://example.com/foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo', search: '', hash: '', }, { input: 'http://example.com/./.foo', base: 'about:blank', href: 'http://example.com/.foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/.foo', search: '', hash: '', }, { input: 'http://example.com/foo/.', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/./', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/bar/..', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/bar/../', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/..bar', base: 'about:blank', href: 'http://example.com/foo/..bar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/..bar', search: '', hash: '', }, { input: 'http://example.com/foo/bar/../ton', base: 'about:blank', href: 'http://example.com/foo/ton', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/ton', search: '', hash: '', }, { input: 'http://example.com/foo/bar/../ton/../../a', base: 'about:blank', href: 'http://example.com/a', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/a', search: '', hash: '', }, { input: 'http://example.com/foo/../../..', base: 'about:blank', href: 'http://example.com/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://example.com/foo/../../../ton', base: 'about:blank', href: 'http://example.com/ton', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/ton', search: '', hash: '', }, { input: 'http://example.com/foo/%2e', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/%2e%2', base: 'about:blank', href: 'http://example.com/foo/%2e%2', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/%2e%2', search: '', hash: '', }, { input: 'http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar', base: 'about:blank', href: 'http://example.com/%2e.bar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%2e.bar', search: '', hash: '', }, { input: 'http://example.com////../..', base: 'about:blank', href: 'http://example.com//', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '//', search: '', hash: '', }, { input: 'http://example.com/foo/bar//../..', base: 'about:blank', href: 'http://example.com/foo/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/', search: '', hash: '', }, { input: 'http://example.com/foo/bar//..', base: 'about:blank', href: 'http://example.com/foo/bar/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo/bar/', search: '', hash: '', }, { input: 'http://example.com/foo', base: 'about:blank', href: 'http://example.com/foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo', search: '', hash: '', }, { input: 'http://example.com/%20foo', base: 'about:blank', href: 'http://example.com/%20foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%20foo', search: '', hash: '', }, { input: 'http://example.com/foo%', base: 'about:blank', href: 'http://example.com/foo%', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%', search: '', hash: '', }, { input: 'http://example.com/foo%2', base: 'about:blank', href: 'http://example.com/foo%2', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%2', search: '', hash: '', }, { input: 'http://example.com/foo%2zbar', base: 'about:blank', href: 'http://example.com/foo%2zbar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%2zbar', search: '', hash: '', }, { input: 'http://example.com/foo%2©zbar', base: 'about:blank', href: 'http://example.com/foo%2%C3%82%C2%A9zbar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%2%C3%82%C2%A9zbar', search: '', hash: '', }, { input: 'http://example.com/foo%41%7a', base: 'about:blank', href: 'http://example.com/foo%41%7a', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%41%7a', search: '', hash: '', }, { input: 'http://example.com/foo\t\u0091%91', base: 'about:blank', href: 'http://example.com/foo%C2%91%91', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%C2%91%91', search: '', hash: '', }, { input: 'http://example.com/foo%00%51', base: 'about:blank', href: 'http://example.com/foo%00%51', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foo%00%51', search: '', hash: '', }, { input: 'http://example.com/(%28:%3A%29)', base: 'about:blank', href: 'http://example.com/(%28:%3A%29)', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/(%28:%3A%29)', search: '', hash: '', }, { input: 'http://example.com/%3A%3a%3C%3c', base: 'about:blank', href: 'http://example.com/%3A%3a%3C%3c', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%3A%3a%3C%3c', search: '', hash: '', }, { input: 'http://example.com/foo\tbar', base: 'about:blank', href: 'http://example.com/foobar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/foobar', search: '', hash: '', }, { input: 'http://example.com\\\\foo\\\\bar', base: 'about:blank', href: 'http://example.com//foo//bar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '//foo//bar', search: '', hash: '', }, { input: 'http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd', base: 'about:blank', href: 'http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%7Ffp3%3Eju%3Dduvgw%3Dd', search: '', hash: '', }, { input: 'http://example.com/@asdf%40', base: 'about:blank', href: 'http://example.com/@asdf%40', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/@asdf%40', search: '', hash: '', }, { input: 'http://example.com/你好你好', base: 'about:blank', href: 'http://example.com/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD', search: '', hash: '', }, { input: 'http://example.com/‥/foo', base: 'about:blank', href: 'http://example.com/%E2%80%A5/foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%E2%80%A5/foo', search: '', hash: '', }, { input: 'http://example.com//foo', base: 'about:blank', href: 'http://example.com/%EF%BB%BF/foo', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%EF%BB%BF/foo', search: '', hash: '', }, { input: 'http://example.com/‮/foo/‭/bar', base: 'about:blank', href: 'http://example.com/%E2%80%AE/foo/%E2%80%AD/bar', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/%E2%80%AE/foo/%E2%80%AD/bar', search: '', hash: '', }, '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/relative.js', { input: 'http://www.google.com/foo?bar=baz#', base: 'about:blank', href: 'http://www.google.com/foo?bar=baz#', origin: 'http://www.google.com', protocol: 'http:', username: '', password: '', host: 'www.google.com', hostname: 'www.google.com', port: '', pathname: '/foo', search: '?bar=baz', hash: '', }, { input: 'http://www.google.com/foo?bar=baz# »', base: 'about:blank', href: 'http://www.google.com/foo?bar=baz#%20%C2%BB', origin: 'http://www.google.com', protocol: 'http:', username: '', password: '', host: 'www.google.com', hostname: 'www.google.com', port: '', pathname: '/foo', search: '?bar=baz', hash: '#%20%C2%BB', }, { input: 'data:test# »', base: 'about:blank', href: 'data:test#%20%C2%BB', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'test', search: '', hash: '#%20%C2%BB', }, { input: 'http://www.google.com', base: 'about:blank', href: 'http://www.google.com/', origin: 'http://www.google.com', protocol: 'http:', username: '', password: '', host: 'www.google.com', hostname: 'www.google.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://192.0x00A80001', base: 'about:blank', href: 'http://192.168.0.1/', origin: 'http://192.168.0.1', protocol: 'http:', username: '', password: '', host: '192.168.0.1', hostname: '192.168.0.1', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://www/foo%2Ehtml', base: 'about:blank', href: 'http://www/foo%2Ehtml', origin: 'http://www', protocol: 'http:', username: '', password: '', host: 'www', hostname: 'www', port: '', pathname: '/foo%2Ehtml', search: '', hash: '', }, { input: 'http://www/foo/%2E/html', base: 'about:blank', href: 'http://www/foo/html', origin: 'http://www', protocol: 'http:', username: '', password: '', host: 'www', hostname: 'www', port: '', pathname: '/foo/html', search: '', hash: '', }, { input: 'http://user:pass@/', base: 'about:blank', failure: true, }, { input: 'http://%25DOMAIN:foobar@foodomain.com/', base: 'about:blank', href: 'http://%25DOMAIN:foobar@foodomain.com/', origin: 'http://foodomain.com', protocol: 'http:', username: '%25DOMAIN', password: 'foobar', host: 'foodomain.com', hostname: 'foodomain.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:\\\\www.google.com\\foo', base: 'about:blank', href: 'http://www.google.com/foo', origin: 'http://www.google.com', protocol: 'http:', username: '', password: '', host: 'www.google.com', hostname: 'www.google.com', port: '', pathname: '/foo', search: '', hash: '', }, { input: 'http://foo:80/', base: 'about:blank', href: 'http://foo/', origin: 'http://foo', protocol: 'http:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://foo:81/', base: 'about:blank', href: 'http://foo:81/', origin: 'http://foo:81', protocol: 'http:', username: '', password: '', host: 'foo:81', hostname: 'foo', port: '81', pathname: '/', search: '', hash: '', }, { input: 'httpa://foo:80/', base: 'about:blank', href: 'httpa://foo:80/', origin: 'null', protocol: 'httpa:', username: '', password: '', host: 'foo:80', hostname: 'foo', port: '80', pathname: '/', search: '', hash: '', }, { input: 'http://foo:-80/', base: 'about:blank', failure: true, }, { input: 'https://foo:443/', base: 'about:blank', href: 'https://foo/', origin: 'https://foo', protocol: 'https:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/', search: '', hash: '', }, { input: 'https://foo:80/', base: 'about:blank', href: 'https://foo:80/', origin: 'https://foo:80', protocol: 'https:', username: '', password: '', host: 'foo:80', hostname: 'foo', port: '80', pathname: '/', search: '', hash: '', }, { input: 'ftp://foo:21/', base: 'about:blank', href: 'ftp://foo/', origin: 'ftp://foo', protocol: 'ftp:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/', search: '', hash: '', }, { input: 'ftp://foo:80/', base: 'about:blank', href: 'ftp://foo:80/', origin: 'ftp://foo:80', protocol: 'ftp:', username: '', password: '', host: 'foo:80', hostname: 'foo', port: '80', pathname: '/', search: '', hash: '', }, { input: 'ws://foo:80/', base: 'about:blank', href: 'ws://foo/', origin: 'ws://foo', protocol: 'ws:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/', search: '', hash: '', }, { input: 'ws://foo:81/', base: 'about:blank', href: 'ws://foo:81/', origin: 'ws://foo:81', protocol: 'ws:', username: '', password: '', host: 'foo:81', hostname: 'foo', port: '81', pathname: '/', search: '', hash: '', }, { input: 'ws://foo:443/', base: 'about:blank', href: 'ws://foo:443/', origin: 'ws://foo:443', protocol: 'ws:', username: '', password: '', host: 'foo:443', hostname: 'foo', port: '443', pathname: '/', search: '', hash: '', }, { input: 'ws://foo:815/', base: 'about:blank', href: 'ws://foo:815/', origin: 'ws://foo:815', protocol: 'ws:', username: '', password: '', host: 'foo:815', hostname: 'foo', port: '815', pathname: '/', search: '', hash: '', }, { input: 'wss://foo:80/', base: 'about:blank', href: 'wss://foo:80/', origin: 'wss://foo:80', protocol: 'wss:', username: '', password: '', host: 'foo:80', hostname: 'foo', port: '80', pathname: '/', search: '', hash: '', }, { input: 'wss://foo:81/', base: 'about:blank', href: 'wss://foo:81/', origin: 'wss://foo:81', protocol: 'wss:', username: '', password: '', host: 'foo:81', hostname: 'foo', port: '81', pathname: '/', search: '', hash: '', }, { input: 'wss://foo:443/', base: 'about:blank', href: 'wss://foo/', origin: 'wss://foo', protocol: 'wss:', username: '', password: '', host: 'foo', hostname: 'foo', port: '', pathname: '/', search: '', hash: '', }, { input: 'wss://foo:815/', base: 'about:blank', href: 'wss://foo:815/', origin: 'wss://foo:815', protocol: 'wss:', username: '', password: '', host: 'foo:815', hostname: 'foo', port: '815', pathname: '/', search: '', hash: '', }, { input: 'http:/example.com/', base: 'about:blank', href: 'http://example.com/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'ftp:/example.com/', base: 'about:blank', href: 'ftp://example.com/', origin: 'ftp://example.com', protocol: 'ftp:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'https:/example.com/', base: 'about:blank', href: 'https://example.com/', origin: 'https://example.com', protocol: 'https:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'madeupscheme:/example.com/', base: 'about:blank', href: 'madeupscheme:/example.com/', origin: 'null', protocol: 'madeupscheme:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'file:/example.com/', base: 'about:blank', href: 'file:///example.com/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'ftps:/example.com/', base: 'about:blank', href: 'ftps:/example.com/', origin: 'null', protocol: 'ftps:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'ws:/example.com/', base: 'about:blank', href: 'ws://example.com/', origin: 'ws://example.com', protocol: 'ws:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'wss:/example.com/', base: 'about:blank', href: 'wss://example.com/', origin: 'wss://example.com', protocol: 'wss:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'data:/example.com/', base: 'about:blank', href: 'data:/example.com/', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'javascript:/example.com/', base: 'about:blank', href: 'javascript:/example.com/', origin: 'null', protocol: 'javascript:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'mailto:/example.com/', base: 'about:blank', href: 'mailto:/example.com/', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/example.com/', search: '', hash: '', }, { input: 'http:example.com/', base: 'about:blank', href: 'http://example.com/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'ftp:example.com/', base: 'about:blank', href: 'ftp://example.com/', origin: 'ftp://example.com', protocol: 'ftp:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'https:example.com/', base: 'about:blank', href: 'https://example.com/', origin: 'https://example.com', protocol: 'https:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'madeupscheme:example.com/', base: 'about:blank', href: 'madeupscheme:example.com/', origin: 'null', protocol: 'madeupscheme:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'ftps:example.com/', base: 'about:blank', href: 'ftps:example.com/', origin: 'null', protocol: 'ftps:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'ws:example.com/', base: 'about:blank', href: 'ws://example.com/', origin: 'ws://example.com', protocol: 'ws:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'wss:example.com/', base: 'about:blank', href: 'wss://example.com/', origin: 'wss://example.com', protocol: 'wss:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'data:example.com/', base: 'about:blank', href: 'data:example.com/', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'javascript:example.com/', base: 'about:blank', href: 'javascript:example.com/', origin: 'null', protocol: 'javascript:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, { input: 'mailto:example.com/', base: 'about:blank', href: 'mailto:example.com/', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'example.com/', search: '', hash: '', }, '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/segments-userinfo-vs-host.html', { input: 'http:@www.example.com', base: 'about:blank', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/@www.example.com', base: 'about:blank', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://@www.example.com', base: 'about:blank', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:a:b@www.example.com', base: 'about:blank', href: 'http://a:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/a:b@www.example.com', base: 'about:blank', href: 'http://a:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://a:b@www.example.com', base: 'about:blank', href: 'http://a:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://@pple.com', base: 'about:blank', href: 'http://pple.com/', origin: 'http://pple.com', protocol: 'http:', username: '', password: '', host: 'pple.com', hostname: 'pple.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http::b@www.example.com', base: 'about:blank', href: 'http://:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/:b@www.example.com', base: 'about:blank', href: 'http://:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://:b@www.example.com', base: 'about:blank', href: 'http://:b@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: 'b', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/:@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http://user@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http:@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http:/@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http://@/www.example.com', base: 'about:blank', failure: true, }, { input: 'https:@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http:a:b@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http:/a:b@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http://a:b@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http::@/www.example.com', base: 'about:blank', failure: true, }, { input: 'http:a:@www.example.com', base: 'about:blank', href: 'http://a@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:/a:@www.example.com', base: 'about:blank', href: 'http://a@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://a:@www.example.com', base: 'about:blank', href: 'http://a@www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: 'a', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://www.@pple.com', base: 'about:blank', href: 'http://www.@pple.com/', origin: 'http://pple.com', protocol: 'http:', username: 'www.', password: '', host: 'pple.com', hostname: 'pple.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http:@:www.example.com', base: 'about:blank', failure: true, }, { input: 'http:/@:www.example.com', base: 'about:blank', failure: true, }, { input: 'http://@:www.example.com', base: 'about:blank', failure: true, }, { input: 'http://:@www.example.com', base: 'about:blank', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, '# Others', { input: '/', base: 'http://www.example.com/test', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: '/test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/test.txt', search: '', hash: '', }, { input: '.', base: 'http://www.example.com/test', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: '..', base: 'http://www.example.com/test', href: 'http://www.example.com/', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/test.txt', search: '', hash: '', }, { input: './test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/test.txt', search: '', hash: '', }, { input: '../test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/test.txt', search: '', hash: '', }, { input: '../aaa/test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/aaa/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/aaa/test.txt', search: '', hash: '', }, { input: '../../test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/test.txt', search: '', hash: '', }, { input: '中/test.txt', base: 'http://www.example.com/test', href: 'http://www.example.com/%E4%B8%AD/test.txt', origin: 'http://www.example.com', protocol: 'http:', username: '', password: '', host: 'www.example.com', hostname: 'www.example.com', port: '', pathname: '/%E4%B8%AD/test.txt', search: '', hash: '', }, { input: 'http://www.example2.com', base: 'http://www.example.com/test', href: 'http://www.example2.com/', origin: 'http://www.example2.com', protocol: 'http:', username: '', password: '', host: 'www.example2.com', hostname: 'www.example2.com', port: '', pathname: '/', search: '', hash: '', }, { input: '//www.example2.com', base: 'http://www.example.com/test', href: 'http://www.example2.com/', origin: 'http://www.example2.com', protocol: 'http:', username: '', password: '', host: 'www.example2.com', hostname: 'www.example2.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:...', base: 'http://www.example.com/test', href: 'file:///...', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/...', search: '', hash: '', }, { input: 'file:..', base: 'http://www.example.com/test', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:a', base: 'http://www.example.com/test', href: 'file:///a', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/a', search: '', hash: '', }, '# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html', 'Basic canonicalization, uppercase should be converted to lowercase', { input: 'http://ExAmPlE.CoM', base: 'http://other.com/', href: 'http://example.com/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://example example.com', base: 'http://other.com/', failure: true, }, { input: 'http://Goo%20 goo%7C|.com', base: 'http://other.com/', failure: true, }, { input: 'http://[]', base: 'http://other.com/', failure: true, }, { input: 'http://[:]', base: 'http://other.com/', failure: true, }, 'U+3000 is mapped to U+0020 (space) which is disallowed', { input: 'http://GOO\u00A0\u3000goo.com', base: 'http://other.com/', failure: true, }, 'Other types of space (no-break, zero-width, zero-width-no-break) are name-prepped away to nothing. U+200B, U+2060, and U+FEFF, are ignored', { input: 'http://GOO\u200B\u2060\uFEFFgoo.com', base: 'http://other.com/', href: 'http://googoo.com/', origin: 'http://googoo.com', protocol: 'http:', username: '', password: '', host: 'googoo.com', hostname: 'googoo.com', port: '', pathname: '/', search: '', hash: '', }, 'Leading and trailing C0 control or space', { input: '\u0000\u001B\u0004\u0012 http://example.com/\u001F \u000D ', base: 'about:blank', href: 'http://example.com/', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/', search: '', hash: '', }, 'Ideographic full stop (full-width period for Chinese, etc.) should be treated as a dot. U+3002 is mapped to U+002E (dot)', { input: 'http://www.foo。bar.com', base: 'http://other.com/', href: 'http://www.foo.bar.com/', origin: 'http://www.foo.bar.com', protocol: 'http:', username: '', password: '', host: 'www.foo.bar.com', hostname: 'www.foo.bar.com', port: '', pathname: '/', search: '', hash: '', }, 'Invalid unicode characters should fail... U+FDD0 is disallowed; %ef%b7%90 is U+FDD0', { input: 'http://\uFDD0zyx.com', base: 'http://other.com/', failure: true, }, 'This is the same as previous but escaped', { input: 'http://%ef%b7%90zyx.com', base: 'http://other.com/', failure: true, }, 'U+FFFD', { input: 'https://\uFFFD', base: 'about:blank', failure: true, }, { input: 'https://%EF%BF%BD', base: 'about:blank', failure: true, }, { input: 'https://x/\uFFFD?\uFFFD#\uFFFD', base: 'about:blank', href: 'https://x/%EF%BF%BD?%EF%BF%BD#%EF%BF%BD', origin: 'https://x', protocol: 'https:', username: '', password: '', host: 'x', hostname: 'x', port: '', pathname: '/%EF%BF%BD', search: '?%EF%BF%BD', hash: '#%EF%BF%BD', }, "Test name prepping, fullwidth input should be converted to ASCII and NOT IDN-ized. This is 'Go' in fullwidth UTF-8/UTF-16.", { input: 'http://Go.com', base: 'http://other.com/', href: 'http://go.com/', origin: 'http://go.com', protocol: 'http:', username: '', password: '', host: 'go.com', hostname: 'go.com', port: '', pathname: '/', search: '', hash: '', }, 'URL spec forbids the following. https://www.w3.org/Bugs/Public/show_bug.cgi?id=24257', { input: 'http://%41.com', base: 'http://other.com/', failure: true, }, { input: 'http://%ef%bc%85%ef%bc%94%ef%bc%91.com', base: 'http://other.com/', failure: true, }, '...%00 in fullwidth should fail (also as escaped UTF-8 input)', { input: 'http://%00.com', base: 'http://other.com/', failure: true, }, { input: 'http://%ef%bc%85%ef%bc%90%ef%bc%90.com', base: 'http://other.com/', failure: true, }, 'Basic IDN support, UTF-8 and UTF-16 input should be converted to IDN', { input: 'http://你好你好', base: 'http://other.com/', href: 'http://xn--6qqa088eba/', origin: 'http://xn--6qqa088eba', protocol: 'http:', username: '', password: '', host: 'xn--6qqa088eba', hostname: 'xn--6qqa088eba', port: '', pathname: '/', search: '', hash: '', }, { input: 'https://faß.ExAmPlE/', base: 'about:blank', href: 'https://xn--fa-hia.example/', origin: 'https://xn--fa-hia.example', protocol: 'https:', username: '', password: '', host: 'xn--fa-hia.example', hostname: 'xn--fa-hia.example', port: '', pathname: '/', search: '', hash: '', }, { input: 'sc://faß.ExAmPlE/', base: 'about:blank', href: 'sc://fa%C3%9F.ExAmPlE/', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'fa%C3%9F.ExAmPlE', hostname: 'fa%C3%9F.ExAmPlE', port: '', pathname: '/', search: '', hash: '', }, 'Invalid escaped characters should fail and the percents should be escaped. https://www.w3.org/Bugs/Public/show_bug.cgi?id=24191', { input: 'http://%zz%66%a.com', base: 'http://other.com/', failure: true, }, 'If we get an invalid character that has been escaped.', { input: 'http://%25', base: 'http://other.com/', failure: true, }, { input: 'http://hello%00', base: 'http://other.com/', failure: true, }, 'Escaped numbers should be treated like IP addresses if they are.', /* { input: 'http://%30%78%63%30%2e%30%32%35%30.01', base: 'http://other.com/', href: 'http://192.168.0.1/', origin: 'http://192.168.0.1', protocol: 'http:', username: '', password: '', host: '192.168.0.1', hostname: '192.168.0.1', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://%30%78%63%30%2e%30%32%35%30.01%2e', base: 'http://other.com/', href: 'http://192.168.0.1/', origin: 'http://192.168.0.1', protocol: 'http:', username: '', password: '', host: '192.168.0.1', hostname: '192.168.0.1', port: '', pathname: '/', search: '', hash: '', }, */ { input: 'http://192.168.0.257', base: 'http://other.com/', failure: true, }, 'Invalid escaping in hosts causes failure', { input: 'http://%3g%78%63%30%2e%30%32%35%30%2E.01', base: 'http://other.com/', failure: true, }, 'A space in a host causes failure', { input: 'http://192.168.0.1 hello', base: 'http://other.com/', failure: true, }, { input: 'https://x x:12', base: 'about:blank', failure: true, }, 'Fullwidth and escaped UTF-8 fullwidth should still be treated as IP', { input: 'http://0Xc0.0250.01', base: 'http://other.com/', href: 'http://192.168.0.1/', origin: 'http://192.168.0.1', protocol: 'http:', username: '', password: '', host: '192.168.0.1', hostname: '192.168.0.1', port: '', pathname: '/', search: '', hash: '', }, 'Domains with empty labels', { input: 'http://./', base: 'about:blank', href: 'http://./', origin: 'http://.', protocol: 'http:', username: '', password: '', host: '.', hostname: '.', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://../', base: 'about:blank', href: 'http://../', origin: 'http://..', protocol: 'http:', username: '', password: '', host: '..', hostname: '..', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://0..0x300/', base: 'about:blank', href: 'http://0..0x300/', origin: 'http://0..0x300', protocol: 'http:', username: '', password: '', host: '0..0x300', hostname: '0..0x300', port: '', pathname: '/', search: '', hash: '', }, 'Broken IPv6', { input: 'http://[www.google.com]/', base: 'about:blank', failure: true, }, { input: 'http://[google.com]', base: 'http://other.com/', failure: true, }, { input: 'http://[::1.2.3.4x]', base: 'http://other.com/', failure: true, }, { input: 'http://[::1.2.3.]', base: 'http://other.com/', failure: true, }, { input: 'http://[::1.2.]', base: 'http://other.com/', failure: true, }, { input: 'http://[::1.]', base: 'http://other.com/', failure: true, }, 'Misc Unicode', { input: 'http://foo:💩@example.com/bar', base: 'http://other.com/', href: 'http://foo:%F0%9F%92%A9@example.com/bar', origin: 'http://example.com', protocol: 'http:', username: 'foo', password: '%F0%9F%92%A9', host: 'example.com', hostname: 'example.com', port: '', pathname: '/bar', search: '', hash: '', }, '# resolving a fragment against any scheme succeeds', { input: '#', base: 'test:test', href: 'test:test#', origin: 'null', protocol: 'test:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'test', search: '', hash: '', }, { input: '#x', base: 'mailto:x@x.com', href: 'mailto:x@x.com#x', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'x@x.com', search: '', hash: '#x', }, { input: '#x', base: 'data:,', href: 'data:,#x', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: ',', search: '', hash: '#x', }, { input: '#x', base: 'about:blank', href: 'about:blank#x', origin: 'null', protocol: 'about:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'blank', search: '', hash: '#x', }, { input: '#', base: 'test:test?test', href: 'test:test?test#', origin: 'null', protocol: 'test:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'test', search: '?test', hash: '', }, '# multiple @ in authority state', { input: 'https://@test@test@example:800/', base: 'http://doesnotmatter/', href: 'https://%40test%40test@example:800/', origin: 'https://example:800', protocol: 'https:', username: '%40test%40test', password: '', host: 'example:800', hostname: 'example', port: '800', pathname: '/', search: '', hash: '', }, { input: 'https://@@@example', base: 'http://doesnotmatter/', href: 'https://%40%40@example/', origin: 'https://example', protocol: 'https:', username: '%40%40', password: '', host: 'example', hostname: 'example', port: '', pathname: '/', search: '', hash: '', }, 'non-az-09 characters', { input: 'http://`{}:`{}@h/`{}?`{}', base: 'http://doesnotmatter/', href: 'http://%60%7B%7D:%60%7B%7D@h/%60%7B%7D?`{}', origin: 'http://h', protocol: 'http:', username: '%60%7B%7D', password: '%60%7B%7D', host: 'h', hostname: 'h', port: '', pathname: '/%60%7B%7D', search: '?`{}', hash: '', }, "byte is ' and url is special", { input: "http://host/?'", base: 'about:blank', href: 'http://host/?%27', origin: 'http://host', protocol: 'http:', username: '', password: '', host: 'host', hostname: 'host', port: '', pathname: '/', search: '?%27', hash: '', }, { input: "notspecial://host/?'", base: 'about:blank', href: "notspecial://host/?'", origin: 'null', protocol: 'notspecial:', username: '', password: '', host: 'host', hostname: 'host', port: '', pathname: '/', search: "?'", hash: '', }, '# Credentials in base', { input: '/some/path', base: 'http://user@example.org/smth', href: 'http://user@example.org/some/path', origin: 'http://example.org', protocol: 'http:', username: 'user', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/some/path', search: '', hash: '', }, { input: '', base: 'http://user:pass@example.org:21/smth', href: 'http://user:pass@example.org:21/smth', origin: 'http://example.org:21', protocol: 'http:', username: 'user', password: 'pass', host: 'example.org:21', hostname: 'example.org', port: '21', pathname: '/smth', search: '', hash: '', }, { input: '/some/path', base: 'http://user:pass@example.org:21/smth', href: 'http://user:pass@example.org:21/some/path', origin: 'http://example.org:21', protocol: 'http:', username: 'user', password: 'pass', host: 'example.org:21', hostname: 'example.org', port: '21', pathname: '/some/path', search: '', hash: '', }, '# a set of tests designed by zcorpan for relative URLs with unknown schemes', { input: 'i', base: 'sc:sd', failure: true, }, { input: 'i', base: 'sc:sd/sd', failure: true, }, { input: 'i', base: 'sc:/pa/pa', href: 'sc:/pa/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/i', search: '', hash: '', }, { input: 'i', base: 'sc://ho/pa', href: 'sc://ho/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'ho', hostname: 'ho', port: '', pathname: '/i', search: '', hash: '', }, { input: 'i', base: 'sc:///pa/pa', href: 'sc:///pa/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/i', search: '', hash: '', }, { input: '../i', base: 'sc:sd', failure: true, }, { input: '../i', base: 'sc:sd/sd', failure: true, }, { input: '../i', base: 'sc:/pa/pa', href: 'sc:/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/i', search: '', hash: '', }, { input: '../i', base: 'sc://ho/pa', href: 'sc://ho/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'ho', hostname: 'ho', port: '', pathname: '/i', search: '', hash: '', }, { input: '../i', base: 'sc:///pa/pa', href: 'sc:///i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/i', search: '', hash: '', }, { input: '/i', base: 'sc:sd', failure: true, }, { input: '/i', base: 'sc:sd/sd', failure: true, }, { input: '/i', base: 'sc:/pa/pa', href: 'sc:/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/i', search: '', hash: '', }, { input: '/i', base: 'sc://ho/pa', href: 'sc://ho/i', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'ho', hostname: 'ho', port: '', pathname: '/i', search: '', hash: '', }, { input: '/i', base: 'sc:///pa/pa', href: 'sc:///i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/i', search: '', hash: '', }, { input: '?i', base: 'sc:sd', failure: true, }, { input: '?i', base: 'sc:sd/sd', failure: true, }, { input: '?i', base: 'sc:/pa/pa', href: 'sc:/pa/pa?i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/pa', search: '?i', hash: '', }, { input: '?i', base: 'sc://ho/pa', href: 'sc://ho/pa?i', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'ho', hostname: 'ho', port: '', pathname: '/pa', search: '?i', hash: '', }, { input: '?i', base: 'sc:///pa/pa', href: 'sc:///pa/pa?i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/pa', search: '?i', hash: '', }, { input: '#i', base: 'sc:sd', href: 'sc:sd#i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'sd', search: '', hash: '#i', }, { input: '#i', base: 'sc:sd/sd', href: 'sc:sd/sd#i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'sd/sd', search: '', hash: '#i', }, { input: '#i', base: 'sc:/pa/pa', href: 'sc:/pa/pa#i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/pa', search: '', hash: '#i', }, { input: '#i', base: 'sc://ho/pa', href: 'sc://ho/pa#i', origin: 'null', protocol: 'sc:', username: '', password: '', host: 'ho', hostname: 'ho', port: '', pathname: '/pa', search: '', hash: '#i', }, { input: '#i', base: 'sc:///pa/pa', href: 'sc:///pa/pa#i', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pa/pa', search: '', hash: '#i', }, '# make sure that relative URL logic works on known typically non-relative schemes too', { input: 'about:/../', base: 'about:blank', href: 'about:/', origin: 'null', protocol: 'about:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'data:/../', base: 'about:blank', href: 'data:/', origin: 'null', protocol: 'data:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'javascript:/../', base: 'about:blank', href: 'javascript:/', origin: 'null', protocol: 'javascript:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'mailto:/../', base: 'about:blank', href: 'mailto:/', origin: 'null', protocol: 'mailto:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, '# unknown schemes and their hosts', { input: 'sc://ñ.test/', base: 'about:blank', href: 'sc://%C3%B1.test/', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1.test', hostname: '%C3%B1.test', port: '', pathname: '/', search: '', hash: '', }, { input: "sc://\u001F!\"$&'()*+,-.;<=>^_`{|}~/", base: 'about:blank', href: "sc://%1F!\"$&'()*+,-.;<=>^_`{|}~/", origin: 'null', protocol: 'sc:', username: '', password: '', host: "%1F!\"$&'()*+,-.;<=>^_`{|}~", hostname: "%1F!\"$&'()*+,-.;<=>^_`{|}~", port: '', pathname: '/', search: '', hash: '', }, { input: 'sc://\u0000/', base: 'about:blank', failure: true, }, { input: 'sc:// /', base: 'about:blank', failure: true, }, /* { input: 'sc://%/', base: 'about:blank', href: 'sc://%/', protocol: 'sc:', username: '', password: '', host: '%', hostname: '%', port: '', pathname: '/', search: '', hash: '', }, */ { input: 'sc://@/', base: 'about:blank', failure: true, }, { input: 'sc://te@s:t@/', base: 'about:blank', failure: true, }, { input: 'sc://:/', base: 'about:blank', failure: true, }, { input: 'sc://:12/', base: 'about:blank', failure: true, }, { input: 'sc://[/', base: 'about:blank', failure: true, }, { input: 'sc://\\/', base: 'about:blank', failure: true, }, { input: 'sc://]/', base: 'about:blank', failure: true, }, { input: 'x', base: 'sc://ñ', href: 'sc://%C3%B1/x', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '/x', search: '', hash: '', }, '# unknown schemes and backslashes', { input: 'sc:\\../', base: 'about:blank', href: 'sc:\\../', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '\\../', search: '', hash: '', }, '# unknown scheme with path looking like a password', { input: 'sc::a@example.net', base: 'about:blank', href: 'sc::a@example.net', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: ':a@example.net', search: '', hash: '', }, '# unknown scheme with bogus percent-encoding', { input: 'wow:%NBD', base: 'about:blank', href: 'wow:%NBD', origin: 'null', protocol: 'wow:', username: '', password: '', host: '', hostname: '', port: '', pathname: '%NBD', search: '', hash: '', }, { input: 'wow:%1G', base: 'about:blank', href: 'wow:%1G', origin: 'null', protocol: 'wow:', username: '', password: '', host: '', hostname: '', port: '', pathname: '%1G', search: '', hash: '', }, '# Hosts and percent-encoding', { input: 'ftp://example.com%80/', base: 'about:blank', failure: true, }, { input: 'ftp://example.com%A0/', base: 'about:blank', failure: true, }, { input: 'https://example.com%80/', base: 'about:blank', failure: true, }, { input: 'https://example.com%A0/', base: 'about:blank', failure: true, }, /* { input: 'ftp://%e2%98%83', base: 'about:blank', href: 'ftp://xn--n3h/', origin: 'ftp://xn--n3h', protocol: 'ftp:', username: '', password: '', host: 'xn--n3h', hostname: 'xn--n3h', port: '', pathname: '/', search: '', hash: '', }, { input: 'https://%e2%98%83', base: 'about:blank', href: 'https://xn--n3h/', origin: 'https://xn--n3h', protocol: 'https:', username: '', password: '', host: 'xn--n3h', hostname: 'xn--n3h', port: '', pathname: '/', search: '', hash: '', }, */ '# tests from jsdom/whatwg-url designed for code coverage', { input: 'http://127.0.0.1:10100/relative_import.html', base: 'about:blank', href: 'http://127.0.0.1:10100/relative_import.html', origin: 'http://127.0.0.1:10100', protocol: 'http:', username: '', password: '', host: '127.0.0.1:10100', hostname: '127.0.0.1', port: '10100', pathname: '/relative_import.html', search: '', hash: '', }, { input: 'http://facebook.com/?foo=%7B%22abc%22', base: 'about:blank', href: 'http://facebook.com/?foo=%7B%22abc%22', origin: 'http://facebook.com', protocol: 'http:', username: '', password: '', host: 'facebook.com', hostname: 'facebook.com', port: '', pathname: '/', search: '?foo=%7B%22abc%22', hash: '', }, { input: 'https://localhost:3000/jqueryui@1.2.3', base: 'about:blank', href: 'https://localhost:3000/jqueryui@1.2.3', origin: 'https://localhost:3000', protocol: 'https:', username: '', password: '', host: 'localhost:3000', hostname: 'localhost', port: '3000', pathname: '/jqueryui@1.2.3', search: '', hash: '', }, '# tab/LF/CR', { input: 'h\tt\nt\rp://h\to\ns\rt:9\t0\n0\r0/p\ta\nt\rh?q\tu\ne\rry#f\tr\na\rg', base: 'about:blank', href: 'http://host:9000/path?query#frag', origin: 'http://host:9000', protocol: 'http:', username: '', password: '', host: 'host:9000', hostname: 'host', port: '9000', pathname: '/path', search: '?query', hash: '#frag', }, '# Stringification of URL.searchParams', { input: '?a=b&c=d', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar?a=b&c=d', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '?a=b&c=d', searchParams: 'a=b&c=d', hash: '', }, { input: '??a=b&c=d', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar??a=b&c=d', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '??a=b&c=d', searchParams: '%3Fa=b&c=d', hash: '', }, '# Scheme only', { input: 'http:', base: 'http://example.org/foo/bar', href: 'http://example.org/foo/bar', origin: 'http://example.org', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/foo/bar', search: '', searchParams: '', hash: '', }, { input: 'http:', base: 'https://example.org/foo/bar', failure: true, }, { input: 'sc:', base: 'https://example.org/foo/bar', href: 'sc:', origin: 'null', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '', search: '', searchParams: '', hash: '', }, '# Percent encoding of fragments', { input: 'http://foo.bar/baz?qux#foo\bbar', base: 'about:blank', href: 'http://foo.bar/baz?qux#foo%08bar', origin: 'http://foo.bar', protocol: 'http:', username: '', password: '', host: 'foo.bar', hostname: 'foo.bar', port: '', pathname: '/baz', search: '?qux', searchParams: 'qux=', hash: '#foo%08bar', }, { input: 'http://foo.bar/baz?qux#foo"bar', base: 'about:blank', href: 'http://foo.bar/baz?qux#foo%22bar', origin: 'http://foo.bar', protocol: 'http:', username: '', password: '', host: 'foo.bar', hostname: 'foo.bar', port: '', pathname: '/baz', search: '?qux', searchParams: 'qux=', hash: '#foo%22bar', }, { input: 'http://foo.bar/baz?qux#foobar', base: 'about:blank', href: 'http://foo.bar/baz?qux#foo%3Ebar', origin: 'http://foo.bar', protocol: 'http:', username: '', password: '', host: 'foo.bar', hostname: 'foo.bar', port: '', pathname: '/baz', search: '?qux', searchParams: 'qux=', hash: '#foo%3Ebar', }, { input: 'http://foo.bar/baz?qux#foo`bar', base: 'about:blank', href: 'http://foo.bar/baz?qux#foo%60bar', origin: 'http://foo.bar', protocol: 'http:', username: '', password: '', host: 'foo.bar', hostname: 'foo.bar', port: '', pathname: '/baz', search: '?qux', searchParams: 'qux=', hash: '#foo%60bar', }, '# IPv4 parsing (via https://github.com/nodejs/node/pull/10317)', { input: 'http://192.168.257', base: 'http://other.com/', href: 'http://192.168.1.1/', origin: 'http://192.168.1.1', protocol: 'http:', username: '', password: '', host: '192.168.1.1', hostname: '192.168.1.1', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://192.168.257.com', base: 'http://other.com/', href: 'http://192.168.257.com/', origin: 'http://192.168.257.com', protocol: 'http:', username: '', password: '', host: '192.168.257.com', hostname: '192.168.257.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://256', base: 'http://other.com/', href: 'http://0.0.1.0/', origin: 'http://0.0.1.0', protocol: 'http:', username: '', password: '', host: '0.0.1.0', hostname: '0.0.1.0', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://256.com', base: 'http://other.com/', href: 'http://256.com/', origin: 'http://256.com', protocol: 'http:', username: '', password: '', host: '256.com', hostname: '256.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://999999999', base: 'http://other.com/', href: 'http://59.154.201.255/', origin: 'http://59.154.201.255', protocol: 'http:', username: '', password: '', host: '59.154.201.255', hostname: '59.154.201.255', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://999999999.com', base: 'http://other.com/', href: 'http://999999999.com/', origin: 'http://999999999.com', protocol: 'http:', username: '', password: '', host: '999999999.com', hostname: '999999999.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://10000000000', base: 'http://other.com/', failure: true, }, { input: 'http://10000000000.com', base: 'http://other.com/', href: 'http://10000000000.com/', origin: 'http://10000000000.com', protocol: 'http:', username: '', password: '', host: '10000000000.com', hostname: '10000000000.com', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://4294967295', base: 'http://other.com/', href: 'http://255.255.255.255/', origin: 'http://255.255.255.255', protocol: 'http:', username: '', password: '', host: '255.255.255.255', hostname: '255.255.255.255', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://4294967296', base: 'http://other.com/', failure: true, }, { input: 'http://0xffffffff', base: 'http://other.com/', href: 'http://255.255.255.255/', origin: 'http://255.255.255.255', protocol: 'http:', username: '', password: '', host: '255.255.255.255', hostname: '255.255.255.255', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://0xffffffff1', base: 'http://other.com/', failure: true, }, { input: 'http://256.256.256.256', base: 'http://other.com/', failure: true, }, { input: 'http://256.256.256.256.256', base: 'http://other.com/', href: 'http://256.256.256.256.256/', origin: 'http://256.256.256.256.256', protocol: 'http:', username: '', password: '', host: '256.256.256.256.256', hostname: '256.256.256.256.256', port: '', pathname: '/', search: '', hash: '', }, { input: 'https://0x.0x.0', base: 'about:blank', href: 'https://0.0.0.0/', origin: 'https://0.0.0.0', protocol: 'https:', username: '', password: '', host: '0.0.0.0', hostname: '0.0.0.0', port: '', pathname: '/', search: '', hash: '', }, 'More IPv4 parsing (via https://github.com/jsdom/whatwg-url/issues/92)', { input: 'https://0x100000000/test', base: 'about:blank', failure: true, }, { input: 'https://256.0.0.1/test', base: 'about:blank', failure: true, }, "# file URLs containing percent-encoded Windows drive letters (shouldn't work)", { input: 'file:///C%3A/', base: 'about:blank', href: 'file:///C%3A/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C%3A/', search: '', hash: '', }, { input: 'file:///C%7C/', base: 'about:blank', href: 'file:///C%7C/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C%7C/', search: '', hash: '', }, '# file URLs relative to other file URLs (via https://github.com/jsdom/whatwg-url/pull/60)', { input: 'pix/submit.gif', base: 'file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/anchor.html', href: 'file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif', search: '', hash: '', }, { input: '..', base: 'file:///C:/', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: '..', base: 'file:///', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, '# More file URL tests by zcorpan and annevk', { input: '/', base: 'file:///C:/a/b', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: '//d:', base: 'file:///C:/a/b', href: 'file:///d:', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/d:', search: '', hash: '', }, { input: '//d:/..', base: 'file:///C:/a/b', href: 'file:///d:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/d:/', search: '', hash: '', }, { input: '..', base: 'file:///ab:/', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '..', base: 'file:///1:/', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '', base: 'file:///test?test#test', href: 'file:///test?test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?test', hash: '', }, { input: 'file:', base: 'file:///test?test#test', href: 'file:///test?test', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?test', hash: '', }, { input: '?x', base: 'file:///test?test#test', href: 'file:///test?x', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?x', hash: '', }, { input: 'file:?x', base: 'file:///test?test#test', href: 'file:///test?x', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?x', hash: '', }, { input: '#x', base: 'file:///test?test#test', href: 'file:///test?test#x', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?test', hash: '#x', }, { input: 'file:#x', base: 'file:///test?test#test', href: 'file:///test?test#x', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test', search: '?test', hash: '#x', }, '# File URLs and many (back)slashes', { input: 'file:\\\\//', base: 'about:blank', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:\\\\\\\\', base: 'about:blank', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:\\\\\\\\?fox', base: 'about:blank', href: 'file:///?fox', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '?fox', hash: '', }, { input: 'file:\\\\\\\\#guppy', base: 'about:blank', href: 'file:///#guppy', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '#guppy', }, { input: 'file://spider///', base: 'about:blank', href: 'file://spider/', protocol: 'file:', username: '', password: '', host: 'spider', hostname: 'spider', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:\\\\localhost//', base: 'about:blank', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:///localhost//cat', base: 'about:blank', href: 'file:///localhost//cat', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/localhost//cat', search: '', hash: '', }, { input: 'file://\\/localhost//cat', base: 'about:blank', href: 'file:///localhost//cat', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/localhost//cat', search: '', hash: '', }, { input: 'file://localhost//a//../..//', base: 'about:blank', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '/////mouse', base: 'file:///elephant', href: 'file:///mouse', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/mouse', search: '', hash: '', }, { input: '\\//pig', base: 'file://lion/', href: 'file:///pig', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pig', search: '', hash: '', }, { input: '\\/localhost//pig', base: 'file://lion/', href: 'file:///pig', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pig', search: '', hash: '', }, { input: '//localhost//pig', base: 'file://lion/', href: 'file:///pig', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/pig', search: '', hash: '', }, { input: '/..//localhost//pig', base: 'file://lion/', href: 'file://lion/localhost//pig', protocol: 'file:', username: '', password: '', host: 'lion', hostname: 'lion', port: '', pathname: '/localhost//pig', search: '', hash: '', }, { input: 'file://', base: 'file://ape/', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, '# File URLs with non-empty hosts', { input: '/rooibos', base: 'file://tea/', href: 'file://tea/rooibos', protocol: 'file:', username: '', password: '', host: 'tea', hostname: 'tea', port: '', pathname: '/rooibos', search: '', hash: '', }, { input: '/?chai', base: 'file://tea/', href: 'file://tea/?chai', protocol: 'file:', username: '', password: '', host: 'tea', hostname: 'tea', port: '', pathname: '/', search: '?chai', hash: '', }, "# Windows drive letter handling with the 'file:' base URL", { input: 'C|', base: 'file://host/dir/file', href: 'file:///C:', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:', search: '', hash: '', }, { input: 'C|#', base: 'file://host/dir/file', href: 'file:///C:#', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:', search: '', hash: '', }, { input: 'C|?', base: 'file://host/dir/file', href: 'file:///C:?', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:', search: '', hash: '', }, { input: 'C|/', base: 'file://host/dir/file', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'C|\n/', base: 'file://host/dir/file', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'C|\\', base: 'file://host/dir/file', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'C', base: 'file://host/dir/file', href: 'file://host/dir/C', protocol: 'file:', username: '', password: '', host: 'host', hostname: 'host', port: '', pathname: '/dir/C', search: '', hash: '', }, { input: 'C|a', base: 'file://host/dir/file', href: 'file://host/dir/C|a', protocol: 'file:', username: '', password: '', host: 'host', hostname: 'host', port: '', pathname: '/dir/C|a', search: '', hash: '', }, '# Windows drive letter quirk in the file slash state', { input: '/c:/foo/bar', base: 'file:///c:/baz/qux', href: 'file:///c:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:/foo/bar', search: '', hash: '', }, { input: '/c|/foo/bar', base: 'file:///c:/baz/qux', href: 'file:///c:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:/foo/bar', search: '', hash: '', }, { input: 'file:\\c:\\foo\\bar', base: 'file:///c:/baz/qux', href: 'file:///c:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:/foo/bar', search: '', hash: '', }, { input: '/c:/foo/bar', base: 'file://host/path', href: 'file:///c:/foo/bar', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/c:/foo/bar', search: '', hash: '', }, '# Windows drive letter quirk with not empty host', { input: 'file://example.net/C:/', base: 'about:blank', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'file://1.2.3.4/C:/', base: 'about:blank', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'file://[1::8]/C:/', base: 'about:blank', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, '# Windows drive letter quirk (no host)', { input: 'file:/C|/', base: 'about:blank', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, { input: 'file://C|/', base: 'about:blank', href: 'file:///C:/', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/C:/', search: '', hash: '', }, '# file URLs without base URL by Rimas Misevičius', { input: 'file:', base: 'about:blank', href: 'file:///', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: 'file:?q=v', base: 'about:blank', href: 'file:///?q=v', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '?q=v', hash: '', }, { input: 'file:#frag', base: 'about:blank', href: 'file:///#frag', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '#frag', }, '# IPv6 tests', { input: 'http://[1:0::]', base: 'http://example.net/', href: 'http://[1::]/', origin: 'http://[1::]', protocol: 'http:', username: '', password: '', host: '[1::]', hostname: '[1::]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://[0:1:2:3:4:5:6:7:8]', base: 'http://example.net/', failure: true, }, { input: 'https://[0::0::0]', base: 'about:blank', failure: true, }, { input: 'https://[0:.0]', base: 'about:blank', failure: true, }, { input: 'https://[0:0:]', base: 'about:blank', failure: true, }, { input: 'https://[0:1:2:3:4:5:6:7.0.0.0.1]', base: 'about:blank', failure: true, }, { input: 'https://[0:1.00.0.0.0]', base: 'about:blank', failure: true, }, { input: 'https://[0:1.290.0.0.0]', base: 'about:blank', failure: true, }, { input: 'https://[0:1.23.23]', base: 'about:blank', failure: true, }, '# Empty host', { input: 'http://?', base: 'about:blank', failure: true, }, { input: 'http://#', base: 'about:blank', failure: true, }, 'Port overflow (2^32 + 81)', { input: 'http://f:4294967377/c', base: 'http://example.org/', failure: true, }, 'Port overflow (2^64 + 81)', { input: 'http://f:18446744073709551697/c', base: 'http://example.org/', failure: true, }, 'Port overflow (2^128 + 81)', { input: 'http://f:340282366920938463463374607431768211537/c', base: 'http://example.org/', failure: true, }, '# Non-special-URL path tests', { input: 'sc://ñ', base: 'about:blank', href: 'sc://%C3%B1', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '', search: '', hash: '', }, { input: 'sc://ñ?x', base: 'about:blank', href: 'sc://%C3%B1?x', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '', search: '?x', hash: '', }, { input: 'sc://ñ#x', base: 'about:blank', href: 'sc://%C3%B1#x', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '', search: '', hash: '#x', }, { input: '#x', base: 'sc://ñ', href: 'sc://%C3%B1#x', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '', search: '', hash: '#x', }, { input: '?x', base: 'sc://ñ', href: 'sc://%C3%B1?x', origin: 'null', protocol: 'sc:', username: '', password: '', host: '%C3%B1', hostname: '%C3%B1', port: '', pathname: '', search: '?x', hash: '', }, { input: 'sc://?', base: 'about:blank', href: 'sc://?', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '', search: '', hash: '', }, { input: 'sc://#', base: 'about:blank', href: 'sc://#', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '', search: '', hash: '', }, { input: '///', base: 'sc://x/', href: 'sc:///', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/', search: '', hash: '', }, { input: '////', base: 'sc://x/', href: 'sc:////', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '//', search: '', hash: '', }, { input: '////x/', base: 'sc://x/', href: 'sc:////x/', protocol: 'sc:', username: '', password: '', host: '', hostname: '', port: '', pathname: '//x/', search: '', hash: '', }, { input: 'tftp://foobar.com/someconfig;mode=netascii', base: 'about:blank', href: 'tftp://foobar.com/someconfig;mode=netascii', origin: 'null', protocol: 'tftp:', username: '', password: '', host: 'foobar.com', hostname: 'foobar.com', port: '', pathname: '/someconfig;mode=netascii', search: '', hash: '', }, { input: 'telnet://user:pass@foobar.com:23/', base: 'about:blank', href: 'telnet://user:pass@foobar.com:23/', origin: 'null', protocol: 'telnet:', username: 'user', password: 'pass', host: 'foobar.com:23', hostname: 'foobar.com', port: '23', pathname: '/', search: '', hash: '', }, { input: 'ut2004://10.10.10.10:7777/Index.ut2', base: 'about:blank', href: 'ut2004://10.10.10.10:7777/Index.ut2', origin: 'null', protocol: 'ut2004:', username: '', password: '', host: '10.10.10.10:7777', hostname: '10.10.10.10', port: '7777', pathname: '/Index.ut2', search: '', hash: '', }, { input: 'redis://foo:bar@somehost:6379/0?baz=bam&qux=baz', base: 'about:blank', href: 'redis://foo:bar@somehost:6379/0?baz=bam&qux=baz', origin: 'null', protocol: 'redis:', username: 'foo', password: 'bar', host: 'somehost:6379', hostname: 'somehost', port: '6379', pathname: '/0', search: '?baz=bam&qux=baz', hash: '', }, { input: 'rsync://foo@host:911/sup', base: 'about:blank', href: 'rsync://foo@host:911/sup', origin: 'null', protocol: 'rsync:', username: 'foo', password: '', host: 'host:911', hostname: 'host', port: '911', pathname: '/sup', search: '', hash: '', }, { input: 'git://github.com/foo/bar.git', base: 'about:blank', href: 'git://github.com/foo/bar.git', origin: 'null', protocol: 'git:', username: '', password: '', host: 'github.com', hostname: 'github.com', port: '', pathname: '/foo/bar.git', search: '', hash: '', }, { input: 'irc://myserver.com:6999/channel?passwd', base: 'about:blank', href: 'irc://myserver.com:6999/channel?passwd', origin: 'null', protocol: 'irc:', username: '', password: '', host: 'myserver.com:6999', hostname: 'myserver.com', port: '6999', pathname: '/channel', search: '?passwd', hash: '', }, { input: 'dns://fw.example.org:9999/foo.bar.org?type=TXT', base: 'about:blank', href: 'dns://fw.example.org:9999/foo.bar.org?type=TXT', origin: 'null', protocol: 'dns:', username: '', password: '', host: 'fw.example.org:9999', hostname: 'fw.example.org', port: '9999', pathname: '/foo.bar.org', search: '?type=TXT', hash: '', }, { input: 'ldap://localhost:389/ou=People,o=JNDITutorial', base: 'about:blank', href: 'ldap://localhost:389/ou=People,o=JNDITutorial', origin: 'null', protocol: 'ldap:', username: '', password: '', host: 'localhost:389', hostname: 'localhost', port: '389', pathname: '/ou=People,o=JNDITutorial', search: '', hash: '', }, { input: 'git+https://github.com/foo/bar', base: 'about:blank', href: 'git+https://github.com/foo/bar', origin: 'null', protocol: 'git+https:', username: '', password: '', host: 'github.com', hostname: 'github.com', port: '', pathname: '/foo/bar', search: '', hash: '', }, { input: 'urn:ietf:rfc:2648', base: 'about:blank', href: 'urn:ietf:rfc:2648', origin: 'null', protocol: 'urn:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'ietf:rfc:2648', search: '', hash: '', }, { input: 'tag:joe@example.org,2001:foo/bar', base: 'about:blank', href: 'tag:joe@example.org,2001:foo/bar', origin: 'null', protocol: 'tag:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'joe@example.org,2001:foo/bar', search: '', hash: '', }, '# percent encoded hosts in non-special-URLs', { input: 'non-special://%E2%80%A0/', base: 'about:blank', href: 'non-special://%E2%80%A0/', protocol: 'non-special:', username: '', password: '', host: '%E2%80%A0', hostname: '%E2%80%A0', port: '', pathname: '/', search: '', hash: '', }, { input: 'non-special://H%4fSt/path', base: 'about:blank', href: 'non-special://H%4fSt/path', protocol: 'non-special:', username: '', password: '', host: 'H%4fSt', hostname: 'H%4fSt', port: '', pathname: '/path', search: '', hash: '', }, '# IPv6 in non-special-URLs', { input: 'non-special://[1:2:0:0:5:0:0:0]/', base: 'about:blank', href: 'non-special://[1:2:0:0:5::]/', protocol: 'non-special:', username: '', password: '', host: '[1:2:0:0:5::]', hostname: '[1:2:0:0:5::]', port: '', pathname: '/', search: '', hash: '', }, { input: 'non-special://[1:2:0:0:0:0:0:3]/', base: 'about:blank', href: 'non-special://[1:2::3]/', protocol: 'non-special:', username: '', password: '', host: '[1:2::3]', hostname: '[1:2::3]', port: '', pathname: '/', search: '', hash: '', }, { input: 'non-special://[1:2::3]:80/', base: 'about:blank', href: 'non-special://[1:2::3]:80/', protocol: 'non-special:', username: '', password: '', host: '[1:2::3]:80', hostname: '[1:2::3]', port: '80', pathname: '/', search: '', hash: '', }, { input: 'non-special://[:80/', base: 'about:blank', failure: true, }, { input: 'blob:https://example.com:443/', base: 'about:blank', href: 'blob:https://example.com:443/', protocol: 'blob:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'https://example.com:443/', search: '', hash: '', }, { input: 'blob:d3958f5c-0777-0845-9dcf-2cb28783acaf', base: 'about:blank', href: 'blob:d3958f5c-0777-0845-9dcf-2cb28783acaf', protocol: 'blob:', username: '', password: '', host: '', hostname: '', port: '', pathname: 'd3958f5c-0777-0845-9dcf-2cb28783acaf', search: '', hash: '', }, 'Invalid IPv4 radix digits', { input: 'http://0177.0.0.0189', base: 'about:blank', href: 'http://0177.0.0.0189/', protocol: 'http:', username: '', password: '', host: '0177.0.0.0189', hostname: '0177.0.0.0189', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://0x7f.0.0.0x7g', base: 'about:blank', href: 'http://0x7f.0.0.0x7g/', protocol: 'http:', username: '', password: '', host: '0x7f.0.0.0x7g', hostname: '0x7f.0.0.0x7g', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://0X7F.0.0.0X7G', base: 'about:blank', href: 'http://0x7f.0.0.0x7g/', protocol: 'http:', username: '', password: '', host: '0x7f.0.0.0x7g', hostname: '0x7f.0.0.0x7g', port: '', pathname: '/', search: '', hash: '', }, 'Invalid IPv4 portion of IPv6 address', { input: 'http://[::127.0.0.0.1]', base: 'about:blank', failure: true, }, 'Uncompressed IPv6 addresses with 0', { input: 'http://[0:1:0:1:0:1:0:1]', base: 'about:blank', href: 'http://[0:1:0:1:0:1:0:1]/', protocol: 'http:', username: '', password: '', host: '[0:1:0:1:0:1:0:1]', hostname: '[0:1:0:1:0:1:0:1]', port: '', pathname: '/', search: '', hash: '', }, { input: 'http://[1:0:1:0:1:0:1:0]', base: 'about:blank', href: 'http://[1:0:1:0:1:0:1:0]/', protocol: 'http:', username: '', password: '', host: '[1:0:1:0:1:0:1:0]', hostname: '[1:0:1:0:1:0:1:0]', port: '', pathname: '/', search: '', hash: '', }, 'Percent-encoded query and fragment', { input: 'http://example.org/test?\u0022', base: 'about:blank', href: 'http://example.org/test?%22', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%22', hash: '', }, { input: 'http://example.org/test?\u0023', base: 'about:blank', href: 'http://example.org/test?#', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '', hash: '', }, { input: 'http://example.org/test?\u003C', base: 'about:blank', href: 'http://example.org/test?%3C', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%3C', hash: '', }, { input: 'http://example.org/test?\u003E', base: 'about:blank', href: 'http://example.org/test?%3E', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%3E', hash: '', }, { input: 'http://example.org/test?\u2323', base: 'about:blank', href: 'http://example.org/test?%E2%8C%A3', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%E2%8C%A3', hash: '', }, { input: 'http://example.org/test?%23%23', base: 'about:blank', href: 'http://example.org/test?%23%23', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%23%23', hash: '', }, /* { input: 'http://example.org/test?%GH', base: 'about:blank', href: 'http://example.org/test?%GH', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?%GH', hash: '', }, */ { input: 'http://example.org/test?a#%EF', base: 'about:blank', href: 'http://example.org/test?a#%EF', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?a', hash: '#%EF', }, { input: 'http://example.org/test?a#%GH', base: 'about:blank', href: 'http://example.org/test?a#%GH', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?a', hash: '#%GH', }, 'URLs that require a non-about:blank base. (Also serve as invalid base tests.)', { input: 'a', base: 'about:blank', failure: true, }, { input: 'a/', base: 'about:blank', failure: true, }, { input: 'a//', base: 'about:blank', failure: true, }, "Bases that don't fail to parse but fail to be bases", { input: 'test-a-colon.html', base: 'a:', failure: true, }, { input: 'test-a-colon-b.html', base: 'a:b', failure: true, }, 'Other base URL tests, that must succeed', { input: 'test-a-colon-slash.html', base: 'a:/', href: 'a:/test-a-colon-slash.html', protocol: 'a:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test-a-colon-slash.html', search: '', hash: '', }, { input: 'test-a-colon-slash-slash.html', base: 'a://', href: 'a:///test-a-colon-slash-slash.html', protocol: 'a:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test-a-colon-slash-slash.html', search: '', hash: '', }, { input: 'test-a-colon-slash-b.html', base: 'a:/b', href: 'a:/test-a-colon-slash-b.html', protocol: 'a:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/test-a-colon-slash-b.html', search: '', hash: '', }, { input: 'test-a-colon-slash-slash-b.html', base: 'a://b', href: 'a://b/test-a-colon-slash-slash-b.html', protocol: 'a:', username: '', password: '', host: 'b', hostname: 'b', port: '', pathname: '/test-a-colon-slash-slash-b.html', search: '', hash: '', }, 'Null code point in fragment', { input: 'http://example.org/test?a#b\u0000c', base: 'about:blank', href: 'http://example.org/test?a#bc', protocol: 'http:', username: '', password: '', host: 'example.org', hostname: 'example.org', port: '', pathname: '/test', search: '?a', hash: '#bc', }, ];