pragmatic-fp-ts
Version:
Opinionated functional programming library with easy use in mind
14 lines (13 loc) • 467 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepend = void 0;
const main_1 = require("./main");
function prepend(el, coll) {
if (arguments.length === 1) {
return (_coll) => prepend(el, _coll);
}
return coll instanceof Array
? [(0, main_1.getValue)(el), ...(0, main_1.getValueOr)([], coll)]
: ((0, main_1.getValueOr)("", el) + (0, main_1.getValueOr)("", coll));
}
exports.prepend = prepend;