Add capacitorjs runtime
This commit is contained in:
parent
d0ece489ee
commit
f90c0e6c40
8362 changed files with 1502407 additions and 1 deletions
46
node_modules/chevrotain/src/text/range.ts
generated
vendored
Normal file
46
node_modules/chevrotain/src/text/range.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
export interface IRange {
|
||||
start: number
|
||||
end: number
|
||||
|
||||
contains(num: number): boolean
|
||||
|
||||
containsRange(other: IRange): boolean
|
||||
|
||||
isContainedInRange(other: IRange): boolean
|
||||
|
||||
strictlyContainsRange(other: IRange): boolean
|
||||
|
||||
isStrictlyContainedInRange(other: IRange): boolean
|
||||
}
|
||||
|
||||
export class Range implements IRange {
|
||||
constructor(public start: number, public end: number) {
|
||||
if (!isValidRange(start, end)) {
|
||||
throw new Error("INVALID RANGE")
|
||||
}
|
||||
}
|
||||
|
||||
contains(num: number): boolean {
|
||||
return this.start <= num && this.end >= num
|
||||
}
|
||||
|
||||
containsRange(other: IRange): boolean {
|
||||
return this.start <= other.start && this.end >= other.end
|
||||
}
|
||||
|
||||
isContainedInRange(other: IRange): boolean {
|
||||
return other.containsRange(this)
|
||||
}
|
||||
|
||||
strictlyContainsRange(other: IRange): boolean {
|
||||
return this.start < other.start && this.end > other.end
|
||||
}
|
||||
|
||||
isStrictlyContainedInRange(other: IRange): boolean {
|
||||
return other.strictlyContainsRange(this)
|
||||
}
|
||||
}
|
||||
|
||||
export function isValidRange(start: number, end: number): boolean {
|
||||
return !(start < 0 || end < start)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue