Skip to content

Instantly share code, notes, and snippets.

View kasperlewau's full-sized avatar

Kasper Lewau kasperlewau

View GitHub Profile
@kasperlewau
kasperlewau / functional-utils.js
Created April 7, 2016 18:47 — forked from bendc/functional-utils.js
A set of pure and immutable ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)