@prelude/array
Version:
Array module.
10 lines • 525 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const at_js_1 = __importDefault(require("./at.js"));
/** Like `at` but bounds less than zero index to 0 and out of bound to last. */
const bounded = (values, index) => (0, at_js_1.default)(values, Math.min(values.length - 1, Math.max(0, index)));
exports.default = bounded;
//# sourceMappingURL=bounded.js.map