Skip to content

Instantly share code, notes, and snippets.

const { composableFetch, pipeP } = require('../dist/index')
const fetch = require('isomorphic-fetch')
const R = require('ramda')
const log = console.log.bind(console)
const fetchJSON = pipeP(
composableFetch.withBaseUrl('https://honzabrecka.com/api'),
composableFetch.withHeader('Content-Type', 'application/json'),
composableFetch.withHeader('Accept', 'application/json'),
composableFetch.withEncodedBody(JSON.stringify),
enum Flags {
A = 1 << 0,
B = 1 << 1,
C = 1 << 2,
}
// number means uint
const allowed = (flags: Flags[], flag: Flags): boolean =>
(flags.reduce((p, c) => p | c) & flag) === flag
/**
* User Timing polyfill (http://www.w3.org/TR/user-timing/)
* @author RubaXa <trash@rubaxa.org>
*/
(function (window){
var
startOffset = Date.now ? Date.now() : +(new Date)
, performance = window.performance || {}
, _entries = []