npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

es6now

v0.8.14

Published

ES6 to ES5 translator and ES6 runtime

Downloads

49

Readme

Overview

es6now is an ES6 to ES5 compiler, written in ES6. It will allow you to write programs using next-generation Javascript features without having to wait for Node or browsers to fully implement ES6.

es6now can also be used as a runtime environment for executing ES6 programs on top of Node.

Source maps are not required when debugging code translated with es6now. One of the fundamental design goals is that the output should look like the input. Line numbers, whitespace and comments are all maintained.

For more information:

  • The Feature Guide describes the ES6 features that you can use with es6now.
  • The Module Guide describes the ES6 module system implemented in es6now.

Instructions

Install globally with NPM (you may need to sudo this):

npm install -g es6now

Start a REPL by running it without any arguments:

es6now

Execute a module by adding a path:

es6now main.js

Translate a module by using a hyphen:

es6now - src/main.js build/es6now.js -b -r

--input, -i  (1)    The file to translate.
--output, -o (2)    The file to write to. If not set, then the output
                    will be written to the console.
--bundle, -b        If present, module dependencies will be bundled
                    together in the output.
--runtime, -r       If present, the es6now runtime code will be bundled
                    with the output.
--global, -g        If specified, the name of the global variable to
                    dump this module's exports into, if the resulting
                    script is not executed within any module system.

API

es6now can also be used as a library. First, install locally with NPM:

npm install es6now

translate(input, options = {})

Translates ES6 code to ES5. The following options are defined:

  • module: (Boolean) If true, parse the input as a module. Otherwise, parse the input as a script. The default is false.
  • runtime: (Boolean) If true, include the es6now runtime library in the output. The default is false.
  • wrap: (Boolean) If true, wrap the output in boilerplate which will ensure compatibility with Node and AMD modules. The default is false.
  • global: (String) If specified, the name of the global variable which will be used to expose the module if it is loaded as a plain script in the browser.

Example:

var es6now = require("es6now");

var output = es6now.translate("class C { foo() {} }", {
    module: true,
    wrap: true
});