should-ignore-line.js 444 B

1234567891011121314151617181920212223242526272829
  1. /* eslint-disable camelcase -- cache index access */
  2. /**
  3. * @param {string} line
  4. */
  5. module.exports.shouldIgnoreLine = (line) => {
  6. if (line === '') {
  7. return null;
  8. }
  9. const line_0 = line[0];
  10. if (
  11. line_0 === '#'
  12. || line_0 === ' '
  13. || line_0 === '\r'
  14. || line_0 === '\n'
  15. || line_0 === '!'
  16. ) {
  17. return null;
  18. }
  19. const trimmed = line.trim();
  20. if (trimmed === '') {
  21. return null;
  22. }
  23. return trimmed;
  24. };