camel-dot-prop-immutable

1.5.1 • Public • Published

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'

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.5.11latest

Version History

VersionDownloads (Last 7 Days)Published
1.5.11
1.5.00
1.4.10
1.4.00
1.3.21
1.3.10
1.3.00
1.2.00
1.1.00
1.0.00

Package Sidebar

Install

npm i camel-dot-prop-immutable

Weekly Downloads

2

Version

1.5.1

License

MIT

Unpacked Size

11.9 kB

Total Files

6

Last publish

Collaborators

  • winton