1import * as ob from 'urbit-ob';
3const compose = (...fs) =>
4 fs.reduceRight((pF, nF) => (...args) => nF(pF(...args)), v => v);
6const allFalse = (...args) => args.every(a => a === false);
8const isLast = (l, i) => i === l - 1;
10const isUndefined = v => v === undefined;
12const defaultTo = (v, d) => (isUndefined(v) ? d : v);
14const seq = n => Array.from(Array(n), (_, i) => i);
16const fill = (n, v) => Array.from(Array(n), () => v);
18const isValidGalaxy = name => {
21 point = parseInt(ob.patp2dec(name), 10);
25 return point >= 0 && point < 256;
28const randomPatq = len => {
29 let bytes = window.crypto.getRandomValues(new Uint8Array(len));
30 let hex = bytes.reduce(
31 (acc, byt) => acc + byt.toString(16).padStart(2, '0'),
34 return ob.hex2patq(hex);
37// TODO: is there a function for this calculation in urbit-ob or similar?
38// 3 characters per byte, plus a tilde and hypen prefix per pair of bytes
39const patpStringLength = byteLength =>
40 byteLength * 3 + Math.ceil(byteLength / 2);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list