Socket
Socket
Sign inDemoInstall

dot-prop

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot-prop - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

18

index.js

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

module.exports.has = function (obj, path) {
if (!isObj(obj) || typeof path !== 'string') {
return false;
}
var pathArr = getPathSegments(path);
for (var i = 0; i < pathArr.length; i++) {
obj = obj[pathArr[i]];
if (obj === undefined) {
return false;
}
}
return true;
};
function getPathSegments(path) {

@@ -65,0 +83,0 @@ var pathArr = path.split('.');

6

package.json
{
"name": "dot-prop",
"version": "2.3.0",
"version": "2.4.0",
"description": "Get, set, or delete a property from a nested object using a dot path",

@@ -16,3 +16,4 @@ "license": "MIT",

"scripts": {
"test": "ava && xo"
"test": "ava && xo",
"bench": "matcha bench.js"
},

@@ -42,4 +43,5 @@ "files": [

"ava": "*",
"matcha": "^0.6.1",
"xo": "*"
}
}

@@ -40,3 +40,3 @@ # dot-prop [![Build Status](https://travis-ci.org/sindresorhus/dot-prop.svg?branch=master)](https://travis-ci.org/sindresorhus/dot-prop)

const obj = {foo: {bar: 'a'}};
dotProp.del(obj, 'foo.bar');
dotProp.delete(obj, 'foo.bar');
console.log(obj);

@@ -46,3 +46,3 @@ //=> {foo: {}}

obj.foo.bar = {x: 'y', y: 'x'};
dotProp.del(obj, 'foo.bar.x');
dotProp.delete(obj, 'foo.bar.x');
console.log(obj);

@@ -49,0 +49,0 @@ //=> {foo: {bar: {y: 'x'}}}

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