Published
Edited
Jan 1, 2021
Insert cell
Insert cell
Insert cell
parse = input => {
const [rules, messages] = input.split('\n\n').map(l => l.split('\n'));
const rulesMap = rules.reduce((map, line) => {
const [num, src] = line.split(': ');
map.set(num, src);
return map;
}, new Map());

return [rulesMap, messages];
}
Insert cell
parse( testInput)
Insert cell
testString = ( rulesMap, rule, string ) => {
}
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