dotted-object
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

dotted-object

Standard - JavaScript Style Guide

A small, single-feature module to use a string with a dot notation to extract values from an object.

npm i dotted-object [--save]
const dotted = require('dotted-object')
 
const obj = {
  data: {
    geo: {
      lat: 44.335,
      lon: 52.983
    }
  }
}
 
const value = dotted('data.geo.lat', obj)
 
/*
 To use a custom divider, use the thrid argument:
  const value = dotted('data:geo:lat', obj, ':')
 */
 
console.log(value) // => Outputs 44.335

TypeScript type definition included!

Standard - JavaScript Style Guide

License

Copyright 2017 Michiel van der Velde.

This software is licensed under the MIT License.

/dotted-object/

    Package Sidebar

    Install

    npm i dotted-object

    Weekly Downloads

    1

    Version

    0.0.4

    License

    MIT

    Last publish

    Collaborators

    • michielvdvelde