UNPKG

@typescript-package/range

Version:

A lightweight TypeScript library for managing various types of ranges.

88 lines (87 loc) 4.75 kB
import { Greater } from './greater.class'; import { Less } from './less.class'; /** * The `Inequality` abstract primitive wrapper `object` represents the primitive value greater or less than the given. */ export declare abstract class Inequality<Value extends number> extends Number { #private; /** * The `get` accessor obtains from the private `#greater` property an instance of the `Greater` with a primitive value from a given * `value` of the `Inequality` constructor. * @returns The return value is the `Greater` instance with a primitive value from the given `value` of the `Inequality` constructor. */ get greater(): Greater<Value>; /** * The `get` accessor obtains from the private `#less` property an instance of the `Less` with a primitive value from a given `value` of * the `Inequality` constructor. * @returns The return value is the `Less` instance with a primitive value from the given `value` of the `Inequality` constructor. */ get less(): Less<Value>; /** * Creates a child class instance with the given primitive `value`. * @param value The value of the generic type variable `Value` is the primitive value of a new child class instance. */ constructor(value: Value); /** * The `isBetween()` method checks whether the primitive value is between the range of a specified object. * @param min The minimum range of number type to test. * @param max The maximum range of number type to test. * @returns The return value is a `boolean` type indicating whether the primitive value is between the range of a specified object. */ isBetween(min: number, max: number): boolean; /** * Checks whether the primitive value is between every range of the given `ranges`. * @param ranges A rest parameter of `array` type ranges to test. * @returns The return value is a `boolean` type indicating whether the primitive value is between every range of the * given `ranges`. */ isBetweenEvery(...ranges: [number, number][]): boolean; /** * Checks whether the primitive value is between some given `ranges`. * @param ranges A rest parameter of `array` type ranges to test. * @returns The return value is a `boolean` type indicating whether the primitive value is between some given `ranges`. */ isBetweenSome(...ranges: [number, number][]): boolean; /** * Checks whether the primitive value of a child class instance is greater than the given `value`. * @param value The value of `number` type to test. * @returns The return value is a `boolean` indicating whether the primitive value of a child class instance is greater than the given * `value`. */ greaterThan(value: number): boolean; /** * Checks whether the primitive value of a child class instance is greater than every value of the given `values`. * @param values A rest parameter of the numbers to test. * @returns The return value is a `boolean` indicating whether the primitive value of a child class instance is greater than every value * of the given `values`. */ greaterThanEvery(...values: number[]): boolean; /** * Checks whether the primitive value of a child class instance is greater than some given `values`. * @param values A rest parameter of the numbers to test. * @returns The return value is a `boolean` indicating whether the primitive value of a child class instance is greater than some given * `values`. */ greaterThanSome(...values: number[]): boolean; /** * Checks whether the primitive value of a child class instance is less than the given `value`. * @param value The value of `number` type to test. * @returns The return value is a `boolean` indicating whether the primitive value of a child class instance is **less** than the given * `value`. */ lessThan(value: number): boolean; /** * Checks whether the primitive value of a child class instance is less than every given value. * @param values A rest parameter of the numbers to test. * @returns The return value is a `boolean` indicating whether the primitive value of a child class instance is less than every value of * the given `values`. */ lessThanEvery(...values: number[]): boolean; /** * Checks whether the primitive value of a child class instance is less than some given `values`. * @param values A rest parameter of the numbers to test. * @returns The return value is a `boolean` indicating whether the primitive value of a child class instance is less than some given * `values`. */ lessThanSome(...values: number[]): boolean; }