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

path-to-prop

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-to-prop - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

28

package.json
{
"name": "path-to-prop",
"version": "2.0.2",
"version": "2.0.3",
"sideEffects": false,

@@ -12,5 +12,5 @@ "type": "module",

".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/index.es.js",
"require": "./dist/index.cjs",
"types": "./dist/types/index.d.ts"
"require": "./dist/index.cjs"
}

@@ -27,3 +27,3 @@ },

"lint": "tsc --noEmit && eslint ./src --ext .ts",
"build": "rollup -c ./scripts/build.js",
"build": "rollup --bundleConfigAsCjs -c ./scripts/build.js",
"release": "npm run lint && del dist && npm run build && np"

@@ -50,14 +50,14 @@ },

"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"del-cli": "^4.0.1",
"eslint": "^8.7.0",
"eslint-config-prettier": "^8.3.0",
"eslint": "^8.40.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-tree-shaking": "^1.10.0",
"np": "^7.6.0",
"prettier": "^2.5.1",
"rollup": "^2.66.1",
"rollup-plugin-typescript2": "^0.31.1",
"typescript": "^4.5.5",
"vitest": "^0.2.3"
"np": "^7.7.0",
"prettier": "^2.8.8",
"rollup": "^3.21.5",
"rollup-plugin-typescript2": "^0.34.1",
"typescript": "^4.9.5",
"vitest": "^0.31.0"
},

@@ -64,0 +64,0 @@ "bugs": {

@@ -20,9 +20,17 @@ # Path to prop 🛤

const target = {a: {b: {c: {d: {e: 1}}}}}
getProp({ nested: { prop: 1 } }, 'nested.prop') // 1
getProp({ nested: { prop: 1 } }, 'nested') // { prop: 1 }
```
You can use `/` or `.` to access nested props:
```js
const obj = {a: {b: {c: {d: {e: 1}}}}}
const path = 'a/b/c.d.e'
getProp(target, path)
getProp(obj, path)
// returns 1
getProp(target, 'nonexistent.prop')
getProp(obj, 'nonexistent.prop')
// returns undefined

@@ -34,6 +42,6 @@ ```

```js
const target = {'a/b': {'c.d': 1}}
const obj = {'a/b': {'c.d': 1}}
getProp(target, ['a/b', 'c.d'])
getProp(obj, ['a/b', 'c.d'])
// returns 1
```

Sorry, the diff of this file is not supported yet

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