object-rewrite
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18331
107