m15o.net/wombat/lib/std

NAME

std - standard lib

const
get = p => req('GET', p),
put = (p, d) => req('PUT', p, d),
del = p => req('DEL', p),
val = (p, d = '') => { try { return get(p) } catch (e) { if (e.reason === 'not found') return d; throw e } },
def = (p, d = '') => { val(p, null) ?? put(p, d) },
ls = p => val(p).split('\n').filter(l => l.startsWith('=> ')).map(l => l.split(' ')[1]),
lsd = p => ls(p).filter(x => x.endsWith('/')).map(x => x.slice(0, -1))

SOURCE

/lib/std