ut-tools
Version:
Build and Release management automation package.
12 lines (8 loc) • 486 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
function inBounds (value, pos, start, end, step) {
const actualStart = start < 0 ? Math.max(0, start + value.length) : Math.min(value.length, start);
const actualEnd = end < 0 ? Math.max(0, end + value.length) : Math.min(value.length, end);
return pos >= actualStart && pos < actualEnd && (step === 1 || actualEnd - Math.abs(step) > 0 && (pos + start) % step === 0);
}
exports['default'] = inBounds;