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

dot2val

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot2val - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

28

index.js

@@ -18,10 +18,12 @@ 'use strict';

if(parts.length > 1) {
k = parts.pop();
let partsLength = parts.length
k = parts[partsLength - 1];
parts.forEach(function(k) {
if(! obj.hasOwnProperty(k)) {
obj[k] = {};
for(let i = 0; i < partsLength - 1; i++) {
let part = parts[i]
if(! obj.hasOwnProperty(part)) {
obj[part] = {};
}
obj = obj[k];
});
obj = obj[part];
}
}

@@ -43,11 +45,13 @@ if(typeof val !== 'undefined') {

if(parts.length > -1) {
k = parts.pop();
let partsLength = parts.length
k = parts[partsLength - 1];
parts.forEach(function(k) {
if(! obj.hasOwnProperty(k)) {
for(let i = 0; i < partsLength - 1; i++) {
let part = parts[i]
if(! obj.hasOwnProperty(part)) {
obj = false;
return false;
break
}
obj = obj[k];
});
obj = obj[part];
}
}

@@ -54,0 +58,0 @@ return obj ? (typeof obj[k] !== 'undefined' ? obj[k] : def) : def;

{
"name": "dot2val",
"version": "1.1.0",
"version": "1.2.0",
"description": "Set or get a value within a deeply nested object using `dot' notation",

@@ -5,0 +5,0 @@ "main": "index.js",

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