MCPcopy
hub / github.com/jestjs/jest / comparePrimitive

Function comparePrimitive

packages/jest-diff/src/index.ts:117–127  ·  view source on GitHub ↗
(
  a: number | boolean,
  b: number | boolean,
  options?: DiffOptions,
)

Source from the content-addressed store, hash-verified

115}
116
117function comparePrimitive(
118 a: number | boolean,
119 b: number | boolean,
120 options?: DiffOptions,
121) {
122 const aFormat = prettyFormat(a, FORMAT_OPTIONS);
123 const bFormat = prettyFormat(b, FORMAT_OPTIONS);
124 return aFormat === bFormat
125 ? getCommonMessage(NO_DIFF_MESSAGE, options)
126 : diffLinesUnified(aFormat.split('\n'), bFormat.split('\n'), options);
127}
128
129function sortMap(map: Map<unknown, unknown>) {
130 return new Map([...map].sort());

Callers 1

diffFunction · 0.85

Calls 2

diffLinesUnifiedFunction · 0.90
getCommonMessageFunction · 0.85

Tested by

no test coverage detected