infinite-loop-loader
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

infinite-loop-loader

A webpack 2 loader to transform ∞ loops so that they throw

Before:

while(true){
  // your logic here
}

After:

var __ITER = 1000000000;
while(true) {
  if (__ITER <= 0) {
    throw new Error("Loop exceeded maximum allowed iterations");
  }
  // your logic here
  __ITER--;
}

Installation

npm install --save-dev infinite-loop-loader

Usage

Webpack config example

...
module: {
      rules: [
        {
          test: /\.js$/,
          use: [
            loader: 'infinite-loop-loader',
            options: {
              // iteration limit
              limit: 10000,
              // falafel -> acorn options
              opts {
                allowImportExportEverywhere: true
              }
            }
          ]
        }
      ],
      ...
    }
...

Package Sidebar

Install

npm i infinite-loop-loader

Weekly Downloads

518

Version

1.0.9

License

MIT

Unpacked Size

4.91 kB

Total Files

7

Last publish

Collaborators

  • matteofigus
  • nickbalestra
  • pbazydlo
  • chriscartlidge
  • mkredz