sdfsdfs
This commit is contained in:
20
node_modules/object.assign/.editorconfig
generated
vendored
Normal file
20
node_modules/object.assign/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 150
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
max_line_length = off
|
||||
|
||||
[Makefile]
|
||||
max_line_length = off
|
28
node_modules/object.assign/.eslintrc
generated
vendored
Normal file
28
node_modules/object.assign/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"ignorePatterns": ["dist/"],
|
||||
|
||||
"rules": {
|
||||
"eqeqeq": [2, "allow-null"],
|
||||
"id-length": [2, { "min": 1, "max": 30 }],
|
||||
"max-statements": [2, 33],
|
||||
"max-statements-per-line": [2, { "max": 2 }],
|
||||
"no-magic-numbers": [1, { "ignore": [0] }],
|
||||
"no-restricted-syntax": [2, "BreakStatement", "ContinueStatement", "DebuggerStatement", "LabeledStatement", "WithStatement"],
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/**",
|
||||
"rules": {
|
||||
"no-invalid-this": 1,
|
||||
"max-lines-per-function": 0,
|
||||
"max-statements-per-line": [2, { "max": 3 }],
|
||||
"no-magic-numbers": 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
12
node_modules/object.assign/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/object.assign/.github/FUNDING.yml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/object.assign
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
9
node_modules/object.assign/.nycrc
generated
vendored
Normal file
9
node_modules/object.assign/.nycrc
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
233
node_modules/object.assign/CHANGELOG.md
generated
vendored
Normal file
233
node_modules/object.assign/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
4.1.5 / 2023-11-30
|
||||
==================
|
||||
* [meta] republish without testing HTML file (#85)
|
||||
* [Deps] update `call-bind`, `define-properties`
|
||||
* [Dev Deps] use `hasown` instead of `has`
|
||||
* [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `npmignore`, `mock-property`, `tape`
|
||||
* [actions] update rebase action
|
||||
|
||||
4.1.4 / 2022-08-16
|
||||
==================
|
||||
* [meta] fix `npmignore` integration (#83)
|
||||
|
||||
4.1.3 / 2022-08-05
|
||||
==================
|
||||
* [Refactor] make steps closer to actual spec
|
||||
* [Refactor] simplify object coercible check
|
||||
* [readme] remove defunct badges, add coverage and actions badges
|
||||
* [eslint] ignore coverage output
|
||||
* [meta] use `npmignore` to autogenerate an npmignore file
|
||||
* [meta] remove audit-level
|
||||
* [Deps] update `call-bind`, `define-properties`, `has-symbols`
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `functions-have-names`, `safe-publish-latest`, `ses`, `tape`
|
||||
* [actions] use `node/install` instead of `node/run`; use `codecov` action
|
||||
* [actions] reuse common workflows
|
||||
* [actions] update codecov uploader
|
||||
* [Tests] add implementation tests
|
||||
* [Tests] use `mock-property`
|
||||
* [Tests] disable posttest pending `aud` handling `file:` deps
|
||||
* [Tests] migrate remaining tests to Github Actions (#81)
|
||||
* [Tests] gitignore coverage output
|
||||
* [Tests] test node v1-v9 on Github Actions instead of travis; resume testing all minors (#80)
|
||||
|
||||
4.1.2 / 2020-10-30
|
||||
==================
|
||||
* [Refactor] use extracted `call-bind` instead of full `es-abstract`
|
||||
* [Dev Deps] update `eslint`, `ses`, `browserify`
|
||||
* [Tests] run tests in SES
|
||||
* [Tests] ses-compat: show error stacks
|
||||
|
||||
4.1.1 / 2020-09-11
|
||||
==================
|
||||
* [Fix] avoid mutating `Object.assign` in modern engines
|
||||
* [Refactor] use `callBind` from `es-abstract` instead of `function-bind`
|
||||
* [Deps] update `has-symbols`, `object-keys`, `define-properties`
|
||||
* [meta] add `funding` field, FUNDING.yml
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `browserify`, `covert`, `for-each`, `is`, `tape`, `functions-have-names`; add `aud`, `safe-publish-latest`; remove `jscs`
|
||||
* [actions] add Require Allow Edits workflow
|
||||
* [actions] add automatic rebasing / merge commit blocking
|
||||
* [Tests] ses-compat - add test to ensure package initializes correctly after ses lockdown (#77)
|
||||
* [Tests] Add passing test for a source of `window.location` (#68)
|
||||
* [Tests] use shared travis-ci config
|
||||
* [Tests] use `npx aud` instead of `npm audit` with hoops or `nsp`
|
||||
* [Tests] use `functions-have-names`
|
||||
|
||||
4.1.0 / 2017-12-21
|
||||
==================
|
||||
* [New] add `auto` entry point (#52)
|
||||
* [Refactor] Use `has-symbols` module
|
||||
* [Deps] update `function-bind`, `object-keys`
|
||||
* [Dev Deps] update `@es-shims/api`, `browserify`, `nsp`, `eslint`, `@ljharb/eslint-config`, `is`
|
||||
* [Tests] up to `node` `v9.3`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS
|
||||
|
||||
4.0.4 / 2016-07-04
|
||||
==================
|
||||
* [Fix] Cache original `getOwnPropertySymbols`, and use that when `Object.getOwnPropertySymbols` is unavailable
|
||||
* [Deps] update `object-keys`
|
||||
* [Dev Deps] update `eslint`, `get-own-property-symbols`, `core-js`, `jscs`, `nsp`, `browserify`, `@ljharb/eslint-config`, `tape`, `@es-shims/api`
|
||||
* [Tests] up to `node` `v6.2`, `v5.10`, `v4.4`
|
||||
* [Tests] run sham tests on node 0.10
|
||||
* [Tests] use pretest/posttest for linting/security
|
||||
|
||||
4.0.3 / 2015-10-21
|
||||
==================
|
||||
* [Fix] Support core-js's Symbol sham (#17)
|
||||
* [Fix] Ensure that properties removed or made non-enumerable during enumeration are not assigned (#16)
|
||||
* [Fix] Avoid looking up keys and values more than once
|
||||
* [Tests] Avoid using `reduce` so `npm run test:shams:corejs` passes in `node` `v0.8` ([core-js#122](https://github.com/zloirock/core-js/issues/122))
|
||||
* [Tests] Refactor to use my conventional structure that separates shimmed, implementation, and common tests
|
||||
* [Tests] Create `npm run test:shams` and better organize tests for symbol shams
|
||||
* [Tests] Remove `nsp` in favor of `requiresafe`
|
||||
|
||||
4.0.2 / 2015-10-20
|
||||
==================
|
||||
* [Fix] Ensure correct property enumeration order, particularly in v8 (#15)
|
||||
* [Deps] update `object-keys`, `define-properties`
|
||||
* [Dev Deps] update `browserify`, `is`, `tape`, `jscs`, `eslint`, `@ljharb/eslint-config`
|
||||
* [Tests] up to `io.js` `v3.3`, `node` `v4.2`
|
||||
|
||||
4.0.1 / 2015-08-16
|
||||
==================
|
||||
* [Docs] Add `Symbol` note to readme
|
||||
|
||||
4.0.0 / 2015-08-15
|
||||
==================
|
||||
* [Breaking] Implement the [es-shim API](es-shims/api).
|
||||
* [Robustness] Make implementation robust against later modification of environment methods.
|
||||
* [Refactor] Move implementation to `implementation.js`
|
||||
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
|
||||
* [Deps] update `object-keys`, `define-properties`
|
||||
* [Dev Deps] update `browserify`, `tape`, `eslint`, `jscs`, `browserify`
|
||||
* [Tests] Add `npm run tests-only`
|
||||
* [Tests] use my personal shared `eslint` config.
|
||||
* [Tests] up to `io.js` `v3.0`
|
||||
|
||||
3.0.1 / 2015-06-28
|
||||
==================
|
||||
* Cache `Object` and `Array#push` to make the shim more robust.
|
||||
* [Fix] Remove use of `Array#filter`, which isn't in ES3.
|
||||
* [Deps] Update `object-keys`, `define-properties`
|
||||
* [Dev Deps] Update `get-own-property-symbols`, `browserify`, `eslint`, `nsp`
|
||||
* [Tests] Test up to `io.js` `v2.3`
|
||||
* [Tests] Adding `Object.assign` tests for non-object targets, per https://github.com/paulmillr/es6-shim/issues/348
|
||||
|
||||
3.0.0 / 2015-05-20
|
||||
==================
|
||||
* Attempt to feature-detect Symbols, even if `typeof Symbol() !== 'symbol'` (#12)
|
||||
* Make a separate `hasSymbols` internal module
|
||||
* Update `browserify`, `eslint`
|
||||
|
||||
2.0.3 / 2015-06-28
|
||||
==================
|
||||
* Cache `Object` and `Array#push` to make the shim more robust.
|
||||
* [Fix] Remove use of `Array#filter`, which isn't in ES3
|
||||
* [Deps] Update `object-keys`, `define-properties`
|
||||
* [Dev Deps] Update `browserify`, `nsp`, `eslint`
|
||||
* [Tests] Test up to `io.js` `v2.3`
|
||||
|
||||
2.0.2 / 2015-05-20
|
||||
==================
|
||||
* Make sure `.shim` is non-enumerable.
|
||||
* Refactor `.shim` implementation to use `define-properties` predicates, rather than `delete`ing the original.
|
||||
* Update docs to match spec/implementation. (#11)
|
||||
* Add `npm run eslint`
|
||||
* Test up to `io.js` `v2.0`
|
||||
* Update `jscs`, `browserify`, `covert`
|
||||
|
||||
2.0.1 / 2015-04-12
|
||||
==================
|
||||
* Make sure non-enumerable Symbols are excluded.
|
||||
|
||||
2.0.0 / 2015-04-12
|
||||
==================
|
||||
* Make sure the shim function overwrites a broken implementation with pending exceptions.
|
||||
* Ensure shim is not enumerable using `define-properties`
|
||||
* Ensure `Object.assign` includes symbols.
|
||||
* All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`.
|
||||
* Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures.
|
||||
* Add `npm run security` via `nsp`
|
||||
* Update `browserify`, `jscs`, `tape`, `object-keys`, `is`
|
||||
|
||||
1.1.1 / 2014-12-14
|
||||
==================
|
||||
* Actually include the browser build in `npm`
|
||||
|
||||
1.1.0 / 2014-12-14
|
||||
==================
|
||||
* Add `npm run build`, and build an automatic-shimming browser distribution as part of the npm publish process.
|
||||
* Update `is`, `jscs`
|
||||
|
||||
1.0.3 / 2014-11-29
|
||||
==================
|
||||
* Revert "optimize --production installs"
|
||||
|
||||
1.0.2 / 2014-11-27
|
||||
==================
|
||||
* Update `jscs`, `is`, `object-keys`, `tape`
|
||||
* Add badges to README
|
||||
* Name URLs in README
|
||||
* Lock `covert` to `v1.0.0`
|
||||
* Optimize --production installs
|
||||
|
||||
1.0.1 / 2014-08-26
|
||||
==================
|
||||
* Update `is`, `covert`
|
||||
|
||||
1.0.0 / 2014-08-07
|
||||
==================
|
||||
* Update `object-keys`, `tape`
|
||||
|
||||
0.5.0 / 2014-07-31
|
||||
==================
|
||||
* Object.assign no longer throws on null or undefined sources, per https://bugs.ecmascript.org/show_bug.cgi?id=3096
|
||||
|
||||
0.4.3 / 2014-07-30
|
||||
==================
|
||||
* Don’t modify vars in the function signature, since it deoptimizes v8
|
||||
|
||||
0.4.2 / 2014-07-30
|
||||
==================
|
||||
* Fixing the version number: v0.4.2
|
||||
|
||||
0.4.1 / 2014-07-19
|
||||
==================
|
||||
* Revert "Use the native Object.keys if it’s available."
|
||||
|
||||
0.4.0 / 2014-07-19
|
||||
==================
|
||||
* Use the native Object.keys if it’s available.
|
||||
* Fixes [#2](https://github.com/ljharb/object.assign/issues/2).
|
||||
* Adding failing tests for [#2](https://github.com/ljharb/object.assign/issues/2).
|
||||
* Fix indentation.
|
||||
* Adding `npm run lint`
|
||||
* Update `tape`, `covert`
|
||||
* README: Use SVG badge for Travis [#1](https://github.com/ljharb/object.assign/issues/1) from mathiasbynens/patch-1
|
||||
|
||||
0.3.1 / 2014-04-10
|
||||
==================
|
||||
* Object.assign does partially modify objects if it throws, per https://twitter.com/awbjs/status/454320863093862400
|
||||
|
||||
0.3.0 / 2014-04-10
|
||||
==================
|
||||
* Update with newest ES6 behavior - Object.assign now takes a variable number of source objects.
|
||||
* Update `tape`
|
||||
* Make sure old and unstable nodes don’t fail Travis
|
||||
|
||||
0.2.1 / 2014-03-16
|
||||
==================
|
||||
* Let object-keys handle the fallback
|
||||
* Update dependency badges
|
||||
* Adding bower.json
|
||||
|
||||
0.2.0 / 2014-03-16
|
||||
==================
|
||||
* Use a for loop, because ES3 browsers don’t have "reduce"
|
||||
|
||||
0.1.1 / 2014-03-14
|
||||
==================
|
||||
* Updating readme
|
||||
|
||||
0.1.0 / 2014-03-14
|
||||
==================
|
||||
* Initial release.
|
||||
|
21
node_modules/object.assign/LICENSE
generated
vendored
Normal file
21
node_modules/object.assign/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Jordan Harband
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
136
node_modules/object.assign/README.md
generated
vendored
Normal file
136
node_modules/object.assign/README.md
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
# object.assign <sup>[![Version Badge][npm-version-svg]][npm-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][npm-url]
|
||||
|
||||
An Object.assign shim. Invoke its "shim" method to shim Object.assign if it is unavailable.
|
||||
|
||||
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](http://www.ecma-international.org/ecma-262/6.0/#sec-object.assign). In an ES6 environment, it will also work properly with `Symbol`s.
|
||||
|
||||
Takes a minimum of 2 arguments: `target` and `source`.
|
||||
Takes a variable sized list of source arguments - at least 1, as many as you want.
|
||||
Throws a TypeError if the `target` argument is `null` or `undefined`.
|
||||
|
||||
Most common usage:
|
||||
```js
|
||||
var assign = require('object.assign').getPolyfill(); // returns native method if compliant
|
||||
/* or */
|
||||
var assign = require('object.assign/polyfill')(); // returns native method if compliant
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var assert = require('assert');
|
||||
|
||||
// Multiple sources!
|
||||
var target = { a: true };
|
||||
var source1 = { b: true };
|
||||
var source2 = { c: true };
|
||||
var sourceN = { n: true };
|
||||
|
||||
var expected = {
|
||||
a: true,
|
||||
b: true,
|
||||
c: true,
|
||||
n: true
|
||||
};
|
||||
|
||||
assign(target, source1, source2, sourceN);
|
||||
assert.deepEqual(target, expected); // AWESOME!
|
||||
```
|
||||
|
||||
```js
|
||||
var target = {
|
||||
a: true,
|
||||
b: true,
|
||||
c: true
|
||||
};
|
||||
var source1 = {
|
||||
c: false,
|
||||
d: false
|
||||
};
|
||||
var sourceN = {
|
||||
e: false
|
||||
};
|
||||
|
||||
var assigned = assign(target, source1, sourceN);
|
||||
assert.equal(target, assigned); // returns the target object
|
||||
assert.deepEqual(assigned, {
|
||||
a: true,
|
||||
b: true,
|
||||
c: false,
|
||||
d: false,
|
||||
e: false
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
/* when Object.assign is not present */
|
||||
delete Object.assign;
|
||||
var shimmedAssign = require('object.assign').shim();
|
||||
/* or */
|
||||
var shimmedAssign = require('object.assign/shim')();
|
||||
|
||||
assert.equal(shimmedAssign, assign);
|
||||
|
||||
var target = {
|
||||
a: true,
|
||||
b: true,
|
||||
c: true
|
||||
};
|
||||
var source = {
|
||||
c: false,
|
||||
d: false,
|
||||
e: false
|
||||
};
|
||||
|
||||
var assigned = assign(target, source);
|
||||
assert.deepEqual(Object.assign(target, source), assign(target, source));
|
||||
```
|
||||
|
||||
```js
|
||||
/* when Object.assign is present */
|
||||
var shimmedAssign = require('object.assign').shim();
|
||||
assert.equal(shimmedAssign, Object.assign);
|
||||
|
||||
var target = {
|
||||
a: true,
|
||||
b: true,
|
||||
c: true
|
||||
};
|
||||
var source = {
|
||||
c: false,
|
||||
d: false,
|
||||
e: false
|
||||
};
|
||||
|
||||
assert.deepEqual(Object.assign(target, source), assign(target, source));
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[npm-url]: https://npmjs.org/package/object.assign
|
||||
[npm-version-svg]: http://versionbadg.es/ljharb/object.assign.svg
|
||||
[travis-svg]: https://travis-ci.org/ljharb/object.assign.svg
|
||||
[travis-url]: https://travis-ci.org/ljharb/object.assign
|
||||
[deps-svg]: https://david-dm.org/ljharb/object.assign.svg?theme=shields.io
|
||||
[deps-url]: https://david-dm.org/ljharb/object.assign
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/object.assign/dev-status.svg?theme=shields.io
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/object.assign#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/object.assign.png?downloads=true&stars=true
|
||||
[license-image]: http://img.shields.io/npm/l/object.assign.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: http://img.shields.io/npm/dm/object.assign.svg
|
||||
[downloads-url]: http://npm-stat.com/charts.html?package=object.assign
|
||||
[codecov-image]: https://codecov.io/gh/ljharb/object.assign/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/ljharb/object.assign/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/object.assign
|
||||
[actions-url]: https://github.com/ljharb/object.assign/actions
|
3
node_modules/object.assign/auto.js
generated
vendored
Normal file
3
node_modules/object.assign/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
1141
node_modules/object.assign/dist/browser.js
generated
vendored
Normal file
1141
node_modules/object.assign/dist/browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
43
node_modules/object.assign/hasSymbols.js
generated
vendored
Normal file
43
node_modules/object.assign/hasSymbols.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
var keys = require('object-keys');
|
||||
|
||||
module.exports = function hasSymbols() {
|
||||
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
||||
if (typeof Symbol.iterator === 'symbol') { return true; }
|
||||
|
||||
var obj = {};
|
||||
var sym = Symbol('test');
|
||||
var symObj = Object(sym);
|
||||
if (typeof sym === 'string') { return false; }
|
||||
|
||||
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
||||
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
||||
|
||||
/*
|
||||
* temp disabled per https://github.com/ljharb/object.assign/issues/17
|
||||
* if (sym instanceof Symbol) { return false; }
|
||||
* temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
||||
* if (!(symObj instanceof Symbol)) { return false; }
|
||||
*/
|
||||
|
||||
var symVal = 42;
|
||||
obj[sym] = symVal;
|
||||
for (sym in obj) { return false; } // eslint-disable-line no-unreachable-loop
|
||||
if (keys(obj).length !== 0) { return false; }
|
||||
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
||||
|
||||
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
||||
|
||||
var syms = Object.getOwnPropertySymbols(obj);
|
||||
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
||||
|
||||
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
||||
|
||||
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
||||
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
||||
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
46
node_modules/object.assign/implementation.js
generated
vendored
Normal file
46
node_modules/object.assign/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
// modified from https://github.com/es-shims/es6-shim
|
||||
var objectKeys = require('object-keys');
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
var callBound = require('call-bind/callBound');
|
||||
var toObject = Object;
|
||||
var $push = callBound('Array.prototype.push');
|
||||
var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');
|
||||
var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
module.exports = function assign(target, source1) {
|
||||
if (target == null) { throw new TypeError('target must be an object'); }
|
||||
var to = toObject(target); // step 1
|
||||
if (arguments.length === 1) {
|
||||
return to; // step 2
|
||||
}
|
||||
for (var s = 1; s < arguments.length; ++s) {
|
||||
var from = toObject(arguments[s]); // step 3.a.i
|
||||
|
||||
// step 3.a.ii:
|
||||
var keys = objectKeys(from);
|
||||
var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
|
||||
if (getSymbols) {
|
||||
var syms = getSymbols(from);
|
||||
for (var j = 0; j < syms.length; ++j) {
|
||||
var key = syms[j];
|
||||
if ($propIsEnumerable(from, key)) {
|
||||
$push(keys, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// step 3.a.iii:
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
var nextKey = keys[i];
|
||||
if ($propIsEnumerable(from, nextKey)) { // step 3.a.iii.2
|
||||
var propValue = from[nextKey]; // step 3.a.iii.2.a
|
||||
to[nextKey] = propValue; // step 3.a.iii.2.b
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return to; // step 4
|
||||
};
|
22
node_modules/object.assign/index.js
generated
vendored
Normal file
22
node_modules/object.assign/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var defineProperties = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var polyfill = callBind.apply(getPolyfill());
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var bound = function assign(target, source1) {
|
||||
return polyfill(Object, arguments);
|
||||
};
|
||||
|
||||
defineProperties(bound, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = bound;
|
96
node_modules/object.assign/package.json
generated
vendored
Normal file
96
node_modules/object.assign/package.json
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
{
|
||||
"name": "object.assign",
|
||||
"version": "4.1.5",
|
||||
"author": "Jordan Harband",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"description": "ES6 spec-compliant Object.assign shim. From https://github.com/es-shims/es6-shim",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"pretest": "npm run lint && es-shim-api --bound",
|
||||
"test": "npm run tests-only && npm run test:ses",
|
||||
"posttest": "aud --production",
|
||||
"tests-only": "npm run test:implementation && npm run test:shim",
|
||||
"test:native": "nyc node test/native",
|
||||
"test:shim": "nyc node test/shimmed",
|
||||
"test:implementation": "nyc node test",
|
||||
"test:ses": "node test/ses-compat",
|
||||
"lint": "eslint .",
|
||||
"build": "mkdir -p dist && browserify browserShim.js > dist/browser.js",
|
||||
"prepublishOnly": "safe-publish-latest && npm run build",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/ljharb/object.assign.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Object.assign",
|
||||
"assign",
|
||||
"ES6",
|
||||
"extend",
|
||||
"$.extend",
|
||||
"jQuery",
|
||||
"_.extend",
|
||||
"Underscore",
|
||||
"es-shim API",
|
||||
"polyfill",
|
||||
"shim"
|
||||
],
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.5",
|
||||
"define-properties": "^1.2.1",
|
||||
"has-symbols": "^1.0.3",
|
||||
"object-keys": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@es-shims/api": "^2.4.2",
|
||||
"@ljharb/eslint-config": "^21.1.0",
|
||||
"aud": "^2.0.3",
|
||||
"browserify": "^16.5.2",
|
||||
"eslint": "=8.8.0",
|
||||
"for-each": "^0.3.3",
|
||||
"functions-have-names": "^1.2.3",
|
||||
"has-strict-mode": "^1.0.1",
|
||||
"hasown": "^2.0.0",
|
||||
"is": "^3.3.0",
|
||||
"mock-property": "^1.0.3",
|
||||
"npmignore": "^0.3.1",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"ses": "^0.11.1",
|
||||
"tape": "^5.7.2"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
"browsers": [
|
||||
"iexplore/6.0..latest",
|
||||
"firefox/3.0..6.0",
|
||||
"firefox/15.0..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/4.0..10.0",
|
||||
"chrome/20.0..latest",
|
||||
"chrome/canary",
|
||||
"opera/10.0..latest",
|
||||
"opera/next",
|
||||
"safari/4.0..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows",
|
||||
"bower.json",
|
||||
"browserShim.js",
|
||||
"!dist/"
|
||||
]
|
||||
}
|
||||
}
|
55
node_modules/object.assign/polyfill.js
generated
vendored
Normal file
55
node_modules/object.assign/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
var lacksProperEnumerationOrder = function () {
|
||||
if (!Object.assign) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* v8, specifically in node 4.x, has a bug with incorrect property enumeration order
|
||||
* note: this does not detect the bug unless there's 20 characters
|
||||
*/
|
||||
var str = 'abcdefghijklmnopqrst';
|
||||
var letters = str.split('');
|
||||
var map = {};
|
||||
for (var i = 0; i < letters.length; ++i) {
|
||||
map[letters[i]] = letters[i];
|
||||
}
|
||||
var obj = Object.assign({}, map);
|
||||
var actual = '';
|
||||
for (var k in obj) {
|
||||
actual += k;
|
||||
}
|
||||
return str !== actual;
|
||||
};
|
||||
|
||||
var assignHasPendingExceptions = function () {
|
||||
if (!Object.assign || !Object.preventExtensions) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* Firefox 37 still has "pending exception" logic in its Object.assign implementation,
|
||||
* which is 72% slower than our shim, and Firefox 40's native implementation.
|
||||
*/
|
||||
var thrower = Object.preventExtensions({ 1: 2 });
|
||||
try {
|
||||
Object.assign(thrower, 'xy');
|
||||
} catch (e) {
|
||||
return thrower[1] === 'y';
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
if (!Object.assign) {
|
||||
return implementation;
|
||||
}
|
||||
if (lacksProperEnumerationOrder()) {
|
||||
return implementation;
|
||||
}
|
||||
if (assignHasPendingExceptions()) {
|
||||
return implementation;
|
||||
}
|
||||
return Object.assign;
|
||||
};
|
14
node_modules/object.assign/shim.js
generated
vendored
Normal file
14
node_modules/object.assign/shim.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
module.exports = function shimAssign() {
|
||||
var polyfill = getPolyfill();
|
||||
define(
|
||||
Object,
|
||||
{ assign: polyfill },
|
||||
{ assign: function () { return Object.assign !== polyfill; } }
|
||||
);
|
||||
return polyfill;
|
||||
};
|
19
node_modules/object.assign/test/implementation.js
generated
vendored
Normal file
19
node_modules/object.assign/test/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('../implementation');
|
||||
var callBind = require('call-bind');
|
||||
var test = require('tape');
|
||||
var hasStrictMode = require('has-strict-mode')();
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('as a function', function (t) {
|
||||
t.test('bad first arg/receiver', { skip: !hasStrictMode }, function (st) {
|
||||
st['throws'](function () { implementation(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { implementation(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(callBind(implementation, Object), t);
|
||||
|
||||
t.end();
|
||||
});
|
17
node_modules/object.assign/test/index.js
generated
vendored
Normal file
17
node_modules/object.assign/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var assign = require('../');
|
||||
var test = require('tape');
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('as a function', function (t) {
|
||||
t.test('bad array/this value', function (st) {
|
||||
st['throws'](function () { assign(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { assign(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(assign, t);
|
||||
|
||||
t.end();
|
||||
});
|
49
node_modules/object.assign/test/native.js
generated
vendored
Normal file
49
node_modules/object.assign/test/native.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var defineProperties = require('define-properties');
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('native', function (t) {
|
||||
t.equal(Object.assign.length, 2, 'Object.assign has a length of 2');
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(Object.assign.name, 'assign', 'Object.assign has name "assign"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Object, 'assign'), 'Object.assign is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
|
||||
|
||||
t.test('bad object value', { skip: !supportsStrictMode }, function (st) {
|
||||
st['throws'](function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return Object.assign(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
// v8 in node 0.8 and 0.10 have non-enumerable string properties
|
||||
var stringCharsAreEnumerable = isEnumerable.call('xy', 0);
|
||||
t.test('when Object.assign is present and has pending exceptions', { skip: !stringCharsAreEnumerable || !Object.preventExtensions }, function (st) {
|
||||
/*
|
||||
* Firefox 37 still has "pending exception" logic in its Object.assign implementation,
|
||||
* which is 72% slower than our shim, and Firefox 40's native implementation.
|
||||
*/
|
||||
var thrower = Object.preventExtensions({ 1: '2' });
|
||||
var error;
|
||||
try { Object.assign(thrower, 'xy'); } catch (e) { error = e; }
|
||||
st.equal(error instanceof TypeError, true, 'error is TypeError');
|
||||
st.equal(thrower[1], '2', 'thrower[1] === "2"');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(Object.assign, t);
|
||||
|
||||
t.end();
|
||||
});
|
12
node_modules/object.assign/test/ses-compat.js
generated
vendored
Normal file
12
node_modules/object.assign/test/ses-compat.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
/* globals lockdown */
|
||||
|
||||
// requiring ses exposes "lockdown" on the global
|
||||
require('ses');
|
||||
|
||||
// lockdown freezes the primordials
|
||||
lockdown({ errorTaming: 'unsafe' });
|
||||
|
||||
// initialize the module
|
||||
require('./');
|
52
node_modules/object.assign/test/shimmed.js
generated
vendored
Normal file
52
node_modules/object.assign/test/shimmed.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
var assign = require('../');
|
||||
assign.shim();
|
||||
|
||||
var test = require('tape');
|
||||
var defineProperties = require('define-properties');
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('shimmed', function (t) {
|
||||
t.equal(Object.assign.length, 2, 'Object.assign has a length of 2');
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(Object.assign.name, 'assign', 'Object.assign has name "assign"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Object, 'assign'), 'Object.assign is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
|
||||
|
||||
t.test('bad object value', { skip: !supportsStrictMode }, function (st) {
|
||||
st['throws'](function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return Object.assign(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
// v8 in node 0.8 and 0.10 have non-enumerable string properties
|
||||
var stringCharsAreEnumerable = isEnumerable.call('xy', 0);
|
||||
t.test('when Object.assign is present and has pending exceptions', { skip: !stringCharsAreEnumerable || !Object.preventExtensions }, function (st) {
|
||||
/*
|
||||
* Firefox 37 still has "pending exception" logic in its Object.assign implementation,
|
||||
* which is 72% slower than our shim, and Firefox 40's native implementation.
|
||||
*/
|
||||
var thrower = Object.preventExtensions({ 1: '2' });
|
||||
var error;
|
||||
try { Object.assign(thrower, 'xy'); } catch (e) { error = e; }
|
||||
st.equal(error instanceof TypeError, true, 'error is TypeError');
|
||||
st.equal(thrower[1], '2', 'thrower[1] === "2"');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(Object.assign, t);
|
||||
|
||||
t.end();
|
||||
});
|
232
node_modules/object.assign/test/tests.js
generated
vendored
Normal file
232
node_modules/object.assign/test/tests.js
generated
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
'use strict';
|
||||
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
var forEach = require('for-each');
|
||||
var hasOwn = require('hasown');
|
||||
var mockProperty = require('mock-property');
|
||||
|
||||
module.exports = function (assign, t) {
|
||||
t.test('error cases', function (st) {
|
||||
st['throws'](function () { assign(null); }, TypeError, 'target must be an object');
|
||||
st['throws'](function () { assign(undefined); }, TypeError, 'target must be an object');
|
||||
st['throws'](function () { assign(null, {}); }, TypeError, 'target must be an object');
|
||||
st['throws'](function () { assign(undefined, {}); }, TypeError, 'target must be an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('non-object target, no sources', function (st) {
|
||||
var bool = assign(true);
|
||||
st.equal(typeof bool, 'object', 'bool is object');
|
||||
st.equal(Boolean.prototype.valueOf.call(bool), true, 'bool coerces to `true`');
|
||||
|
||||
var number = assign(1);
|
||||
st.equal(typeof number, 'object', 'number is object');
|
||||
st.equal(Number.prototype.valueOf.call(number), 1, 'number coerces to `1`');
|
||||
|
||||
var string = assign('1');
|
||||
st.equal(typeof string, 'object', 'number is object');
|
||||
st.equal(String.prototype.valueOf.call(string), '1', 'number coerces to `"1"`');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('non-object target, with sources', function (st) {
|
||||
var signal = {};
|
||||
|
||||
st.test('boolean', function (st2) {
|
||||
var bool = assign(true, { a: signal });
|
||||
st2.equal(typeof bool, 'object', 'bool is object');
|
||||
st2.equal(Boolean.prototype.valueOf.call(bool), true, 'bool coerces to `true`');
|
||||
st2.equal(bool.a, signal, 'source properties copied');
|
||||
st2.end();
|
||||
});
|
||||
|
||||
st.test('number', function (st2) {
|
||||
var number = assign(1, { a: signal });
|
||||
st2.equal(typeof number, 'object', 'number is object');
|
||||
st2.equal(Number.prototype.valueOf.call(number), 1, 'number coerces to `1`');
|
||||
st2.equal(number.a, signal, 'source properties copied');
|
||||
st2.end();
|
||||
});
|
||||
|
||||
st.test('string', function (st2) {
|
||||
var string = assign('1', { a: signal });
|
||||
st2.equal(typeof string, 'object', 'number is object');
|
||||
st2.equal(String.prototype.valueOf.call(string), '1', 'number coerces to `"1"`');
|
||||
st2.equal(string.a, signal, 'source properties copied');
|
||||
st2.end();
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('non-object sources', function (st) {
|
||||
st.deepEqual(assign({ a: 1 }, null, { b: 2 }), { a: 1, b: 2 }, 'ignores null source');
|
||||
st.deepEqual(assign({ a: 1 }, { b: 2 }, undefined), { a: 1, b: 2 }, 'ignores undefined source');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('returns the modified target object', function (st) {
|
||||
var target = {};
|
||||
var returned = assign(target, { a: 1 });
|
||||
st.equal(returned, target, 'returned object is the same reference as the target object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('has the right length', function (st) {
|
||||
st.equal(assign.length, 2, 'length is 2 => 2 required arguments');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('merge two objects', function (st) {
|
||||
var target = { a: 1 };
|
||||
var returned = assign(target, { b: 2 });
|
||||
st.deepEqual(returned, { a: 1, b: 2 }, 'returned object has properties from both');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('works with functions', function (st) {
|
||||
var target = function () {};
|
||||
target.a = 1;
|
||||
var returned = assign(target, { b: 2 });
|
||||
st.equal(target, returned, 'returned object is target');
|
||||
st.equal(returned.a, 1);
|
||||
st.equal(returned.b, 2);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('works with primitives', function (st) {
|
||||
var target = 2;
|
||||
var source = { b: 42 };
|
||||
var returned = assign(target, source);
|
||||
st.equal(Object.prototype.toString.call(returned), '[object Number]', 'returned is object form of number primitive');
|
||||
st.equal(Number(returned), target, 'returned and target have same valueOf');
|
||||
st.equal(returned.b, source.b);
|
||||
st.end();
|
||||
});
|
||||
|
||||
/* globals window */
|
||||
t.test('works with window.location', { skip: typeof window === 'undefined' }, function (st) {
|
||||
var target = {};
|
||||
assign(target, window.location);
|
||||
for (var prop in window.location) {
|
||||
if (hasOwn(window.location, prop)) {
|
||||
st.deepEqual(target[prop], window.location[prop], prop + ' is copied');
|
||||
}
|
||||
}
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('merge N objects', function (st) {
|
||||
var target = { a: 1 };
|
||||
var source1 = { b: 2 };
|
||||
var source2 = { c: 3 };
|
||||
var returned = assign(target, source1, source2);
|
||||
st.deepEqual(returned, { a: 1, b: 2, c: 3 }, 'returned object has properties from all sources');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('only iterates over own keys', function (st) {
|
||||
var Foo = function () {};
|
||||
Foo.prototype.bar = true;
|
||||
var foo = new Foo();
|
||||
foo.baz = true;
|
||||
var target = { a: 1 };
|
||||
var returned = assign(target, foo);
|
||||
st.equal(returned, target, 'returned object is the same reference as the target object');
|
||||
st.deepEqual(target, { a: 1, baz: true }, 'returned object has only own properties from both');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('includes enumerable symbols, after keys', { skip: !hasSymbols }, function (st) {
|
||||
var visited = [];
|
||||
var obj = {};
|
||||
Object.defineProperty(obj, 'a', { enumerable: true, get: function () { visited.push('a'); return 42; } });
|
||||
var symbol = Symbol('enumerable');
|
||||
Object.defineProperty(obj, symbol, {
|
||||
enumerable: true,
|
||||
get: function () { visited.push(symbol); return Infinity; }
|
||||
});
|
||||
var nonEnumSymbol = Symbol('non-enumerable');
|
||||
Object.defineProperty(obj, nonEnumSymbol, {
|
||||
enumerable: false,
|
||||
get: function () { visited.push(nonEnumSymbol); return -Infinity; }
|
||||
});
|
||||
var target = assign({}, obj);
|
||||
st.deepEqual(visited, ['a', symbol], 'key is visited first, then symbol');
|
||||
st.equal(target.a, 42, 'target.a is 42');
|
||||
st.equal(target[symbol], Infinity, 'target[symbol] is Infinity');
|
||||
st.notEqual(target[nonEnumSymbol], -Infinity, 'target[nonEnumSymbol] is not -Infinity');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('does not fail when symbols are not present', { skip: !Object.isFrozen || Object.isFrozen(Object) }, function (st) {
|
||||
st.teardown(mockProperty(Object, 'getOwnPropertySymbols', { 'delete': true }));
|
||||
|
||||
var visited = [];
|
||||
var obj = {};
|
||||
Object.defineProperty(obj, 'a', { enumerable: true, get: function () { visited.push('a'); return 42; } });
|
||||
var keys = ['a'];
|
||||
if (hasSymbols) {
|
||||
var symbol = Symbol('sym');
|
||||
Object.defineProperty(obj, symbol, {
|
||||
enumerable: true,
|
||||
get: function () { visited.push(symbol); return Infinity; }
|
||||
});
|
||||
keys.push(symbol);
|
||||
}
|
||||
var target = assign({}, obj);
|
||||
st.deepEqual(visited, keys, 'assign visits expected keys');
|
||||
st.equal(target.a, 42, 'target.a is 42');
|
||||
|
||||
if (hasSymbols) {
|
||||
st.equal(target[symbol], Infinity);
|
||||
}
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('preserves correct property enumeration order', function (st) {
|
||||
var str = 'abcdefghijklmnopqrst';
|
||||
var letters = {};
|
||||
forEach(str.split(''), function (letter) {
|
||||
letters[letter] = letter;
|
||||
});
|
||||
|
||||
var n = 5;
|
||||
st.comment('run the next test ' + n + ' times');
|
||||
var object = assign({}, letters);
|
||||
var actual = '';
|
||||
for (var k in object) {
|
||||
actual += k;
|
||||
}
|
||||
for (var i = 0; i < n; ++i) {
|
||||
st.equal(actual, str, 'property enumeration order should be followed');
|
||||
}
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('checks enumerability and existence, in case of modification during [[Get]]', { skip: !Object.defineProperty }, function (st) {
|
||||
var targetBvalue = {};
|
||||
var targetCvalue = {};
|
||||
var target = { b: targetBvalue, c: targetCvalue };
|
||||
var source = {};
|
||||
Object.defineProperty(source, 'a', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
delete this.b;
|
||||
Object.defineProperty(this, 'c', { enumerable: false });
|
||||
return 'a';
|
||||
}
|
||||
});
|
||||
var sourceBvalue = {};
|
||||
var sourceCvalue = {};
|
||||
source.b = sourceBvalue;
|
||||
source.c = sourceCvalue;
|
||||
var result = assign(target, source);
|
||||
st.equal(result, target, 'sanity check: result is === target');
|
||||
st.equal(result.b, targetBvalue, 'target key not overwritten by deleted source key');
|
||||
st.equal(result.c, targetCvalue, 'target key not overwritten by non-enumerable source key');
|
||||
|
||||
st.end();
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user