remove-spaces-after.js 453 B

1234567891011121314
  1. 'use strict';
  2. function removeSpacesAfter(indexOrNodeOrToken, sourceCode, fixer) {
  3. let index = indexOrNodeOrToken;
  4. if (typeof indexOrNodeOrToken === 'object' && Array.isArray(indexOrNodeOrToken.range)) {
  5. index = indexOrNodeOrToken.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;