View treeify.js
const assert = require('assert')
// takes a flat structure like this
const input = [
{
level: 1,
title: '1'
},
{
level: 1,
View package.json
{
"name": "gist-test",
"version": "0.0.0",
"bin": "./run.js"
}
View .gitignore
node_modules
View diff.json
[
{
"op": "replace",
"path": [
"nodes",
"0",
"nodes",
"0",
"characters",
"8",
View replayer.js
export default function replayer(array, opts = {}, emit) {
let idx = 0
let timer
return {
start: next,
stop: stop,
reset: reset
}
View syncUrl.js
import url from 'url'
export default Object.assign(configure(), configure)
function configure({qsImpl} = {}) {
return {
parse(urlToParse) {
return Object.assign(createUrlObject({qsImpl}), {
href: urlToParse
})
View README.md

Minimalistic pubsub

function pubsubber() {
  const subscribers = []
  return {
    subscribe,
    once,
    publish
  }
View .gitignore
.DS_Store
npm-debug.log
node_modules
View skip-single-keys.js
const assert = require("assert");
function skipSingleKeys(obj) {
if (obj === null || typeof obj !== 'object') {
return obj;
}
const keys = Object.keys(obj);
if (keys.length == 1) {
return skipSingleKeys(obj[keys[0]]);
}
View parse.js
const Rx = require('rx');
const csv = require('csv-parse');
const fs = require('fs');
Rx.Node.fromReadableStream(fs.createReadStream('file.csv').pipe(csv()))
.skip(1)
.withLatestFrom(rows.take(1), (row, header) => {
// Map header[i] => row[i]
return row.reduce((rowObj, cell, i) => {
rowObj[header[i]] = cell;