@yookue/ts-lang-utils
Advanced tools
Comparing version 0.1.10 to 0.1.11
export { ArrayUtils } from './util/ArrayUtils'; | ||
export { BooleanUtils } from './util/BooleanUtils'; | ||
export { DateUtils } from './util/DateUtils'; | ||
export { JsonUtils } from './util/JsonUtils'; | ||
export { NumberUtils } from './util/NumberUtils'; | ||
export { ObjectUtils } from './util/ObjectUtils'; | ||
@@ -8,2 +10,1 @@ export { RandomUtils } from './util/RandomUtils'; | ||
export { ThreadUtils } from './util/ThreadUtils'; | ||
export { DateUtils } from './util/DateUtils'; |
@@ -26,2 +26,3 @@ var __defProp = Object.defineProperty; | ||
JsonUtils: () => import_JsonUtils.JsonUtils, | ||
NumberUtils: () => import_NumberUtils.NumberUtils, | ||
ObjectUtils: () => import_ObjectUtils.ObjectUtils, | ||
@@ -35,3 +36,5 @@ RandomUtils: () => import_RandomUtils.RandomUtils, | ||
var import_BooleanUtils = require("./util/BooleanUtils"); | ||
var import_DateUtils = require("./util/DateUtils"); | ||
var import_JsonUtils = require("./util/JsonUtils"); | ||
var import_NumberUtils = require("./util/NumberUtils"); | ||
var import_ObjectUtils = require("./util/ObjectUtils"); | ||
@@ -41,3 +44,2 @@ var import_RandomUtils = require("./util/RandomUtils"); | ||
var import_ThreadUtils = require("./util/ThreadUtils"); | ||
var import_DateUtils = require("./util/DateUtils"); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -49,2 +51,3 @@ 0 && (module.exports = { | ||
JsonUtils, | ||
NumberUtils, | ||
ObjectUtils, | ||
@@ -51,0 +54,0 @@ RandomUtils, |
@@ -11,18 +11,18 @@ /** | ||
* | ||
* @param array the array to check | ||
* @return number the length of the given array | ||
* @param {Array<any>} array the array to check | ||
* @return {number} the length of the given array | ||
*/ | ||
static getLength(array?: Array<any>): number; | ||
static getLength(array?: any[]): number; | ||
/** | ||
* Returns the element types of the given array | ||
* | ||
* @param array the array to check | ||
* @return the element types of the given array | ||
* @param {Array<any>} array the array to check | ||
* @return {Array<string>} the element types of the given array | ||
*/ | ||
static getTypeof(array?: Array<any>): string[] | undefined; | ||
static getTypeof(array?: any[]): string[] | undefined; | ||
/** | ||
* Returns whether the given array is empty | ||
* | ||
* @param array the array to check | ||
* @return true if the given array is empty | ||
* @param {Array<any>} array the array to check | ||
* @return {boolean} whether the given array is empty | ||
* | ||
@@ -32,8 +32,8 @@ * @example | ||
*/ | ||
static isEmpty(array?: Array<any>): boolean; | ||
static isEmpty(array?: any[]): boolean; | ||
/** | ||
* Returns whether the given array is not empty | ||
* | ||
* @param array the array to check | ||
* @return true if the given array is not empty | ||
* @param {Array<any>} array the array to check | ||
* @return {boolean} whether the given array is not empty | ||
* | ||
@@ -43,18 +43,18 @@ * @example | ||
*/ | ||
static isNotEmpty(array?: Array<any>): boolean; | ||
static isNotEmpty(array?: any[]): boolean; | ||
/** | ||
* Returns whether each element in the given array is the expected type | ||
* | ||
* @param array the array to check | ||
* @param type the expected element type | ||
* @param relaxed treat null as string or object | ||
* @return true if each element in the given array is the expected type | ||
* @param {Array<any>} array the array to check | ||
* @param {string} type the expected element type | ||
* @param {boolean} relaxed treat null as string or object | ||
* @return {boolean} whether each element in the given array is the expected type | ||
*/ | ||
static isTypeof(array?: Array<any>, type?: string, relaxed?: boolean): boolean; | ||
static isTypeof(array?: any[], type?: string, relaxed?: boolean): boolean; | ||
/** | ||
* Returns whether the given array includes the given element | ||
* | ||
* @param array the array to check | ||
* @param element the element to compare | ||
* @return true if the given array includes the given element | ||
* @param {Array<any>} array the array to check | ||
* @param {any} element the element to compare | ||
* @return {boolean} whether the given array includes the given element | ||
* | ||
@@ -64,8 +64,8 @@ * @example | ||
*/ | ||
static includes<T>(array?: Array<T>, element?: T): boolean; | ||
static includes<T>(array?: T[], element?: T): boolean; | ||
/** | ||
* Returns the max length of the given arrays | ||
* | ||
* @param arrays the arrays to check | ||
* @return number the max length of the given arrays | ||
* @param {Array<any>} arrays the arrays to check | ||
* @return {number} the max length of the given arrays | ||
* | ||
@@ -79,4 +79,4 @@ * @example | ||
* | ||
* @param arrays the arrays to check | ||
* @return number the min length of the given arrays | ||
* @param {Array<any>} arrays the arrays to check | ||
* @return {number} the min length of the given arrays | ||
* | ||
@@ -90,5 +90,5 @@ * @example | ||
* | ||
* @param array the arrays to inspect | ||
* @param startInclusive the starting index, inclusive | ||
* @param endExclusive the ending index, exclusive | ||
* @param {Array<any>} array the arrays to inspect | ||
* @param {number} startInclusive the starting index, inclusive | ||
* @param {number} endExclusive the ending index, exclusive | ||
* | ||
@@ -98,3 +98,3 @@ * @example | ||
*/ | ||
static reverse(array?: Array<any>, startInclusive?: number, endExclusive?: number): void; | ||
static reverse(array?: any[], startInclusive?: number, endExclusive?: number): void; | ||
} |
@@ -31,4 +31,4 @@ var __defProp = Object.defineProperty; | ||
* | ||
* @param array the array to check | ||
* @return number the length of the given array | ||
* @param {Array<any>} array the array to check | ||
* @return {number} the length of the given array | ||
*/ | ||
@@ -41,4 +41,4 @@ static getLength(array) { | ||
* | ||
* @param array the array to check | ||
* @return the element types of the given array | ||
* @param {Array<any>} array the array to check | ||
* @return {Array<string>} the element types of the given array | ||
*/ | ||
@@ -62,4 +62,4 @@ static getTypeof(array) { | ||
* | ||
* @param array the array to check | ||
* @return true if the given array is empty | ||
* @param {Array<any>} array the array to check | ||
* @return {boolean} whether the given array is empty | ||
* | ||
@@ -75,4 +75,4 @@ * @example | ||
* | ||
* @param array the array to check | ||
* @return true if the given array is not empty | ||
* @param {Array<any>} array the array to check | ||
* @return {boolean} whether the given array is not empty | ||
* | ||
@@ -88,6 +88,6 @@ * @example | ||
* | ||
* @param array the array to check | ||
* @param type the expected element type | ||
* @param relaxed treat null as string or object | ||
* @return true if each element in the given array is the expected type | ||
* @param {Array<any>} array the array to check | ||
* @param {string} type the expected element type | ||
* @param {boolean} relaxed treat null as string or object | ||
* @return {boolean} whether each element in the given array is the expected type | ||
*/ | ||
@@ -105,5 +105,5 @@ static isTypeof(array, type, relaxed = false) { | ||
* | ||
* @param array the array to check | ||
* @param element the element to compare | ||
* @return true if the given array includes the given element | ||
* @param {Array<any>} array the array to check | ||
* @param {any} element the element to compare | ||
* @return {boolean} whether the given array includes the given element | ||
* | ||
@@ -119,4 +119,4 @@ * @example | ||
* | ||
* @param arrays the arrays to check | ||
* @return number the max length of the given arrays | ||
* @param {Array<any>} arrays the arrays to check | ||
* @return {number} the max length of the given arrays | ||
* | ||
@@ -139,4 +139,4 @@ * @example | ||
* | ||
* @param arrays the arrays to check | ||
* @return number the min length of the given arrays | ||
* @param {Array<any>} arrays the arrays to check | ||
* @return {number} the min length of the given arrays | ||
* | ||
@@ -163,5 +163,5 @@ * @example | ||
* | ||
* @param array the arrays to inspect | ||
* @param startInclusive the starting index, inclusive | ||
* @param endExclusive the ending index, exclusive | ||
* @param {Array<any>} array the arrays to inspect | ||
* @param {number} startInclusive the starting index, inclusive | ||
* @param {number} endExclusive the ending index, exclusive | ||
* | ||
@@ -168,0 +168,0 @@ * @example |
@@ -11,18 +11,19 @@ /** | ||
* | ||
* @param value the string value to check | ||
* @returns boolean a boolean value from the string value, or undefined if the value cannot be converted | ||
* @param {string | number} value the string value to check | ||
* @returns {boolean} a boolean value from the string value, or undefined if the value cannot be converted | ||
* | ||
* @example | ||
* BooleanUtils.fromString('true'); // true | ||
* BooleanUtils.fromString('yes'); // true | ||
* BooleanUtils.toBoolean(1); // true | ||
* BooleanUtils.toBoolean('true'); // true | ||
* BooleanUtils.toBoolean('yes'); // true | ||
*/ | ||
static fromString(value?: string): boolean | undefined; | ||
static toBoolean(value?: string | number): boolean | undefined; | ||
/** | ||
* Returns a string value from the boolean value | ||
* | ||
* @param value the boolean value to check | ||
* @param truthy the string to represent true | ||
* @param falsy the string to represent false | ||
* @param nil the string to represent undefined or null | ||
* @returns string a string value from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @param {string} truthy the string to represent true | ||
* @param {string} falsy the string to represent false | ||
* @param {string} nil the string to represent undefined or null | ||
* @returns {string} a string value from the boolean value | ||
* | ||
@@ -36,4 +37,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'true'/'false' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'true'/'false' from the boolean value | ||
* | ||
@@ -47,4 +48,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'on'/'off' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'on'/'off' from the boolean value | ||
* | ||
@@ -58,4 +59,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'yes'/'no' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'yes'/'no' from the boolean value | ||
* | ||
@@ -69,4 +70,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'Y'/'N' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'Y'/'N' from the boolean value | ||
* | ||
@@ -80,4 +81,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'T'/'F' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'T'/'F' from the boolean value | ||
* | ||
@@ -91,4 +92,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of '1'/'0' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of '1'/'0' from the boolean value | ||
* | ||
@@ -95,0 +96,0 @@ * @example |
@@ -31,16 +31,21 @@ var __defProp = Object.defineProperty; | ||
* | ||
* @param value the string value to check | ||
* @returns boolean a boolean value from the string value, or undefined if the value cannot be converted | ||
* @param {string | number} value the string value to check | ||
* @returns {boolean} a boolean value from the string value, or undefined if the value cannot be converted | ||
* | ||
* @example | ||
* BooleanUtils.fromString('true'); // true | ||
* BooleanUtils.fromString('yes'); // true | ||
* BooleanUtils.toBoolean(1); // true | ||
* BooleanUtils.toBoolean('true'); // true | ||
* BooleanUtils.toBoolean('yes'); // true | ||
*/ | ||
static fromString(value) { | ||
if (import_StringUtils.StringUtils.equalsAnyIgnoreCase(value, ["true", "yes", "on", "y", "t", "1"])) { | ||
return true; | ||
static toBoolean(value) { | ||
if (typeof value === "number") { | ||
return value > 0; | ||
} else if (typeof value === "string") { | ||
if (import_StringUtils.StringUtils.equalsAnyIgnoreCase(value, ["true", "yes", "on", "y", "t", "1"])) { | ||
return true; | ||
} | ||
if (import_StringUtils.StringUtils.equalsAnyIgnoreCase(value, ["false", "no", "off", "n", "f", "0"])) { | ||
return false; | ||
} | ||
} | ||
if (import_StringUtils.StringUtils.equalsAnyIgnoreCase(value, ["false", "no", "off", "n", "f", "0"])) { | ||
return false; | ||
} | ||
return void 0; | ||
@@ -51,7 +56,7 @@ } | ||
* | ||
* @param value the boolean value to check | ||
* @param truthy the string to represent true | ||
* @param falsy the string to represent false | ||
* @param nil the string to represent undefined or null | ||
* @returns string a string value from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @param {string} truthy the string to represent true | ||
* @param {string} falsy the string to represent false | ||
* @param {string} nil the string to represent undefined or null | ||
* @returns {string} a string value from the boolean value | ||
* | ||
@@ -67,4 +72,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'true'/'false' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'true'/'false' from the boolean value | ||
* | ||
@@ -80,4 +85,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'on'/'off' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'on'/'off' from the boolean value | ||
* | ||
@@ -93,4 +98,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'yes'/'no' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'yes'/'no' from the boolean value | ||
* | ||
@@ -106,4 +111,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'Y'/'N' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'Y'/'N' from the boolean value | ||
* | ||
@@ -119,4 +124,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'T'/'F' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'T'/'F' from the boolean value | ||
* | ||
@@ -132,4 +137,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of '1'/'0' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of '1'/'0' from the boolean value | ||
* | ||
@@ -136,0 +141,0 @@ * @example |
@@ -11,5 +11,5 @@ /** | ||
* | ||
* @param date the date to inspect | ||
* @param amount the amount to add, negative number means minus | ||
* @return Date the year calculated date with the source date and the specified amount | ||
* @param {Date} date the date to inspect | ||
* @param {number} amount the amount to add, negative number means minus | ||
* @return {Date} the year calculated date with the source date and the specified amount | ||
* | ||
@@ -23,5 +23,5 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @param amount the amount to add, negative number means minus | ||
* @return Date the month calculated date with the source date and the specified amount | ||
* @param {Date} date the date to inspect | ||
* @param {number} amount the amount to add, negative number means minus | ||
* @return {Date} the month calculated date with the source date and the specified amount | ||
* | ||
@@ -35,5 +35,5 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @param amount the amount to add, negative number means minus | ||
* @return Date the day calculated date with the source date and the specified amount | ||
* @param {Date} date the date to inspect | ||
* @param {number} amount the amount to add, negative number means minus | ||
* @return {Date} the day calculated date with the source date and the specified amount | ||
* | ||
@@ -47,5 +47,5 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @param format the date/time format string | ||
* @return string the formatted string that represent the given date | ||
* @param {Date} date the date to inspect | ||
* @param {string} format the date/time format string | ||
* @return {string} the formatted string that represent the given date | ||
*/ | ||
@@ -56,4 +56,4 @@ static formatDateTime(date: Date, format: string): string | undefined; | ||
* | ||
* @param format the date format string | ||
* @return string the current date | ||
* @param {string} format the date format string | ||
* @return {string} the current date | ||
*/ | ||
@@ -64,4 +64,4 @@ static getCurrentDate(format?: string): string; | ||
* | ||
* @param format the date time format string | ||
* @return string the current date time | ||
* @param {string} format the date time format string | ||
* @return {string} the current date time | ||
*/ | ||
@@ -72,4 +72,4 @@ static getCurrentDateTime(format?: string): string; | ||
* | ||
* @param format the time format string | ||
* @return string the current time | ||
* @param {string} format the time format string | ||
* @return {string} the current time | ||
*/ | ||
@@ -80,4 +80,4 @@ static getCurrentTime(format?: string): string; | ||
* | ||
* @param date the date to inspect | ||
* @return Date the start year date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the start year date of the given date | ||
* | ||
@@ -91,4 +91,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the start month date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the start month date of the given date | ||
* | ||
@@ -102,4 +102,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the start day date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the start day date of the given date | ||
* | ||
@@ -113,4 +113,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the end year date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the end year date of the given date | ||
* | ||
@@ -124,4 +124,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the end month date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the end month date of the given date | ||
* | ||
@@ -135,4 +135,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the end day date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the end day date of the given date | ||
* | ||
@@ -146,4 +146,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @returns string the timezone of the given date | ||
* @param {Date} date the date to inspect | ||
* @returns {string} the timezone of the given date | ||
*/ | ||
@@ -154,4 +154,4 @@ static getTimezone(date?: Date): string; | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is the first day of month | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is the first day of month | ||
* | ||
@@ -166,4 +166,4 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is the last day of month | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is the last day of month | ||
* | ||
@@ -178,4 +178,4 @@ * @example | ||
* | ||
* @param dateYear the date or year to check | ||
* @return boolean whether the date or year is a leap year | ||
* @param {Date | number} dateYear the date or year to check | ||
* @return {boolean} whether the date or year is a leap year | ||
* | ||
@@ -190,5 +190,5 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @param comparison the date to compare | ||
* @return whether the given date is same year with the comparison date | ||
* @param {Date} date the date to check | ||
* @param {Date} comparison the date to compare | ||
* @return {boolean} whether the given date is same year with the comparison date | ||
* | ||
@@ -202,6 +202,6 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @param comparison the date to compare | ||
* @param deepCompare whether compare deeply with year | ||
* @return whether the given date is same month with the comparison date | ||
* @param {Date} date the date to check | ||
* @param {Date} comparison the date to compare | ||
* @param {boolean} deepCompare whether compare deeply with year | ||
* @return {boolean} whether the given date is same month with the comparison date | ||
* | ||
@@ -215,6 +215,6 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @param comparison the date to compare | ||
* @param deepCompare whether compare deeply with year | ||
* @return whether the given date is same day with the comparison date | ||
* @param {Date} date the date to check | ||
* @param {Date} comparison the date to compare | ||
* @param {boolean} deepCompare whether compare deeply with year | ||
* @return {boolean} whether the given date is same day with the comparison date | ||
* | ||
@@ -228,4 +228,4 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is a weekend | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is a weekend | ||
* | ||
@@ -239,4 +239,4 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is yesterday | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is yesterday | ||
*/ | ||
@@ -247,6 +247,6 @@ static isYesterday(date: Date): boolean; | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is tomorrow | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is tomorrow | ||
*/ | ||
static isTomorrow(date: Date): boolean; | ||
} |
@@ -30,5 +30,5 @@ var __defProp = Object.defineProperty; | ||
* | ||
* @param date the date to inspect | ||
* @param amount the amount to add, negative number means minus | ||
* @return Date the year calculated date with the source date and the specified amount | ||
* @param {Date} date the date to inspect | ||
* @param {number} amount the amount to add, negative number means minus | ||
* @return {Date} the year calculated date with the source date and the specified amount | ||
* | ||
@@ -49,5 +49,5 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @param amount the amount to add, negative number means minus | ||
* @return Date the month calculated date with the source date and the specified amount | ||
* @param {Date} date the date to inspect | ||
* @param {number} amount the amount to add, negative number means minus | ||
* @return {Date} the month calculated date with the source date and the specified amount | ||
* | ||
@@ -68,5 +68,5 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @param amount the amount to add, negative number means minus | ||
* @return Date the day calculated date with the source date and the specified amount | ||
* @param {Date} date the date to inspect | ||
* @param {number} amount the amount to add, negative number means minus | ||
* @return {Date} the day calculated date with the source date and the specified amount | ||
* | ||
@@ -87,5 +87,5 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @param format the date/time format string | ||
* @return string the formatted string that represent the given date | ||
* @param {Date} date the date to inspect | ||
* @param {string} format the date/time format string | ||
* @return {string} the formatted string that represent the given date | ||
*/ | ||
@@ -123,4 +123,4 @@ static formatDateTime(date, format) { | ||
* | ||
* @param format the date format string | ||
* @return string the current date | ||
* @param {string} format the date format string | ||
* @return {string} the current date | ||
*/ | ||
@@ -133,4 +133,4 @@ static getCurrentDate(format = "yyyy-MM-dd") { | ||
* | ||
* @param format the date time format string | ||
* @return string the current date time | ||
* @param {string} format the date time format string | ||
* @return {string} the current date time | ||
*/ | ||
@@ -143,4 +143,4 @@ static getCurrentDateTime(format = "yyyy-MM-dd hh:mm:ss") { | ||
* | ||
* @param format the time format string | ||
* @return string the current time | ||
* @param {string} format the time format string | ||
* @return {string} the current time | ||
*/ | ||
@@ -153,4 +153,4 @@ static getCurrentTime(format = "hh:mm:ss") { | ||
* | ||
* @param date the date to inspect | ||
* @return Date the start year date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the start year date of the given date | ||
* | ||
@@ -169,4 +169,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the start month date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the start month date of the given date | ||
* | ||
@@ -185,4 +185,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the start day date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the start day date of the given date | ||
* | ||
@@ -200,4 +200,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the end year date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the end year date of the given date | ||
* | ||
@@ -216,4 +216,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the end month date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the end month date of the given date | ||
* | ||
@@ -232,4 +232,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the end day date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the end day date of the given date | ||
* | ||
@@ -247,4 +247,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @returns string the timezone of the given date | ||
* @param {Date} date the date to inspect | ||
* @returns {string} the timezone of the given date | ||
*/ | ||
@@ -262,4 +262,4 @@ static getTimezone(date = /* @__PURE__ */ new Date()) { | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is the first day of month | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is the first day of month | ||
* | ||
@@ -276,4 +276,4 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is the last day of month | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is the last day of month | ||
* | ||
@@ -290,4 +290,4 @@ * @example | ||
* | ||
* @param dateYear the date or year to check | ||
* @return boolean whether the date or year is a leap year | ||
* @param {Date | number} dateYear the date or year to check | ||
* @return {boolean} whether the date or year is a leap year | ||
* | ||
@@ -305,5 +305,5 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @param comparison the date to compare | ||
* @return whether the given date is same year with the comparison date | ||
* @param {Date} date the date to check | ||
* @param {Date} comparison the date to compare | ||
* @return {boolean} whether the given date is same year with the comparison date | ||
* | ||
@@ -319,6 +319,6 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @param comparison the date to compare | ||
* @param deepCompare whether compare deeply with year | ||
* @return whether the given date is same month with the comparison date | ||
* @param {Date} date the date to check | ||
* @param {Date} comparison the date to compare | ||
* @param {boolean} deepCompare whether compare deeply with year | ||
* @return {boolean} whether the given date is same month with the comparison date | ||
* | ||
@@ -334,6 +334,6 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @param comparison the date to compare | ||
* @param deepCompare whether compare deeply with year | ||
* @return whether the given date is same day with the comparison date | ||
* @param {Date} date the date to check | ||
* @param {Date} comparison the date to compare | ||
* @param {boolean} deepCompare whether compare deeply with year | ||
* @return {boolean} whether the given date is same day with the comparison date | ||
* | ||
@@ -349,4 +349,4 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is a weekend | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is a weekend | ||
* | ||
@@ -362,4 +362,4 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is yesterday | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is yesterday | ||
*/ | ||
@@ -372,4 +372,4 @@ static isYesterday(date) { | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is tomorrow | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is tomorrow | ||
*/ | ||
@@ -376,0 +376,0 @@ static isTomorrow(date) { |
@@ -11,4 +11,4 @@ /** | ||
* | ||
* @param text the string to check | ||
* @return true if the given object is a JSON string | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given object is a JSON string | ||
* | ||
@@ -24,4 +24,4 @@ * @example | ||
* | ||
* @param object the object to inspect | ||
* @return string that represents the given object | ||
* @param {any} object the object to inspect | ||
* @return {string} a JSON string that represents the given object | ||
* | ||
@@ -28,0 +28,0 @@ * @example |
@@ -31,4 +31,4 @@ var __defProp = Object.defineProperty; | ||
* | ||
* @param text the string to check | ||
* @return true if the given object is a JSON string | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given object is a JSON string | ||
* | ||
@@ -55,4 +55,4 @@ * @example | ||
* | ||
* @param object the object to inspect | ||
* @return string that represents the given object | ||
* @param {any} object the object to inspect | ||
* @return {string} a JSON string that represents the given object | ||
* | ||
@@ -59,0 +59,0 @@ * @example |
@@ -11,4 +11,4 @@ /** | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is null or undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is null or undefined | ||
* | ||
@@ -24,4 +24,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not null or undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not null or undefined | ||
* | ||
@@ -36,4 +36,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is null | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is null | ||
* | ||
@@ -48,4 +48,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not null | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not null | ||
* | ||
@@ -59,4 +59,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is undefined | ||
* | ||
@@ -71,4 +71,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not undefined | ||
* | ||
@@ -82,4 +82,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is empty | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is empty | ||
* | ||
@@ -96,4 +96,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not empty | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not empty | ||
* | ||
@@ -108,4 +108,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return true if the given object is a plain object | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is a plain object | ||
* | ||
@@ -120,4 +120,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is a promise | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is a promise | ||
* | ||
@@ -132,4 +132,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is a prototype | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is a prototype | ||
* | ||
@@ -144,4 +144,4 @@ * @example | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are null or undefined | ||
* | ||
@@ -152,8 +152,8 @@ * @example | ||
*/ | ||
static allNil(...objects: Array<any>): boolean; | ||
static allNil(...objects: any[]): boolean; | ||
/** | ||
* Returns whether all the given objects are not null or undefined | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are not null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are not null or undefined | ||
* | ||
@@ -165,8 +165,8 @@ * @example | ||
*/ | ||
static allNotNil(...objects: Array<any>): boolean; | ||
static allNotNil(...objects: any[]): boolean; | ||
/** | ||
* Returns whether any of the given objects is null or undefined | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is null or undefined | ||
* | ||
@@ -177,8 +177,8 @@ * @example | ||
*/ | ||
static anyNil(...objects: Array<any>): boolean; | ||
static anyNil(...objects: any[]): boolean; | ||
/** | ||
* Returns whether any of the given objects is not null or undefined | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is not null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is not null or undefined | ||
* | ||
@@ -189,8 +189,8 @@ * @example | ||
*/ | ||
static anyNotNil(...objects: Array<any>): boolean; | ||
static anyNotNil(...objects: any[]): boolean; | ||
/** | ||
* Returns whether all the given objects are empty | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are empty | ||
* | ||
@@ -201,8 +201,8 @@ * @example | ||
*/ | ||
static allEmpty(...objects: Array<any>): boolean; | ||
static allEmpty(...objects: any[]): boolean; | ||
/** | ||
* Returns whether all the given objects are not empty | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are not empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are not empty | ||
* | ||
@@ -214,8 +214,8 @@ * @example | ||
*/ | ||
static allNotEmpty(...objects: Array<any>): boolean; | ||
static allNotEmpty(...objects: any[]): boolean; | ||
/** | ||
* Returns whether any of the given objects is empty | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is empty | ||
* | ||
@@ -226,8 +226,8 @@ * @example | ||
*/ | ||
static anyEmpty(...objects: Array<any>): boolean; | ||
static anyEmpty(...objects: any[]): boolean; | ||
/** | ||
* Returns whether any of the given objects is not empty | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is not empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is not empty | ||
* | ||
@@ -238,8 +238,8 @@ * @example | ||
*/ | ||
static anyNotEmpty(...objects: Array<any>): boolean; | ||
static anyNotEmpty(...objects: any[]): boolean; | ||
/** | ||
* Returns the first none nil element in the given array, or null if all elements are nil | ||
* | ||
* @param objects the objects to check | ||
* @returns any the first none nil element in the given array, or null if all elements are nil | ||
* @param {Array<any>} objects the objects to check | ||
* @returns {any} the first none nil element in the given array, or null if all elements are nil | ||
* | ||
@@ -249,9 +249,9 @@ * @example | ||
*/ | ||
static firstNonNil(...objects: Array<any>): any; | ||
static firstNonNil(...objects: any[]): any; | ||
/** | ||
* Returns the property value if property name is present on the given object | ||
* | ||
* @param object the object to inspect | ||
* @param prop the property name to inspect, parent property and child property are concat with dot (.) | ||
* @return any the property value if property name is present on the given object | ||
* @param {any} object the object to inspect | ||
* @param {string} prop the property name to inspect, parent property and child property are concat with dot (.) | ||
* @return {any} the property value if property name is present on the given object | ||
* | ||
@@ -265,5 +265,5 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @param prop the property name to check | ||
* @return true if the object has the specified property | ||
* @param {any} object the object to check | ||
* @param {string} prop the property name to check | ||
* @return {boolean} whether the object has the specified property | ||
* | ||
@@ -278,4 +278,4 @@ * @example | ||
* | ||
* @param object the object to inspect | ||
* @returns Array<string> the keys of the given object | ||
* @param {any} object the object to inspect | ||
* @returns {Array<string>} the keys of the given object | ||
* | ||
@@ -289,7 +289,7 @@ * @example | ||
* | ||
* @param object the object to inspect | ||
* @param nil the default string if the object is nil | ||
* @return string the string representation of the given object | ||
* @param {any} object the object to inspect | ||
* @param {string} nil the default string if the object is nil | ||
* @return {string} a string representation of the given object | ||
*/ | ||
static toString(object?: any, nil?: string | null): string; | ||
} |
@@ -29,4 +29,4 @@ var __defProp = Object.defineProperty; | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is null or undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is null or undefined | ||
* | ||
@@ -44,4 +44,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not null or undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not null or undefined | ||
* | ||
@@ -58,4 +58,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is null | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is null | ||
* | ||
@@ -72,4 +72,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not null | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not null | ||
* | ||
@@ -85,4 +85,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is undefined | ||
* | ||
@@ -99,4 +99,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not undefined | ||
* | ||
@@ -112,4 +112,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is empty | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is empty | ||
* | ||
@@ -141,4 +141,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not empty | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not empty | ||
* | ||
@@ -155,4 +155,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return true if the given object is a plain object | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is a plain object | ||
* | ||
@@ -169,4 +169,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is a promise | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is a promise | ||
* | ||
@@ -183,4 +183,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is a prototype | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is a prototype | ||
* | ||
@@ -202,4 +202,4 @@ * @example | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are null or undefined | ||
* | ||
@@ -216,4 +216,4 @@ * @example | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are not null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are not null or undefined | ||
* | ||
@@ -231,4 +231,4 @@ * @example | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is null or undefined | ||
* | ||
@@ -245,4 +245,4 @@ * @example | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is not null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is not null or undefined | ||
* | ||
@@ -259,4 +259,4 @@ * @example | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are empty | ||
* | ||
@@ -273,4 +273,4 @@ * @example | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are not empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are not empty | ||
* | ||
@@ -288,4 +288,4 @@ * @example | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is empty | ||
* | ||
@@ -302,4 +302,4 @@ * @example | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is not empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is not empty | ||
* | ||
@@ -316,4 +316,4 @@ * @example | ||
* | ||
* @param objects the objects to check | ||
* @returns any the first none nil element in the given array, or null if all elements are nil | ||
* @param {Array<any>} objects the objects to check | ||
* @returns {any} the first none nil element in the given array, or null if all elements are nil | ||
* | ||
@@ -337,5 +337,5 @@ * @example | ||
* | ||
* @param object the object to inspect | ||
* @param prop the property name to inspect, parent property and child property are concat with dot (.) | ||
* @return any the property value if property name is present on the given object | ||
* @param {any} object the object to inspect | ||
* @param {string} prop the property name to inspect, parent property and child property are concat with dot (.) | ||
* @return {any} the property value if property name is present on the given object | ||
* | ||
@@ -358,5 +358,5 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @param prop the property name to check | ||
* @return true if the object has the specified property | ||
* @param {any} object the object to check | ||
* @param {string} prop the property name to check | ||
* @return {boolean} whether the object has the specified property | ||
* | ||
@@ -373,4 +373,4 @@ * @example | ||
* | ||
* @param object the object to inspect | ||
* @returns Array<string> the keys of the given object | ||
* @param {any} object the object to inspect | ||
* @returns {Array<string>} the keys of the given object | ||
* | ||
@@ -398,5 +398,5 @@ * @example | ||
* | ||
* @param object the object to inspect | ||
* @param nil the default string if the object is nil | ||
* @return string the string representation of the given object | ||
* @param {any} object the object to inspect | ||
* @param {string} nil the default string if the object is nil | ||
* @return {string} a string representation of the given object | ||
*/ | ||
@@ -403,0 +403,0 @@ static toString(object, nil) { |
@@ -11,3 +11,3 @@ /** | ||
* | ||
* @return boolean the random boolean value | ||
* @return {boolean} the random boolean value | ||
* | ||
@@ -21,4 +21,4 @@ * @example | ||
* | ||
* @param array the array to random | ||
* @return any a random element of the array | ||
* @param {Array<any>} array the array to random | ||
* @return {any} a random element of the array | ||
* | ||
@@ -28,9 +28,9 @@ * @example | ||
*/ | ||
static randomElement(array: Array<any>): any; | ||
static randomElement(array: any[]): any; | ||
/** | ||
* Returns a random element array with the specified length within the given array | ||
* | ||
* @param array the array to random | ||
* @param size the size to generate | ||
* @return Array<any> a random element array with the specified length within the given array | ||
* @param {Array<any>} array the array to random | ||
* @param {number} size the size to generate | ||
* @return {Array<any>} a random element array with the specified length within the given array | ||
* | ||
@@ -44,5 +44,5 @@ * @example | ||
* | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return number the random integer that between the min value (inclusive) and the max value (exclusive) | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {number} a random integer that between the min value (inclusive) and the max value (exclusive) | ||
* | ||
@@ -57,6 +57,6 @@ * @example | ||
* | ||
* @param size the size of the expected array | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return Array<number> the random integer array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* @param {number} size the size of the expected array | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {Array<number>} a random integer array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* | ||
@@ -71,5 +71,5 @@ * @example | ||
* | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return number the random number that between the min value (inclusive) and the max value (exclusive) | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {number} a random number that between the min value (inclusive) and the max value (exclusive) | ||
* | ||
@@ -84,6 +84,6 @@ * @example | ||
* | ||
* @param size the size of the expected array | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return Array<number> the random number array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* @param {number} size the size of the expected array | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {Array<number>} a random number array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* | ||
@@ -90,0 +90,0 @@ * @example |
@@ -30,3 +30,3 @@ var __defProp = Object.defineProperty; | ||
* | ||
* @return boolean the random boolean value | ||
* @return {boolean} the random boolean value | ||
* | ||
@@ -42,4 +42,4 @@ * @example | ||
* | ||
* @param array the array to random | ||
* @return any a random element of the array | ||
* @param {Array<any>} array the array to random | ||
* @return {any} a random element of the array | ||
* | ||
@@ -55,5 +55,5 @@ * @example | ||
* | ||
* @param array the array to random | ||
* @param size the size to generate | ||
* @return Array<any> a random element array with the specified length within the given array | ||
* @param {Array<any>} array the array to random | ||
* @param {number} size the size to generate | ||
* @return {Array<any>} a random element array with the specified length within the given array | ||
* | ||
@@ -79,5 +79,5 @@ * @example | ||
* | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return number the random integer that between the min value (inclusive) and the max value (exclusive) | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {number} a random integer that between the min value (inclusive) and the max value (exclusive) | ||
* | ||
@@ -94,6 +94,6 @@ * @example | ||
* | ||
* @param size the size of the expected array | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return Array<number> the random integer array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* @param {number} size the size of the expected array | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {Array<number>} a random integer array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* | ||
@@ -117,5 +117,5 @@ * @example | ||
* | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return number the random number that between the min value (inclusive) and the max value (exclusive) | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {number} a random number that between the min value (inclusive) and the max value (exclusive) | ||
* | ||
@@ -139,6 +139,6 @@ * @example | ||
* | ||
* @param size the size of the expected array | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return Array<number> the random number array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* @param {number} size the size of the expected array | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {Array<number>} a random number array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* | ||
@@ -145,0 +145,0 @@ * @example |
@@ -11,4 +11,4 @@ /** | ||
* | ||
* @param text the source string to check | ||
* @return number the length of the given string | ||
* @param {string} text the source string to check | ||
* @return {number} the length of the given string | ||
*/ | ||
@@ -19,4 +19,4 @@ static getLength(text?: string): number; | ||
* | ||
* @param text the string to check | ||
* @returns true if the given string is empty | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is empty | ||
* | ||
@@ -31,4 +31,4 @@ * @example | ||
* | ||
* @param text the string to check | ||
* @returns true if the given string is not empty | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is not empty | ||
* | ||
@@ -43,4 +43,4 @@ * @example | ||
* @description check if all the characters in the given string is whitespace or line separators | ||
* @param text the string to check | ||
* @returns true if the given string is blank | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is blank | ||
* | ||
@@ -55,4 +55,4 @@ * @example | ||
* | ||
* @param text the string to check | ||
* @returns true if the given string is not blank | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is not blank | ||
* | ||
@@ -66,4 +66,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are empty | ||
* | ||
@@ -78,4 +78,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are not empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are not empty | ||
* | ||
@@ -91,4 +91,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is empty | ||
* | ||
@@ -103,4 +103,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is not empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is not empty | ||
* | ||
@@ -115,4 +115,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are blank | ||
* | ||
@@ -127,4 +127,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are not blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are not blank | ||
* | ||
@@ -140,4 +140,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is blank | ||
* | ||
@@ -152,4 +152,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is not blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is not blank | ||
* | ||
@@ -164,4 +164,4 @@ * @example | ||
* | ||
* @param text the text to check | ||
* @return string an empty value if the given text is undefined | ||
* @param {string} text the text to check | ||
* @return {string} an empty value if the given text is undefined | ||
* | ||
@@ -175,5 +175,5 @@ * @example | ||
* | ||
* @param text the text to check | ||
* @param defaultValue the default value placeholder | ||
* @return string the default value if the given text is empty, or the text self if it is not empty | ||
* @param {string} text the text to check | ||
* @param {string} defaultValue the default value placeholder | ||
* @return {string} the default value if the given text is empty, or the text self if it is not empty | ||
* | ||
@@ -187,5 +187,5 @@ * @example | ||
* | ||
* @param text the text to check | ||
* @param defaultValue the default value placeholder | ||
* @return string the default value if the given text is blank, or the text self if it is not blank | ||
* @param {string} text the text to check | ||
* @param {string} defaultValue the default value placeholder | ||
* @return {string} the default value if the given text is blank, or the text self if it is not blank | ||
* | ||
@@ -199,5 +199,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given strings are equal | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given strings are equal | ||
* | ||
@@ -212,5 +212,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given strings are equal, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given strings are equal, case-insensitive | ||
* | ||
@@ -224,5 +224,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the given string equals to any of the comparison strings | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the given string equals to any of the comparison strings | ||
* | ||
@@ -236,5 +236,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the given string equals to any of the comparison strings, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the given string equals to any of the comparison strings, case-insensitive | ||
* | ||
@@ -248,10 +248,10 @@ * @example | ||
* | ||
* @param text the source string to inspect | ||
* @param params the parameters to replaced with | ||
* @return string the replaced string of the source string | ||
* @param {string} text the source string to inspect | ||
* @param {Array<any>} params the parameters to replaced with | ||
* @return {string} the replaced string of the source string | ||
* | ||
* @example | ||
* StringUtils.formatBrace("foo{}", "bar"); // "foobar" | ||
* StringUtils.formatBrace("foobar{}"); // "foobar{}" | ||
* StringUtils.formatBrace("hello {}, foo{}", "world", "bar"); // "hello world, foobar" | ||
* StringUtils.formatBrace('foo{}', 'bar'); // 'foobar' | ||
* StringUtils.formatBrace('foobar{}'); // 'foobar{}' | ||
* StringUtils.formatBrace('hello {}, foo{}', 'world', 'bar'); // 'hello world, foobar' | ||
*/ | ||
@@ -262,5 +262,5 @@ static formatBrace(text?: string, ...params: Array<any>): string | undefined; | ||
* | ||
* @param text the source string to inspect | ||
* @param params the parameters to replaced with | ||
* @return string the replaced string of the source string | ||
* @param {string} text the source string to inspect | ||
* @param {Array<any>} params the parameters to replaced with | ||
* @return {string} the replaced string of the source string | ||
* | ||
@@ -274,9 +274,9 @@ * @see "https://github.com/samsonjs/format/blob/main/format.js" | ||
*/ | ||
static formatPercent(text: string, ...params: Array<any>): string | undefined; | ||
static formatPercent(text?: string, ...params: Array<any>): string | undefined; | ||
/** | ||
* Returns the replaced string of the source string (named placeholder) with the given parameters | ||
* | ||
* @param text the source string to inspect | ||
* @param params the parameters to replaced with, in the form of key values | ||
* @return string the replaced string of the source string | ||
* @param {string} text the source string to inspect | ||
* @param {Record<string, any>} params the parameters to replaced with, in the form of key values | ||
* @return {string} the replaced string of the source string | ||
* | ||
@@ -295,5 +295,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given text includes the comparison string | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given text includes the comparison string | ||
* | ||
@@ -307,5 +307,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given text includes the comparison string, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given text includes the comparison string, case-insensitive | ||
* | ||
@@ -319,5 +319,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the given text includes the comparison string | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the given text includes the comparison string | ||
* | ||
@@ -327,9 +327,9 @@ * @example | ||
*/ | ||
static includesAny(text: string, comparisons: Array<string | undefined>): boolean; | ||
static includesAny(text?: string, comparisons?: Array<string | undefined>): boolean; | ||
/** | ||
* Returns whether the given text includes to any of the comparison strings, case-insensitive | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the text includes the comparison string, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the text includes the comparison string, case-insensitive | ||
* | ||
@@ -339,9 +339,9 @@ * @example | ||
*/ | ||
static includesAnyIgnoreCase(text: string, comparisons: Array<string | undefined>): boolean; | ||
static includesAnyIgnoreCase(text?: string, comparisons?: Array<string | undefined>): boolean; | ||
/** | ||
* Returns a string that trimmed from the given string | ||
* | ||
* @param text the string to trim | ||
* @param emptyAsNull whether to return null if the trimmed result is empty | ||
* @return string the trimmed string value from the given string | ||
* @param {string} text the string to trim | ||
* @param {boolean} emptyAsNull whether to return null if the trimmed result is empty | ||
* @return {string} the trimmed string value from the given string | ||
* | ||
@@ -348,0 +348,0 @@ * @example |
@@ -31,4 +31,4 @@ var __defProp = Object.defineProperty; | ||
* | ||
* @param text the source string to check | ||
* @return number the length of the given string | ||
* @param {string} text the source string to check | ||
* @return {number} the length of the given string | ||
*/ | ||
@@ -41,4 +41,4 @@ static getLength(text) { | ||
* | ||
* @param text the string to check | ||
* @returns true if the given string is empty | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is empty | ||
* | ||
@@ -55,4 +55,4 @@ * @example | ||
* | ||
* @param text the string to check | ||
* @returns true if the given string is not empty | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is not empty | ||
* | ||
@@ -69,4 +69,4 @@ * @example | ||
* @description check if all the characters in the given string is whitespace or line separators | ||
* @param text the string to check | ||
* @returns true if the given string is blank | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is blank | ||
* | ||
@@ -83,4 +83,4 @@ * @example | ||
* | ||
* @param text the string to check | ||
* @returns true if the given string is not blank | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is not blank | ||
* | ||
@@ -96,4 +96,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are empty | ||
* | ||
@@ -110,4 +110,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are not empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are not empty | ||
* | ||
@@ -125,4 +125,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is empty | ||
* | ||
@@ -139,4 +139,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is not empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is not empty | ||
* | ||
@@ -148,3 +148,3 @@ * @example | ||
static anyNotEmpty(...texts) { | ||
return texts && texts.length > 0 && texts.some((text) => this.isNotEmpty(text)); | ||
return texts && (texts == null ? void 0 : texts.length) > 0 && texts.some((text) => this.isNotEmpty(text)); | ||
} | ||
@@ -154,4 +154,4 @@ /** | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are blank | ||
* | ||
@@ -168,4 +168,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are not blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are not blank | ||
* | ||
@@ -183,4 +183,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is blank | ||
* | ||
@@ -197,4 +197,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is not blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is not blank | ||
* | ||
@@ -211,4 +211,4 @@ * @example | ||
* | ||
* @param text the text to check | ||
* @return string an empty value if the given text is undefined | ||
* @param {string} text the text to check | ||
* @return {string} an empty value if the given text is undefined | ||
* | ||
@@ -224,5 +224,5 @@ * @example | ||
* | ||
* @param text the text to check | ||
* @param defaultValue the default value placeholder | ||
* @return string the default value if the given text is empty, or the text self if it is not empty | ||
* @param {string} text the text to check | ||
* @param {string} defaultValue the default value placeholder | ||
* @return {string} the default value if the given text is empty, or the text self if it is not empty | ||
* | ||
@@ -238,5 +238,5 @@ * @example | ||
* | ||
* @param text the text to check | ||
* @param defaultValue the default value placeholder | ||
* @return string the default value if the given text is blank, or the text self if it is not blank | ||
* @param {string} text the text to check | ||
* @param {string} defaultValue the default value placeholder | ||
* @return {string} the default value if the given text is blank, or the text self if it is not blank | ||
* | ||
@@ -252,5 +252,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given strings are equal | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given strings are equal | ||
* | ||
@@ -273,5 +273,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given strings are equal, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given strings are equal, case-insensitive | ||
* | ||
@@ -293,5 +293,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the given string equals to any of the comparison strings | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the given string equals to any of the comparison strings | ||
* | ||
@@ -307,5 +307,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the given string equals to any of the comparison strings, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the given string equals to any of the comparison strings, case-insensitive | ||
* | ||
@@ -324,10 +324,10 @@ * @example | ||
* | ||
* @param text the source string to inspect | ||
* @param params the parameters to replaced with | ||
* @return string the replaced string of the source string | ||
* @param {string} text the source string to inspect | ||
* @param {Array<any>} params the parameters to replaced with | ||
* @return {string} the replaced string of the source string | ||
* | ||
* @example | ||
* StringUtils.formatBrace("foo{}", "bar"); // "foobar" | ||
* StringUtils.formatBrace("foobar{}"); // "foobar{}" | ||
* StringUtils.formatBrace("hello {}, foo{}", "world", "bar"); // "hello world, foobar" | ||
* StringUtils.formatBrace('foo{}', 'bar'); // 'foobar' | ||
* StringUtils.formatBrace('foobar{}'); // 'foobar{}' | ||
* StringUtils.formatBrace('hello {}, foo{}', 'world', 'bar'); // 'hello world, foobar' | ||
*/ | ||
@@ -347,5 +347,5 @@ static formatBrace(text, ...params) { | ||
* | ||
* @param text the source string to inspect | ||
* @param params the parameters to replaced with | ||
* @return string the replaced string of the source string | ||
* @param {string} text the source string to inspect | ||
* @param {Array<any>} params the parameters to replaced with | ||
* @return {string} the replaced string of the source string | ||
* | ||
@@ -445,5 +445,5 @@ * @see "https://github.com/samsonjs/format/blob/main/format.js" | ||
* | ||
* @param text the source string to inspect | ||
* @param params the parameters to replaced with, in the form of key values | ||
* @return string the replaced string of the source string | ||
* @param {string} text the source string to inspect | ||
* @param {Record<string, any>} params the parameters to replaced with, in the form of key values | ||
* @return {string} the replaced string of the source string | ||
* | ||
@@ -471,5 +471,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given text includes the comparison string | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given text includes the comparison string | ||
* | ||
@@ -485,5 +485,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given text includes the comparison string, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given text includes the comparison string, case-insensitive | ||
* | ||
@@ -500,5 +500,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the given text includes the comparison string | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the given text includes the comparison string | ||
* | ||
@@ -509,3 +509,6 @@ * @example | ||
static includesAny(text, comparisons) { | ||
return import_ObjectUtils.ObjectUtils.allNotNil(text, comparisons) && (comparisons == null ? void 0 : comparisons.some((comparison) => this.includes(text, comparison))); | ||
if (import_ObjectUtils.ObjectUtils.anyNil(text, comparisons)) { | ||
return false; | ||
} | ||
return comparisons == null ? void 0 : comparisons.some((comparison) => this.includes(text, comparison)); | ||
} | ||
@@ -515,5 +518,5 @@ /** | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the text includes the comparison string, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the text includes the comparison string, case-insensitive | ||
* | ||
@@ -524,3 +527,6 @@ * @example | ||
static includesAnyIgnoreCase(text, comparisons) { | ||
return import_ObjectUtils.ObjectUtils.allNotNil(text, comparisons) && (comparisons == null ? void 0 : comparisons.some((comparison) => this.includesIgnoreCase(text, comparison))); | ||
if (import_ObjectUtils.ObjectUtils.anyNil(text, comparisons)) { | ||
return false; | ||
} | ||
return comparisons == null ? void 0 : comparisons.some((comparison) => this.includesIgnoreCase(text, comparison)); | ||
} | ||
@@ -530,5 +536,5 @@ /** | ||
* | ||
* @param text the string to trim | ||
* @param emptyAsNull whether to return null if the trimmed result is empty | ||
* @return string the trimmed string value from the given string | ||
* @param {string} text the string to trim | ||
* @param {boolean} emptyAsNull whether to return null if the trimmed result is empty | ||
* @return {string} the trimmed string value from the given string | ||
* | ||
@@ -535,0 +541,0 @@ * @example |
@@ -11,4 +11,4 @@ /** | ||
* | ||
* @param microseconds the amount of time to sleep, in microseconds | ||
* @return Promise<void> a promise that could be resolved | ||
* @param {number} microseconds the amount of time to sleep, in microseconds | ||
* @return {Promise<void>} a promise that could be resolved | ||
* | ||
@@ -15,0 +15,0 @@ * @example |
@@ -29,4 +29,4 @@ var __defProp = Object.defineProperty; | ||
* | ||
* @param microseconds the amount of time to sleep, in microseconds | ||
* @return Promise<void> a promise that could be resolved | ||
* @param {number} microseconds the amount of time to sleep, in microseconds | ||
* @return {Promise<void>} a promise that could be resolved | ||
* | ||
@@ -33,0 +33,0 @@ * @example |
export { ArrayUtils } from './util/ArrayUtils'; | ||
export { BooleanUtils } from './util/BooleanUtils'; | ||
export { DateUtils } from './util/DateUtils'; | ||
export { JsonUtils } from './util/JsonUtils'; | ||
export { NumberUtils } from './util/NumberUtils'; | ||
export { ObjectUtils } from './util/ObjectUtils'; | ||
@@ -8,2 +10,1 @@ export { RandomUtils } from './util/RandomUtils'; | ||
export { ThreadUtils } from './util/ThreadUtils'; | ||
export { DateUtils } from './util/DateUtils'; |
export { ArrayUtils } from "./util/ArrayUtils"; | ||
export { BooleanUtils } from "./util/BooleanUtils"; | ||
export { DateUtils } from "./util/DateUtils"; | ||
export { JsonUtils } from "./util/JsonUtils"; | ||
export { NumberUtils } from "./util/NumberUtils"; | ||
export { ObjectUtils } from "./util/ObjectUtils"; | ||
export { RandomUtils } from "./util/RandomUtils"; | ||
export { StringUtils } from "./util/StringUtils"; | ||
export { ThreadUtils } from "./util/ThreadUtils"; | ||
export { DateUtils } from "./util/DateUtils"; | ||
export { ThreadUtils } from "./util/ThreadUtils"; |
@@ -11,18 +11,18 @@ /** | ||
* | ||
* @param array the array to check | ||
* @return number the length of the given array | ||
* @param {Array<any>} array the array to check | ||
* @return {number} the length of the given array | ||
*/ | ||
static getLength(array?: Array<any>): number; | ||
static getLength(array?: any[]): number; | ||
/** | ||
* Returns the element types of the given array | ||
* | ||
* @param array the array to check | ||
* @return the element types of the given array | ||
* @param {Array<any>} array the array to check | ||
* @return {Array<string>} the element types of the given array | ||
*/ | ||
static getTypeof(array?: Array<any>): string[] | undefined; | ||
static getTypeof(array?: any[]): string[] | undefined; | ||
/** | ||
* Returns whether the given array is empty | ||
* | ||
* @param array the array to check | ||
* @return true if the given array is empty | ||
* @param {Array<any>} array the array to check | ||
* @return {boolean} whether the given array is empty | ||
* | ||
@@ -32,8 +32,8 @@ * @example | ||
*/ | ||
static isEmpty(array?: Array<any>): boolean; | ||
static isEmpty(array?: any[]): boolean; | ||
/** | ||
* Returns whether the given array is not empty | ||
* | ||
* @param array the array to check | ||
* @return true if the given array is not empty | ||
* @param {Array<any>} array the array to check | ||
* @return {boolean} whether the given array is not empty | ||
* | ||
@@ -43,18 +43,18 @@ * @example | ||
*/ | ||
static isNotEmpty(array?: Array<any>): boolean; | ||
static isNotEmpty(array?: any[]): boolean; | ||
/** | ||
* Returns whether each element in the given array is the expected type | ||
* | ||
* @param array the array to check | ||
* @param type the expected element type | ||
* @param relaxed treat null as string or object | ||
* @return true if each element in the given array is the expected type | ||
* @param {Array<any>} array the array to check | ||
* @param {string} type the expected element type | ||
* @param {boolean} relaxed treat null as string or object | ||
* @return {boolean} whether each element in the given array is the expected type | ||
*/ | ||
static isTypeof(array?: Array<any>, type?: string, relaxed?: boolean): boolean; | ||
static isTypeof(array?: any[], type?: string, relaxed?: boolean): boolean; | ||
/** | ||
* Returns whether the given array includes the given element | ||
* | ||
* @param array the array to check | ||
* @param element the element to compare | ||
* @return true if the given array includes the given element | ||
* @param {Array<any>} array the array to check | ||
* @param {any} element the element to compare | ||
* @return {boolean} whether the given array includes the given element | ||
* | ||
@@ -64,8 +64,8 @@ * @example | ||
*/ | ||
static includes<T>(array?: Array<T>, element?: T): boolean; | ||
static includes<T>(array?: T[], element?: T): boolean; | ||
/** | ||
* Returns the max length of the given arrays | ||
* | ||
* @param arrays the arrays to check | ||
* @return number the max length of the given arrays | ||
* @param {Array<any>} arrays the arrays to check | ||
* @return {number} the max length of the given arrays | ||
* | ||
@@ -79,4 +79,4 @@ * @example | ||
* | ||
* @param arrays the arrays to check | ||
* @return number the min length of the given arrays | ||
* @param {Array<any>} arrays the arrays to check | ||
* @return {number} the min length of the given arrays | ||
* | ||
@@ -90,5 +90,5 @@ * @example | ||
* | ||
* @param array the arrays to inspect | ||
* @param startInclusive the starting index, inclusive | ||
* @param endExclusive the ending index, exclusive | ||
* @param {Array<any>} array the arrays to inspect | ||
* @param {number} startInclusive the starting index, inclusive | ||
* @param {number} endExclusive the ending index, exclusive | ||
* | ||
@@ -98,3 +98,3 @@ * @example | ||
*/ | ||
static reverse(array?: Array<any>, startInclusive?: number, endExclusive?: number): void; | ||
static reverse(array?: any[], startInclusive?: number, endExclusive?: number): void; | ||
} |
@@ -11,18 +11,19 @@ /** | ||
* | ||
* @param value the string value to check | ||
* @returns boolean a boolean value from the string value, or undefined if the value cannot be converted | ||
* @param {string | number} value the string value to check | ||
* @returns {boolean} a boolean value from the string value, or undefined if the value cannot be converted | ||
* | ||
* @example | ||
* BooleanUtils.fromString('true'); // true | ||
* BooleanUtils.fromString('yes'); // true | ||
* BooleanUtils.toBoolean(1); // true | ||
* BooleanUtils.toBoolean('true'); // true | ||
* BooleanUtils.toBoolean('yes'); // true | ||
*/ | ||
static fromString(value?: string): boolean | undefined; | ||
static toBoolean(value?: string | number): boolean | undefined; | ||
/** | ||
* Returns a string value from the boolean value | ||
* | ||
* @param value the boolean value to check | ||
* @param truthy the string to represent true | ||
* @param falsy the string to represent false | ||
* @param nil the string to represent undefined or null | ||
* @returns string a string value from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @param {string} truthy the string to represent true | ||
* @param {string} falsy the string to represent false | ||
* @param {string} nil the string to represent undefined or null | ||
* @returns {string} a string value from the boolean value | ||
* | ||
@@ -36,4 +37,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'true'/'false' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'true'/'false' from the boolean value | ||
* | ||
@@ -47,4 +48,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'on'/'off' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'on'/'off' from the boolean value | ||
* | ||
@@ -58,4 +59,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'yes'/'no' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'yes'/'no' from the boolean value | ||
* | ||
@@ -69,4 +70,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'Y'/'N' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'Y'/'N' from the boolean value | ||
* | ||
@@ -80,4 +81,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of 'T'/'F' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of 'T'/'F' from the boolean value | ||
* | ||
@@ -91,4 +92,4 @@ * @example | ||
* | ||
* @param value the boolean value to check | ||
* @returns string the string value of '1'/'0' from the boolean value | ||
* @param {boolean} value the boolean value to check | ||
* @returns {string} the string value of '1'/'0' from the boolean value | ||
* | ||
@@ -95,0 +96,0 @@ * @example |
@@ -10,10 +10,14 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
_createClass(BooleanUtils, null, [{ | ||
key: "fromString", | ||
value: function fromString(value) { | ||
if (StringUtils.equalsAnyIgnoreCase(value, ['true', 'yes', 'on', 'y', 't', '1'])) { | ||
return true; | ||
key: "toBoolean", | ||
value: function toBoolean(value) { | ||
if (typeof value === 'number') { | ||
return value > 0; | ||
} else if (typeof value === 'string') { | ||
if (StringUtils.equalsAnyIgnoreCase(value, ['true', 'yes', 'on', 'y', 't', '1'])) { | ||
return true; | ||
} | ||
if (StringUtils.equalsAnyIgnoreCase(value, ['false', 'no', 'off', 'n', 'f', '0'])) { | ||
return false; | ||
} | ||
} | ||
if (StringUtils.equalsAnyIgnoreCase(value, ['false', 'no', 'off', 'n', 'f', '0'])) { | ||
return false; | ||
} | ||
return undefined; | ||
@@ -20,0 +24,0 @@ } |
@@ -11,5 +11,5 @@ /** | ||
* | ||
* @param date the date to inspect | ||
* @param amount the amount to add, negative number means minus | ||
* @return Date the year calculated date with the source date and the specified amount | ||
* @param {Date} date the date to inspect | ||
* @param {number} amount the amount to add, negative number means minus | ||
* @return {Date} the year calculated date with the source date and the specified amount | ||
* | ||
@@ -23,5 +23,5 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @param amount the amount to add, negative number means minus | ||
* @return Date the month calculated date with the source date and the specified amount | ||
* @param {Date} date the date to inspect | ||
* @param {number} amount the amount to add, negative number means minus | ||
* @return {Date} the month calculated date with the source date and the specified amount | ||
* | ||
@@ -35,5 +35,5 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @param amount the amount to add, negative number means minus | ||
* @return Date the day calculated date with the source date and the specified amount | ||
* @param {Date} date the date to inspect | ||
* @param {number} amount the amount to add, negative number means minus | ||
* @return {Date} the day calculated date with the source date and the specified amount | ||
* | ||
@@ -47,5 +47,5 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @param format the date/time format string | ||
* @return string the formatted string that represent the given date | ||
* @param {Date} date the date to inspect | ||
* @param {string} format the date/time format string | ||
* @return {string} the formatted string that represent the given date | ||
*/ | ||
@@ -56,4 +56,4 @@ static formatDateTime(date: Date, format: string): string | undefined; | ||
* | ||
* @param format the date format string | ||
* @return string the current date | ||
* @param {string} format the date format string | ||
* @return {string} the current date | ||
*/ | ||
@@ -64,4 +64,4 @@ static getCurrentDate(format?: string): string; | ||
* | ||
* @param format the date time format string | ||
* @return string the current date time | ||
* @param {string} format the date time format string | ||
* @return {string} the current date time | ||
*/ | ||
@@ -72,4 +72,4 @@ static getCurrentDateTime(format?: string): string; | ||
* | ||
* @param format the time format string | ||
* @return string the current time | ||
* @param {string} format the time format string | ||
* @return {string} the current time | ||
*/ | ||
@@ -80,4 +80,4 @@ static getCurrentTime(format?: string): string; | ||
* | ||
* @param date the date to inspect | ||
* @return Date the start year date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the start year date of the given date | ||
* | ||
@@ -91,4 +91,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the start month date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the start month date of the given date | ||
* | ||
@@ -102,4 +102,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the start day date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the start day date of the given date | ||
* | ||
@@ -113,4 +113,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the end year date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the end year date of the given date | ||
* | ||
@@ -124,4 +124,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the end month date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the end month date of the given date | ||
* | ||
@@ -135,4 +135,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @return Date the end day date of the given date | ||
* @param {Date} date the date to inspect | ||
* @return {Date} the end day date of the given date | ||
* | ||
@@ -146,4 +146,4 @@ * @example | ||
* | ||
* @param date the date to inspect | ||
* @returns string the timezone of the given date | ||
* @param {Date} date the date to inspect | ||
* @returns {string} the timezone of the given date | ||
*/ | ||
@@ -154,4 +154,4 @@ static getTimezone(date?: Date): string; | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is the first day of month | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is the first day of month | ||
* | ||
@@ -166,4 +166,4 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is the last day of month | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is the last day of month | ||
* | ||
@@ -178,4 +178,4 @@ * @example | ||
* | ||
* @param dateYear the date or year to check | ||
* @return boolean whether the date or year is a leap year | ||
* @param {Date | number} dateYear the date or year to check | ||
* @return {boolean} whether the date or year is a leap year | ||
* | ||
@@ -190,5 +190,5 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @param comparison the date to compare | ||
* @return whether the given date is same year with the comparison date | ||
* @param {Date} date the date to check | ||
* @param {Date} comparison the date to compare | ||
* @return {boolean} whether the given date is same year with the comparison date | ||
* | ||
@@ -202,6 +202,6 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @param comparison the date to compare | ||
* @param deepCompare whether compare deeply with year | ||
* @return whether the given date is same month with the comparison date | ||
* @param {Date} date the date to check | ||
* @param {Date} comparison the date to compare | ||
* @param {boolean} deepCompare whether compare deeply with year | ||
* @return {boolean} whether the given date is same month with the comparison date | ||
* | ||
@@ -215,6 +215,6 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @param comparison the date to compare | ||
* @param deepCompare whether compare deeply with year | ||
* @return whether the given date is same day with the comparison date | ||
* @param {Date} date the date to check | ||
* @param {Date} comparison the date to compare | ||
* @param {boolean} deepCompare whether compare deeply with year | ||
* @return {boolean} whether the given date is same day with the comparison date | ||
* | ||
@@ -228,4 +228,4 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is a weekend | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is a weekend | ||
* | ||
@@ -239,4 +239,4 @@ * @example | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is yesterday | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is yesterday | ||
*/ | ||
@@ -247,6 +247,6 @@ static isYesterday(date: Date): boolean; | ||
* | ||
* @param date the date to check | ||
* @return boolean whether the date is tomorrow | ||
* @param {Date} date the date to check | ||
* @return {boolean} whether the date is tomorrow | ||
*/ | ||
static isTomorrow(date: Date): boolean; | ||
} |
@@ -11,4 +11,4 @@ /** | ||
* | ||
* @param text the string to check | ||
* @return true if the given object is a JSON string | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given object is a JSON string | ||
* | ||
@@ -24,4 +24,4 @@ * @example | ||
* | ||
* @param object the object to inspect | ||
* @return string that represents the given object | ||
* @param {any} object the object to inspect | ||
* @return {string} a JSON string that represents the given object | ||
* | ||
@@ -28,0 +28,0 @@ * @example |
@@ -11,4 +11,4 @@ /** | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is null or undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is null or undefined | ||
* | ||
@@ -24,4 +24,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not null or undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not null or undefined | ||
* | ||
@@ -36,4 +36,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is null | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is null | ||
* | ||
@@ -48,4 +48,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not null | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not null | ||
* | ||
@@ -59,4 +59,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is undefined | ||
* | ||
@@ -71,4 +71,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not undefined | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not undefined | ||
* | ||
@@ -82,4 +82,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is empty | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is empty | ||
* | ||
@@ -96,4 +96,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is not empty | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is not empty | ||
* | ||
@@ -108,4 +108,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return true if the given object is a plain object | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is a plain object | ||
* | ||
@@ -120,4 +120,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is a promise | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is a promise | ||
* | ||
@@ -132,4 +132,4 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @return ture if the given object is a prototype | ||
* @param {any} object the object to check | ||
* @return {boolean} whether the given object is a prototype | ||
* | ||
@@ -144,4 +144,4 @@ * @example | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are null or undefined | ||
* | ||
@@ -152,8 +152,8 @@ * @example | ||
*/ | ||
static allNil(...objects: Array<any>): boolean; | ||
static allNil(...objects: any[]): boolean; | ||
/** | ||
* Returns whether all the given objects are not null or undefined | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are not null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are not null or undefined | ||
* | ||
@@ -165,8 +165,8 @@ * @example | ||
*/ | ||
static allNotNil(...objects: Array<any>): boolean; | ||
static allNotNil(...objects: any[]): boolean; | ||
/** | ||
* Returns whether any of the given objects is null or undefined | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is null or undefined | ||
* | ||
@@ -177,8 +177,8 @@ * @example | ||
*/ | ||
static anyNil(...objects: Array<any>): boolean; | ||
static anyNil(...objects: any[]): boolean; | ||
/** | ||
* Returns whether any of the given objects is not null or undefined | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is not null or undefined | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is not null or undefined | ||
* | ||
@@ -189,8 +189,8 @@ * @example | ||
*/ | ||
static anyNotNil(...objects: Array<any>): boolean; | ||
static anyNotNil(...objects: any[]): boolean; | ||
/** | ||
* Returns whether all the given objects are empty | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are empty | ||
* | ||
@@ -201,8 +201,8 @@ * @example | ||
*/ | ||
static allEmpty(...objects: Array<any>): boolean; | ||
static allEmpty(...objects: any[]): boolean; | ||
/** | ||
* Returns whether all the given objects are not empty | ||
* | ||
* @param objects the objects to check | ||
* @return ture if all the given objects are not empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether all the given objects are not empty | ||
* | ||
@@ -214,8 +214,8 @@ * @example | ||
*/ | ||
static allNotEmpty(...objects: Array<any>): boolean; | ||
static allNotEmpty(...objects: any[]): boolean; | ||
/** | ||
* Returns whether any of the given objects is empty | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is empty | ||
* | ||
@@ -226,8 +226,8 @@ * @example | ||
*/ | ||
static anyEmpty(...objects: Array<any>): boolean; | ||
static anyEmpty(...objects: any[]): boolean; | ||
/** | ||
* Returns whether any of the given objects is not empty | ||
* | ||
* @param objects the objects to check | ||
* @return ture if any of the given objects is not empty | ||
* @param {Array<any>} objects the objects to check | ||
* @return {boolean} whether any of the given objects is not empty | ||
* | ||
@@ -238,8 +238,8 @@ * @example | ||
*/ | ||
static anyNotEmpty(...objects: Array<any>): boolean; | ||
static anyNotEmpty(...objects: any[]): boolean; | ||
/** | ||
* Returns the first none nil element in the given array, or null if all elements are nil | ||
* | ||
* @param objects the objects to check | ||
* @returns any the first none nil element in the given array, or null if all elements are nil | ||
* @param {Array<any>} objects the objects to check | ||
* @returns {any} the first none nil element in the given array, or null if all elements are nil | ||
* | ||
@@ -249,9 +249,9 @@ * @example | ||
*/ | ||
static firstNonNil(...objects: Array<any>): any; | ||
static firstNonNil(...objects: any[]): any; | ||
/** | ||
* Returns the property value if property name is present on the given object | ||
* | ||
* @param object the object to inspect | ||
* @param prop the property name to inspect, parent property and child property are concat with dot (.) | ||
* @return any the property value if property name is present on the given object | ||
* @param {any} object the object to inspect | ||
* @param {string} prop the property name to inspect, parent property and child property are concat with dot (.) | ||
* @return {any} the property value if property name is present on the given object | ||
* | ||
@@ -265,5 +265,5 @@ * @example | ||
* | ||
* @param object the object to check | ||
* @param prop the property name to check | ||
* @return true if the object has the specified property | ||
* @param {any} object the object to check | ||
* @param {string} prop the property name to check | ||
* @return {boolean} whether the object has the specified property | ||
* | ||
@@ -278,4 +278,4 @@ * @example | ||
* | ||
* @param object the object to inspect | ||
* @returns Array<string> the keys of the given object | ||
* @param {any} object the object to inspect | ||
* @returns {Array<string>} the keys of the given object | ||
* | ||
@@ -289,7 +289,7 @@ * @example | ||
* | ||
* @param object the object to inspect | ||
* @param nil the default string if the object is nil | ||
* @return string the string representation of the given object | ||
* @param {any} object the object to inspect | ||
* @param {string} nil the default string if the object is nil | ||
* @return {string} a string representation of the given object | ||
*/ | ||
static toString(object?: any, nil?: string | null): string; | ||
} |
@@ -11,3 +11,3 @@ /** | ||
* | ||
* @return boolean the random boolean value | ||
* @return {boolean} the random boolean value | ||
* | ||
@@ -21,4 +21,4 @@ * @example | ||
* | ||
* @param array the array to random | ||
* @return any a random element of the array | ||
* @param {Array<any>} array the array to random | ||
* @return {any} a random element of the array | ||
* | ||
@@ -28,9 +28,9 @@ * @example | ||
*/ | ||
static randomElement(array: Array<any>): any; | ||
static randomElement(array: any[]): any; | ||
/** | ||
* Returns a random element array with the specified length within the given array | ||
* | ||
* @param array the array to random | ||
* @param size the size to generate | ||
* @return Array<any> a random element array with the specified length within the given array | ||
* @param {Array<any>} array the array to random | ||
* @param {number} size the size to generate | ||
* @return {Array<any>} a random element array with the specified length within the given array | ||
* | ||
@@ -44,5 +44,5 @@ * @example | ||
* | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return number the random integer that between the min value (inclusive) and the max value (exclusive) | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {number} a random integer that between the min value (inclusive) and the max value (exclusive) | ||
* | ||
@@ -57,6 +57,6 @@ * @example | ||
* | ||
* @param size the size of the expected array | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return Array<number> the random integer array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* @param {number} size the size of the expected array | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {Array<number>} a random integer array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* | ||
@@ -71,5 +71,5 @@ * @example | ||
* | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return number the random number that between the min value (inclusive) and the max value (exclusive) | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {number} a random number that between the min value (inclusive) and the max value (exclusive) | ||
* | ||
@@ -84,6 +84,6 @@ * @example | ||
* | ||
* @param size the size of the expected array | ||
* @param minInclusive the min value, inclusive | ||
* @param maxExclusive the max value, exclusive | ||
* @return Array<number> the random number array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* @param {number} size the size of the expected array | ||
* @param {number} minInclusive the min value, inclusive | ||
* @param {number} maxExclusive the max value, exclusive | ||
* @return {Array<number>} a random number array that between the min value (inclusive) and the max value (exclusive), matching the given size | ||
* | ||
@@ -90,0 +90,0 @@ * @example |
@@ -11,4 +11,4 @@ /** | ||
* | ||
* @param text the source string to check | ||
* @return number the length of the given string | ||
* @param {string} text the source string to check | ||
* @return {number} the length of the given string | ||
*/ | ||
@@ -19,4 +19,4 @@ static getLength(text?: string): number; | ||
* | ||
* @param text the string to check | ||
* @returns true if the given string is empty | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is empty | ||
* | ||
@@ -31,4 +31,4 @@ * @example | ||
* | ||
* @param text the string to check | ||
* @returns true if the given string is not empty | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is not empty | ||
* | ||
@@ -43,4 +43,4 @@ * @example | ||
* @description check if all the characters in the given string is whitespace or line separators | ||
* @param text the string to check | ||
* @returns true if the given string is blank | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is blank | ||
* | ||
@@ -55,4 +55,4 @@ * @example | ||
* | ||
* @param text the string to check | ||
* @returns true if the given string is not blank | ||
* @param {string} text the string to check | ||
* @return {boolean} whether the given string is not blank | ||
* | ||
@@ -66,4 +66,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are empty | ||
* | ||
@@ -78,4 +78,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are not empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are not empty | ||
* | ||
@@ -91,4 +91,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is empty | ||
* | ||
@@ -103,4 +103,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is not empty | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is not empty | ||
* | ||
@@ -115,4 +115,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are blank | ||
* | ||
@@ -127,4 +127,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if all the given texts are not blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether all the given texts are not blank | ||
* | ||
@@ -140,4 +140,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is blank | ||
* | ||
@@ -152,4 +152,4 @@ * @example | ||
* | ||
* @param texts the texts to check | ||
* @return true if any of the given texts is not blank | ||
* @param {Array<string>} texts the texts to check | ||
* @return {boolean} whether any of the given texts is not blank | ||
* | ||
@@ -164,4 +164,4 @@ * @example | ||
* | ||
* @param text the text to check | ||
* @return string an empty value if the given text is undefined | ||
* @param {string} text the text to check | ||
* @return {string} an empty value if the given text is undefined | ||
* | ||
@@ -175,5 +175,5 @@ * @example | ||
* | ||
* @param text the text to check | ||
* @param defaultValue the default value placeholder | ||
* @return string the default value if the given text is empty, or the text self if it is not empty | ||
* @param {string} text the text to check | ||
* @param {string} defaultValue the default value placeholder | ||
* @return {string} the default value if the given text is empty, or the text self if it is not empty | ||
* | ||
@@ -187,5 +187,5 @@ * @example | ||
* | ||
* @param text the text to check | ||
* @param defaultValue the default value placeholder | ||
* @return string the default value if the given text is blank, or the text self if it is not blank | ||
* @param {string} text the text to check | ||
* @param {string} defaultValue the default value placeholder | ||
* @return {string} the default value if the given text is blank, or the text self if it is not blank | ||
* | ||
@@ -199,5 +199,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given strings are equal | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given strings are equal | ||
* | ||
@@ -212,5 +212,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given strings are equal, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given strings are equal, case-insensitive | ||
* | ||
@@ -224,5 +224,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the given string equals to any of the comparison strings | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the given string equals to any of the comparison strings | ||
* | ||
@@ -236,5 +236,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the given string equals to any of the comparison strings, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the given string equals to any of the comparison strings, case-insensitive | ||
* | ||
@@ -248,10 +248,10 @@ * @example | ||
* | ||
* @param text the source string to inspect | ||
* @param params the parameters to replaced with | ||
* @return string the replaced string of the source string | ||
* @param {string} text the source string to inspect | ||
* @param {Array<any>} params the parameters to replaced with | ||
* @return {string} the replaced string of the source string | ||
* | ||
* @example | ||
* StringUtils.formatBrace("foo{}", "bar"); // "foobar" | ||
* StringUtils.formatBrace("foobar{}"); // "foobar{}" | ||
* StringUtils.formatBrace("hello {}, foo{}", "world", "bar"); // "hello world, foobar" | ||
* StringUtils.formatBrace('foo{}', 'bar'); // 'foobar' | ||
* StringUtils.formatBrace('foobar{}'); // 'foobar{}' | ||
* StringUtils.formatBrace('hello {}, foo{}', 'world', 'bar'); // 'hello world, foobar' | ||
*/ | ||
@@ -262,5 +262,5 @@ static formatBrace(text?: string, ...params: Array<any>): string | undefined; | ||
* | ||
* @param text the source string to inspect | ||
* @param params the parameters to replaced with | ||
* @return string the replaced string of the source string | ||
* @param {string} text the source string to inspect | ||
* @param {Array<any>} params the parameters to replaced with | ||
* @return {string} the replaced string of the source string | ||
* | ||
@@ -274,9 +274,9 @@ * @see "https://github.com/samsonjs/format/blob/main/format.js" | ||
*/ | ||
static formatPercent(text: string, ...params: Array<any>): string | undefined; | ||
static formatPercent(text?: string, ...params: Array<any>): string | undefined; | ||
/** | ||
* Returns the replaced string of the source string (named placeholder) with the given parameters | ||
* | ||
* @param text the source string to inspect | ||
* @param params the parameters to replaced with, in the form of key values | ||
* @return string the replaced string of the source string | ||
* @param {string} text the source string to inspect | ||
* @param {Record<string, any>} params the parameters to replaced with, in the form of key values | ||
* @return {string} the replaced string of the source string | ||
* | ||
@@ -295,5 +295,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given text includes the comparison string | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given text includes the comparison string | ||
* | ||
@@ -307,5 +307,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparison the target string to compare | ||
* @returns true if the given text includes the comparison string, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {string} comparison the target string to compare | ||
* @return {boolean} whether the given text includes the comparison string, case-insensitive | ||
* | ||
@@ -319,5 +319,5 @@ * @example | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the given text includes the comparison string | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the given text includes the comparison string | ||
* | ||
@@ -327,9 +327,9 @@ * @example | ||
*/ | ||
static includesAny(text: string, comparisons: Array<string | undefined>): boolean; | ||
static includesAny(text?: string, comparisons?: Array<string | undefined>): boolean; | ||
/** | ||
* Returns whether the given text includes to any of the comparison strings, case-insensitive | ||
* | ||
* @param text the source string to check | ||
* @param comparisons the target strings to compare | ||
* @returns true if the text includes the comparison string, case-insensitive | ||
* @param {string} text the source string to check | ||
* @param {Array<string>} comparisons the target strings to compare | ||
* @return {boolean} whether the text includes the comparison string, case-insensitive | ||
* | ||
@@ -339,9 +339,9 @@ * @example | ||
*/ | ||
static includesAnyIgnoreCase(text: string, comparisons: Array<string | undefined>): boolean; | ||
static includesAnyIgnoreCase(text?: string, comparisons?: Array<string | undefined>): boolean; | ||
/** | ||
* Returns a string that trimmed from the given string | ||
* | ||
* @param text the string to trim | ||
* @param emptyAsNull whether to return null if the trimmed result is empty | ||
* @return string the trimmed string value from the given string | ||
* @param {string} text the string to trim | ||
* @param {boolean} emptyAsNull whether to return null if the trimmed result is empty | ||
* @return {string} the trimmed string value from the given string | ||
* | ||
@@ -348,0 +348,0 @@ * @example |
@@ -74,3 +74,3 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
} | ||
return texts && texts.length > 0 && texts.some(function (text) { | ||
return texts && (texts === null || texts === void 0 ? void 0 : texts.length) > 0 && texts.some(function (text) { | ||
return _this4.isNotEmpty(text); | ||
@@ -309,5 +309,8 @@ }); | ||
var _this10 = this; | ||
return ObjectUtils.allNotNil(text, comparisons) && (comparisons === null || comparisons === void 0 ? void 0 : comparisons.some(function (comparison) { | ||
if (ObjectUtils.anyNil(text, comparisons)) { | ||
return false; | ||
} | ||
return comparisons === null || comparisons === void 0 ? void 0 : comparisons.some(function (comparison) { | ||
return _this10.includes(text, comparison); | ||
})); | ||
}); | ||
} | ||
@@ -318,5 +321,8 @@ }, { | ||
var _this11 = this; | ||
return ObjectUtils.allNotNil(text, comparisons) && (comparisons === null || comparisons === void 0 ? void 0 : comparisons.some(function (comparison) { | ||
if (ObjectUtils.anyNil(text, comparisons)) { | ||
return false; | ||
} | ||
return comparisons === null || comparisons === void 0 ? void 0 : comparisons.some(function (comparison) { | ||
return _this11.includesIgnoreCase(text, comparison); | ||
})); | ||
}); | ||
} | ||
@@ -323,0 +329,0 @@ }, { |
@@ -11,4 +11,4 @@ /** | ||
* | ||
* @param microseconds the amount of time to sleep, in microseconds | ||
* @return Promise<void> a promise that could be resolved | ||
* @param {number} microseconds the amount of time to sleep, in microseconds | ||
* @return {Promise<void>} a promise that could be resolved | ||
* | ||
@@ -15,0 +15,0 @@ * @example |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.TsLangUtils=e():t.TsLangUtils=e()}(self,(function(){return function(){var t={154:function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},t.exports.__esModule=!0,t.exports.default=t.exports},608:function(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},218:function(t,e,n){var r=n(108);function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,r(o.key),o)}}t.exports=function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},706:function(t,e,n){var r=n(237);t.exports=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=r(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){l=!0,u=t},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw u}}}},t.exports.__esModule=!0,t.exports.default=t.exports},875:function(t,e,n){var r=n(191).default;t.exports=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},108:function(t,e,n){var r=n(191).default,o=n(875);t.exports=function(t){var e=o(t,"string");return"symbol"===r(e)?e:String(e)},t.exports.__esModule=!0,t.exports.default=t.exports},191:function(t){function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},237:function(t,e,n){var r=n(154);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return function(){"use strict";n.r(r),n.d(r,{ArrayUtils:function(){return y},BooleanUtils:function(){return v},DateUtils:function(){return m},JsonUtils:function(){return h},ObjectUtils:function(){return f},RandomUtils:function(){return g},StringUtils:function(){return c},ThreadUtils:function(){return p}});var t=n(706),e=n.n(t),o=n(191),i=n.n(o),u=n(608),a=n.n(u),l=n(218),s=n.n(l),f=function(){function t(){a()(this,t)}return s()(t,null,[{key:"isNil",value:function(t){return null==t}},{key:"isNotNil",value:function(t){return!this.isNil(t)}},{key:"isNull",value:function(t){return null===t}},{key:"isNotNull",value:function(t){return!this.isNull(t)}},{key:"isUndefined",value:function(t){return void 0===t}},{key:"isNotUndefined",value:function(t){return!this.isUndefined(t)}},{key:"isEmpty",value:function(t){return!!this.isNil(t)||("string"==typeof t||Array.isArray(t)?0===t.length:t instanceof Map||t instanceof Set?0===t.size:"object"===i()(t)&&0===(null===(e=this.keys(t))||void 0===e?void 0:e.length));var e}},{key:"isNotEmpty",value:function(t){return!this.isEmpty(t)}},{key:"isPlainObject",value:function(t){return"object"===i()(t)&&"[object Object]"===Object.prototype.toString.call(t)}},{key:"isPromiseObject",value:function(t){return"object"===i()(t)&&"[object Promise]"===Object.prototype.toString.call(t)}},{key:"isPrototype",value:function(t){if("object"!==i()(t))return!1;var e=t.constructor;return t===("function"==typeof e?e.prototype:t.prototype)}},{key:"allNil",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isEmpty(n)||!n.some((function(e){return t.isNotNil(e)}))}},{key:"allNotNil",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&!n.some((function(e){return t.isNil(e)}))}},{key:"anyNil",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isEmpty(n)||n.some((function(e){return t.isNil(e)}))}},{key:"anyNotNil",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&n.some((function(e){return t.isNotNil(e)}))}},{key:"allEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isEmpty(n)||!n.some((function(e){return t.isNotEmpty(e)}))}},{key:"allNotEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&!n.some((function(e){return t.isEmpty(e)}))}},{key:"anyEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isEmpty(n)||n.some((function(e){return t.isEmpty(e)}))}},{key:"anyNotEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&n.some((function(e){return t.isNotEmpty(e)}))}},{key:"firstNonNil",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(!e||0===e.length)return null;for(var r=0,o=e;r<o.length;r++){var i=o[r];if(this.isNotNil(i))return i}return null}},{key:"getProperty",value:function(t,e){if(!this.anyNil(t,e)&&"object"===i()(t)&&0!==(null==e?void 0:e.length)){var n=e.replace(/\[/g,".").replace(/]/g,"").split(".");if(n&&0!==(null==n?void 0:n.length))return 1===(null==n?void 0:n.length)?t[n[0]]:n.reduce((function(t,e){return(t||{})[e]}),t)}}},{key:"hasProperty",value:function(t,e){return this.allNotNil(t,e)&&"object"===i()(t)&&(null==e?void 0:e.length)>0&&Object.prototype.hasOwnProperty.call(t,e)}},{key:"keys",value:function(t){if(this.isNil(t))return[];if(!this.isPrototype(t))return Object.keys(t);var e=[];for(var n in Object(t))"constructor"!==n&&this.hasProperty(t,n)&&e.push(n);return e}},{key:"toString",value:function(t,e){return t?t.toString():e}}]),t}(),c=function(){function t(){a()(this,t)}return s()(t,null,[{key:"getLength",value:function(t){return t?t.length:0}},{key:"isEmpty",value:function(t){return!t||0===t.length}},{key:"isNotEmpty",value:function(t){return!this.isEmpty(t)}},{key:"isBlank",value:function(t){return!t||0===(null==t?void 0:t.length)||/^\s*$/.test(t)}},{key:"isNotBlank",value:function(t){return!this.isBlank(t)}},{key:"allEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return!n||0===n.length||!n.some((function(e){return t.isNotEmpty(e)}))}},{key:"allNotEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n&&n.length>0&&!n.some((function(e){return t.isEmpty(e)}))}},{key:"anyEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return!n||0===n.length||n.some((function(e){return t.isEmpty(e)}))}},{key:"anyNotEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n&&n.length>0&&n.some((function(e){return t.isNotEmpty(e)}))}},{key:"allBlank",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return!n||0===n.length||!n.some((function(e){return t.isNotBlank(e)}))}},{key:"allNotBlank",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n&&n.length>0&&!n.some((function(e){return t.isBlank(e)}))}},{key:"anyBlank",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return!n||0===n.length||n.some((function(e){return t.isBlank(e)}))}},{key:"anyNotBlank",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n&&n.length>0&&n.some((function(e){return t.isNotBlank(e)}))}},{key:"defaultString",value:function(t){return t||""}},{key:"defaultIfEmpty",value:function(t,e){return this.isEmpty(t)?e:t}},{key:"defaultIfBlank",value:function(t,e){return this.isBlank(t)?e:t}},{key:"equals",value:function(t,e){return!(t!==e&&!f.allNil(t,e))||!f.anyNil(t,e)&&(null==t?void 0:t.length)===(null==e?void 0:e.length)&&t===e}},{key:"equalsIgnoreCase",value:function(t,e){return!(t!==e&&!f.allNil(t,e))||!f.anyNil(t,e)&&(null==t?void 0:t.length)===(null==e?void 0:e.length)&&(null==t?void 0:t.toUpperCase())===(null==e?void 0:e.toUpperCase())}},{key:"equalsAny",value:function(t,e){return y.includes(e,t)}},{key:"equalsAnyIgnoreCase",value:function(t,e){var n=this;return!f.isNil(t)&&!y.isEmpty(e)&&e.some((function(e){return n.equalsIgnoreCase(t,e)}))}},{key:"formatBrace",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];if(!t||t.length<=2||y.isEmpty(n))return t;for(var o=t,i=0,u=n;i<u.length;i++){var a=u[i];o=o.replace("{}",f.toString(a,""))}return o}},{key:"formatPercent",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];if(!t||t.length<=2||y.isEmpty(n))return t;var o=t.match(/%[bcdfjosxX]/g)||[],i=y.minLength(o,n);if(0===i)return t;for(var u=t,a=0;a<i;a++){var l=n[a],s=o[a].substring(1);switch(s){case"b":case"c":case"d":case"o":case"x":case"X":try{var c=void 0;"string"==typeof l?c=Number.parseInt(l):l instanceof String?c=Number.parseInt(l.toString()):"number"==typeof l&&(c=l),c&&("b"===s?u=u.replace("%".concat(s),c.toString(2)):"c"===s?u=u.replace("%".concat(s),String.fromCharCode(c)):"d"===s?u=u.replace("%".concat(s),c.toString(10)):"o"===s?u=u.replace("%".concat(s),"0"+c.toString(8)):"x"===s?u=u.replace("%".concat(s),"0x"+c.toString(16)):"X"===s&&(u=u.replace("%".concat(s),"0x"+c.toString(16).toUpperCase())))}catch(t){throw new TypeError("Invalid parameter type of '".concat(l,"', index ").concat(a))}break;case"f":try{var v=void 0;"string"==typeof l?v=Number.parseFloat(l):l instanceof String?v=Number.parseFloat(l.toString()):"number"==typeof l&&(v=l),v&&(u=u.replace("%".concat(s),"0x"+v.toString()))}catch(t){throw new TypeError("Invalid parameter type of '".concat(l,"', index ").concat(a))}break;case"j":if(null==l){u=u.replace("%".concat(s),"");break}if(f.isPlainObject(l)){u=u.replace("%".concat(s),JSON.stringify(l));break}throw new TypeError("Invalid parameter type of '".concat(l,"', index ").concat(a));case"s":u=u.replace("%".concat(s),f.toString(l,""))}}return u}},{key:"formatPlaceholder",value:function(t,e){if(!t||t.length<=2||!e)return t;var n=t;for(var r in e){var o=new RegExp("\\{".concat(r,"\\}"),"g"),i=e[r];n=n.replace(o,i?i.toString():"")}return n}},{key:"includes",value:function(t,e){return t===e||f.allNotNil(t,e)&&t.includes(e)}},{key:"includesIgnoreCase",value:function(t,e){var n;return t===e||f.allNotNil(t,e)&&(null==t||null===(n=t.toUpperCase())||void 0===n?void 0:n.includes(null==e?void 0:e.toUpperCase()))}},{key:"includesAny",value:function(t,e){var n=this;return f.allNotNil(t,e)&&(null==e?void 0:e.some((function(e){return n.includes(t,e)})))}},{key:"includesAnyIgnoreCase",value:function(t,e){var n=this;return f.allNotNil(t,e)&&(null==e?void 0:e.some((function(e){return n.includesIgnoreCase(t,e)})))}},{key:"trim",value:function(t,e){if(!t)return t;var n=t.trim();return e&&this.isEmpty(n)?null:n}}]),t}(),y=function(){function t(){a()(this,t)}return s()(t,null,[{key:"getLength",value:function(t){return t?t.length:0}},{key:"getTypeof",value:function(t){if(!this.isEmpty(t))return null==t?void 0:t.map((function(t){return Array.isArray(t)?"array":"object"===i()(t)?null===t?"null":"object":i()(t)}))}},{key:"isEmpty",value:function(t){return!t||0===t.length}},{key:"isNotEmpty",value:function(t){return!this.isEmpty(t)}},{key:"isTypeof",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!this.isEmpty(t)&&!c.isBlank(e)&&(null==t?void 0:t.every((function(t){return i()(t)===e||n&&null===t&&c.equalsAny(e,["string","object"])})))}},{key:"includes",value:function(t,e){return f.allNotNil(t,e)&&t.includes(e)}},{key:"maxLength",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(this.isEmpty(e))return 0;for(var r=0,o=0,i=e;o<i.length;o++){var u=i[o];r=Math.max(r,this.getLength(u))}return r}},{key:"minLength",value:function(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];if(this.isEmpty(r))return 0;var i,u=null===(t=r[0])||void 0===t?void 0:t.length,a=e()(r.slice(1));try{for(a.s();!(i=a.n()).done;){var l=i.value;if(0===(u=Math.min(u,this.getLength(l))))break}}catch(t){a.e(t)}finally{a.f()}return u}},{key:"reverse",value:function(t,e,n){if(!this.isEmpty(t))for(var r=Math.max(e||0,0),o=Math.min(n||this.getLength(t),this.getLength(t))-1;t&&o>r;){var i=t[o];t[o]=t[r],t[r]=i,o--,r++}}}]),t}(),v=function(){function t(){a()(this,t)}return s()(t,null,[{key:"fromString",value:function(t){return!!c.equalsAnyIgnoreCase(t,["true","yes","on","y","t","1"])||!c.equalsAnyIgnoreCase(t,["false","no","off","n","f","0"])&&void 0}},{key:"toString",value:function(t,e,n,r){return f.isNil(t)?r:t?e:n}},{key:"toStringTrueFalse",value:function(t){return this.toString(t,"true","false",void 0)}},{key:"toStringOnOff",value:function(t){return this.toString(t,"on","off",void 0)}},{key:"toStringYesNo",value:function(t){return this.toString(t,"yes","no",void 0)}},{key:"toStringYN",value:function(t){return this.toString(t,"Y","N",void 0)}},{key:"toStringTF",value:function(t){return this.toString(t,"T","F",void 0)}},{key:"toString10",value:function(t){return this.toString(t,"1","0",void 0)}}]),t}(),h=function(){function t(){a()(this,t)}return s()(t,null,[{key:"isJsonString",value:function(t){if(c.isBlank(t))return!1;try{if("object"===i()(JSON.parse(t)))return!0}catch(t){}return!1}},{key:"toJsonString",value:function(t){if("string"==typeof t&&t.length>0)try{var e=JSON.parse(t);if("object"===i()(e))return JSON.stringify(e)}catch(t){}if(f.isPlainObject(t))return JSON.stringify(t)}}]),t}(),g=function(){function t(){a()(this,t)}return s()(t,null,[{key:"randomBoolean",value:function(){return Math.random()>=.5}},{key:"randomElement",value:function(t){return y.isNotEmpty(t)?t.at(this.randomInteger(0,t.length)):void 0}},{key:"randomElements",value:function(t,e){if(y.isEmpty(t)||e<=0)return[];if(y.getLength(t)<=e)return t;for(var n=new Set;n.size<e;)n.add(this.randomInteger(0,t.length));return t.filter((function(t,e){return n.has(e)}))}},{key:"randomInteger",value:function(t,e){return Math.floor(this.randomNumber(t,e))}},{key:"randomIntegers",value:function(t,e,n){if(t<=0)return[];for(var r=[],o=0;o<t;o++)r.push(this.randomInteger(e,n));return r}},{key:"randomNumber",value:function(t,e){var n=t||0,r=e||Number.MAX_SAFE_INTEGER-1;if(n>r)throw SyntaxError("The min value must not be greater than max value");return n===r?n:n+(r-n)*Math.random()}},{key:"randomNumbers",value:function(t,e,n){if(t<=0)return[];for(var r=[],o=0;o<t;o++)r.push(this.randomNumber(e,n));return r}}]),t}(),p=function(){function t(){a()(this,t)}return s()(t,null,[{key:"sleep",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;return new Promise((function(e){setTimeout(e,t)}))}}]),t}(),m=function(){function t(){a()(this,t)}return s()(t,null,[{key:"addYear",value:function(t,e){if(!e)return t;var n=new Date(t);return n.setFullYear(t.getFullYear()+e),n}},{key:"addMonth",value:function(t,e){if(!e)return t;var n=new Date(t);return n.setMonth(t.getMonth()+e),n}},{key:"addDay",value:function(t,e){if(!e)return t;var n=new Date(t);return n.setDate(t.getDate()+e),n}},{key:"formatDateTime",value:function(t,e){if(!c.isBlank(e)){var n={"y+":t.getFullYear(),"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours()%12==0?12:t.getHours()%12,"H+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()},r=e;for(var o in n){var i=new RegExp("(".concat(o,")")).exec(r);i&&(r=/(y+)/.test(o)?r.replace(i[1],n[o].toString().substring(4-i[1].length)):r.replace(i[1],1===i[1].length?n[o].toString():n[o].toString().padStart(i[1].length,"0")))}return r}}},{key:"getCurrentDate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd";return this.formatDateTime(new Date,t)}},{key:"getCurrentDateTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd hh:mm:ss";return this.formatDateTime(new Date,t)}},{key:"getCurrentTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"hh:mm:ss";return this.formatDateTime(new Date,t)}},{key:"getStartOfYear",value:function(t){var e=new Date(t);return e.setFullYear(t.getFullYear(),0,1),e.setHours(0,0,0,0),e}},{key:"getStartOfMonth",value:function(t){var e=new Date(t);return e.setDate(1),e.setHours(0,0,0,0),e}},{key:"getStartOfDay",value:function(t){var e=new Date(t);return e.setHours(0,0,0,0),e}},{key:"getEndOfYear",value:function(t){var e=new Date(t);return e.setFullYear(t.getFullYear()+1,0,0),e.setHours(23,59,59,999),e}},{key:"getEndOfMonth",value:function(t){var e=new Date(t);return e.setFullYear(t.getFullYear(),t.getMonth()+1,0),e.setHours(23,59,59,999),e}},{key:"getEndOfDay",value:function(t){var e=new Date(t);return e.setHours(23,59,59,999),e}},{key:"getTimezone",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=t.getTimezoneOffset(),n=Math.abs(e),r=Math.floor(n/60),o=n%60,i=o>0?":"+("0"+o).slice(-2):"";return(e<0?"+":"-")+r+i}},{key:"isFirstDayOfMonth",value:function(t){return 1===t.getDate()}},{key:"isLastDayOfMonth",value:function(t){return this.isSameDay(this.getEndOfDay(t),this.getEndOfMonth(t))}},{key:"isLeapYear",value:function(t){var e=t instanceof Date?t.getFullYear():t;return!((e%4||!(e%100))&&e%400)}},{key:"isSameYear",value:function(t,e){return t.getFullYear()===e.getFullYear()}},{key:"isSameMonth",value:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.getMonth()===e.getMonth()&&(!n||t.getFullYear()===e.getFullYear())}},{key:"isSameDay",value:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.getDate()===e.getDate()&&(!n||t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth())}},{key:"isWeekend",value:function(t){return 0===t.getDay()||6===t.getDay()}},{key:"isYesterday",value:function(t){return this.isSameDay(new Date,this.addDay(t,1))}},{key:"isTomorrow",value:function(t){return this.isSameDay(new Date,this.addDay(t,-1))}}]),t}()}(),r}()})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.TsLangUtils=e():t.TsLangUtils=e()}(self,(function(){return function(){var t={154:function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},t.exports.__esModule=!0,t.exports.default=t.exports},608:function(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},218:function(t,e,n){var r=n(108);function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,r(o.key),o)}}t.exports=function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},706:function(t,e,n){var r=n(237);t.exports=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=r(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,u=function(){};return{s:u,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}},t.exports.__esModule=!0,t.exports.default=t.exports},875:function(t,e,n){var r=n(191).default;t.exports=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},108:function(t,e,n){var r=n(191).default,o=n(875);t.exports=function(t){var e=o(t,"string");return"symbol"===r(e)?e:String(e)},t.exports.__esModule=!0,t.exports.default=t.exports},191:function(t){function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},237:function(t,e,n){var r=n(154);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var u=e[r]={exports:{}};return t[r](u,u.exports,n),u.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return function(){"use strict";n.r(r),n.d(r,{ArrayUtils:function(){return y},BooleanUtils:function(){return v},DateUtils:function(){return h},JsonUtils:function(){return g},NumberUtils:function(){return p},ObjectUtils:function(){return f},RandomUtils:function(){return m},StringUtils:function(){return c},ThreadUtils:function(){return d}});var t=n(706),e=n.n(t),o=n(191),u=n.n(o),i=n(608),a=n.n(i),l=n(218),s=n.n(l),f=function(){function t(){a()(this,t)}return s()(t,null,[{key:"isNil",value:function(t){return null==t}},{key:"isNotNil",value:function(t){return!this.isNil(t)}},{key:"isNull",value:function(t){return null===t}},{key:"isNotNull",value:function(t){return!this.isNull(t)}},{key:"isUndefined",value:function(t){return void 0===t}},{key:"isNotUndefined",value:function(t){return!this.isUndefined(t)}},{key:"isEmpty",value:function(t){return!!this.isNil(t)||("string"==typeof t||Array.isArray(t)?0===t.length:t instanceof Map||t instanceof Set?0===t.size:"object"===u()(t)&&0===(null===(e=this.keys(t))||void 0===e?void 0:e.length));var e}},{key:"isNotEmpty",value:function(t){return!this.isEmpty(t)}},{key:"isPlainObject",value:function(t){return"object"===u()(t)&&"[object Object]"===Object.prototype.toString.call(t)}},{key:"isPromiseObject",value:function(t){return"object"===u()(t)&&"[object Promise]"===Object.prototype.toString.call(t)}},{key:"isPrototype",value:function(t){if("object"!==u()(t))return!1;var e=t.constructor;return t===("function"==typeof e?e.prototype:t.prototype)}},{key:"allNil",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isEmpty(n)||!n.some((function(e){return t.isNotNil(e)}))}},{key:"allNotNil",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&!n.some((function(e){return t.isNil(e)}))}},{key:"anyNil",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isEmpty(n)||n.some((function(e){return t.isNil(e)}))}},{key:"anyNotNil",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&n.some((function(e){return t.isNotNil(e)}))}},{key:"allEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isEmpty(n)||!n.some((function(e){return t.isNotEmpty(e)}))}},{key:"allNotEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&!n.some((function(e){return t.isEmpty(e)}))}},{key:"anyEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isEmpty(n)||n.some((function(e){return t.isEmpty(e)}))}},{key:"anyNotEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&n.some((function(e){return t.isNotEmpty(e)}))}},{key:"firstNonNil",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(!e||0===e.length)return null;for(var r=0,o=e;r<o.length;r++){var u=o[r];if(this.isNotNil(u))return u}return null}},{key:"getProperty",value:function(t,e){if(!this.anyNil(t,e)&&"object"===u()(t)&&0!==(null==e?void 0:e.length)){var n=e.replace(/\[/g,".").replace(/]/g,"").split(".");if(n&&0!==(null==n?void 0:n.length))return 1===(null==n?void 0:n.length)?t[n[0]]:n.reduce((function(t,e){return(t||{})[e]}),t)}}},{key:"hasProperty",value:function(t,e){return this.allNotNil(t,e)&&"object"===u()(t)&&(null==e?void 0:e.length)>0&&Object.prototype.hasOwnProperty.call(t,e)}},{key:"keys",value:function(t){if(this.isNil(t))return[];if(!this.isPrototype(t))return Object.keys(t);var e=[];for(var n in Object(t))"constructor"!==n&&this.hasProperty(t,n)&&e.push(n);return e}},{key:"toString",value:function(t,e){return t?t.toString():e}}]),t}(),c=function(){function t(){a()(this,t)}return s()(t,null,[{key:"getLength",value:function(t){return t?t.length:0}},{key:"isEmpty",value:function(t){return!t||0===t.length}},{key:"isNotEmpty",value:function(t){return!this.isEmpty(t)}},{key:"isBlank",value:function(t){return!t||0===(null==t?void 0:t.length)||/^\s*$/.test(t)}},{key:"isNotBlank",value:function(t){return!this.isBlank(t)}},{key:"allEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return!n||0===n.length||!n.some((function(e){return t.isNotEmpty(e)}))}},{key:"allNotEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n&&n.length>0&&!n.some((function(e){return t.isEmpty(e)}))}},{key:"anyEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return!n||0===n.length||n.some((function(e){return t.isEmpty(e)}))}},{key:"anyNotEmpty",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n&&(null==n?void 0:n.length)>0&&n.some((function(e){return t.isNotEmpty(e)}))}},{key:"allBlank",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return!n||0===n.length||!n.some((function(e){return t.isNotBlank(e)}))}},{key:"allNotBlank",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n&&n.length>0&&!n.some((function(e){return t.isBlank(e)}))}},{key:"anyBlank",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return!n||0===n.length||n.some((function(e){return t.isBlank(e)}))}},{key:"anyNotBlank",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n&&n.length>0&&n.some((function(e){return t.isNotBlank(e)}))}},{key:"defaultString",value:function(t){return t||""}},{key:"defaultIfEmpty",value:function(t,e){return this.isEmpty(t)?e:t}},{key:"defaultIfBlank",value:function(t,e){return this.isBlank(t)?e:t}},{key:"equals",value:function(t,e){return!(t!==e&&!f.allNil(t,e))||!f.anyNil(t,e)&&(null==t?void 0:t.length)===(null==e?void 0:e.length)&&t===e}},{key:"equalsIgnoreCase",value:function(t,e){return!(t!==e&&!f.allNil(t,e))||!f.anyNil(t,e)&&(null==t?void 0:t.length)===(null==e?void 0:e.length)&&(null==t?void 0:t.toUpperCase())===(null==e?void 0:e.toUpperCase())}},{key:"equalsAny",value:function(t,e){return y.includes(e,t)}},{key:"equalsAnyIgnoreCase",value:function(t,e){var n=this;return!f.isNil(t)&&!y.isEmpty(e)&&e.some((function(e){return n.equalsIgnoreCase(t,e)}))}},{key:"formatBrace",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];if(!t||t.length<=2||y.isEmpty(n))return t;for(var o=t,u=0,i=n;u<i.length;u++){var a=i[u];o=o.replace("{}",f.toString(a,""))}return o}},{key:"formatPercent",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];if(!t||t.length<=2||y.isEmpty(n))return t;var o=t.match(/%[bcdfjosxX]/g)||[],u=y.minLength(o,n);if(0===u)return t;for(var i=t,a=0;a<u;a++){var l=n[a],s=o[a].substring(1);switch(s){case"b":case"c":case"d":case"o":case"x":case"X":try{var c=void 0;"string"==typeof l?c=Number.parseInt(l):l instanceof String?c=Number.parseInt(l.toString()):"number"==typeof l&&(c=l),c&&("b"===s?i=i.replace("%".concat(s),c.toString(2)):"c"===s?i=i.replace("%".concat(s),String.fromCharCode(c)):"d"===s?i=i.replace("%".concat(s),c.toString(10)):"o"===s?i=i.replace("%".concat(s),"0"+c.toString(8)):"x"===s?i=i.replace("%".concat(s),"0x"+c.toString(16)):"X"===s&&(i=i.replace("%".concat(s),"0x"+c.toString(16).toUpperCase())))}catch(t){throw new TypeError("Invalid parameter type of '".concat(l,"', index ").concat(a))}break;case"f":try{var v=void 0;"string"==typeof l?v=Number.parseFloat(l):l instanceof String?v=Number.parseFloat(l.toString()):"number"==typeof l&&(v=l),v&&(i=i.replace("%".concat(s),"0x"+v.toString()))}catch(t){throw new TypeError("Invalid parameter type of '".concat(l,"', index ").concat(a))}break;case"j":if(null==l){i=i.replace("%".concat(s),"");break}if(f.isPlainObject(l)){i=i.replace("%".concat(s),JSON.stringify(l));break}throw new TypeError("Invalid parameter type of '".concat(l,"', index ").concat(a));case"s":i=i.replace("%".concat(s),f.toString(l,""))}}return i}},{key:"formatPlaceholder",value:function(t,e){if(!t||t.length<=2||!e)return t;var n=t;for(var r in e){var o=new RegExp("\\{".concat(r,"\\}"),"g"),u=e[r];n=n.replace(o,u?u.toString():"")}return n}},{key:"includes",value:function(t,e){return t===e||f.allNotNil(t,e)&&t.includes(e)}},{key:"includesIgnoreCase",value:function(t,e){var n;return t===e||f.allNotNil(t,e)&&(null==t||null===(n=t.toUpperCase())||void 0===n?void 0:n.includes(null==e?void 0:e.toUpperCase()))}},{key:"includesAny",value:function(t,e){var n=this;return!f.anyNil(t,e)&&(null==e?void 0:e.some((function(e){return n.includes(t,e)})))}},{key:"includesAnyIgnoreCase",value:function(t,e){var n=this;return!f.anyNil(t,e)&&(null==e?void 0:e.some((function(e){return n.includesIgnoreCase(t,e)})))}},{key:"trim",value:function(t,e){if(!t)return t;var n=t.trim();return e&&this.isEmpty(n)?null:n}}]),t}(),y=function(){function t(){a()(this,t)}return s()(t,null,[{key:"getLength",value:function(t){return t?t.length:0}},{key:"getTypeof",value:function(t){if(!this.isEmpty(t))return null==t?void 0:t.map((function(t){return Array.isArray(t)?"array":"object"===u()(t)?null===t?"null":"object":u()(t)}))}},{key:"isEmpty",value:function(t){return!t||0===t.length}},{key:"isNotEmpty",value:function(t){return!this.isEmpty(t)}},{key:"isTypeof",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!this.isEmpty(t)&&!c.isBlank(e)&&(null==t?void 0:t.every((function(t){return u()(t)===e||n&&null===t&&c.equalsAny(e,["string","object"])})))}},{key:"includes",value:function(t,e){return f.allNotNil(t,e)&&t.includes(e)}},{key:"maxLength",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(this.isEmpty(e))return 0;for(var r=0,o=0,u=e;o<u.length;o++){var i=u[o];r=Math.max(r,this.getLength(i))}return r}},{key:"minLength",value:function(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];if(this.isEmpty(r))return 0;var u,i=null===(t=r[0])||void 0===t?void 0:t.length,a=e()(r.slice(1));try{for(a.s();!(u=a.n()).done;){var l=u.value;if(0===(i=Math.min(i,this.getLength(l))))break}}catch(t){a.e(t)}finally{a.f()}return i}},{key:"reverse",value:function(t,e,n){if(!this.isEmpty(t))for(var r=Math.max(e||0,0),o=Math.min(n||this.getLength(t),this.getLength(t))-1;t&&o>r;){var u=t[o];t[o]=t[r],t[r]=u,o--,r++}}}]),t}(),v=function(){function t(){a()(this,t)}return s()(t,null,[{key:"toBoolean",value:function(t){if("number"==typeof t)return t>0;if("string"==typeof t){if(c.equalsAnyIgnoreCase(t,["true","yes","on","y","t","1"]))return!0;if(c.equalsAnyIgnoreCase(t,["false","no","off","n","f","0"]))return!1}}},{key:"toString",value:function(t,e,n,r){return f.isNil(t)?r:t?e:n}},{key:"toStringTrueFalse",value:function(t){return this.toString(t,"true","false",void 0)}},{key:"toStringOnOff",value:function(t){return this.toString(t,"on","off",void 0)}},{key:"toStringYesNo",value:function(t){return this.toString(t,"yes","no",void 0)}},{key:"toStringYN",value:function(t){return this.toString(t,"Y","N",void 0)}},{key:"toStringTF",value:function(t){return this.toString(t,"T","F",void 0)}},{key:"toString10",value:function(t){return this.toString(t,"1","0",void 0)}}]),t}(),h=function(){function t(){a()(this,t)}return s()(t,null,[{key:"addYear",value:function(t,e){if(!e)return t;var n=new Date(t);return n.setFullYear(t.getFullYear()+e),n}},{key:"addMonth",value:function(t,e){if(!e)return t;var n=new Date(t);return n.setMonth(t.getMonth()+e),n}},{key:"addDay",value:function(t,e){if(!e)return t;var n=new Date(t);return n.setDate(t.getDate()+e),n}},{key:"formatDateTime",value:function(t,e){if(!c.isBlank(e)){var n={"y+":t.getFullYear(),"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours()%12==0?12:t.getHours()%12,"H+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()},r=e;for(var o in n){var u=new RegExp("(".concat(o,")")).exec(r);u&&(r=/(y+)/.test(o)?r.replace(u[1],n[o].toString().substring(4-u[1].length)):r.replace(u[1],1===u[1].length?n[o].toString():n[o].toString().padStart(u[1].length,"0")))}return r}}},{key:"getCurrentDate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd";return this.formatDateTime(new Date,t)}},{key:"getCurrentDateTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd hh:mm:ss";return this.formatDateTime(new Date,t)}},{key:"getCurrentTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"hh:mm:ss";return this.formatDateTime(new Date,t)}},{key:"getStartOfYear",value:function(t){var e=new Date(t);return e.setFullYear(t.getFullYear(),0,1),e.setHours(0,0,0,0),e}},{key:"getStartOfMonth",value:function(t){var e=new Date(t);return e.setDate(1),e.setHours(0,0,0,0),e}},{key:"getStartOfDay",value:function(t){var e=new Date(t);return e.setHours(0,0,0,0),e}},{key:"getEndOfYear",value:function(t){var e=new Date(t);return e.setFullYear(t.getFullYear()+1,0,0),e.setHours(23,59,59,999),e}},{key:"getEndOfMonth",value:function(t){var e=new Date(t);return e.setFullYear(t.getFullYear(),t.getMonth()+1,0),e.setHours(23,59,59,999),e}},{key:"getEndOfDay",value:function(t){var e=new Date(t);return e.setHours(23,59,59,999),e}},{key:"getTimezone",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=t.getTimezoneOffset(),n=Math.abs(e),r=Math.floor(n/60),o=n%60,u=o>0?":"+("0"+o).slice(-2):"";return(e<0?"+":"-")+r+u}},{key:"isFirstDayOfMonth",value:function(t){return 1===t.getDate()}},{key:"isLastDayOfMonth",value:function(t){return this.isSameDay(this.getEndOfDay(t),this.getEndOfMonth(t))}},{key:"isLeapYear",value:function(t){var e=t instanceof Date?t.getFullYear():t;return!((e%4||!(e%100))&&e%400)}},{key:"isSameYear",value:function(t,e){return t.getFullYear()===e.getFullYear()}},{key:"isSameMonth",value:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.getMonth()===e.getMonth()&&(!n||t.getFullYear()===e.getFullYear())}},{key:"isSameDay",value:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.getDate()===e.getDate()&&(!n||t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth())}},{key:"isWeekend",value:function(t){return 0===t.getDay()||6===t.getDay()}},{key:"isYesterday",value:function(t){return this.isSameDay(new Date,this.addDay(t,1))}},{key:"isTomorrow",value:function(t){return this.isSameDay(new Date,this.addDay(t,-1))}}]),t}(),g=function(){function t(){a()(this,t)}return s()(t,null,[{key:"isJsonString",value:function(t){if(c.isBlank(t))return!1;try{if("object"===u()(JSON.parse(t)))return!0}catch(t){}return!1}},{key:"toJsonString",value:function(t){if("string"==typeof t&&t.length>0)try{var e=JSON.parse(t);if("object"===u()(e))return JSON.stringify(e)}catch(t){}if(f.isPlainObject(t))return JSON.stringify(t)}}]),t}(),p=function(){function t(){a()(this,t)}return s()(t,null,[{key:"isInteger",value:function(t){return!!t&&Math.floor(t)===Math.ceil(t)}},{key:"toInteger",value:function(t){if(t)try{var e=Number.parseInt(t);return Number.isNaN(e)?void 0:e}catch(t){}}},{key:"toFloat",value:function(t){if(t)try{var e=Number.parseFloat(t);return Number.isNaN(e)?void 0:e}catch(t){}}},{key:"max",value:function(t){if(t&&0!==(null==t?void 0:t.length)){for(var e=t[0],n=1;n<t.length;n++)e<t[n]&&(e=t[n]);return e}}},{key:"min",value:function(t){if(t&&0!==(null==t?void 0:t.length)){for(var e=t[0],n=1;n<t.length;n++)e>t[n]&&(e=t[n]);return e}}},{key:"sum",value:function(t){return t.reduce((function(t,e){return t+e}))}},{key:"average",value:function(t){return this.sum(t)/t.length}}]),t}(),m=function(){function t(){a()(this,t)}return s()(t,null,[{key:"randomBoolean",value:function(){return Math.random()>=.5}},{key:"randomElement",value:function(t){return y.isNotEmpty(t)?t.at(this.randomInteger(0,t.length)):void 0}},{key:"randomElements",value:function(t,e){if(y.isEmpty(t)||e<=0)return[];if(y.getLength(t)<=e)return t;for(var n=new Set;n.size<e;)n.add(this.randomInteger(0,t.length));return t.filter((function(t,e){return n.has(e)}))}},{key:"randomInteger",value:function(t,e){return Math.floor(this.randomNumber(t,e))}},{key:"randomIntegers",value:function(t,e,n){if(t<=0)return[];for(var r=[],o=0;o<t;o++)r.push(this.randomInteger(e,n));return r}},{key:"randomNumber",value:function(t,e){var n=t||0,r=e||Number.MAX_SAFE_INTEGER-1;if(n>r)throw SyntaxError("The min value must not be greater than max value");return n===r?n:n+(r-n)*Math.random()}},{key:"randomNumbers",value:function(t,e,n){if(t<=0)return[];for(var r=[],o=0;o<t;o++)r.push(this.randomNumber(e,n));return r}}]),t}(),d=function(){function t(){a()(this,t)}return s()(t,null,[{key:"sleep",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;return new Promise((function(e){setTimeout(e,t)}))}}]),t}()}(),r}()})); |
{ | ||
"name": "@yookue/ts-lang-utils", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"title": "TsLangUtils", | ||
@@ -37,3 +37,3 @@ "description": "Common Lang Utilities for TypeScript", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage" | ||
"test:coverage": "del-cli ./coverage && jest --coverage" | ||
}, | ||
@@ -51,3 +51,3 @@ "dependencies": { | ||
"eslint": "^7.32.0", | ||
"father": "^4.3.5", | ||
"father": "^4.3.6", | ||
"gh-pages": "^6.0.0", | ||
@@ -54,0 +54,0 @@ "jsdoc": "^4.0.2", |
@@ -15,6 +15,7 @@ # @yookue/ts-lang-utils | ||
4️⃣ Utilities for json | ||
5️⃣ Utilities for object | ||
6️⃣ Utilities for random | ||
7️⃣ Utilities for string | ||
8️⃣ Utilities for thread | ||
5️⃣ Utilities for number | ||
6️⃣ Utilities for object | ||
7️⃣ Utilities for random | ||
8️⃣ Utilities for string | ||
9️⃣ Utilities for thread | ||
@@ -32,3 +33,3 @@ ## Quickstart | ||
```jsx | pure | ||
import {ArrayUtils, BooleanUtils, DateUtils, JsonUtils, ObjectUtils, RandomUtils, StringUtils, ThreadUtils} from '@yookue/ts-lang-utils'; | ||
import {ArrayUtils, BooleanUtils, DateUtils, JsonUtils, NumberUtils, ObjectUtils, RandomUtils, StringUtils, ThreadUtils} from '@yookue/ts-lang-utils'; | ||
``` | ||
@@ -35,0 +36,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
225005
44
5692
48