New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

upsert-value

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

upsert-value

Update or set nested values and any intermediaries with dot notation (`'a.b.c'`) paths.

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
11
-47.62%
Maintainers
1
Weekly downloads
 
Created
Source

upsert-value NPM version Build Status

Update or set nested values and any intermediaries with dot notation ('a.b.c') paths.

Install with npm

$ npm i upsert-value --save

Usage

var upsert = require('upsert-value');

API

upsert

Update or set a value on the given object with the given key path.

Params

  • obj {Object}: Object to update/set.
  • path {String}: Key path to update/set.
  • value {*}: Value to update/set.
  • returns {Object}: Update object.

Example

var obj = {};
upsert(obj, 'a.b.c', 'foo');
//=> {a: {b: {c: 'foo'}}}
  • has-value: Returns true if a value exists, false if empty. Works with deeply nested values using… more
  • put-value: Update only existing values fromn an object, works with dot notation paths like a.b.c and… more
  • set-value: Create nested values and any intermediaries using dot notation ('a.b.c') paths.

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Brian Woodward

License

Copyright © 2015 Brian Woodward Released under the MIT license.

This file was generated by verb-cli on July 09, 2015.

FAQs

Package last updated on 09 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts