Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down