File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ Parses a given JSON-formatted text into an object where:
67
67
- ` 'error' ` - throw a ` SyntaxError ` when a ` constructor.prototype ` key is found. This is the default value.
68
68
- ` 'remove' ` - deletes any ` constructor ` keys from the result object.
69
69
- ` 'ignore' ` - skips all validation (same as calling ` JSON.parse() ` directly).
70
+ - ` safe ` - optional boolean:
71
+ - ` true ` - returns ` null ` instead of throwing when a forbidden prototype property is found.
72
+ - ` false ` - default behavior (throws or removes based on ` protoAction ` /` constructorAction ` ).
70
73
71
74
### ` sjson.scan(obj, [options]) `
72
75
@@ -79,6 +82,9 @@ Scans a given object for prototype properties where:
79
82
- ` constructorAction ` - optional string with one of:
80
83
- ` 'error' ` - throw a ` SyntaxError ` when a ` constructor.prototype ` key is found. This is the default value.
81
84
- ` 'remove' ` - deletes any ` constructor ` keys from the input ` obj ` .
85
+ - ` safe ` - optional boolean:
86
+ - ` true ` - returns ` null ` instead of throwing when a forbidden prototype property is found.
87
+ - ` false ` - default behavior (throws or removes based on ` protoAction ` /` constructorAction ` ).
82
88
83
89
## Benchmarks
84
90
You can’t perform that action at this time.
0 commit comments