crocks
Version:
A collection of well known Algebraic Datatypes for your utter enjoyment.
19 lines (14 loc) • 349 B
JavaScript
/** @license ISC License (c) copyright 2017 original and current authors */
/** @author Ian Hofmann-Hicks (evil) */
// once : ((*) -> b) -> ((*) -> b)
function once(fn) {
var called, result
return function() {
if(!called) {
called = true
result = fn.apply(null, arguments)
}
return result
}
}
module.exports = once