Socket
Socket
Sign inDemoInstall

dot-prop

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot-prop - npm Package Compare versions

Comparing version 5.1.0 to 5.1.1

6

index.d.ts

@@ -26,4 +26,8 @@ declare const dotProp: {

object: {[key: string]: any},
path: string
): T | undefined;
get<T>(
object: {[key: string]: any},
path: string,
defaultValue?: T
defaultValue: T
): T;

@@ -30,0 +34,0 @@

'use strict';
const isObj = require('is-obj');
const disallowedKeys = [
'__proto__',
'prototype',
'constructor'
];
const isValidPath = pathSegments => !pathSegments.some(segment => disallowedKeys.includes(segment));
function getPathSegments(path) {

@@ -19,2 +27,6 @@ const pathArray = path.split('.');

if (!isValidPath(parts)) {
return [];
}
return parts;

@@ -30,2 +42,5 @@ }

const pathArray = getPathSegments(path);
if (pathArray.length === 0) {
return;
}

@@ -110,2 +125,5 @@ for (let i = 0; i < pathArray.length; i++) {

const pathArray = getPathSegments(path);
if (pathArray.length === 0) {
return false;
}

@@ -112,0 +130,0 @@ for (let i = 0; i < pathArray.length; i++) {

2

package.json
{
"name": "dot-prop",
"version": "5.1.0",
"version": "5.1.1",
"description": "Get, set, or delete a property from a nested object using a dot path",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -88,2 +88,4 @@ # dot-prop [![Build Status](https://travis-ci.org/sindresorhus/dot-prop.svg?branch=master)](https://travis-ci.org/sindresorhus/dot-prop)

The following path components are invalid and results in `undefined` being returned: `__proto__`, `prototype`, `constructor`.
#### value

@@ -90,0 +92,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