Comparing version 1.8.2 to 1.9.0
@@ -37,6 +37,13 @@ 'use strict' | ||
assigner.copyObject = function ( source, props, object ) { | ||
assigner.blueprinting = function ( blueprinting ) { | ||
this.options.blueprinting = blueprinting | ||
return this | ||
} | ||
assigner.copyObject = function ( source, object ) { | ||
var self = this | ||
object = object || { } | ||
var props = self.options.blueprinting ? Object.keys(object) : Object.keys(source) | ||
var index = -1, | ||
@@ -52,3 +59,3 @@ length = props.length | ||
if (_.isPlainObject( object[key] ) && self.options.recursive ) | ||
self.copyObject( source[key], Object.keys(source[key]), object[key] ) | ||
self.copyObject( source[key], object[key] ) | ||
else | ||
@@ -104,3 +111,3 @@ if ( !self.options.respect || object[key] === null || object[key] === undefined ) | ||
if ( element ) | ||
self.copyObject( element, Object.keys(element), obj ) | ||
self.copyObject( element, obj ) | ||
}) | ||
@@ -107,0 +114,0 @@ return obj |
{ | ||
"name": "assign.js", | ||
"version": "1.8.2", | ||
"version": "1.9.0", | ||
"description": "Tiny libary to assign objects", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,12 +0,14 @@ | ||
var assigner = require('../lib/assign'); | ||
var Assigner = require('../lib/assign') | ||
var assigner = new Assigner() | ||
var a = { | ||
name: 'A', | ||
walking: function(){} | ||
}; | ||
walking: function () {} | ||
} | ||
var b = { | ||
name: 'B', | ||
sulking: function(){} | ||
}; | ||
sulking: function () {} | ||
} | ||
console.log( assigner.assign( a, b, true ) ); | ||
assigner.blueprinting( true ) | ||
console.log( assigner.assign( a, b ) ) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11414
301