Socket
Socket
Sign inDemoInstall

keyarray-set

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

keyarray-set

set nested properties with key arrays


Version published
Maintainers
1
Weekly downloads
477
increased by110.13%

Weekly downloads

Readme

Source
var set = require('keyarray-set')
var assert = require('assert')

var anObject = {
  a: {
    b: {}
  }
}

assert(set(anObject, ['a', 'b', 'c'], 'new value') === 'new value')

assert(anObject.a.b.hasOwnProperty('c') === true)

assert(anObject.a.b.c === 'new value')

assert.throws(function () {
  set(anObject, ['nonexistent', 'key'], 'another value')
}, TypeError)

Keywords

FAQs

Last updated on 10 Sep 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc