MCPcopy Create free account
hub / github.com/kpdecker/jsdiff / castInput

Method castInput

src/diff/json.ts:14–18  ·  view source on GitHub ↗
(value: string | object, options: DiffJsonOptionsNonabortable | DiffJsonOptionsAbortable)

Source from the content-addressed store, hash-verified

12 tokenize = tokenize;
13
14 castInput(value: string | object, options: DiffJsonOptionsNonabortable | DiffJsonOptionsAbortable) {
15 const {undefinedReplacement, stringifyReplacer = (k, v) => typeof v === 'undefined' ? undefinedReplacement : v} = options;
16
17 return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), null, ' ');
18 }
19
20 equals(left: string, right: string, options: DiffJsonOptionsNonabortable | DiffJsonOptionsAbortable) {
21 return super.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options);

Callers

nothing calls this directly

Calls 1

canonicalizeFunction · 0.85

Tested by

no test coverage detected