Index Class
Package: @esfx/interval
Represents an ordinal index within an indexed collection.
Declaration
export declare class Index implements Equatable
Constructors
constructor(value, isFromEnd)
Constructs a new instance of the Index
class
Declaration
constructor(value: number, isFromEnd?: boolean);
Parameters
- value
- number
- isFromEnd
- boolean
Properties
end
Gets an Index
representing the last element of an indexed collection.
Declaration
static get end(): Index;
Property Value
isFromEnd
Gets a value indicating whether the index value is relative to the end of the collection.
Declaration
get isFromEnd(): boolean;
Property Value
start
Gets an Index
representing the first element of an indexed collection.
Declaration
static get start(): Index;
Property Value
value
Gets the value for the index.
Declaration
get value(): number;
Property Value
Methods
[Equatable.equals](other)
Declaration
[Equatable.equals](other: unknown): boolean;
Parameters
- other
- unknown
Returns
[Equatable.hash]()
Declaration
[Equatable.hash](): number;
Returns
equals(other)
Declaration
equals(other: Index): boolean;
Parameters
- other
- Index
Returns
fromEnd(value)
Creates an index relative to the end of an indexed collection.
Declaration
static fromEnd(value: number): Index;
Parameters
- value
- number
Returns
fromStart(value)
Creates an index relative to the start of an indexed collection.
Declaration
static fromStart(value: number): Index;
Parameters
- value
- number
Returns
getIndex(length)
Computes the index based on a fixed length.
Declaration
getIndex(length: number): number;
Parameters
Returns
hash()
Declaration
hash(): number;
Returns
toString()
Declaration
toString(): string;