MCPcopy Index your code
hub / github.com/prototypejs/prototype / errorDiff

Function errorDiff

test/unit/static/js/mocha.js:2040–2052  ·  view source on GitHub ↗

* Return a character diff for `err`. * * @param {Error} err * @return {String} * @api private

(err, type, escape)

Source from the content-addressed store, hash-verified

2038 */
2039
2040function errorDiff(err, type, escape) {
2041 return diff['diff' + type](err.actual, err.expected).map(function(str){
2042 if (escape) {
2043 str.value = str.value
2044 .replace(/\t/g, '<tab>')
2045 .replace(/\r/g, '<CR>')
2046 .replace(/\n/g, '<LF>\n');
2047 }
2048 if (str.added) return colorLines('diff added', str.value);
2049 if (str.removed) return colorLines('diff removed', str.value);
2050 return str.value;
2051 }).join('');
2052}
2053
2054/**
2055 * Color lines for `str`, using the color `name`.

Callers 1

mocha.jsFile · 0.85

Calls 1

colorLinesFunction · 0.85

Tested by

no test coverage detected