1.0.5 • Published 4 months ago

string-to-path v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

String to Path

Return the value from given object using a dynamic path

Great for when you need a dynamic path

Takes two arguments:

1. obj: the object you want to dynamically set a path within.
2. desiredPathAsString: a string, describing the desired path, e.g:
    `data.results[${index}].customer.${detailDesired}`.

Returns the value from given object at set dynamic path.

Installation:

npm i string-to-path

Usage

// Import string-to-path

const value = stringToPath(
  someObject,
  `data.results[${index}].customer.${detailDesired}`
);

Have fun! 😀

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

0.0.2

8 years ago

0.0.0

8 years ago