@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
18 lines (17 loc) • 540 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getNodeSource = getNodeSource;
// Get raw source code string for a given node
function getNodeSource(fileContents, node) {
var _node$loc;
if ((_node$loc = node.loc) !== null && _node$loc !== void 0 && _node$loc.source) {
var _node$loc2;
return (_node$loc2 = node.loc) === null || _node$loc2 === void 0 ? void 0 : _node$loc2.source;
}
if (node.range) {
return fileContents.text.slice(node.range[0], node.range[1]);
}
return '';
}