Socket
Socket
Sign inDemoInstall

es6-for-of

Package Overview
Dependencies
4
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    es6-for-of

Compiles JavaScript written using ES6 for-of to ES3 syntax. For example, this:


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

es6-for-of

Compiles JavaScript written using ES6 for-of to ES3 syntax. For example, this:

for (var a of b) {
  console.log(a);
}

compiles to this:

var $__getIterator = function(iterable) {
  var sym = (typeof Symbol === "function" ? Symbol.iterator : "@@iterator");

  if (typeof iterable[sym] === "function") {
    return iterable[sym]();
  } else if (Object.prototype.toString.call(iterable) === "[object Array]") {
    return $__arrayIterator(iterable);
  } else {
    throw new TypeError();
  }
};

var $__arrayIterator = function(array) {
  var index = 0;

  return {
    next: function() {
      if (index >= array.length) {
        return {
          done: true,
          value: void 0
        };
      } else {
        return {
          done: false,
          value: array[index++]
        };
      }
    }
  };
};

for (var $__0 = $__getIterator(b), $__1; !($__1 = $__0.next()).done; ) {
  var a = $__1.value;
  console.log(a);
}

Install

$ npm install es6-for-of

Browserify

Browserify support is built in.

$ npm install es6-for-of  # install local dependency
$ browserify -t es6-for-of $file

Setup

First, install the development dependencies:

$ npm install

Then, try running the tests:

$ npm test

FAQs

Last updated on 25 Sep 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc