Comparison of two javascript type checker mainly about tagged union = discriminated union = disjoint union.
Short answer: TypeScript win!
Reference: facebook/flow#2400
/** | |
Using the Vuex plugin pattern: https://vuex.vuejs.org/en/plugins.html, | |
this plugin will fire off a gtm.trackEvent for each mutation that occurs within your app. | |
It will also do a lookup on a literal object methods named after your mutation types. From those methods, | |
return a object with looks up on the store. | |
*/ | |
import Vue from 'vue' | |
// import mutation-types, see example: | |
/** |
Comparison of two javascript type checker mainly about tagged union = discriminated union = disjoint union.
Short answer: TypeScript win!
Reference: facebook/flow#2400
// for reference: | |
// https://www.bignerdranch.com/blog/asyncing-feeling-about-javascript-generators/ | |
// https://gist.github.com/nybblr/3af62797052c42f7090b4f8614b5e157#gistcomment-2044311 | |
const destreamify = async (stream, callback) => { | |
for await (let event of stream) { | |
callback(event); | |
} | |
}; |
Ramda | Sanctuary |
---|---|
add(a, b) |
add(b, a) |
addIndex(f) |
`` |
adjust(f, i, xs) |
`` |
all(f, xs) |
`` |
allPass(fs, x) |
allPass(fs, x) |
always(x) |
K(x) |
and(a, b) |
and(a, b) |
any(f, x) |
`` |
A list of languages which compile to JS (Elm, Purescript, OCaml) | |
(Inspired by this thread: https://groups.google.com/forum/#!topic/elm-discuss/Um7WIBTq9xU) | |
They all support curry calling convention by default. | |
Some interesting results: | |
1. `min` is curried function, only OCaml(BuckleScript) managed to optimize this overhead. | |
2. All optimize the self tail call | |
3. Only BuckleScript and PureScript type-specialized comparison functoin (>=) and inlined |
import 'package:flutter/material.dart'; | |
import 'theme.dart' as Theme; | |
void main() { | |
runApp( | |
new MaterialApp( | |
title: 'CompanyApp', | |
color: Theme.CompanyColors.blue[500], | |
theme: Theme.CompanyThemeData, | |
home: new Scaffold( |
// Create a Promise that resolves after ms time | |
var timer = function(ms) { | |
return new Promise(resolve => { | |
setTimeout(resolve, ms); | |
}); | |
}; | |
// Repeatedly generate a number starting | |
// from 0 after a random amount of time | |
var source = async function*() { |
|