Published
Edited
Nov 15, 2018
Importers
2 stars
Insert cell
Insert cell
Insert cell
map = fn => arr => arr.map((x,i) => fn(x,i))
Insert cell
reduce = (fn, agg) => arr => arr.reduce(fn, agg)
Insert cell
pipe = (...fns) => data => reduce((d, fn) => fn(d),data)(fns)
Insert cell
filter = fn => arr => arr.filter(fn)
Insert cell
find = fn => arr => arr.find(fn)
Insert cell
pick = prop => obj => obj ? obj[prop] : null
Insert cell
pickEvery = field => map(pick(field))
Insert cell
split = delimiter => str => str.split(delimiter)
Insert cell
Insert cell
Insert cell
tail = arr => {
const [head, ...tail] = arr
return tail
}
Insert cell
trim = str => str.trim()
Insert cell
splitNewLine = split('\n')
Insert cell
splitPipe = split('|')
Insert cell
toInt = pipe(trim, parseInt)
Insert cell
toFloat = pipe(trim, parseFloat)
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more