For convenience and example for whoever might be wondering about TypeScript and React.
Because SFC<Props>
is much more readable in a chunk of code than React.SFC<Props>
API call Promise | |
Pending | |
on data -> Fulfilled | |
on error -> Rejected | |
canceled -> Rejected | |
Fulfilled | |
done -> Finally | |
Rejected | |
done -> Finally | |
Finally |
Notification | |
Idle | |
show -> Show | |
Show | |
delay ms -> Close | |
Close | |
completed -> Reset |
const { Suite } = require('benchmark'); | |
const R = require('ramda'); | |
const util = require('util'); | |
const suite = new Suite(); | |
const colors = `be4a2f | |
d77643 | |
ead4aa | |
e4a672 |
Services* | |
Init* | |
init -> Get Results | |
Get Results | |
success -> Show Results | |
failed -> Show Error | |
Show Results | |
export declare type Lens = string | number; | |
export declare type Optic = Lens | Array<Lens>; | |
export type Pred<T> = (x: T) => boolean; | |
export type GetValueFn<T = any, U = T> = (maybeData: T, index: number) => U; | |
export type SetValueFn<T1 = any, T2 = T1, U = T2> = (maybeValue: T1, maybeData: T2, index: number) => U; | |
export type ModifyFn<T = any, U = T> = (maybeData: T, i?: number) => U; |
[*.js] | |
indent_size = 2 | |
indent_style = space | |
trim_trailing_whitespace = true | |
insert_final_newline = true |
const $ = require('sanctuary-def'); | |
const Ratio = | |
$.NullaryType('package-name/Ratio', | |
'https://package.url.io/Ratio', | |
x => typeof x === 'number' && (x >= 0 && x <= 1)); | |
// | |
const def = $.create({ |
import * as R from 'ramda'; | |
import * as L from 'partial.lenses'; | |
// | |
const splitCamelCase = R.match(/(^[a-z]+|[A-Z][a-z]+)/g); | |
const flatJoin = R.compose(R.join(''), R.flatten); | |
// |
/** | |
* Takes a list of elements and functions (`vfn` and `kfn`) for transforming the string. | |
* The resulting elements from applying each function will become the `key` and `value` in | |
* the resulting object. | |
* | |
* For example: | |
* | |
* ```js | |
* const tokens = ['foo-bar', 'top-kek']; | |
* const Obj = foldTokens_(tokens, R.split('-'), R.toUpper); |