securityos/node_modules/eslint-plugin-unicorn/rules/fix/replace-string-literal.js

12 lines
473 B
JavaScript
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
'use strict';
function replaceStringLiteral(fixer, node, text, relativeRangeStart, relativeRangeEnd) {
const firstCharacterIndex = node.range[0] + 1;
const start = Number.isInteger(relativeRangeEnd) ? relativeRangeStart + firstCharacterIndex : firstCharacterIndex;
const end = Number.isInteger(relativeRangeEnd) ? relativeRangeEnd + firstCharacterIndex : node.range[1] - 1;
return fixer.replaceTextRange([start, end], text);
}
module.exports = replaceStringLiteral;