1.0.0 • Published 11 months ago

@enkh-amar/digx v1.0.0

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

Digx Library

Digx is a simple library that enables you to "dig" values from nested objects using a path. It functions similarly to lodash's get method.

Usage

To use the Digx library, follow these steps:

  1. Install Digx by including the library in your project.
  2. Import the Digx module into your code.
const digx = require('digx');
  1. Prepare your nested object, source, from which you want to extract values.
const source = { my: { nested: [1, 2, 3] } };
  1. Invoke the digx function with the source object and the desired path as arguments.
digx(source, "my.nested[1]"); //=> 2

The digx function will return the value found at the specified path within the nested object. In the example above, the value 2 is retrieved from the source object at the path "my.nested[1]".

Please note that the path syntax follows JavaScript object notation, allowing you to traverse nested objects and arrays using dot notation for objects and square brackets for arrays.

Conclusion

Digx provides a convenient way to extract values from nested objects by specifying a path. By using Digx in your projects, you can easily access and manipulate data within complex data structures.

1.0.0

11 months ago