This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type AbortListener = () => void; | |
export interface AbortSignal { | |
readonly addEventListener: (type: "abort", fn: AbortListener) => void; | |
readonly removeEventListener: (type: "abort", fn: AbortListener) => void; | |
readonly aborted: boolean; | |
} | |
export interface AbortController { | |
readonly abort: () => void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from "fs"; | |
import util from "util"; | |
import { chan } from "./chan"; | |
import { split } from "./split"; | |
const open = util.promisify(fs.open); | |
const write = util.promisify(fs.write); | |
const close = util.promisify(fs.close); | |
export type Append = (line: string) => void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { CaseOf, TypePattern, caseOf } from "./caseOf"; | |
function success<T>(value: T): T { | |
return value; | |
} | |
const errorPattern: TypePattern<never> = { | |
Array() { | |
throw new TypeError("Array"); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export * from "./pattern-of"; | |
export * from "./test"; | |
export * from "./union-of"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const child_process = require("child_process"); | |
const fs = require("fs"); | |
function spawn(command = "", args = []) { | |
return new Promise((resolve, reject) => { | |
const proc = child_process.spawn(command, args, { | |
stdio: "inherit" | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type CancellationSubscriber = (err: Error) => void; | |
export type Unsubscribe = () => void; | |
export interface CancellationToken { | |
subscribe(subscriber: CancellationSubscriber): Unsubscribe; | |
} | |
export class CancellationError extends Error { | |
public readonly name = "CancellationError"; | |
public readonly message = "The operation was cancelled"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const fs = require("fs"); | |
function usage() { | |
console.error("rotate v1.0.0"); | |
console.error(); | |
console.error("$ rotate -r <file>"); | |
console.error("Rotates a file with using a random offset."); | |
console.error(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface ArrayOfSchema<T> { | |
readonly type: "arrayOf"; | |
readonly payload: T; | |
} | |
function arrayOfSchema<T>(payload: T): ArrayOfSchema<T> { | |
return { type: "arrayOf", payload }; | |
} | |
export interface BooleanSchema { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface Store<State, Action> extends MiddlewareStore<State, Action> { | |
readonly subscribe: Subscribe; | |
} | |
export interface MiddlewareStore<State, Action> { | |
readonly dispatch: Dispatch<Action>; | |
readonly getState: GetState<State>; | |
} | |
export type Subscribe = (fn: Subscriber) => Unsubscribe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const child_process = require("child_process"); | |
const fs = require("fs"); | |
const path = require("path"); | |
const util = require("util"); | |
const templates = []; | |
templates.push({ |