Test case for copying test with native APIs. (Works on latest Chrome, Firefox, Safari.)
made with esnextbin
'use strict'; | |
import React from 'react'; | |
import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table'; | |
var products = []; | |
function addProducts(quantity) { | |
var startId = products.length; | |
for (var i = 0; i < quantity; i++) { |
const Case = cases => ( | |
pred => ( | |
(typeof cases[pred] !== 'undefined') ? cases[pred]() : cases['_']() | |
) | |
) | |
const count = Case({ | |
0: () => 'zero', | |
1: () => 'one', | |
_: () => 'many' |
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- test here: https://esnextb.in/?gist=fa2b7e6775c242a76489c0ebc329ba7f --> | |
</head> | |
<body> | |
<div id="app"></div> | |
</body> |
const Cycle = require('@cycle/core'); | |
const {makeDOMDriver, div, button} = require('@cycle/dom'); | |
const {Observable} = require('rx'); | |
function intent({ DOM }) { | |
const incr$ = DOM | |
.select('.incr') | |
.events('click') | |
.map(() => prev => prev + 1); | |
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- test here: https://esnextb.in/?gist=7cba0a35afc77d49ebb2bf5b99e944f1 --> | |
</head> | |
<body> | |
<div id="app"></div> | |
</body> |
Test case for copying test with native APIs. (Works on latest Chrome, Firefox, Safari.)
made with esnextbin
const pop = (arr, tmp) => (tmp = arr.slice(0), tmp.pop(), tmp) | |
const push = (arr, item, tmp) => (tmp = arr.slice(0), tmp.push(item), tmp) | |
// Can you see why and how this works? Does it really? Can you guess if it's pure or impure? | |
// Does it modify any of its arguments, or pollute global scope? |
const obj = { foo: 'bar', baz: 'quux' } // let's define our object | |
const { foo, baz } = bar // the keys are now in the envorinment! | |
const hello = 'world' // hello is defined in our environment | |
const newObj = { hello } // and now it's captured in our object! |
Test case for gcanti/flow-static-land#56
Enter the username of a Github user to get their full name. Request on keystroke with XHR cancellation instead of debounce, which results in less latency and better user experience. Very simple implementation with RxJS. The magic is the .switch
operator.
See live on esnextbin, don't forget to open Network tab in DevTools to see cancellation.