Public
Edited
Jan 16, 2021
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Applies fn to the integers [0, n)
doTimes = (n, fn) =>
Array(n)
.fill()
.forEach((_, i) => fn(i))
Insert cell
// Returns a string with no more than two digits after the decimal point
// Actually truncates it; the name is aspirational
roundDecimal = x => String(x).replace(/(\.\d{2}).+/, '$1')
Insert cell
Insert cell
// test withCommas
[1, 123, 12345, 12345678, 1234.56].map(withCommas)
Insert cell
Insert cell
// test formatTime
[0.123, 10, 65, 605, 3610, 24 * 3600 + 10 * 60 + 30].map(formatTime)
Insert cell
hcat = columns =>
html`<div style="display:flex; flex-direction:row; flex-wrap:wrap; width:100%">
${columns.map(
col =>
html`<div style="display:flex; flex-direction:column; flex-basis:100%; flex:1">${col}</div>`
)}
</div>`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { max, range } from "@osteele/utilities"
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