securityos/node_modules/eslint-plugin-unicorn/rules/utils/get-indent-string.js

12 lines
286 B
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
'use strict';
function getIndentString(node, sourceCode) {
const {line, column} = sourceCode.getLocFromIndex(node.range[0]);
const lines = sourceCode.getLines();
const before = lines[line - 1].slice(0, column);
return before.match(/\s*$/)[0];
}
module.exports = getIndentString;