Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object-rewrite

Package Overview
Dependencies
Maintainers
1
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-rewrite - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"name": "object-rewrite",
"version": "1.1.0",
"version": "1.1.1",
"description": "Rewrite an Object",

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

@@ -31,3 +31,3 @@ [![Build Status](https://circleci.com/gh/blackflux/object-rewrite.png?style=shield)](https://circleci.com/gh/blackflux/object-rewrite)

count: 3,
active: true,
active: "yes",
tags: [{ id: 1 }, { id: 2 }, { id: 3 }]

@@ -37,3 +37,3 @@ }, {

count: 4,
active: true,
active: "yes",
tags: [{ id: 2 }, { id: 3 }, { id: 4 }]

@@ -43,3 +43,3 @@ }, {

count: 5,
active: false,
active: "no",
tags: [{ id: 3 }, { id: 4 }, { id: 5 }]

@@ -50,12 +50,12 @@ }];

exclude: {
"": (key, value, parents) => value.active !== true,
"": (key, value, parents) => value.active !== "yes",
tags: (key, value, parents) => value.id !== 4
},
inject: {
"": (key, value, parents) => ({ count: value.count + 100 })
"": (key, value, parents) => ({ countNext: value.count + 1 })
},
overwrite: {
active: () => "yes"
active: (key, value) => value === "yes"
},
retain: ["count", "active", "tags.id"]
retain: ["count", "countNext", "active", "tags.id"]
});

@@ -68,8 +68,10 @@

[{
"count": 103,
"active": "yes",
"count": 3,
"countNext": 4,
"active": true,
"tags": []
}, {
"count": 104,
"active": "yes",
"count": 4,
"countNext": 5,
"active": true,
"tags": [{"id": 4}]

@@ -105,1 +107,6 @@ }]

Array of needles. Matches are kept if not excluded previously. All entries not matched are excluded. Defaults to `["**"]` which matches all entries.
## Deficiencies
Problems when different matchers are used between exclude, inject, overwrite, retain that target the same elements.
E.g. using `**` for retain, but `*.field` for inject.
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