New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@blazingedge/update

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blazingedge/update - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

10

lib/index.js

@@ -74,4 +74,3 @@ 'use strict';

for (var i = 0; i < n; ++i) {
var val = f(array[i], i, array);
ret = change(i, val, ret, array, true, true);
ret = change(i, f(array[i]), ret, array, true, true);
}

@@ -90,4 +89,3 @@

var ret = keys.reduce(function (acc, key) {
var val = f(data[key], key, data);
return change(key, val, acc, data, dataIsArray, dataIsArray);
return change(key, f(data[key]), acc, data, dataIsArray, dataIsArray);
}, data);

@@ -196,4 +194,4 @@

} else if (isFunc(part)) {
return map(data, function (v, k, obj) {
return part(v) ? f(v, k, obj) : v;
return map(data, function (v) {
return part(v) ? f(v) : v;
});

@@ -200,0 +198,0 @@ } else {

2

package.json
{
"name": "@blazingedge/update",
"version": "1.0.2",
"version": "1.1.0",
"description": "Utility for immutable deep updates of objects.",

@@ -5,0 +5,0 @@ "main": "lib",

@@ -66,5 +66,4 @@ [![Build Status](https://travis-ci.org/blazing-edge-labs/update.svg?branch=master)](https://travis-ci.org/blazing-edge-labs/update)

update(state, 'path.to.users[*]', (user, index) => {
// Removing every second user
if (index % 2 === 0) {
update(state, 'path.to.users[*]', (user) => {
if (Math.random() < 8) {
return REMOVE

@@ -71,0 +70,0 @@ }

@@ -62,4 +62,3 @@ const { isArray } = Array

for (let i = 0; i < n; ++i) {
const val = f(array[i], i, array)
ret = change(i, val, ret, array, true, true)
ret = change(i, f(array[i]), ret, array, true, true)
}

@@ -78,4 +77,3 @@

const ret = keys.reduce((acc, key) => {
const val = f(data[key], key, data)
return change(key, val, acc, data, dataIsArray, dataIsArray)
return change(key, f(data[key]), acc, data, dataIsArray, dataIsArray)
}, data)

@@ -168,3 +166,3 @@

} else if (isFunc(part)) {
return map(data, (v, k, obj) => part(v) ? f(v, k, obj) : v)
return map(data, (v) => part(v) ? f(v) : v)

@@ -171,0 +169,0 @@ } else {

@@ -144,7 +144,3 @@ const test = require('tape')

let result = update(data, 'a.b.*', (val, i, obj) => {
t.is(i, val.id, 'index is passed')
t.is(obj, data.a.b)
return i
})
let result = update(data, 'a.b.*', it => it.id)

@@ -155,11 +151,7 @@ t.same(result.a.b, [0, 1])

result = update(data, 'a.*.*', (val, i, obj) => {
t.is(i, val.id, 'index is passed')
if (obj === data.a.b) return val
if (i === 0) return REMOVE
return i
})
let i = 0
result = update(data, 'a.*.*', it => i++ === 2 ? it.id : it)
t.is(result.a.b, data.a.b, 'array unchanged if no changes to items ')
t.same(result.a.c, [1])
t.same(result.a.c, [0, {id: 1}])

@@ -166,0 +158,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