Socket
Socket
Sign inDemoInstall

simple-update-in

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-update-in - npm Package Compare versions

Comparing version 1.3.1-master.023101b to 1.3.1-master.f84f35c

4

CHANGELOG.md

@@ -8,2 +8,6 @@ # Changelog

## [Unreleased]
### Fixed
- Using a predicate on a non-existing key/index should not throw error and return the original value as-is
- `updateIn({}, ['Hello', () => true], () => 'World!'])` will return `{}`
- `updateIn([], [0, () => true], () => 'Aloha'])` will return `[]`

@@ -10,0 +14,0 @@ ## [1.3.0] - 2018-08-17

2

lib/index.js

@@ -37,3 +37,3 @@ 'use strict';

});
} else {
} else if (obj) {
Object.keys(obj).forEach(function (key) {

@@ -40,0 +40,0 @@ if (accessor.call(obj, obj[key], key)) {

{
"name": "simple-update-in",
"version": "1.3.1-master.023101b",
"version": "1.3.1-master.f84f35c",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -184,2 +184,20 @@ # simple-update-in

### Non-existing key/index with predicate
Since it is impossible to guess if the predicate is performing on an array or map. [automatic expansion](#automatic-expansion) will not be performed if the key/index does not exists. Nevertheless, even we expand it into an empty array or map, it will not be enumerated thru the predicate since the new item is empty. Thus, nothing will change.
```js
const from = {};
const actual = updateIn(from, ['Hello', () => true], () => 'World!']);
expect(actual).toBe(from);
```
```js
const from = [];
const actual = updateIn(from, [0, () => true], () => 'Aloha']);
expect(actual).toBe(from);
```
# Contributions

@@ -186,0 +204,0 @@

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