Detect trailing whitespace
$ npm install detect-trailing-whitespace
const fs = require('fs');
const detectTrailingWhitespace = require('detect-trailing-whitespace');
const fileContents = fs.readFileSync('file.txt', 'utf8');
const containsTrailingWhitespace = detectTrailingWhitespace(fileContents);
console.log(containsTrailingWhitespace);
// => `true` if file contains trailing whitespace, otherwise `false`
This project follows Semantic Versioning 2.
- v1.0.0 (2017-07-23):
- Add support for Node.js v6, v8, and v10.
- Drop support for Node.js versions older than v6.
- v0.1.0 (2015-01-24): Initial release.