Skip to content

Return value somewhere in a json object, from a dotted string path

Notifications You must be signed in to change notification settings

Empreintes/PathMap

Repository files navigation

PathMap

return value somewhere in a json object, from a dotted string path

Getting Started

This script target nodejs environment

npm install @empreintes/pathmath
# or
yarn add @empreintes/pathmath

const { PathMap } = require("@empreintes/pathmap")
const data = {
  data: [
    {
      id: 47179,
      stuff: {
        id: 2
      }
    }
    ...
  ]
  foo : {
    bar : true
  }
}
const pathMap = new PathMap(data)
pathMap.path("data#0.stuff.id") // 2
pathMap.path("data#0.id") // 47179
pathMap.path("foo.bar") // true

Licence

released under the MIT license.

Versioning

Semantic Versioning for versioning.

Authors

Acknowledgments

  • This is a side project of a side project of a side project (for real)
  • Use in production only if you know what you do.
  • Extend Map Object for personal choice.

About

Return value somewhere in a json object, from a dotted string path

Topics

Resources

Stars

Watchers

Forks