Skip to content

Commit d4b9288

Browse files
committed
docs(readme): add missing safe option
1 parent 50893ec commit d4b9288

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ Parses a given JSON-formatted text into an object where:
6767
- `'error'` - throw a `SyntaxError` when a `constructor.prototype` key is found. This is the default value.
6868
- `'remove'` - deletes any `constructor` keys from the result object.
6969
- `'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`).
7073

7174
### `sjson.scan(obj, [options])`
7275

@@ -79,6 +82,9 @@ Scans a given object for prototype properties where:
7982
- `constructorAction` - optional string with one of:
8083
- `'error'` - throw a `SyntaxError` when a `constructor.prototype` key is found. This is the default value.
8184
- `'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`).
8288

8389
## Benchmarks
8490

0 commit comments

Comments
 (0)