New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

object-path-builder

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-path-builder

Construct object property dynamically

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Object Path Builder

Simple module for generating object path. Module supports all the form for JS object accessing method.

Usage

You can decode the object path string to array of keys which can be then reduced to value by your logic or using the module Javascript easy object.

Snippet:

import objectPathBuilder from 'object-path-builder';

const objectBinding = {
  a: {
    b: 'B',
  },
}

const pathArray = objectPathBuilder('x.y[a.b].z', objectBinding);
console.log('path array : ', pathArray)

Output:

path array: ['x', 'y', 'B', 'z']

Aruguments:

objectPathBuilder takes two argument. First one is the string that you want to decode and the second argument is the binding which is associated the path specified inside the square bracket. Second argument is optional.

FAQs

Package last updated on 31 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts