JSPM

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

Makeify is a utility to create objects with nested values

Package Exports

  • makeify

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

Readme

Makeify

Makeify is a utility to create deeply nested objects from paths. Similar to lodash's _.set. Makeify uses ES6 proxies to enable a convenient syntax.

NPM Version Build Status Dependency Status devDependency Status

How to use

import makeify from 'makeify'

// Create a new object
const value = makeify().deeply.nested[1]('a value'); //  === { deeply: { nested : [undefined, 'a value '] } }

// Mutate an existing object
const obj = { key: 'value' }
makeify(obj).key2('value 2') // obj === { key: 'value', key2: 'value 2'}

Browser and server support

ES6 Proxies are currently supported by the latest stable version of Chrome, Firefox and Edge. It is not supported by Node 5.x or Safari yet.

ES6 compatibility table: Proxy

Install

npm install makeify

API

makeify().any.path['here'][3](optionalValue)

The path is any valid javascript property path. Returns an object matching the path with the final property being set to the optionalValue

makeify(object).any.path['here'][3](optionalValue)

Mutates object and adds the path to it. Returns the object with added properties.