altheia-async-data-validator
Version:
A very simple, fast and customizable async data validator
83 lines (82 loc) • 1.73 kB
TypeScript
import { TypeBase } from './base';
import { LangList } from '../types/lang';
export declare const messages: LangList;
/**
* Number class
*/
export declare class TypeNumber extends TypeBase {
/**
* Constructor
*/
constructor();
/**
* Try to cast value
*
* @param {mixed} value
* @return {Number|mixed}
*/
_cast(value: any): number | any;
/**
* Test to validate the type of the value
*
* @return {this}
*/
typeof(): this;
/**
* Force a number to be equal or more to the value passed.
*
* @param {number} min
* @return {this}
*/
min(min: number): this;
/**
* Force a number to be equal or less to the value passed.
*
* @param {number} max
* @return {this}
*/
max(max: number): this;
/**
* Force a number to be an integer.
*
* @return {this}
*/
integer(): this;
/**
* Force a number to be unsigned.
*
* @return {this}
*/
unsigned(): this;
/**
* Force a number to be greater than 0.
*
* @return {this}
*/
positive(): this;
/**
* Force a number to be lesser than 0.
*
* @return {this}
*/
negative(): this;
/**
* Force a number to be equal to one of the value passed in the set.
*
* @param {...number} obj
* @return {this}
*/
in(...obj: number[]): this;
/**
* Force a number to be different to all of the value passed in the set.
*
* @param {...number} obj
* @return {this}
*/
not(...obj: number[]): this;
}
declare const def: {
Class: typeof TypeNumber;
messages: LangList;
};
export default def;