@arrows/array
Version:
Functional tools for JS arrays
17 lines (16 loc) • 510 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepend_ = void 0;
const curry_1 = require("@arrows/composition/curry");
const _prepend_ = (value, arr) => [value].concat(arr);
/**
* Adds a value at the beginning of the array.
* Similar to Array.prototype.unshift, but immutable.
*
* @param value Additional value
* @param arr Initial array
* @returns New array
*/
const prepend_ = curry_1.default(_prepend_);
exports.prepend_ = prepend_;
exports.default = prepend_;
;