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.11.0 to 0.11.1

2

index.js

@@ -82,3 +82,3 @@ (function (root, factory){

function getShallowProperty(obj, prop) {
if(options.includeInheritedProps || (typeof prop === 'number' && Array.isArray(obj)) || obj.hasOwnProperty(prop)) {
if (options.includeInheritedProps || (typeof prop === 'number' && Array.isArray(obj)) || _hasOwnProperty.call(obj, prop)) {
return obj[prop];

@@ -85,0 +85,0 @@ }

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

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

@@ -131,5 +131,6 @@

```javascript
var Obj = function() {};
Obj.prototype.notOwn = {prop: 'a'};
var obj = new Obj();
var proto = {
notOwn: {prop: 'a'}
}
var obj = Object.create(proto);

@@ -141,3 +142,3 @@ //This will return undefined (or the default value you specified), because notOwn is

//This will set the property on the obj instance and not the prototype.
//In other words Obj.notOwn.prop === 'a' and obj.notOwn.prop === 'b'
//In other words proto.notOwn.prop === 'a' and obj.notOwn.prop === 'b'
objectPath.set(obj, 'notOwn.prop', 'b');

@@ -161,5 +162,6 @@ ```

```javascript
var Obj = function() {};
Obj.prototype.notOwn = {prop: 'a'};
var obj = new Obj();
var proto = {
notOwn: {prop: 'a'}
}
var obj = Object.create(proto);

@@ -169,3 +171,3 @@ //This will return 'a'

//This will set Obj.notOwn.prop to 'b'
//This will set proto.notOwn.prop to 'b'
objectPath.set(obj, 'notOwn.prop', 'b');

@@ -172,0 +174,0 @@ ```

@@ -105,2 +105,12 @@ 'use strict';

it(
'should not fail on an object with a null prototype',
function assertSuccessForObjWithNullProto(){
var foo = 'FOO';
var objWithNullProto = Object.create(null);
objWithNullProto.foo = foo;
expect(objectPath.get(objWithNullProto, 'foo')).to.equal(foo);
}
);
it('should skip non own properties', function() {

@@ -776,3 +786,3 @@ var Base = function(enabled){ };

describe('Don\' access not own properties [default]', function () {
describe('Don\'t access not own properties [default]', function () {
it('should not get a not own property', function() {

@@ -779,0 +789,0 @@ var Obj = function() {};

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