looptar

0.0.5 • Public • Published

Well this is a library to break loops, helps you make good UI's originally this is supposed to go inside babel-plugin-looptar which can do this optionally for you but if you are one of them who don't like to use transpilers you can use this library naked.

#Whats the purpose of this ? Well this will save you a frozen tab and also will gracefully break your code in debug mode by throwing a noble error, just like stackoverflows.

#How to install Good ol' npm install, for those new to javascript development

  $npm install --save looptar

#How to use ?

  1. Import Looptar

    This is done by either

      require('looptar');

    or in the ES6 way

      import Looptar from 'looptar';
  2. Create a Looptar instance. We will use loop here but you can use whatever you please

       const loop = new Looptar({
         breakAfter: 1000 // unit in milliseconds, defaults to 1000
       });
  3. Now inject it in all loops have.

If you had the following code (this is where babel saves you)

  for(let i = 0; i < 114000000; i++ ){
    /* some expensive operation */
  }

It will look like

  for(let i = 0; i < 114000000; i++){
    loop.iterates(0); // where 0 is the unique id, you can use whatever a string, or whatever.
    /* That expansive operation */
  }
  loop.exits(0); // The id must match here and don't miss it or bad things will happen.

Readme

Keywords

Package Sidebar

Install

npm i looptar

Weekly Downloads

1

Version

0.0.5

License

ISC

Last publish

Collaborators

  • darkyen00