remove-spaces-after.js 418 B

1234567891011121314
  1. 'use strict';
  2. function removeSpacesAfter(indexOrNode, sourceCode, fixer) {
  3. let index = indexOrNode;
  4. if (typeof indexOrNode === 'object' && Array.isArray(indexOrNode.range)) {
  5. index = indexOrNode.range[1];
  6. }
  7. const textAfter = sourceCode.text.slice(index);
  8. const [leadingSpaces] = textAfter.match(/^\s*/);
  9. return fixer.removeRange([index, index + leadingSpaces.length]);
  10. }
  11. module.exports = removeSpacesAfter;