froebel
Version:
TypeScript utility library
15 lines (11 loc) • 454 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/** Access list at `i % length`. Negative indexes start indexing the last
* element as `[-1]` and wrap around to the back. */
const atWrap = (arr, i) => arr[i >= 0 ? i % arr.length : arr.length + (i % arr.length || -arr.length)];
var _default = atWrap;
exports.default = _default;
module.exports = Object.assign(exports.default || {}, exports);