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

get-value

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-value - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

39

index.js

@@ -8,7 +8,21 @@ /*!

module.exports = function(obj, prop) {
if (!isObject(obj)) { return obj; }
var segs = toSegments(prop);
if (segs === null) return obj;
module.exports = function(obj, prop, a, b, c) {
if (!isObject(obj) || !prop) {
return obj;
}
prop = toString(prop);
// allowing for multiple properties to be passed as
// a string or array, but much faster (3-4x) than doing
// `[].slice.call(arguments)`
if (a) prop += '.' + toString(a);
if (b) prop += '.' + toString(b);
if (c) prop += '.' + toString(c);
if (prop in obj) {
return obj[prop];
}
var segs = prop.split('.');
var len = segs.length;

@@ -27,12 +41,2 @@ var i = -1;

function toSegments(val) {
if (Array.isArray(val)) {
return val.join('.').split('.');
}
if (typeof val === 'string') {
return val.split('.');
}
return null;
}
function isObject(val) {

@@ -42,1 +46,8 @@ return val !== null && (typeof val === 'object' || typeof val === 'function');

function toString(val) {
if (!val) return '';
if (Array.isArray(val)) {
return val.join('.');
}
return val;
}
{
"name": "get-value",
"description": "Use property paths (`a.b.c`) to get a nested value from an object.",
"version": "2.0.1",
"version": "2.0.2",
"homepage": "https://github.com/jonschlinkert/get-value",

@@ -67,2 +67,2 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

}
}
}
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