Socket
Socket
Sign inDemoInstall

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.5 to 0.0.6

2

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

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

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

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

@@ -16,3 +18,6 @@ var len = props.length,

for (i = 0; i < len; i += 1) {
if (typeof head[props[i]] === 'undefined') return d;
if (typeof head[props[i]] === 'undefined' ||
head[props[i]] === null) {
return d;
}
head = head[props[i]];

@@ -19,0 +24,0 @@ if (typeof head !== 'undefined') {

{
"name": "get-prop",
"version": "0.0.5",
"version": "0.0.6",
"description": "Get a property from object",

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

@@ -58,3 +58,4 @@ # getprop

},
'foo.bar': 'noob'
'foo.bar': 'noob',
qax: null
};

@@ -75,2 +76,3 @@

getProp(obj, '[foo.bar]') // 'noob'
getProp(obj, 'qux.qux') // undefined
```

@@ -77,0 +79,0 @@

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

test('getProp', function (t) {
t.plan(21);
t.plan(22);

@@ -29,3 +29,4 @@ var obj = {

},
'foo.bar': 'noob'
'foo.bar': 'noob',
qax: null
};

@@ -53,2 +54,3 @@

t.equal(getProp(obj, '[foo.bar]'), 'noob');
t.equal(getProp(obj, 'qax.quz'), undefined);

@@ -55,0 +57,0 @@ // oldschool

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc