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

dot-object

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot-object - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

CHANGELOG.md

2

index.js

@@ -104,3 +104,3 @@ 'use strict';

for (i = 0; i < keys.length; i++) {
if (obj.hasOwnProperty(keys[i])) {
if (obj && typeof obj === 'object' && keys[i] in obj) {
if (i === (keys.length - 1)) {

@@ -107,0 +107,0 @@ if (remove) {

{
"name": "dot-object",
"description": "dot-object makes it possible to transform and read (JSON) objects using dot notation.",
"version": "0.6.0",
"version": "0.7.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Rob Halff",

@@ -39,2 +39,63 @@ 'use strict';

it('Should be able to pick null properties', function() {
var dj = new DJ();
var obj = {
'some': null
};
var val = dj.pick('some', obj);
(val === null).should.be.true;
});
it('Should return undefined when picking an non-existing value', function() {
var dj = new DJ();
var obj = {
'some': null
};
var val = dj.pick('other', obj);
(val === undefined).should.be.true;
});
it('Should return undefined when picking an non-existing dotted value', function() {
var dj = new DJ();
var obj = {
'some': null
};
var val = dj.pick('some.other', obj);
(val === undefined).should.be.true;
});
it('Should check down the object\'s prototype chain', function() {
var dj = new DJ();
var obj = {
'some': {
'other': 'value'
}
};
var objIns = Object.create(obj);
objIns.should.have.property('some');
var val = dj.pick('some.other', objIns);
val.should.be.an.Object;
});
});
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