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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more