UNPKG

@typed/fp

Version:

Data Structures and Resources for fp-ts

93 lines 3.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.endoMap = exports.updateAt = exports.uniq = exports.sortBy = exports.sort = exports.rotate = exports.reverse = exports.prepend = exports.modifyAt = exports.insertAt = exports.filter = exports.deleteAt = exports.concat = exports.append = void 0; const tslib_1 = require("tslib"); const O = (0, tslib_1.__importStar)(require("fp-ts/Option")); const RA = (0, tslib_1.__importStar)(require("fp-ts/ReadonlyArray")); const E = (0, tslib_1.__importStar)(require("./Env")); const function_1 = require("./function"); /** * @since 0.11.0 * @category Combinator */ const append = (value) => (ra) => ra.update((0, function_1.flow)(RA.append(value), E.of)); exports.append = append; /** * @since 0.12.0 * @category Combinator */ const concat = (end) => (ra) => ra.update((0, function_1.flow)(RA.concat(end), E.of)); exports.concat = concat; /** * @since 0.14.0 * @category Combinator */ const deleteAt = (index) => (ra) => ra.update((list) => (0, function_1.pipe)(list, RA.deleteAt(index), O.getOrElse(() => list), E.of)); exports.deleteAt = deleteAt; /** * @since 0.11.0 * @category Combinator */ const filter = (p) => (ra) => ra.update((0, function_1.flow)(RA.filter(p), E.of)); exports.filter = filter; /** * @since 0.11.0 * @category Combinator */ const insertAt = (index, value) => (ra) => ra.update((list) => (0, function_1.pipe)(list, RA.insertAt(index, value), O.getOrElse(() => list), E.of)); exports.insertAt = insertAt; /** * @since 0.11.0 * @category Combinator */ const modifyAt = (index, f) => (ra) => ra.update((list) => (0, function_1.pipe)(list, RA.modifyAt(index, f), O.getOrElse(() => list), E.of)); exports.modifyAt = modifyAt; /** * @since 0.11.0 * @category Combinator */ const prepend = (value) => (ra) => ra.update((0, function_1.flow)(RA.prepend(value), E.of)); exports.prepend = prepend; /** * @since 0.11.0 * @category Combinator */ const reverse = (ra) => ra.update((0, function_1.flow)(RA.reverse, E.of)); exports.reverse = reverse; /** * @since 0.11.0 * @category Combinator */ const rotate = (n) => (ra) => ra.update((0, function_1.flow)(RA.rotate(n), E.of)); exports.rotate = rotate; /** * @since 0.11.0 * @category Combinator */ const sort = (O) => (ra) => ra.update((0, function_1.flow)(RA.sort(O), E.of)); exports.sort = sort; /** * @since 0.11.0 * @category Combinator */ const sortBy = (O) => (ra) => ra.update((0, function_1.flow)(RA.sortBy(O), E.of)); exports.sortBy = sortBy; /** * @since 0.11.0 * @category Combinator */ const uniq = (Eq) => (ra) => ra.update((0, function_1.flow)(RA.uniq(Eq), E.of)); exports.uniq = uniq; /** * @since 0.11.0 * @category Combinator */ const updateAt = (index, a) => (ra) => ra.update((list) => (0, function_1.pipe)(list, RA.updateAt(index, a), O.getOrElse(() => list), E.of)); exports.updateAt = updateAt; /** * @since 0.11.0 * @category Combinator */ const endoMap = (f) => (ra) => ra.update((0, function_1.flow)(RA.map(f), E.of)); exports.endoMap = endoMap; //# sourceMappingURL=RefArray.js.map