1.0.1 ā€¢ Published 3 years ago

js-dot v1.0.1

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

JavaScript dot notation handler

šŸ  Homepage

Install

$ npm i -D js-dot

Usage

const jsDot = require('jsdot')

const data = {
  foo: {
    "bar": {
      "sample": "jsDot"
    }
  }
}

// ======== Get Data ========
jsDot.get(data, "foo.bar.sample") // outputs "jsDot"
// ---- or -----
data.dot("foo.bar.sample") // outputs "jsDot"

// ======== Get Data with default ========
jsDot.get(data, "foo.nofoo", "foo") // outputs "foo"

// ======== Set Data ========
jsDot.set(data, "foo.bar", "bar")
// ----- or ------
data.dot("foo.bar", "bar")
console.log(data.foo.bar.sample) // undefined

Author

šŸ‘¤ Jonathan Irhodia

šŸ¤ Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ā­ļø if this project helped you!

šŸ“ License

Copyright Ā© 2020 Jonathan Irhodia. This project is MIT licensed.