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

Function diffWords

src/diff/word.ts:184–194  ·  view source on GitHub ↗
(oldStr: string, newStr: string, options?: any)

Source from the content-addressed store, hash-verified

182 options?: DiffWordsOptionsNonabortable
183): ChangeObject<string>[]
184export function diffWords(oldStr: string, newStr: string, options?: any): undefined | ChangeObject<string>[] {
185 // This option has never been documented and never will be (it's clearer to
186 // just call `diffWordsWithSpace` directly if you need that behavior), but
187 // has existed in jsdiff for a long time, so we retain support for it here
188 // for the sake of backwards compatibility.
189 if (options?.ignoreWhitespace != null && !options.ignoreWhitespace) {
190 return diffWordsWithSpace(oldStr, newStr, options);
191 }
192
193 return wordDiff.diff(oldStr, newStr, options);
194}
195
196function dedupeWhitespaceInChangeObjects(
197 startKeep: ChangeObject<string> | null,

Callers 2

create.jsFile · 0.90
word.jsFile · 0.85

Calls 2

diffWordsWithSpaceFunction · 0.85
diffMethod · 0.80

Tested by

no test coverage detected