(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
if ( typeof document.currentScript == "undefined" && document.__defineGetter__ ) { | |
document.__defineGetter__("currentScript", function (){ | |
try { | |
throw new Error() | |
} | |
catch ( e ) { | |
var qualifiedUrl = location.protocol + "//" + location.host | |
, srcs = e.stack.match(new RegExp(qualifiedUrl + ".*?\\.js", 'g')) | |
, src = srcs[srcs.length - 1] | |
, absoluteUrl = src.replace(qualifiedUrl, "") |
This Gist presents a new design of class-based object construction in ES6 that does not require use of the two-phase @@create protocol.
One of the characteristics of this proposal is that subclass constructors must explicitly super invoke their superclass's constructor if they wish to use the base class' object allocation and initialization logic.
An alternative version of this design automatically invokes the base constructor in most situations.
In React's terminology, there are five core types that are important to distinguish:
React Elements
// Groovy's Elvis operator | |
// | |
// lhs ?: rhs | |
// | |
// is equivalent to: | |
// | |
// lhs == null ? rhs : lhs | |
// | |
// or: | |
// |
var uniqueArray = function(arrArg) { | |
return arrArg.filter(function(elem, pos,arr) { | |
return arr.indexOf(elem) == pos; | |
}); | |
}; | |
var uniqEs6 = (arrArg) => { | |
return arrArg.filter((elem, pos, arr) => { | |
return arr.indexOf(elem) == pos; | |
}); |
A lot of people mentioned other immutable JS libraries after reading my post. I thought it would be good to make a list of available ones.
There are two types of immutable libraries: simple helpers for copying JavaScript objects, and actual persistent data structure implementations. My post generally analyzed the tradeoffs between both kinds of libraries and everything applies to the below libraries in either category.
Libraries are sorted by github popularity.
$ npm install --save babel-cli babel-preset-es2015
$ npm install --save-dev jasmine
.babelrc:
{
"presets": ["es2015"]
These use separate document structures instead of HTML, some are more modular libraries than full editors
const I = x => x | |
const K = x => y => x | |
const A = f => x => f (x) | |
const T = x => f => f (x) | |
const W = f => x => f (x) (x) | |
const C = f => y => x => f (x) (y) | |
const B = f => g => x => f (g (x)) | |
const S = f => g => x => f (x) (g (x)) | |
const S_ = f => g => x => f (g (x)) (x) | |
const S2 = f => g => h => x => f (g (x)) (h (x)) |