govuk_publishing_components 17.7.0 → 17.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +3 -24
- data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +6 -18
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +35 -45
- data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +0 -4
- data/lib/govuk_publishing_components.rb +0 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/package.json +1 -1
- data/node_modules/define-properties/package.json +2 -1
- data/node_modules/function-bind/package.json +2 -1
- data/node_modules/has-symbols/package.json +2 -1
- data/node_modules/jsx-ast-utils/CHANGELOG.md +16 -0
- data/node_modules/jsx-ast-utils/__tests__/helper.js +2 -0
- data/node_modules/jsx-ast-utils/__tests__/src/getPropLiteralValue-test.js +39 -3
- data/node_modules/jsx-ast-utils/__tests__/src/getPropValue-test.js +9 -4
- data/node_modules/jsx-ast-utils/lib/values/expressions/ObjectExpression.js +9 -2
- data/node_modules/jsx-ast-utils/lib/values/expressions/index.js +21 -6
- data/node_modules/jsx-ast-utils/lib/values/index.js +5 -1
- data/node_modules/jsx-ast-utils/package.json +35 -31
- data/node_modules/jsx-ast-utils/src/values/expressions/ObjectExpression.js +3 -1
- data/node_modules/jsx-ast-utils/src/values/expressions/index.js +12 -4
- data/node_modules/object-keys/package.json +2 -1
- data/node_modules/object.assign/CHANGELOG.md +179 -0
- data/node_modules/object.assign/LICENSE +21 -0
- data/node_modules/object.assign/README.md +135 -0
- data/node_modules/object.assign/auto.js +3 -0
- data/node_modules/object.assign/dist/browser.js +492 -0
- data/node_modules/object.assign/hasSymbols.js +41 -0
- data/node_modules/object.assign/implementation.js +41 -0
- data/node_modules/object.assign/index.js +17 -0
- data/node_modules/object.assign/package.json +148 -0
- data/node_modules/object.assign/polyfill.js +51 -0
- data/node_modules/object.assign/shim.js +14 -0
- data/node_modules/object.assign/test.sh +53 -0
- data/node_modules/object.assign/test/index.js +17 -0
- data/node_modules/object.assign/test/native.js +47 -0
- data/node_modules/object.assign/test/shimmed.js +50 -0
- data/node_modules/object.assign/test/tests.js +224 -0
- metadata +18 -3
- data/lib/govuk_publishing_components/presenters/cookie_banner_helper.rb +0 -23
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.default = getValue;
|
7
7
|
exports.getLiteralValue = getLiteralValue;
|
8
8
|
|
9
|
+
var _object = require('object.assign');
|
10
|
+
|
11
|
+
var _object2 = _interopRequireDefault(_object);
|
12
|
+
|
9
13
|
var _Literal = require('./Literal');
|
10
14
|
|
11
15
|
var _Literal2 = _interopRequireDefault(_Literal);
|
@@ -28,7 +32,7 @@ var TYPES = {
|
|
28
32
|
};
|
29
33
|
|
30
34
|
// Composition map of types to their extractor functions to handle literals.
|
31
|
-
var LITERAL_TYPES =
|
35
|
+
var LITERAL_TYPES = (0, _object2.default)({}, TYPES, {
|
32
36
|
JSXElement: function JSXElement() {
|
33
37
|
return null;
|
34
38
|
},
|
@@ -15,12 +15,12 @@
|
|
15
15
|
],
|
16
16
|
"_from": "jsx-ast-utils@>=2.0.1 <3.0.0",
|
17
17
|
"_hasShrinkwrap": false,
|
18
|
-
"_id": "jsx-ast-utils@2.
|
18
|
+
"_id": "jsx-ast-utils@2.2.0",
|
19
19
|
"_inCache": true,
|
20
20
|
"_location": "/jsx-ast-utils",
|
21
21
|
"_npmOperationalInternal": {
|
22
22
|
"host": "s3://npm-registry-packages",
|
23
|
-
"tmp": "tmp/jsx-ast-utils_2.
|
23
|
+
"tmp": "tmp/jsx-ast-utils_2.2.0_1561499116457_0.2449212730726673"
|
24
24
|
},
|
25
25
|
"_npmUser": {
|
26
26
|
"name": "evcohen",
|
@@ -39,8 +39,8 @@
|
|
39
39
|
"_requiredBy": [
|
40
40
|
"/eslint-plugin-react"
|
41
41
|
],
|
42
|
-
"_resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.
|
43
|
-
"_shasum": "
|
42
|
+
"_resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.2.0.tgz",
|
43
|
+
"_shasum": "e2bade6d09c8ef9d5f6b9ff2ace67b2cdbc7e370",
|
44
44
|
"_shrinkwrap": null,
|
45
45
|
"_spec": "jsx-ast-utils@^2.0.1",
|
46
46
|
"_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ/node_modules/eslint-plugin-react",
|
@@ -51,34 +51,37 @@
|
|
51
51
|
"url": "https://github.com/evcohen/jsx-ast-utils/issues"
|
52
52
|
},
|
53
53
|
"dependencies": {
|
54
|
-
"array-includes": "^3.0.3"
|
54
|
+
"array-includes": "^3.0.3",
|
55
|
+
"object.assign": "^4.1.0"
|
55
56
|
},
|
56
57
|
"description": "AST utility module for statically analyzing JSX",
|
57
58
|
"devDependencies": {
|
58
|
-
"@babel/parser": "^7.
|
59
|
-
"babel-cli": "^6.
|
60
|
-
"babel-core": "^6.
|
61
|
-
"babel-eslint": "^
|
62
|
-
"babel-jest": "^20.0.
|
63
|
-
"babel-
|
64
|
-
"babel-
|
65
|
-
"
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"eslint
|
69
|
-
"eslint-
|
70
|
-
"
|
59
|
+
"@babel/parser": "^7.4.4",
|
60
|
+
"babel-cli": "^6.26.0",
|
61
|
+
"babel-core": "^6.26.3",
|
62
|
+
"babel-eslint": "^10.0.2",
|
63
|
+
"babel-jest": "^20.0.3",
|
64
|
+
"babel-plugin-transform-replace-object-assign": "^1.0.0",
|
65
|
+
"babel-polyfill": "^6.26.0",
|
66
|
+
"babel-preset-env": "^1.7.0",
|
67
|
+
"babylon": "^6.18.0",
|
68
|
+
"coveralls": "^3.0.4",
|
69
|
+
"eslint": "^6.0.0",
|
70
|
+
"eslint-config-airbnb-base": "^13.1.0",
|
71
|
+
"eslint-plugin-import": "^2.17.2",
|
72
|
+
"in-publish": "^2.0.0",
|
73
|
+
"jest": "^20.0.4",
|
71
74
|
"jest-cli": "^20.0.4",
|
72
|
-
"rimraf": "^2.
|
75
|
+
"rimraf": "^2.6.3"
|
73
76
|
},
|
74
77
|
"directories": {},
|
75
78
|
"dist": {
|
76
|
-
"shasum": "
|
77
|
-
"integrity": "sha512-
|
78
|
-
"tarball": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.
|
79
|
+
"shasum": "e2bade6d09c8ef9d5f6b9ff2ace67b2cdbc7e370",
|
80
|
+
"integrity": "sha512-yAmhGSzR7TsD0OQpu1AGLz8Bx84cxMqtgoJrufomY6BlveEDlREhvu1rea21936xbe5tlUh7IPda82m5ae0H8Q==",
|
81
|
+
"tarball": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.2.0.tgz",
|
79
82
|
"fileCount": 94,
|
80
|
-
"unpackedSize":
|
81
|
-
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\
|
83
|
+
"unpackedSize": 138568,
|
84
|
+
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdEpXtCRA9TVsSAnZWagAAIUUQAIE4pkwcpI5KAB1hmohg\nxryrC17bYOosFFa3Q7exY+OWhf7sr40RehK52t6WNwjpdloid3iig25YNWqD\nUUeZUeI2/+VjAYx3hqkiUQ51GsKP6ODkqvj4vXQufZRZzbnvzakzBuZsS13I\nsNzfwtfxU4nTbIVj98XeYIMIMNz9QgRs2GyCSNEyivCuLVVAfc+Gk+Kyhe7K\nXFYS96LXd3UWGYqUNX+BmsdGbWnsjunM28yoD0K/xvhlR5jJiiQRIeLWQNSR\nvxesF6Zi3tCyq7LSdd93cNiMSRsQ/jJ6MJx6ybMTqTLTVKd93nGaKv61JgLu\nbWBPh2vjqywgfaQyPjistr5vlVzR0c6hqHE+bmMNoN/6BgBQZeGF2jr8Sfrg\no4zYDFR5fyKvs2VDfiTvY+fRsAJRlXLOh1rs2LPd5U743QSRG2yIj+32392e\nRexK1YdvYt8hifHNhK4ns0rmXeyhWwVtqTKuYWHTXMKYGoCP/PE9Oo0ug+TI\ny5+EsJN7X7FlItJr67lNF4fd9HoYo7vu3AYKlh3eMsy4rvT2pz/4h3hrnDsp\nEMLAQbZf5zWa5L38MlGpv34kmsdYFrY5N3CN6grDjmlihEDKf158IWUxVKa4\nnAVBU3VqZVUJ5881624g9gZ+fygoawXnZ0OCAY7GjYLH7kpUkMCcep9nDxdU\n2y1u\r\n=8Oud\r\n-----END PGP SIGNATURE-----\r\n"
|
82
85
|
},
|
83
86
|
"engines": {
|
84
87
|
"node": ">=4.0"
|
@@ -117,14 +120,15 @@
|
|
117
120
|
"url": "git+https://github.com/evcohen/jsx-ast-utils.git"
|
118
121
|
},
|
119
122
|
"scripts": {
|
120
|
-
"build": "
|
123
|
+
"build": "babel src --out-dir lib",
|
121
124
|
"coveralls": "cat ./reports/lcov.info | coveralls",
|
122
|
-
"lint": "eslint
|
123
|
-
"
|
124
|
-
"prepublish": "
|
125
|
+
"lint": "eslint .",
|
126
|
+
"prebuild": "rimraf lib",
|
127
|
+
"prepublish": "not-in-publish || (npm test && npm run build)",
|
125
128
|
"pretest": "npm run lint",
|
126
|
-
"test": "
|
127
|
-
"test:watch": "npm test -- --watch"
|
129
|
+
"test": "npm run tests-only --",
|
130
|
+
"test:watch": "npm test -- --watch",
|
131
|
+
"tests-only": "jest --coverage"
|
128
132
|
},
|
129
|
-
"version": "2.
|
133
|
+
"version": "2.2.0"
|
130
134
|
}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import assign from 'object.assign';
|
2
|
+
|
1
3
|
/**
|
2
4
|
* Extractor function for an ObjectExpression type value node.
|
3
5
|
* An object expression is using {}.
|
@@ -12,7 +14,7 @@ export default function extractValueFromObjectExpression(value) {
|
|
12
14
|
// Support types: SpreadProperty and ExperimentalSpreadProperty
|
13
15
|
if (/^(?:Experimental)?Spread(?:Property|Element)$/.test(property.type)) {
|
14
16
|
if (property.argument.type === 'ObjectExpression') {
|
15
|
-
return
|
17
|
+
return assign(object, extractValueFromObjectExpression(property.argument));
|
16
18
|
}
|
17
19
|
} else {
|
18
20
|
object[getValue(property.key)] = getValue(property.value);
|
@@ -73,12 +73,16 @@ export default function extract(value) {
|
|
73
73
|
let { type } = expression;
|
74
74
|
|
75
75
|
while (type === 'TSNonNullExpression' || type === 'TSAsExpression') {
|
76
|
-
|
77
|
-
|
76
|
+
({ type } = expression);
|
77
|
+
if (expression.expression) {
|
78
|
+
({ expression } = expression);
|
79
|
+
}
|
78
80
|
}
|
79
81
|
|
80
82
|
if (TYPES[type] === undefined) {
|
81
|
-
|
83
|
+
// eslint-disable-next-line no-console
|
84
|
+
console.error(errorMessage(type));
|
85
|
+
return null;
|
82
86
|
}
|
83
87
|
|
84
88
|
return TYPES[type](expression);
|
@@ -123,6 +127,8 @@ const LITERAL_TYPES = Object.assign({}, TYPES, {
|
|
123
127
|
},
|
124
128
|
BindExpression: noop,
|
125
129
|
SpreadElement: noop,
|
130
|
+
TSNonNullExpression: noop,
|
131
|
+
TSAsExpression: noop,
|
126
132
|
});
|
127
133
|
|
128
134
|
/**
|
@@ -141,7 +147,9 @@ export function extractLiteral(value) {
|
|
141
147
|
const { type } = expression;
|
142
148
|
|
143
149
|
if (LITERAL_TYPES[type] === undefined) {
|
144
|
-
|
150
|
+
// eslint-disable-next-line no-console
|
151
|
+
console.error(errorMessage(type));
|
152
|
+
return null;
|
145
153
|
}
|
146
154
|
|
147
155
|
return LITERAL_TYPES[type](expression);
|
@@ -0,0 +1,179 @@
|
|
1
|
+
4.0.4 / 2017-12-21
|
2
|
+
==================
|
3
|
+
* [New] add `auto` entry point (#52)
|
4
|
+
* [Refactor] Use `has-symbols` module
|
5
|
+
* [Deps] update `function-bind`, `object-keys`
|
6
|
+
* [Dev Deps] update `@es-shims/api`, `browserify`, `nsp`, `eslint`, `@ljharb/eslint-config`, `is`
|
7
|
+
* [Tests] up to `node` `v9.3`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS
|
8
|
+
|
9
|
+
4.0.4 / 2016-07-04
|
10
|
+
==================
|
11
|
+
* [Fix] Cache original `getOwnPropertySymbols`, and use that when `Object.getOwnPropertySymbols` is unavailable
|
12
|
+
* [Deps] update `object-keys`
|
13
|
+
* [Dev Deps] update `eslint`, `get-own-property-symbols`, `core-js`, `jscs`, `nsp`, `browserify`, `@ljharb/eslint-config`, `tape`, `@es-shims/api`
|
14
|
+
* [Tests] up to `node` `v6.2`, `v5.10`, `v4.4`
|
15
|
+
* [Tests] run sham tests on node 0.10
|
16
|
+
* [Tests] use pretest/posttest for linting/security
|
17
|
+
|
18
|
+
4.0.3 / 2015-10-21
|
19
|
+
==================
|
20
|
+
* [Fix] Support core-js's Symbol sham (#17)
|
21
|
+
* [Fix] Ensure that properties removed or made non-enumerable during enumeration are not assigned (#16)
|
22
|
+
* [Fix] Avoid looking up keys and values more than once
|
23
|
+
* [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))
|
24
|
+
* [Tests] Refactor to use my conventional structure that separates shimmed, implementation, and common tests
|
25
|
+
* [Tests] Create `npm run test:shams` and better organize tests for symbol shams
|
26
|
+
* [Tests] Remove `nsp` in favor of `requiresafe`
|
27
|
+
|
28
|
+
4.0.2 / 2015-10-20
|
29
|
+
==================
|
30
|
+
* [Fix] Ensure correct property enumeration order, particularly in v8 (#15)
|
31
|
+
* [Deps] update `object-keys`, `define-properties`
|
32
|
+
* [Dev Deps] update `browserify`, `is`, `tape`, `jscs`, `eslint`, `@ljharb/eslint-config`
|
33
|
+
* [Tests] up to `io.js` `v3.3`, `node` `v4.2`
|
34
|
+
|
35
|
+
4.0.1 / 2015-08-16
|
36
|
+
==================
|
37
|
+
* [Docs] Add `Symbol` note to readme
|
38
|
+
|
39
|
+
4.0.0 / 2015-08-15
|
40
|
+
==================
|
41
|
+
* [Breaking] Implement the [es-shim API](es-shims/api).
|
42
|
+
* [Robustness] Make implementation robust against later modification of environment methods.
|
43
|
+
* [Refactor] Move implementation to `implementation.js`
|
44
|
+
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
|
45
|
+
* [Deps] update `object-keys`, `define-properties`
|
46
|
+
* [Dev Deps] update `browserify`, `tape`, `eslint`, `jscs`, `browserify`
|
47
|
+
* [Tests] Add `npm run tests-only`
|
48
|
+
* [Tests] use my personal shared `eslint` config.
|
49
|
+
* [Tests] up to `io.js` `v3.0`
|
50
|
+
|
51
|
+
3.0.1 / 2015-06-28
|
52
|
+
==================
|
53
|
+
* Cache `Object` and `Array#push` to make the shim more robust.
|
54
|
+
* [Fix] Remove use of `Array#filter`, which isn't in ES3.
|
55
|
+
* [Deps] Update `object-keys`, `define-properties`
|
56
|
+
* [Dev Deps] Update `get-own-property-symbols`, `browserify`, `eslint`, `nsp`
|
57
|
+
* [Tests] Test up to `io.js` `v2.3`
|
58
|
+
* [Tests] Adding `Object.assign` tests for non-object targets, per https://github.com/paulmillr/es6-shim/issues/348
|
59
|
+
|
60
|
+
3.0.0 / 2015-05-20
|
61
|
+
==================
|
62
|
+
* Attempt to feature-detect Symbols, even if `typeof Symbol() !== 'symbol'` (#12)
|
63
|
+
* Make a separate `hasSymbols` internal module
|
64
|
+
* Update `browserify`, `eslint`
|
65
|
+
|
66
|
+
2.0.3 / 2015-06-28
|
67
|
+
==================
|
68
|
+
* Cache `Object` and `Array#push` to make the shim more robust.
|
69
|
+
* [Fix] Remove use of `Array#filter`, which isn't in ES3
|
70
|
+
* [Deps] Update `object-keys`, `define-properties`
|
71
|
+
* [Dev Deps] Update `browserify`, `nsp`, `eslint`
|
72
|
+
* [Tests] Test up to `io.js` `v2.3`
|
73
|
+
|
74
|
+
2.0.2 / 2015-05-20
|
75
|
+
==================
|
76
|
+
* Make sure `.shim` is non-enumerable.
|
77
|
+
* Refactor `.shim` implementation to use `define-properties` predicates, rather than `delete`ing the original.
|
78
|
+
* Update docs to match spec/implementation. (#11)
|
79
|
+
* Add `npm run eslint`
|
80
|
+
* Test up to `io.js` `v2.0`
|
81
|
+
* Update `jscs`, `browserify`, `covert`
|
82
|
+
|
83
|
+
2.0.1 / 2015-04-12
|
84
|
+
==================
|
85
|
+
* Make sure non-enumerable Symbols are excluded.
|
86
|
+
|
87
|
+
2.0.0 / 2015-04-12
|
88
|
+
==================
|
89
|
+
* Make sure the shim function overwrites a broken implementation with pending exceptions.
|
90
|
+
* Ensure shim is not enumerable using `define-properties`
|
91
|
+
* Ensure `Object.assign` includes symbols.
|
92
|
+
* All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`.
|
93
|
+
* Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures.
|
94
|
+
* Add `npm run security` via `nsp`
|
95
|
+
* Update `browserify`, `jscs`, `tape`, `object-keys`, `is`
|
96
|
+
|
97
|
+
1.1.1 / 2014-12-14
|
98
|
+
==================
|
99
|
+
* Actually include the browser build in `npm`
|
100
|
+
|
101
|
+
1.1.0 / 2014-12-14
|
102
|
+
==================
|
103
|
+
* Add `npm run build`, and build an automatic-shimming browser distribution as part of the npm publish process.
|
104
|
+
* Update `is`, `jscs`
|
105
|
+
|
106
|
+
1.0.3 / 2014-11-29
|
107
|
+
==================
|
108
|
+
* Revert "optimize --production installs"
|
109
|
+
|
110
|
+
1.0.2 / 2014-11-27
|
111
|
+
==================
|
112
|
+
* Update `jscs`, `is`, `object-keys`, `tape`
|
113
|
+
* Add badges to README
|
114
|
+
* Name URLs in README
|
115
|
+
* Lock `covert` to `v1.0.0`
|
116
|
+
* Optimize --production installs
|
117
|
+
|
118
|
+
1.0.1 / 2014-08-26
|
119
|
+
==================
|
120
|
+
* Update `is`, `covert`
|
121
|
+
|
122
|
+
1.0.0 / 2014-08-07
|
123
|
+
==================
|
124
|
+
* Update `object-keys`, `tape`
|
125
|
+
|
126
|
+
0.5.0 / 2014-07-31
|
127
|
+
==================
|
128
|
+
* Object.assign no longer throws on null or undefined sources, per https://bugs.ecmascript.org/show_bug.cgi?id=3096
|
129
|
+
|
130
|
+
0.4.3 / 2014-07-30
|
131
|
+
==================
|
132
|
+
* Don’t modify vars in the function signature, since it deoptimizes v8
|
133
|
+
|
134
|
+
0.4.2 / 2014-07-30
|
135
|
+
==================
|
136
|
+
* Fixing the version number: v0.4.2
|
137
|
+
|
138
|
+
0.4.1 / 2014-07-19
|
139
|
+
==================
|
140
|
+
* Revert "Use the native Object.keys if it’s available."
|
141
|
+
|
142
|
+
0.4.0 / 2014-07-19
|
143
|
+
==================
|
144
|
+
* Use the native Object.keys if it’s available.
|
145
|
+
* Fixes [#2](https://github.com/ljharb/object.assign/issues/2).
|
146
|
+
* Adding failing tests for [#2](https://github.com/ljharb/object.assign/issues/2).
|
147
|
+
* Fix indentation.
|
148
|
+
* Adding `npm run lint`
|
149
|
+
* Update `tape`, `covert`
|
150
|
+
* README: Use SVG badge for Travis [#1](https://github.com/ljharb/object.assign/issues/1) from mathiasbynens/patch-1
|
151
|
+
|
152
|
+
0.3.1 / 2014-04-10
|
153
|
+
==================
|
154
|
+
* Object.assign does partially modify objects if it throws, per https://twitter.com/awbjs/status/454320863093862400
|
155
|
+
|
156
|
+
0.3.0 / 2014-04-10
|
157
|
+
==================
|
158
|
+
* Update with newest ES6 behavior - Object.assign now takes a variable number of source objects.
|
159
|
+
* Update `tape`
|
160
|
+
* Make sure old and unstable nodes don’t fail Travis
|
161
|
+
|
162
|
+
0.2.1 / 2014-03-16
|
163
|
+
==================
|
164
|
+
* Let object-keys handle the fallback
|
165
|
+
* Update dependency badges
|
166
|
+
* Adding bower.json
|
167
|
+
|
168
|
+
0.2.0 / 2014-03-16
|
169
|
+
==================
|
170
|
+
* Use a for loop, because ES3 browsers don’t have "reduce"
|
171
|
+
|
172
|
+
0.1.1 / 2014-03-14
|
173
|
+
==================
|
174
|
+
* Updating readme
|
175
|
+
|
176
|
+
0.1.0 / 2014-03-14
|
177
|
+
==================
|
178
|
+
* Initial release.
|
179
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Jordan Harband
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,135 @@
|
|
1
|
+
#object.assign <sup>[![Version Badge][npm-version-svg]][npm-url]</sup>
|
2
|
+
|
3
|
+
[![Build Status][travis-svg]][travis-url]
|
4
|
+
[![dependency status][deps-svg]][deps-url]
|
5
|
+
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
6
|
+
[![License][license-image]][license-url]
|
7
|
+
[![Downloads][downloads-image]][downloads-url]
|
8
|
+
|
9
|
+
[![npm badge][npm-badge-png]][npm-url]
|
10
|
+
|
11
|
+
[![browser support][testling-png]][testling-url]
|
12
|
+
|
13
|
+
An Object.assign shim. Invoke its "shim" method to shim Object.assign if it is unavailable.
|
14
|
+
|
15
|
+
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.
|
16
|
+
|
17
|
+
Takes a minimum of 2 arguments: `target` and `source`.
|
18
|
+
Takes a variable sized list of source arguments - at least 1, as many as you want.
|
19
|
+
Throws a TypeError if the `target` argument is `null` or `undefined`.
|
20
|
+
|
21
|
+
Most common usage:
|
22
|
+
```js
|
23
|
+
var assign = require('object.assign').getPolyfill(); // returns native method if compliant
|
24
|
+
/* or */
|
25
|
+
var assign = require('object.assign/polyfill')(); // returns native method if compliant
|
26
|
+
```
|
27
|
+
|
28
|
+
## Example
|
29
|
+
|
30
|
+
```js
|
31
|
+
var assert = require('assert');
|
32
|
+
|
33
|
+
// Multiple sources!
|
34
|
+
var target = { a: true };
|
35
|
+
var source1 = { b: true };
|
36
|
+
var source2 = { c: true };
|
37
|
+
var sourceN = { n: true };
|
38
|
+
|
39
|
+
var expected = {
|
40
|
+
a: true,
|
41
|
+
b: true,
|
42
|
+
c: true,
|
43
|
+
n: true
|
44
|
+
};
|
45
|
+
|
46
|
+
assign(target, source1, source2, sourceN);
|
47
|
+
assert.deepEqual(target, expected); // AWESOME!
|
48
|
+
```
|
49
|
+
|
50
|
+
```js
|
51
|
+
var target = {
|
52
|
+
a: true,
|
53
|
+
b: true,
|
54
|
+
c: true
|
55
|
+
};
|
56
|
+
var source1 = {
|
57
|
+
c: false,
|
58
|
+
d: false
|
59
|
+
};
|
60
|
+
var sourceN = {
|
61
|
+
e: false
|
62
|
+
};
|
63
|
+
|
64
|
+
var assigned = assign(target, source1, sourceN);
|
65
|
+
assert.equal(target, assigned); // returns the target object
|
66
|
+
assert.deepEqual(assigned, {
|
67
|
+
a: true,
|
68
|
+
b: true,
|
69
|
+
c: false,
|
70
|
+
d: false,
|
71
|
+
e: false
|
72
|
+
});
|
73
|
+
```
|
74
|
+
|
75
|
+
```js
|
76
|
+
/* when Object.assign is not present */
|
77
|
+
delete Object.assign;
|
78
|
+
var shimmedAssign = require('object.assign').shim();
|
79
|
+
/* or */
|
80
|
+
var shimmedAssign = require('object.assign/shim')();
|
81
|
+
|
82
|
+
assert.equal(shimmedAssign, assign);
|
83
|
+
|
84
|
+
var target = {
|
85
|
+
a: true,
|
86
|
+
b: true,
|
87
|
+
c: true
|
88
|
+
};
|
89
|
+
var source = {
|
90
|
+
c: false,
|
91
|
+
d: false,
|
92
|
+
e: false
|
93
|
+
};
|
94
|
+
|
95
|
+
var assigned = assign(target, source);
|
96
|
+
assert.deepEqual(Object.assign(target, source), assign(target, source));
|
97
|
+
```
|
98
|
+
|
99
|
+
```js
|
100
|
+
/* when Object.assign is present */
|
101
|
+
var shimmedAssign = require('object.assign').shim();
|
102
|
+
assert.equal(shimmedAssign, Object.assign);
|
103
|
+
|
104
|
+
var target = {
|
105
|
+
a: true,
|
106
|
+
b: true,
|
107
|
+
c: true
|
108
|
+
};
|
109
|
+
var source = {
|
110
|
+
c: false,
|
111
|
+
d: false,
|
112
|
+
e: false
|
113
|
+
};
|
114
|
+
|
115
|
+
assert.deepEqual(Object.assign(target, source), assign(target, source));
|
116
|
+
```
|
117
|
+
|
118
|
+
## Tests
|
119
|
+
Simply clone the repo, `npm install`, and run `npm test`
|
120
|
+
|
121
|
+
[npm-url]: https://npmjs.org/package/object.assign
|
122
|
+
[npm-version-svg]: http://versionbadg.es/ljharb/object.assign.svg
|
123
|
+
[travis-svg]: https://travis-ci.org/ljharb/object.assign.svg
|
124
|
+
[travis-url]: https://travis-ci.org/ljharb/object.assign
|
125
|
+
[deps-svg]: https://david-dm.org/ljharb/object.assign.svg?theme=shields.io
|
126
|
+
[deps-url]: https://david-dm.org/ljharb/object.assign
|
127
|
+
[dev-deps-svg]: https://david-dm.org/ljharb/object.assign/dev-status.svg?theme=shields.io
|
128
|
+
[dev-deps-url]: https://david-dm.org/ljharb/object.assign#info=devDependencies
|
129
|
+
[testling-png]: https://ci.testling.com/ljharb/object.assign.png
|
130
|
+
[testling-url]: https://ci.testling.com/ljharb/object.assign
|
131
|
+
[npm-badge-png]: https://nodei.co/npm/object.assign.png?downloads=true&stars=true
|
132
|
+
[license-image]: http://img.shields.io/npm/l/object.assign.svg
|
133
|
+
[license-url]: LICENSE
|
134
|
+
[downloads-image]: http://img.shields.io/npm/dm/object.assign.svg
|
135
|
+
[downloads-url]: http://npm-stat.com/charts.html?package=object.assign
|