CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
README.md137 linesDownload Raw Back to object.assign
1# object.assign <sup>[![Version Badge][npm-version-svg]][npm-url]</sup>2 3[![github actions][actions-image]][actions-url]4[![coverage][codecov-image]][codecov-url]5[![dependency status][deps-svg]][deps-url]6[![dev dependency status][dev-deps-svg]][dev-deps-url]7[![License][license-image]][license-url]8[![Downloads][downloads-image]][downloads-url]9 10[![npm badge][npm-badge-png]][npm-url]11 12An Object.assign shim. Invoke its "shim" method to shim Object.assign if it is unavailable.13 14This 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.15 16Takes a minimum of 2 arguments: `target` and `source`.17Takes a variable sized list of source arguments - at least 1, as many as you want.18Throws a TypeError if the `target` argument is `null` or `undefined`.19 20Most common usage:21```js22var assign = require('object.assign').getPolyfill(); // returns native method if compliant23	/* or */24var assign = require('object.assign/polyfill')(); // returns native method if compliant25```26 27## Example28 29```js30var assert = require('assert');31 32// Multiple sources!33var target = { a: true };34var source1 = { b: true };35var source2 = { c: true };36var sourceN = { n: true };37 38var expected = {39	a: true,40	b: true,41	c: true,42	n: true43};44 45assign(target, source1, source2, sourceN);46assert.deepEqual(target, expected); // AWESOME!47```48 49```js50var target = {51	a: true,52	b: true,53	c: true54};55var source1 = {56	c: false,57	d: false58};59var sourceN = {60	e: false61};62 63var assigned = assign(target, source1, sourceN);64assert.equal(target, assigned); // returns the target object65assert.deepEqual(assigned, {66	a: true,67	b: true,68	c: false,69	d: false,70	e: false71});72```73 74```js75/* when Object.assign is not present */76delete Object.assign;77var shimmedAssign = require('object.assign').shim();78	/* or */79var shimmedAssign = require('object.assign/shim')();80 81assert.equal(shimmedAssign, assign);82 83var target = {84	a: true,85	b: true,86	c: true87};88var source = {89	c: false,90	d: false,91	e: false92};93 94var assigned = assign(target, source);95assert.deepEqual(Object.assign(target, source), assign(target, source));96```97 98```js99/* when Object.assign is present */100var shimmedAssign = require('object.assign').shim();101assert.equal(shimmedAssign, Object.assign);102 103var target = {104	a: true,105	b: true,106	c: true107};108var source = {109	c: false,110	d: false,111	e: false112};113 114assert.deepEqual(Object.assign(target, source), assign(target, source));115```116 117## Tests118Simply clone the repo, `npm install`, and run `npm test`119 120[npm-url]: https://npmjs.org/package/object.assign121[npm-version-svg]: http://versionbadg.es/ljharb/object.assign.svg122[travis-svg]: https://travis-ci.org/ljharb/object.assign.svg123[travis-url]: https://travis-ci.org/ljharb/object.assign124[deps-svg]: https://david-dm.org/ljharb/object.assign.svg?theme=shields.io125[deps-url]: https://david-dm.org/ljharb/object.assign126[dev-deps-svg]: https://david-dm.org/ljharb/object.assign/dev-status.svg?theme=shields.io127[dev-deps-url]: https://david-dm.org/ljharb/object.assign#info=devDependencies128[npm-badge-png]: https://nodei.co/npm/object.assign.png?downloads=true&stars=true129[license-image]: http://img.shields.io/npm/l/object.assign.svg130[license-url]: LICENSE131[downloads-image]: http://img.shields.io/npm/dm/object.assign.svg132[downloads-url]: http://npm-stat.com/charts.html?package=object.assign133[codecov-image]: https://codecov.io/gh/ljharb/object.assign/branch/main/graphs/badge.svg134[codecov-url]: https://app.codecov.io/gh/ljharb/object.assign/135[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/object.assign136[actions-url]: https://github.com/ljharb/object.assign/actions137 
basant307/AI_Governance_Project · CoolFace