Skip to content

Instantly share code, notes, and snippets.

View char0n's full-sized avatar
GitHub Star

Vladimír Gorej char0n

GitHub Star
View GitHub Profile
@char0n
char0n / utils.js
Last active November 16, 2017 17:02 — forked from anonymous/utils.js
import { curry, defaultTo, length } from 'ramda';
import { Buffer } from 'buffer'; // Buffer is global in node environment
// stringToBuffer :: String -> String -> Uint8Array
export const stringToBuffer = curry((encoding, string) => Buffer.from(string, encoding));
// byteRange :: Array -> Array
export const byteOffset = ([begin]) => begin;