🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

setx

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

setx

Set deeply into an object given an array of keys

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

setx

Set deep into an object given an array of keys.

api

setx (object, any, array[string]) -> obj

install

npm install setx --save

usage

  var setx = require('setx')

  var obj = { x: { foo: 1, bar: 2, baz: [() => 1] } }

  var keyPath = ['x', 'y', 'z']

  var value = [1,2,3,4]

  var o = setx(obj, value, keyPath)

  o.x.y.z // [1,2,3,4]

FAQs

Package last updated on 16 Jun 2017

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