enables strict mode in your package

npm install strict-mode
8 downloads in the last day
8 downloads in the last week
17 downloads in the last month


enables strict mode in your package


With npm do

npm install package-name


Suppose your package.json main attribute is the npm init default index.js.

If you want that all the modules in your package has strict mode enabled, just wrap your index.js this way

require('strict-mode')(function () {

// your index.js content

// every *require* call inside this function will have strict mode enabled



Strict mode is a best practice most of developers will agree.

Adding a "use strict"; on top of every .js file in your package could

  • require a big effort
  • be error proning
  • make complain jshint
  • be a problem when concatenating files

On the other hand the use-strict package solution is too invasive, cause it makes all modules in Node get loaded in strict mode.


Code stolen from isaacs' use-strict.



npm loves you