JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17573424
  • Score
    100M100P100Q213765F
  • License MIT

Safely get a dot-notated property within an object.

Package Exports

  • dlv
  • dlv/index
  • dlv/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dlv) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

dlv(obj, keypath) NPM Build

Safely get a dot-notated path within a nested object.

Why?

Smallest possible implementation: only 120 bytes.

You could write this yourself, but then you'd have to write tests.

Implementation is ripped directly from preact.

Supports ES Modules, CommonJS and globals.

Installation

npm install --save dlv

Usage

import delve from 'dlv';

let obj = {
    a: {
        b: {
            c: 1
        }
    }
};

delve(obj, 'a.b.c') === 1;

delve(obj, 'a.b') === obj.a.b;

delve(obj, 'a.b.c.d') === undefined;

License

MIT