Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

assign.js

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assign.js - npm Package Compare versions

Comparing version 1.7.5 to 1.8.0

20

lib/assign.js

@@ -59,2 +59,22 @@ 'use strict'

assigner.cloneObject = function ( source, object ) {
var self = this
object = object || { }
var index = -1, props = Object.keys( source ),
length = props.length
while (++index < length) {
var key = props[index]
console.log('>>>>>>>>>>>>', key, _.isPlainObject( source[key] ), _.isArray( source[key] ))
if (_.isPlainObject( source[key] ) )
object[key] = self.cloneObject( source[key], Object.keys(source[key]), object[key] )
else if (_.isArray( source[key] ) )
object[key] = source[key].slice()
else
object[key] = source[key]
}
return object
}
assigner.pick = function (object, properties) {

@@ -61,0 +81,0 @@ var obj = { }

4

package.json
{
"name": "assign.js",
"version": "1.7.5",
"version": "1.8.0",
"description": "Tiny libary to assign objects",

@@ -29,3 +29,3 @@ "keywords": [

"gulp-eslint": "^2.0.0",
"gulp-load-plugins": "^1.2.0",
"gulp-load-plugins": "^1.2.4",
"gulp-mocha": "^2.2.0"

@@ -32,0 +32,0 @@ },

@@ -17,2 +17,7 @@ 'use strict'

karl: false
},
extra: {
_type: 'String',
validation: function () { return 'ok' },
spectrum: [ 1, 2, 3, 4, 5 ]
}

@@ -25,2 +30,9 @@ }

describe('Test Assign services', function () {
it('Clone object', function (done) {
var cloned = assigner.cloneObject( person )
cloned.extra.spectrum[1] = 200
expect( cloned.extra.spectrum ).to.eql( [ 1, 200, 3, 4, 5 ] )
expect( person.extra.spectrum ).to.eql( [ 1, 2, 3, 4, 5 ] )
done()
})
it('Non recursive assign', function (done) {

@@ -27,0 +39,0 @@ assigner.respect( true ).recursive(false)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc