This file contains 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
// pure | |
const addOne = num => num + 1; | |
//impure: modifies input variable | |
const addOneImpure = num => num++; | |
//pure | |
const addOneToAll = arr => arr.map(addOne); | |
//impure: modifies input array |
This file contains 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
const giveProp = (propName, prop, obj) => Object.assign({}, obj, {[propName]: prop}); | |
const curry = (func, arg) => { | |
return (...args) => func(arg, ...args); | |
}; | |
const giveName = curry(giveProp, 'name'); | |
const giveJob = curry(giveProp, 'job'); | |
const giveHero = curry(giveProp, 'hero'); |
This file contains 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
//OOP | |
class Parent { | |
constructor(name, job) { | |
this.name = name; | |
this.job = job; | |
} | |
} | |
const solo = new Parent('Han', 'smuggler'); // {name: 'Han', job: 'smuggler'} |
This file contains 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
//OOP | |
class Parent { | |
constructor(name, job) { | |
this.name = name; | |
this.job = job; | |
} | |
} | |
const solo = new Parent('Han', 'smuggler'); // {name: 'Han', job: 'smuggler'} |
This file contains 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
'} |
This file contains 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": "how_far_hr", | |
"version": "1.1.0", | |
"engines": { | |
"node": "5.12.0" | |
}, | |
"description": "A small toy app showing HR progress with React and ES6", | |
"author": "Jon Deng <jondeng.com>", | |
"license": "MIT", | |
"private": false, |
This file contains 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
Show hidden characters
{ | |
"plugins": ["react-hot-loader/babel"], | |
"ignore":[] | |
} |
This file contains 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": "how_far_hr", | |
"version": "1.1.0", | |
"engines": { | |
"node": "5.12.0" | |
}, | |
"description": "A small toy app showing HR progress with React and ES6", | |
"author": "Jon Deng <jondeng.com>", | |
"license": "MIT", | |
"private": false, |
This file contains 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
{ | |
"parser": "babel-eslint", // I want to use babel-eslint for parsing! | |
"rules": { | |
"comma-dangle": 0, // dangling commas are ok | |
"indent": [2, 2, { | |
"SwitchCase": 1 | |
}], | |
"jsx-quotes": 1, | |
"linebreak-style": [2, "unix"], | |
"quotes": [2, "single"], |
This file contains 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
{ | |
"parser": "babel-eslint", // I want to use babel-eslint for parsing! | |
"rules": { | |
"comma-dangle": 0, // dangling commas are ok | |
"indent": [2, 2, { | |
"SwitchCase": 1 | |
}], | |
"jsx-quotes": 1, | |
"linebreak-style": [2, "unix"], | |
"quotes": [2, "single"], |