Skip to content

Commit 6a878bf

Browse files
committed
AG-21246 Fix 'trusted-json-set' documentation
Squashed commit of the following: commit 747981f Author: Adam Wróblewski <adam@adguard.com> Date: Thu Mar 19 19:10:13 2026 +0100 Fix 'trusted-json-set' documentation
1 parent 32b2d47 commit 6a878bf

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/scriptlets/trusted-json-set.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,17 @@ import { type Source } from './scriptlets';
7777
* - `trueFunc` — function returning true
7878
* - `falseFunc` — function returning false
7979
* - `throwFunc` — function throwing an error
80-
* - `noopPromiseResolve` — function returning Promise resolved with an empty response
81-
* - `noopPromiseReject` — function returning Promise.reject()
80+
* - `noopPromiseResolve` — function returning `Promise` resolved with an empty response
81+
* - `noopPromiseReject` — function returning `Promise.reject()`
8282
* - any other string is set as a string literal
83+
*
8384
* Can also be a replacement applied to the current string value at the target path,
8485
* in the format `replace:/regex/replacement/`:
8586
* - `replace:/foo/bar/` — replaces the first occurrence of `foo` with `bar`
8687
* - `replace:/foo/bar/g` — replaces all occurrences
87-
* Or `json:{...}` — parses the provided JSON value, can be used to apply multiple modifications at once;
88-
* if the current target value is also an object, the parsed object is merged into it.
88+
*
89+
* Or `json:{...}` — parses the provided `JSON` value, can be used to apply multiple modifications at once.
90+
* If the current target value is also an object, the parsed object is merged into it.
8991
* - `requiredInitialProps` — optional, space-separated list of property paths.
9092
* All listed paths must be present in the JSON object for the modification to occur.
9193
* - `jsonSource` — optional, where to read and modify the JSON value from. Defaults to `result`.
@@ -259,8 +261,8 @@ import { type Source } from './scriptlets';
259261
* 1. Only modifies the JSON object if `tracking.enabled` property is present
260262
*
261263
* ```adblock
262-
* example.org#%#//scriptlet(
263-
* 'trusted-json-set', 'JSON.parse', 'tracking.enabled', 'false', 'tracking.enabled', 'result')
264+
* example.org#%#//scriptlet('trusted-json-set', 'JSON.parse', 'tracking.enabled', 'false', 'tracking.enabled', 'result')
265+
* ```
264266
*
265267
* Input JSON:
266268
*

0 commit comments

Comments
 (0)