MCPcopy Create free account
hub / github.com/webpack/less-loader / getFileExcerptIfPossible

Function getFileExcerptIfPossible

src/utils.js:432–447  ·  view source on GitHub ↗

* @param {LessError} error error * @returns {string[]} file excerpt

(error)

Source from the content-addressed store, hash-verified

430 * @returns {string[]} file excerpt
431 */
432function getFileExcerptIfPossible(error) {
433 if (typeof error.extract === "undefined") {
434 return [];
435 }
436
437 const excerpt = error.extract.slice(0, 2);
438 const column = Math.max(/** @type {number} */ (error.column) - 1, 0);
439
440 if (typeof excerpt[0] === "undefined") {
441 excerpt.shift();
442 }
443
444 excerpt.push(`${" ".repeat(column)}^`);
445
446 return excerpt;
447}
448
449/**
450 * @param {LessError} error error

Callers 1

errorFactoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…