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

Comparing version 0.1.0 to 1.0.0

LICENSE

35

package.json
{
"name": "keyarray-set",
"description": "set nested properties with key arrays",
"version": "0.1.0",
"author": {
"name": "Kyle E. Mitchell",
"email": "kyle@kemitchell.com",
"url": "http://kemitchell.com/"
},
"bugs": "https://github.com/kemitchell/keyarray-set.js/issues",
"version": "1.0.0",
"author": "Kyle E. Mitchell <kyle@kemitchell.com> (https://kemitchell.com)",
"files": [
"files.js"
],
"dependencies": {

@@ -15,8 +13,6 @@ "keyarray-get": "0.1.x"

"devDependencies": {
"check-versions": "^1.0.0",
"jscs": "^1.12.0",
"jshint": "^2.7.0",
"literate-assertions": "^0.1.0"
"defence-cli": "^2.0.0",
"replace-require-self": "^1.1.1",
"standard": "^8.0.0"
},
"homepage": "https://github.com/kemitchell/keyarray-set.js",
"keywords": [

@@ -31,15 +27,8 @@ "arrays",

],
"license": "Apache-2.0",
"main": "keyarray-set.js",
"repository": {
"type": "git",
"url": "https://github.com/kemitchell/keyarray-set.js.git"
},
"license": "MIT",
"repository": "kemitchell/keyarray-set.js",
"scripts": {
"check": "check-versions --check-module",
"lint": "jshint keyarray-set.js && jscs keyarray-set.js",
"pre-commit": "npm run check && npm run lint && npm run test",
"test": "literate-assertions < README.md | sed 's!keyarray-set!./!g' | node",
"travis-ci": "npm run pre-commit"
"test": "defence -i javascript README.md | replace-require-self | node",
"lint": "standard"
}
}

@@ -1,14 +0,5 @@

keyarray-set.js
===============
[![NPM version](https://img.shields.io/npm/v/keyarray-set.svg)](https://www.npmjs.com/package/keyarray-set)
[![build status](https://img.shields.io/travis/kemitchell/keyarray-set.js.svg)](http://travis-ci.org/kemitchell/keyarray-set.js)
Set nested properties with key arrays.
```javascript
var set = require('keyarray-set');
var set = require('keyarray-set')
var assert = require('assert')
typeof set; // === 'function'
var anObject = {

@@ -18,11 +9,13 @@ a: {

}
};
}
set(anObject, ['a', 'b', 'c'], 'new value'); // === 'new value'
assert(set(anObject, ['a', 'b', 'c'], 'new value') === 'new value')
anObject.a.b.hasOwnProperty('c'); // === true
assert(anObject.a.b.hasOwnProperty('c') === true)
anObject.a.b.c; // === 'new value'
assert(anObject.a.b.c === 'new value')
set(anObject, ['nonexistent', 'key'], 'another value'); // throws TypeError
assert.throws(function () {
set(anObject, ['nonexistent', 'key'], 'another value')
}, TypeError)
```
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