Socket
Socket
Sign inDemoInstall

101

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

101 - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

set.js

5

package.json
{
"name": "101",
"version": "0.4.0",
"version": "0.4.1",
"description": "common javascript utils that can be required selectively that assume es5+",

@@ -38,4 +38,5 @@ "main": "index.js",

"keypather": "^1.6.0",
"lab": "~3.1.1"
"lab": "~3.1.1",
"clone": "~0.1.15"
}
}

@@ -267,4 +267,29 @@ 101 [![Build Status](https://travis-ci.org/tjmehta/101.svg?branch=master)](https://travis-ci.org/tjmehta/101)

## set
Functional version of obj[key] = val, returns a new obj with the key and value set.
```js
var set = require('101/set');
var obj = {
foo: 1,
bar: 2
};
set(obj, 'foo'); // 1
// use it with array.map
[obj, obj, obj].map(set('foo', 100)); // [{ foo: 100, bar: 2 }, {same}, {same}]
// supports keypaths by default
var obj = {
foo: 1,
bar: 2
};
set(obj, 'foo', 100); // { foo: 100, bar:2 }
```
## License
MIT
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc