safe-json-value
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -25,3 +25,3 @@ import{recurseArray}from"./array.js"; | ||
newValue:undefined, | ||
reason:"cycle"}); | ||
reason:"unsafeCycle"}); | ||
@@ -28,0 +28,0 @@ return{value:undefined,size}; |
@@ -46,3 +46,8 @@ | ||
if(get!==undefined||set!==undefined){ | ||
changes.push({path,oldValue:get,newValue:prop,reason:"getter"}); | ||
changes.push({ | ||
path, | ||
oldValue:get, | ||
newValue:prop, | ||
reason:"unresolvedGetter"}); | ||
} | ||
@@ -63,3 +68,3 @@ }; | ||
newValue:prop, | ||
reason:"notWritable"}); | ||
reason:"descriptorNotWritable"}); | ||
@@ -73,3 +78,3 @@ } | ||
newValue:prop, | ||
reason:"notConfigurable"}); | ||
reason:"descriptorNotConfigurable"}); | ||
@@ -76,0 +81,0 @@ } |
@@ -21,3 +21,3 @@ import{safeGetChangeProp}from"./get.js"; | ||
newValue:undefined, | ||
reason:"notArrayIndex"}); | ||
reason:"ignoredArrayProperty"}); | ||
@@ -24,0 +24,0 @@ } |
@@ -10,3 +10,3 @@ | ||
newValue:undefined, | ||
reason:"symbolKey"}); | ||
reason:"ignoredSymbolKey"}); | ||
@@ -21,3 +21,3 @@ return{prop:undefined,validKey:false}; | ||
newValue:undefined, | ||
reason:"notEnumerable"}); | ||
reason:"ignoredNotEnumerable"}); | ||
@@ -24,0 +24,0 @@ return{prop:undefined,validKey:false}; |
@@ -37,19 +37,19 @@ /** | ||
type ReasonWithError = 'uncaughtException' | 'unsafeGetter' | 'unsafeToJSON' | ||
type ReasonWithError = 'unsafeException' | 'unsafeGetter' | 'unsafeToJSON' | ||
type ReasonWithoutError = | ||
| 'bigint' | ||
| 'class' | ||
| 'cycle' | ||
| 'function' | ||
| 'getter' | ||
| 'infiniteNumber' | ||
| 'descriptorNotConfigurable' | ||
| 'descriptorNotWritable' | ||
| 'ignoredArrayProperty' | ||
| 'ignoredFunction' | ||
| 'ignoredNotEnumerable' | ||
| 'ignoredSymbolKey' | ||
| 'ignoredSymbolValue' | ||
| 'ignoredUndefined' | ||
| 'maxSize' | ||
| 'notArrayIndex' | ||
| 'notEnumerable' | ||
| 'notConfigurable' | ||
| 'notWritable' | ||
| 'symbolKey' | ||
| 'symbolValue' | ||
| 'toJSON' | ||
| 'undefined' | ||
| 'unresolvedClass' | ||
| 'unresolvedGetter' | ||
| 'unresolvedToJSON' | ||
| 'unsafeBigInt' | ||
| 'unsafeCycle' | ||
| 'unstableInfinite' | ||
@@ -119,3 +119,3 @@ /** | ||
* // newValue: undefined, | ||
* // reason: 'cycle' | ||
* // reason: 'unsafeCycle' | ||
* // } | ||
@@ -122,0 +122,0 @@ * // ] |
@@ -6,3 +6,3 @@ import{checkCycleThenRecurse}from"./cycle.js"; | ||
import{omitInvalidTypes}from"./type.js"; | ||
import{handleUncaughtException}from"./uncaught.js"; | ||
import{handleUnsafeException}from"./uncaught.js"; | ||
@@ -56,3 +56,3 @@ | ||
}catch(error){ | ||
return handleUncaughtException({value,changes,path,error,size}); | ||
return handleUnsafeException({value,changes,path,error,size}); | ||
} | ||
@@ -59,0 +59,0 @@ }; |
@@ -67,3 +67,3 @@ import isPlainObj from"is-plain-obj"; | ||
newValue:newObject, | ||
reason:"class"}); | ||
reason:"unresolvedClass"}); | ||
@@ -70,0 +70,0 @@ } |
@@ -23,3 +23,3 @@ import{isObject}from"./is_object.js"; | ||
newValue:toJSONResult, | ||
reason:"toJSON"}); | ||
reason:"unresolvedToJSON"}); | ||
@@ -26,0 +26,0 @@ return toJSONResult; |
@@ -24,3 +24,3 @@ | ||
if(type==="number"&&!Number.isFinite(value)){ | ||
return"infiniteNumber"; | ||
return"unstableInfinite"; | ||
} | ||
@@ -30,6 +30,6 @@ }; | ||
const INVALID_TYPES={ | ||
function:"function", | ||
symbol:"symbolValue", | ||
undefined:"undefined", | ||
bigint:"bigint"}; | ||
function:"ignoredFunction", | ||
symbol:"ignoredSymbolValue", | ||
undefined:"ignoredUndefined", | ||
bigint:"unsafeBigInt"}; | ||
//# sourceMappingURL=type.js.map |
@@ -14,3 +14,3 @@ | ||
export const handleUncaughtException=function({ | ||
export const handleUnsafeException=function({ | ||
value, | ||
@@ -26,3 +26,3 @@ changes, | ||
newValue:undefined, | ||
reason:"uncaughtException", | ||
reason:"unsafeException", | ||
error}); | ||
@@ -29,0 +29,0 @@ |
{ | ||
"name": "safe-json-value", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "exports": "./build/src/main.js", |
@@ -38,3 +38,3 @@ [![Codecov](https://img.shields.io/codecov/c/github/ehmicky/safe-json-value.svg?label=tested&logo=codecov)](https://codecov.io/gh/ehmicky/safe-json-value) | ||
// newValue: undefined, | ||
// reason: 'cycle' | ||
// reason: 'unsafeCycle' | ||
// } | ||
@@ -135,14 +135,22 @@ // ] | ||
Reason for the change among: [`"bigint"`](#bigint), [`"class"`](#classes), | ||
[`"cycle"`](#cycles), [`"function"`](#functions), [`"getter"`](#getters), | ||
[`"infiniteNumber"`](#nan-and-infinity), [`"maxSize"`](#big-output), | ||
[`"notArrayIndex"`](#array-properties), | ||
[`"notEnumerable"`](#non-enumerable-keys), | ||
[`"notConfigurable"`](#non-configurable-properties), | ||
[`"notWritable"`](#non-writable-properties), [`"symbolKey"`](#symbol-keys), | ||
[`"symbolValue"`](#symbol-values), [`"toJSON"`](#tojson), | ||
[`"uncaughtException"`](#infinite-recursion), [`"undefined"`](#undefined), | ||
[`"unsafeGetter"`](#exceptions-in-getters) or | ||
[`"unsafeToJSON"`](#exceptions-in-tojson). | ||
Reason for the change among: | ||
- [Exceptions](#exceptions): [`"unsafeCycle"`](#cycles), | ||
[`"unsafeException"`](#infinite-recursion), [`"unsafeBigInt"`](#bigint), | ||
[`"unsafeToJSON"`](#exceptions-in-tojson), | ||
[`"unsafeGetter"`](#exceptions-in-getters) | ||
- [Invalid descriptors](#invalid-descriptors): | ||
[`"descriptorNotWritable"`](#non-writable-properties), | ||
[`"descriptorNotConfigurable"`](#non-configurable-properties) | ||
- [Unexpected types](#unexpected-types): | ||
[`"unstableInfinite"`](#nan-and-infinity) | ||
- [Filtered values](#filtered-values): [`"ignoredFunction"`](#functions), | ||
[`"ignoredUndefined"`](#undefined), [`"ignoredSymbolValue"`](#symbol-values), | ||
[`"ignoredSymbolKey"`](#symbol-keys), | ||
[`"ignoredNotEnumerable"`](#non-enumerable-keys), | ||
[`"ignoredArrayProperty"`](#array-properties) | ||
- [Unresolved values](#unresolved-values): [`"unresolvedToJSON"`](#tojson), | ||
[`"unresolvedClass"`](#classes), [`"unresolvedGetter"`](#getters) | ||
- [Big output](#big-output): [`"maxSize"`](#big-output) | ||
##### changes[*].error | ||
@@ -153,5 +161,5 @@ | ||
Error that triggered the change. Only present if [`reason`](#changesreason) is | ||
[`"uncaughtException"`](#infinite-recursion), | ||
[`"unsafeGetter"`](#exceptions-in-getters) or | ||
[`"unsafeToJSON"`](#exceptions-in-tojson). | ||
[`"unsafeException"`](#infinite-recursion), | ||
[`"unsafeToJSON"`](#exceptions-in-tojson) or | ||
[`"unsafeGetter"`](#exceptions-in-getters). | ||
@@ -240,2 +248,4 @@ # Changes | ||
## Invalid descriptors | ||
### Non-writable properties | ||
@@ -242,0 +252,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
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
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
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
75862
645
483