Comparing version 2.2.1 to 2.2.5
@@ -37,2 +37,12 @@ 'use strict' | ||
assigner.excluded = function (list) { | ||
this.options.excluded = list | ||
return this | ||
} | ||
assigner.primitives = function (list) { | ||
this.options.primitives = list | ||
return this | ||
} | ||
assigner.blueprinting = function ( blueprinting ) { | ||
@@ -68,5 +78,7 @@ this.options.blueprinting = blueprinting | ||
continue | ||
if ( this.options.excluded && this.options.excluded.indexOf(key) !== -1 ) | ||
continue | ||
var ref = this.options.forceful ? source[key] : object[key] | ||
if (_.isPlainObject( ref ) && self.options.recursive ) { | ||
if (_.isPlainObject( ref ) && self.options.recursive && (!this.options.primitives || this.options.primitives.indexOf(key) === -1) ) { | ||
if (this.options.forceful && !object[key]) object[key] = {} | ||
@@ -76,3 +88,3 @@ self.copyObject( source[key], object[key] ) | ||
if ( !self.options.respect || object[key] === null || object[key] === undefined ) | ||
object[key] = source[key] | ||
object[key] = self.cloneObject( source[key] ) | ||
} | ||
@@ -79,0 +91,0 @@ return object |
{ | ||
"name": "assign.js", | ||
"version": "2.2.1", | ||
"version": "2.2.5", | ||
"description": "Tiny libary to assign objects", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -48,2 +48,10 @@ Assign.js - dependency-free very minimal assign function | ||
assigner.attributes( [] ) | ||
Defines the list of keys excluded to be assigned. | ||
assigner.primitives( [] ) | ||
Defines the list of keys considered as values to be assigned preventing to recursively processed. | ||
assigner.blueprinting( true ) | ||
@@ -50,0 +58,0 @@ |
13626
324
74