Skip to content
On this page

Home > @taiyuuki/utils > MathRange

MathRange class

This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

数字区间类,构造一个形如 (4, 10] 的区间对象,区分开闭区间。

Signature:

typescript
declare class MathRange
declare class MathRange

Constructors

ConstructorModifiersDescription
(constructor)(r)(BETA) Range 构造函数

Properties

PropertyModifiersTypeDescription
e_openboolean(BETA)
endnumber(BETA)
s_openboolean(BETA)
startnumber(BETA)

Methods

MethodModifiersDescription
cross(other)(BETA) 获取两个区间的交集,如果不存在交集则返回null
equals(other)(BETA) 判断两个区间是否相等
is_between(num)(BETA) 判断一个数字是否在区间内
toString()(BETA) toString 函数返回字符串格式的数字区间。
valid(origin)static(BETA) 验证数字区间是否合法,但不验证数字的大小。

Released under the MIT License.