intervalEngulfsUnix
Signature
Section titled “Signature”intervalEngulfsUnix(aStart: string | number, aEnd: string | number, bStart: string | number, bEnd: string | number): booleanReturn true when the half-open interval B [bStart, bEnd) lies within the half-open interval A [aStart, aEnd) — every instant of B falls within A.
- Compares numeric Unix epoch values directly.
- B is inside A when the intervals overlap and
aStart <= bStartandbEnd <= aEnd. Both ends are exclusive, so B may start at A’s start and end at A’s end. - An empty B counts only strictly inside A, the same edge rule as
clampInterval; at either edge of A it returnsfalse, and an empty A engulfs nothing. - Equivalent to 4-argument
intervalContainsUnix(aStart, aEnd, bStart, bEnd). - Returns
falseif either interval is invalid (start > end). - Returns
falseon invalid input: non-numeric types, empty strings, and values that are not safe integers (fractions,NaN,±Infinity, beyond ±(2^53 − 1)).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
aStart | string | number | Unix epoch value, in the one unit all epoch arguments share — outer interval start |
aEnd | string | number | Unix epoch value, in the one unit all epoch arguments share — outer interval end |
bStart | string | number | Unix epoch value, in the one unit all epoch arguments share — inner interval start |
bEnd | string | number | Unix epoch value, in the one unit all epoch arguments share — inner interval end |
Returns
Section titled “Returns”true if B is fully contained in A, or false on invalid input
Examples
Section titled “Examples”import { intervalEngulfsUnix } from "@northguild/gmt/unix/interval";
intervalEngulfsUnix(0, 1700000000, 1500000000, 1600000000) // true