View .babelrc
{
"presets": [
[
"env",
{
"targets": {
"node": "6",
"chrome": "59",
"safari": "10",
"firefox": "56",
View translate.js
/* eslint-disable no-console */
import client from 'part:@sanity/base/client'
import reduce from 'json-reduce'
// see https://github.com/sanity-io/sanity/blob/next/packages/example-studio/schemas/languages.js for an example
import {SUPPORTED_LANGUAGES} from '../schemas/languages'
import Translate from '@google-cloud/translate'
const translateAPI = new Translate({
View stateContainer.js
import {Subject} from 'rx/Subject'
import {of} from 'rx/observable/of'
import {publishReplay, refCount, concat} from 'rxjs/observable'
function createState(initial) {
const onChange$ = new Subject()
function onChange(...args) {
onChange$.next(args)
}
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
  }