So I'm trying to calculate the cartesian product of object's properties
const style = {
fontFamily: ['helvetica', 'comic sans'],
fontWeight: [300, 700],
}
const expected = [
import expect from 'expect'; | |
import { flatten, unflatten } from 'src/flatten'; | |
describe('Flatten', () => { | |
it('flattens an object, prefixed by original keys', () => { | |
const input = { | |
foo: { | |
bar: 'baz', | |
qux: 'zip', | |
}, |
📷
👍 | 💰 | 🔗 |
---|---|---|
6 | $648 | Sony A6000 |
5 | $1100 | Fuji X100T |
3 | $4250 | Leica Q |
3 | $1400 | Fuji XT1 |
2 | $950 | Sony RX100 IV |
2 | $950 | Fuji T-10 |
/* @flow */ | |
import { compose, contains, filter, forEach, flip, map, prop } from 'ramda'; | |
type TypekitFont = { | |
descriptors: { | |
featureSettings: string, | |
subset: string, | |
unicodeRange: string, | |
weight: number, | |
}, |
/* @flow */ | |
import type { Action, AppState, StyleProp } from '../../Types'; | |
import { append, compose, equals, init, last, lensPath, over, reject, set, | |
update, view } from 'ramda'; | |
const UNDO = 'UNDO'; | |
export function undo(): Action { | |
return { | |
type: UNDO, | |
data: true, |
import { compose, countBy, divide, filter, groupBy, head, last, toLower, map, prop, sum, values } from 'ramda'; | |
const sumValues = compose(sum, values); | |
export function countByFrom(input) { | |
return compose( | |
map(countBy(last)), | |
groupBy(head), | |
filter((x) => { | |
return x.length > 1; |
import expect from 'expect'; | |
import { countByFrom, probablize } from 'src/MarkovMatrix'; | |
describe('MarkovMatrix', () => { | |
it('counts by from-state', () => { | |
const input = [ | |
['foo', 'bar'], | |
['foo', 'bar'], | |
['foo', 'bar'], | |
['foo', 'baz'], |
viewBookList bookList = | |
bookList | |
|> List.map viewBook | |
|> div [ class "container" ] | |
viewBookList bookList = | |
div | |
[ class "container" ] | |
(List.map viewBook bookList) |