JSPM

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

dot-prop-immutable w/ check for flattened props

Package Exports

  • camel-dot-prop-immutable

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 (camel-dot-prop-immutable) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

camel-dot-prop-immutable

This extension to dot-prop-immutable adds fuzzy matching.

Props Matches Type
foo.bar.buzz { foo: { bar: { buzz } } } Default behavior
foo.bar.buzz { foo: { barBuzz } } Collapse right
foo.bar.buzz { fooBar: { buzz } } Collapse left

Example

import dot from "camel-dot-prop-immutable"

dot.get(
  { foo: { bar: { buzz: "unicorn" } } },
  "foo.bar.buzz"
)
//=> 'unicorn'

dot.get({ fooBar: { buzz: "unicorn" } }, "foo.bar.buzz")
//=> 'unicorn'

dot.get({ foo: { barBuzz: "unicorn" } }, "foo.bar.buzz")
//=> 'unicorn'

dot.get({ fooBarBuzz: "unicorn" }, "foo.bar.buzz")
//=> 'unicorn'

Restrictions

Only collapse from left or right. Middle collapses like this will not work:

dot.get({ foo: { barBuzz: { bang: "unicorn" } }, "foo.bar.buzz.bang")
//=> 'unicorn'

But these do:

dot.get({ fooBar: { buzz: { bang: "unicorn" } }, "foo.bar.buzz.bang")
//=> 'unicorn'

dot.get({ foo: { bar: { buzzBang: "unicorn" } }, "foo.bar.buzz.bang")
//=> 'unicorn'