replace-string-literal.js 473 B

1234567891011
  1. 'use strict';
  2. function replaceStringLiteral(fixer, node, text, relativeRangeStart, relativeRangeEnd) {
  3. const firstCharacterIndex = node.range[0] + 1;
  4. const start = Number.isInteger(relativeRangeEnd) ? relativeRangeStart + firstCharacterIndex : firstCharacterIndex;
  5. const end = Number.isInteger(relativeRangeEnd) ? relativeRangeEnd + firstCharacterIndex : node.range[1] - 1;
  6. return fixer.replaceTextRange([start, end], text);
  7. }
  8. module.exports = replaceStringLiteral;