1.0.7 • Published 6 years ago

strip-whitespace v1.0.7

Weekly downloads
46
License
MIT
Repository
github
Last release
6 years ago

Strip-Whitespace - a javascript string minifier

node Travis AppVeyor Known Vulnerabilities David Greenkeeper badge Coveralls Codacy grade

Strip-Whitespace will remove extraneous spaces from strings. It's perfect for working with rendering templates (ex. mustache, handlebars) or es6 javascript templates. It works with anything where you might create very long strings.

Before strip-whitespace:
function() {
  if (condition) {
    const longString = '  String   with    some    extra   spaces  ';
  }
}
After strip-whitespace:
function() {
  if (condition) {
    const longString = ' String with some extra spaces ';
  }
}
Command-line usage
$ strip-whitespace --input <input-file> --output <output-file>
Javascript usage
var StripWhitespace = require('strip-whitespace');

// options are optional and can be omitted
var stripWhitespace = new StripWhitespace(options);
var result = stripWhitespace.strip(code);

// do things with the code
code = result.code;
Options

All options are optional

{
  shouldStripWhitespace: function(fatString) {
    // following code will answer the question: should this string be stripped of whitespace?
    if (fatString.startsWith('DO NOT MODIFY THIS STRING')) {
      return false;
    }

    return true;
  }
}
1.0.7

6 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago