@cfpb/object-assign

Utility used to copy Javascript object properties from one or more source objects to a target object

Usage no npm install needed!

<script type="module">
  import cfpbObjectAssign from 'https://cdn.skypack.dev/@cfpb/object-assign';
</script>

README

object-assign

Utility used to copy Javascript object properties from one or more source objects to a target object

Example

JS

var assert = require( 'assert' );
var assign = require( 'object-assign' ).assign;
var testObjectA = {
    str:  'test',
    func: function() { return 'testStr'; },
    num:  1
 };
 var testObjectB = {
    obj:   { test: 2 },
    arr:   [ 3 ],
    _null: null
 };
 assign( testObjectA, testObjectB );
 assert( testObjectA.hasOwnProperty( 'obj' ), true ) ;
 assert( testObjectA.hasOwnProperty( 'arr' ) );
 assert( testObjectA.hasOwnProperty( '_null' ), true );

Installation

npm install @cfpb/object-assign

Contributing

We welcome your feedback and contributions. See the contribution guidelines for more details.

Additionally, you may want to consider contributing to the Capital Framework, which is the front-end pattern library used in this project.

Open source licensing info

  1. TERMS
  2. LICENSE
  3. CFPB Source Code Policy