This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
"babel": { | |
options: { | |
sourceMap: true | |
}, | |
dist: { | |
files: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Rectangle} from "./rectangle.js" | |
var r = new Rectangle(50, 20) | |
console.log(r.area === 1000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Rectangle { | |
constructor (width, height) { | |
this.width = width | |
this.height = height | |
} | |
set width (width) { this._width = width } | |
get width () { return this._width } | |
set height (height) { this._height = height } | |
get height () { return this._height } | |
get area () { return this.width * this.height } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "es6_first_try", | |
"version": "1.0.0", | |
"description": "", | |
"main": "main.js", | |
"dependencies": {}, | |
"devDependencies": { | |
"babel-core": "^5.8.22", | |
"grunt": "^0.4.5", | |
"grunt-babel": "^5.0.1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
es6_first_try | |
|-- src | |
|---- app.js | |
|---- rectangle.js | |
|-- Gruntfile.js | |
|-- package.json |