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

object-path

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-path - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

7

index.js

@@ -77,5 +77,5 @@ (function (root, factory){

if (isString(path)) {
return set(obj, path.split('.'), value, doNotReplace);
return set(obj, path.split('.').map(getKey), value, doNotReplace);
}
var currentPath = getKey(path[0]);
var currentPath = path[0];

@@ -92,4 +92,3 @@ if (path.length === 1) {

//check if we assume an array
var nextPath = getKey(path[1]);
if(isNumber(nextPath)) {
if(isNumber(path[1])) {
obj[currentPath] = [];

@@ -96,0 +95,0 @@ } else {

{
"name": "object-path",
"description": "Access deep properties using a path",
"version": "0.8.0",
"version": "0.8.1",
"author": {

@@ -6,0 +6,0 @@ "name": "Mario Casciaro"

@@ -151,4 +151,4 @@ var expect = require('chai').expect,

obj = getTestObj();
objectPath.set(obj, ['c','0',1,'m'], 'l');
expect(obj.c).to.be.an('array');
objectPath.set(obj, ['c','0', 1,'m'], 'l');
expect(obj.c).to.be.an('object');
expect(obj.c[0]).to.be.an('array');

@@ -222,2 +222,10 @@ expect(obj).to.have.deep.property('c.0.1.m', 'l');

});
it('Issue #26', function() {
var any = {};
objectPath.ensureExists(any, ['1','1'], {});
expect(any).to.be.an('object');
expect(any[1]).to.be.an('object');
expect(any[1][1]).to.be.an('object');
});
});

@@ -224,0 +232,0 @@

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