MCPcopy Create free account
hub / github.com/denoland/std / createDetails

Function createDetails

internal/diff_str.ts:101–119  ·  view source on GitHub ↗
(
  line: DiffResult<string>,
  tokens: DiffResult<string>[],
)

Source from the content-addressed store, hash-verified

99 * ```
100 */
101export function createDetails(
102 line: DiffResult<string>,
103 tokens: DiffResult<string>[],
104): DiffResult<string>[] {
105 return tokens.filter(({ type }) => type === line.type || type === "common")
106 .map((result, i, t) => {
107 const token = t[i - 1];
108 if (
109 (result.type === "common") && token &&
110 (token.type === t[i + 1]?.type) && /\s+/.test(result.value)
111 ) {
112 return {
113 ...result,
114 type: token.type,
115 };
116 }
117 return result;
118 });
119}
120
121const NON_WHITESPACE_REGEXP = /\S/;
122

Callers 2

fnFunction · 0.90
diffStrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected