es6-destructuring
es6 destructuring compiled to es3
Last updated 6 years ago by eventualbuddha .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install es6-destructuring 
SYNC missed versions from official npm registry.

es6-destructuring

desugar ES6 destructuring to ES5.

var {x, y} = z;

function x(x, {y}) {
}

compiles to this:

var x = z.x, y = z.y;
function x(arg$0) {
  var y = arg$0.y;
}

Install

$ npm install es6-destructuring

Usage

$ node
> var compile = require('es6-destructuring').compile;
[Function]
> compile('var {x, y} = z;').code;
'var x = z.x, y = z.y;'

Command line

If installing via npm a command line tool will be available called es6-destructuring.

$ echo "var {x, y} = z;" | es6-destructuring
var x = z.x, y = z.y;
$ es6-destructuring $file
var x = z.x, y = z.y;

Browserify

Browserify support is built in.

$ npm install es6-destructuring  # install local dependency
$ browserify -t es6-destructuring $file
// BOILERPLATE
var x = z.x, y = z.y;

Acknowledgements

This module is a port of Andrey Popp es6-destructuring-jstransform project, I wanted a recast based transformer, and that's why I ported it, part of square es6-arrow-function code has also been used for this module, thanks to Andrey Popp and Square for their amazing work, and thanks to Ben Newman for the amazing recast project.

Current Tags

  • 0.4.0                                ...           latest (6 years ago)

5 Versions

  • 0.4.0                                ...           6 years ago
  • 0.3.1                                ...           6 years ago
  • 0.3.0                                ...           6 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 5
Last Month 20
Dependencies (4)
Dev Dependencies (0)
None
Dependents (3)

Copyright 2014 - 2016 © taobao.org |