safe-json-value
Advanced tools
Comparing version
@@ -9,2 +9,5 @@ import{transformProp}from"./prop.js"; | ||
export const recurseArray=function({ | ||
@@ -23,5 +26,3 @@ array, | ||
for(let index=0;index<array.length;index+=1){ | ||
state=transformProp({ | ||
@@ -40,5 +41,3 @@ parent:array, | ||
if(state.value!==undefined){ | ||
newArray.push(state.value); | ||
@@ -45,0 +44,0 @@ } |
@@ -6,2 +6,4 @@ import{safeGetChangeProp}from"./get.js"; | ||
export const addNotArrayIndexChanges=function(array,changes,path){ | ||
@@ -14,5 +16,3 @@ if(!Array.isArray(array)){ | ||
for(const key of Reflect.ownKeys(array)){ | ||
if(!arrayProps.has(key)){ | ||
@@ -31,2 +31,3 @@ changes.push({ | ||
const getArrayProps=function(length){ | ||
@@ -33,0 +34,0 @@ const indices=Array.from({length},getArrayIndex); |
@@ -11,2 +11,4 @@ import isPlainObj from"is-plain-obj"; | ||
export const recurseObject=function({ | ||
@@ -22,8 +24,5 @@ object, | ||
const newObject=getNewObject(object); | ||
let state={empty:true,size}; | ||
for(const key of Reflect.ownKeys(object)){ | ||
state=transformProp({ | ||
@@ -42,5 +41,3 @@ parent:object, | ||
if(state.value!==undefined){ | ||
newObject[key]=state.value; | ||
@@ -57,2 +54,3 @@ } | ||
const getNewObject=function(object){ | ||
@@ -59,0 +57,0 @@ return Object.getPrototypeOf(object)===null?Object.create(null):{}; |
{ | ||
"name": "safe-json-value", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "exports": "./build/src/main.js", |
@@ -0,1 +1,6 @@ | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ehmicky/design/main/safe-json-value/safe-json-value_dark.svg"/> | ||
<img alt="modern-errors logo" src="https://raw.githubusercontent.com/ehmicky/design/main/safe-json-value/safe-json-value.svg" width="700"/> | ||
</picture> | ||
[](https://codecov.io/gh/ehmicky/safe-json-value) | ||
@@ -123,6 +128,2 @@ [](https://www.npmjs.com/package/safe-json-value) | ||
It can be manipulated or | ||
[stringified](https://github.com/ehmicky/wild-wild-parser/#serializepathpatharray) | ||
using [`wild-wild-parser`](https://github.com/ehmicky/wild-wild-parser). | ||
##### changes[*].oldValue | ||
@@ -461,2 +462,7 @@ | ||
# Related projects | ||
- [`is-json-value`](https://github.com/ehmicky/is-json-value): Check if a value | ||
is valid JSON | ||
# Support | ||
@@ -463,0 +469,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
78008
0.34%493
1.23%