diff --git a/index.js b/index.js index 8e9656f..166edf8 100644 --- a/index.js +++ b/index.js @@ -3,10 +3,10 @@ var compile = module.prototype._compile var path = require('path') var index = __dirname.indexOf('node_modules') -var baseDirectory = (index < 1) ? __dirname : __dirname.substr(0, index - 1) +var nodeModulesDir = (index < 1) ? path.join(__dirname, 'node_modules') : __dirname.substr(0, index + 12) module.prototype._compile = function (content, filename) { - var isThirdParty = filename.startsWith(path.join(baseDirectory, 'node_modules')) + var isThirdParty = filename.startsWith(nodeModulesDir) if (!isThirdParty) { content = "'use strict';" + content } diff --git a/package.json b/package.json index 526f019..3078e69 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "auto-strict", - "version": "0.0.3", + "version": "0.0.4", "description": "Add 'use strict'; to all code not in node_modules", "main": "index.js", "author": {