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

get-prop

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-prop - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

bower.json
{
"name": "getprop",
"main": "getprop.js",
"version": "0.0.1",
"version": "0.0.2",
"homepage": "https://github.com/miguelmota/getprop",

@@ -6,0 +6,0 @@ "authors": [

@@ -7,4 +7,5 @@ (function(root) {

if (!(typeof s === 'string' || s instanceof String)) return;
var props = s.split('.'),
last = props[props.length - 1],
var props = s.match(/(\[(.*?)\]|[0-9a-zA-Z]+)/gi).map(function(m) { return m.replace(/[\[\]]/gi,''); });
var last = props[props.length - 1],
i = 0,

@@ -11,0 +12,0 @@ head = o;

{
"name": "get-prop",
"version": "0.0.1",
"version": "0.0.2",
"description": "Get a property from object",

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

@@ -23,3 +23,5 @@ # getprop

}
}
},
'key.with.dots': 'hello',
'"key.with.quotes"': 'hi'
};

@@ -32,2 +34,4 @@

getProp(obj, 'qux.zee.peep.1') // 'zonk'
getProp(obj, 'qux[key.with.dots]') // 'hello'
getProp(obj, 'qux["key.with.quotes"]') // 'hi'
```

@@ -34,0 +38,0 @@

@@ -5,3 +5,3 @@ var test = require('tape');

test('getProp', function (t) {
t.plan(8);
t.plan(10);

@@ -14,4 +14,6 @@ var obj = {

peep: [55,'zonk']
}
}
},
'key.with.dots': 'hello',
'"key.with.quotes"': 'hi'
},
};

@@ -24,2 +26,4 @@

t.equal(getProp(obj, 'qux.zee.peep.1'), 'zonk');
t.equal(getProp(obj, 'qux[key.with.dots]'), 'hello');
t.equal(getProp(obj, 'qux["key.with.quotes"]'), 'hi');
t.equal(getProp(obj, ''), undefined);

@@ -26,0 +30,0 @@ t.equal(getProp(obj, {}), undefined);

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