source: trip-planner-front/node_modules/object-assign/readme.md@ 6fe77af

Last change on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign)
2
3> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com)
4
5
6## Use the built-in
7
8Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari),
9support `Object.assign()` :tada:. If you target only those environments, then by all
10means, use `Object.assign()` instead of this package.
11
12
13## Install
14
15```
16$ npm install --save object-assign
17```
18
19
20## Usage
21
22```js
23const objectAssign = require('object-assign');
24
25objectAssign({foo: 0}, {bar: 1});
26//=> {foo: 0, bar: 1}
27
28// multiple sources
29objectAssign({foo: 0}, {bar: 1}, {baz: 2});
30//=> {foo: 0, bar: 1, baz: 2}
31
32// overwrites equal keys
33objectAssign({foo: 0}, {foo: 1}, {foo: 2});
34//=> {foo: 2}
35
36// ignores null and undefined sources
37objectAssign({foo: 0}, null, {bar: 1}, undefined);
38//=> {foo: 0, bar: 1}
39```
40
41
42## API
43
44### objectAssign(target, [source, ...])
45
46Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones.
47
48
49## Resources
50
51- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign)
52
53
54## Related
55
56- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()`
57
58
59## License
60
61MIT © [Sindre Sorhus](https://sindresorhus.com)
Note: See TracBrowser for help on using the repository browser.