diff --git a/README.md b/README.md index 75c4bfd..9a2f082 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ function doStuff() { # opts `exclude`: array of file extensions to exclude. defaults to `['json']` +`newline`: boolean to append a newline after "use strict". defaults to `false` # install diff --git a/index.js b/index.js index 30b027d..622e3fd 100644 --- a/index.js +++ b/index.js @@ -8,6 +8,8 @@ function strictify(file, opts) { opts = opts || {}; opts.exclude = ['json'].concat(opts.exclude||[]); + var tail = opts.newline ? '\n' : ''; + var stream = through(write, end); var applied = false; @@ -20,7 +22,7 @@ function strictify(file, opts) { function write(buf) { if (!applied && !excluded) { - stream.queue('"use strict";\n'); + stream.queue('"use strict";'+tail); applied = true; } stream.queue(buf); diff --git a/package.json b/package.json index ffbaf1f..50b655d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "strictify", - "version": "0.2.0", + "version": "0.2.1", "description": "browserify v2 plugin for enforcing strict mode", "main": "index.js", "dependencies": {