Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@yookue/ts-lang-utils

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yookue/ts-lang-utils - npm Package Compare versions

Comparing version 0.1.21 to 0.1.22

4

dist/cjs/util/ArrayUtils.d.ts

@@ -111,3 +111,3 @@ /**

*/
static includes<T>(array?: T[] | null, element?: T | null): boolean;
static includes<E>(array?: E[] | null, element?: E | null): boolean;
/**

@@ -146,3 +146,3 @@ * Returns the max length of the given arrays

*/
static remove<T>(array?: T[], excludes?: T[]): T[] | undefined;
static remove<E>(array?: E[] | null, excludes?: E[] | null): E[] | undefined | null;
/**

@@ -149,0 +149,0 @@ * Reverses the given array

@@ -20,3 +20,3 @@ /**

*/
static isJsonString(text: string): boolean;
static isJsonString(text: string | null): boolean;
/**

@@ -23,0 +23,0 @@ * Returns a JSON string that represents the given object

@@ -45,3 +45,3 @@ var __defProp = Object.defineProperty;

try {
if (typeof JSON.parse(text) === "object") {
if (typeof text === "string" && typeof JSON.parse(text) === "object") {
return true;

@@ -48,0 +48,0 @@ }

@@ -296,3 +296,3 @@ /**

*/
static keys(object?: any): Array<string>;
static keys(object?: any): string[];
/**

@@ -299,0 +299,0 @@ * Returns the string representation of the given object

@@ -39,3 +39,3 @@ /**

*/
static randomElements(array: Array<any>, size: number): any[];
static randomElements(array: any[], size: number): any[];
/**

@@ -42,0 +42,0 @@ * Returns a random integer that between the min value (inclusive) and the max value (exclusive)

@@ -19,3 +19,3 @@ /**

*/
static extractWords(text?: string, pattern?: RegExp | string): string[] | undefined;
static extractWords(text?: string | null, pattern?: RegExp | string): string[] | undefined;
}

@@ -38,3 +38,3 @@ var __defProp = Object.defineProperty;

static extractWords(text, pattern = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g) {
return !text || text.length === 0 ? void 0 : text.match(pattern) || void 0;
return !text ? void 0 : text.match(pattern) || void 0;
}

@@ -41,0 +41,0 @@ };

@@ -15,3 +15,3 @@ /**

*/
static getLength(text?: string): number;
static getLength(text?: string | null): number;
/**

@@ -28,3 +28,3 @@ * Returns whether the given string is empty

*/
static isEmpty(text?: string): boolean;
static isEmpty(text?: string | null): boolean;
/**

@@ -40,3 +40,3 @@ * Returns whether the given string is not empty

*/
static isNotEmpty(text?: string): boolean;
static isNotEmpty(text?: string | null): boolean;
/**

@@ -55,3 +55,3 @@ * Returns whether the given string is blank

*/
static isBlank(text?: string): boolean;
static isBlank(text?: string | null): boolean;
/**

@@ -67,3 +67,3 @@ * Returns whether the given string is not blank

*/
static isNotBlank(text?: string): boolean;
static isNotBlank(text?: string | null): boolean;
/**

@@ -80,3 +80,3 @@ * Returns whether all the given texts are empty

*/
static allEmpty(...texts: Array<string | undefined>): boolean;
static allEmpty(...texts: Array<string | undefined | null>): boolean;
/**

@@ -94,3 +94,3 @@ * Returns whether all the given texts are not empty

*/
static allNotEmpty(...texts: Array<string | undefined>): boolean;
static allNotEmpty(...texts: Array<string | undefined | null>): boolean;
/**

@@ -107,3 +107,3 @@ * Returns whether any of the given texts is empty

*/
static anyEmpty(...texts: Array<string | undefined>): boolean;
static anyEmpty(...texts: Array<string | undefined | null>): boolean;
/**

@@ -120,3 +120,3 @@ * Returns whether any of the given texts is not empty

*/
static anyNotEmpty(...texts: Array<string | undefined>): boolean;
static anyNotEmpty(...texts: Array<string | undefined | null>): boolean;
/**

@@ -133,3 +133,3 @@ * Returns whether all the given texts are blank

*/
static allBlank(...texts: Array<string | undefined>): boolean;
static allBlank(...texts: Array<string | undefined | null>): boolean;
/**

@@ -147,3 +147,3 @@ * Returns whether all the given texts are not blank

*/
static allNotBlank(...texts: Array<string | undefined>): boolean;
static allNotBlank(...texts: Array<string | undefined | null>): boolean;
/**

@@ -160,3 +160,3 @@ * Returns whether any of the given texts is blank

*/
static anyBlank(...texts: Array<string | undefined>): boolean;
static anyBlank(...texts: Array<string | undefined | null>): boolean;
/**

@@ -173,3 +173,3 @@ * Returns whether any of the given texts is not blank

*/
static anyNotBlank(...texts: Array<string | undefined>): boolean;
static anyNotBlank(...texts: Array<string | undefined | null>): boolean;
/**

@@ -187,3 +187,3 @@ * Returns a string that concat the given text and suffix

*/
static appendIfMissing(text?: string, suffix?: string): string | undefined;
static appendIfMissing(text?: string | null, suffix?: string | null): string | undefined | null;
/**

@@ -201,3 +201,3 @@ * Returns a string that concat the given text and suffix, case-insensitive

*/
static appendIfMissingIgnoreCase(text?: string, suffix?: string): string | undefined;
static appendIfMissingIgnoreCase(text?: string | null, suffix?: string | null): string | undefined | null;
/**

@@ -213,3 +213,3 @@ * Returns the first letter capitalized representation of the given string

*/
static capitalizeFirst(text?: string): string | undefined;
static capitalizeFirst(text?: string | null): string | undefined | null;
/**

@@ -224,4 +224,5 @@ * Returns an empty value if the given text is undefined

* StringUtils.defaultString(undefined); // ''
* StringUtils.defaultString(null); // ''
*/
static defaultString(text?: string): string;
static defaultString(text?: string | null): string;
/**

@@ -238,3 +239,3 @@ * Returns the default value if the given text is empty, or the text self if it is not empty

*/
static defaultIfEmpty(text?: string, defaultValue?: string): string | undefined;
static defaultIfEmpty(text?: string | null, defaultValue?: string | null): string | undefined | null;
/**

@@ -251,3 +252,3 @@ * Returns the default value if the given text is blank, or the text self if it is not blank

*/
static defaultIfBlank(text?: string, defaultValue?: string): string | undefined;
static defaultIfBlank(text?: string | null, defaultValue?: string | null): string | undefined | null;
/**

@@ -265,3 +266,3 @@ * Returns whether the given string ends with the suffix

*/
static endsWith(text?: string, suffix?: string): boolean;
static endsWith(text?: string | null, suffix?: string | null): boolean;
/**

@@ -279,3 +280,3 @@ * Returns whether the given string ends with the suffix, case-insensitive

*/
static endsWithIgnoreCase(text?: string, suffix?: string): boolean;
static endsWithIgnoreCase(text?: string | null, suffix?: string | null): boolean;
/**

@@ -293,3 +294,3 @@ * Returns whether the given string ends with any of the suffixes

*/
static endsWithAny(text?: string, suffixes?: Array<string | undefined>): boolean;
static endsWithAny(text?: string | null, suffixes?: Array<string | undefined | null>): boolean;
/**

@@ -307,3 +308,3 @@ * Returns whether the given string ends with any of the suffixes, case-insensitive

*/
static endsWithAnyIgnoreCase(text?: string, suffixes?: Array<string | undefined>): boolean;
static endsWithAnyIgnoreCase(text?: string | null, suffixes?: Array<string | undefined | null>): boolean;
/**

@@ -318,6 +319,7 @@ * Returns whether the given strings are equal

* @example
* StringUtils.equals(undefined, null); // false
* StringUtils.equals('foo', 'foo'); // true
* StringUtils.equals('foo', 'bar'); // false
*/
static equals(text?: string, comparison?: string): boolean;
static equals(text?: string | null, comparison?: string | null): boolean;
/**

@@ -334,3 +336,3 @@ * Returns whether the given strings are equal, case-insensitive

*/
static equalsIgnoreCase(text?: string, comparison?: string): boolean;
static equalsIgnoreCase(text?: string | null, comparison?: string | null): boolean;
/**

@@ -347,3 +349,3 @@ * Returns whether the given string equals to any of the comparison strings

*/
static equalsAny(text?: string, comparisons?: Array<string | undefined>): boolean;
static equalsAny(text?: string | null, comparisons?: Array<string | undefined | null>): boolean;
/**

@@ -360,3 +362,3 @@ * Returns whether the given text equals to any of the comparison strings, case-insensitive

*/
static equalsAnyIgnoreCase(text?: string, comparisons?: Array<string | undefined>): boolean;
static equalsAnyIgnoreCase(text?: string | null, comparisons?: Array<string | undefined | null>): boolean;
/**

@@ -375,3 +377,3 @@ * Returns the replaced string of the source string ("{}" placeholder) with the given parameters

*/
static formatBrace(text?: string, ...params: Array<any>): string | undefined;
static formatBrace(text?: string | null, ...params: Array<any>): string | undefined | null;
/**

@@ -392,3 +394,3 @@ * Returns the replaced string of the source string ("%" placeholder) with the given parameters

*/
static formatPercent(text?: string, ...params: Array<any>): string | undefined;
static formatPercent(text?: string | null, ...params: Array<any>): string | undefined | null;
/**

@@ -408,5 +410,5 @@ * Returns the replaced string of the source string (named placeholder) with the given parameters

*/
static formatPlaceholder(text?: string, params?: {
static formatPlaceholder(text?: string | null, params?: {
[key: string]: any;
}): string | undefined;
}): string | undefined | null;
/**

@@ -423,3 +425,3 @@ * Returns whether the given text includes the comparison string

*/
static includes(text?: string, comparison?: string): boolean;
static includes(text?: string | null, comparison?: string | null): boolean;
/**

@@ -436,3 +438,3 @@ * Returns whether the given text includes the comparison string, case-insensitive

*/
static includesIgnoreCase(text?: string, comparison?: string): boolean;
static includesIgnoreCase(text?: string | null, comparison?: string | null): boolean;
/**

@@ -449,3 +451,3 @@ * Returns whether the given text includes to any of the comparison strings

*/
static includesAny(text?: string, comparisons?: Array<string | undefined>): boolean;
static includesAny(text?: string | null, comparisons?: Array<string | undefined | null>): boolean;
/**

@@ -462,4 +464,19 @@ * Returns whether the given text includes to any of the comparison strings, case-insensitive

*/
static includesAnyIgnoreCase(text?: string, comparisons?: Array<string | undefined>): boolean;
static includesAnyIgnoreCase(text?: string | null, comparisons?: Array<string | undefined | null>): boolean;
/**
* Returns the joined string with the given texts and delimiter
*
* @param {string | Array<string>} texts the source string or strings to inspect
* @param {string} separator the delimiter string to append between each of the given texts
* @param {function} filter the filter to check each of the given texts should be included
*
* @return {string} the joined string with the given texts and delimiter
*
* @example
* StringUtils.joinWith('foobar'); // 'foobar'
* StringUtils.joinWith(['foo', 'bar'], undefined); // 'foobar'
* StringUtils.joinWith(['foo', 'bar', 'world'], undefined, (text => text !== 'world')); // 'foobar'
*/
static joinWith(texts?: string | string[] | null, separator?: string | null, filter?: (text?: string) => boolean): string | undefined;
/**
* Returns a string that concat the given prefix and text

@@ -476,3 +493,3 @@ *

*/
static prependIfMissing(text?: string, prefix?: string): string | undefined;
static prependIfMissing(text?: string | null, prefix?: string): string | undefined | null;
/**

@@ -490,3 +507,3 @@ * Returns a string that concat the given prefix and text, case-insensitive

*/
static prependIfMissingIgnoreCase(text?: string, prefix?: string): string | undefined;
static prependIfMissingIgnoreCase(text?: string | null, prefix?: string): string | undefined | null;
/**

@@ -503,3 +520,3 @@ * Returns the array that excludes the elements which equals to any of the given exclusions

*/
static removeEquals(texts?: string[], excludes?: string[]): string[] | undefined;
static removeEquals(texts?: string[] | null, excludes?: string[] | null): string[] | undefined | null;
/**

@@ -516,3 +533,3 @@ * Returns the array that excludes the elements which equals to any of the given exclusions, case-insensitive

*/
static removeEqualsIgnoreCase(texts?: string[], excludes?: string[]): string[] | undefined;
static removeEqualsIgnoreCase(texts?: string[] | null, excludes?: string[] | null): string[] | undefined | null;
/**

@@ -529,3 +546,3 @@ * Returns the array that excludes the elements which includes any of the given exclusions

*/
static removeIncludes(texts?: string[], excludes?: string[]): string[] | undefined;
static removeIncludes(texts?: string[] | null, excludes?: string[] | null): string[] | undefined | null;
/**

@@ -542,3 +559,3 @@ * Returns the array that excludes the elements which includes any of the given exclusions, case-insensitive

*/
static removeIncludesIgnoreCase(texts?: string[], excludes?: string[]): string[] | undefined;
static removeIncludesIgnoreCase(texts?: string[] | null, excludes?: string[] | null): string[] | undefined | null;
/**

@@ -556,3 +573,3 @@ * Returns whether the given string starts with the prefix

*/
static startsWith(text?: string, prefix?: string): boolean;
static startsWith(text?: string | null, prefix?: string | null): boolean;
/**

@@ -570,3 +587,3 @@ * Returns whether the given string starts with the prefix, case-insensitive

*/
static startsWithIgnoreCase(text?: string, prefix?: string): boolean;
static startsWithIgnoreCase(text?: string | null, prefix?: string | null): boolean;
/**

@@ -584,3 +601,3 @@ * Returns whether the given string starts with any of the prefixes

*/
static startsWithAny(text?: string, prefixes?: Array<string | undefined>): boolean;
static startsWithAny(text?: string | null, prefixes?: Array<string | undefined | null>): boolean;
/**

@@ -598,3 +615,3 @@ * Returns whether the given string starts with any of the prefixes, case-insensitive

*/
static startsWithAnyIgnoreCase(text?: string, prefixes?: Array<string | undefined>): boolean;
static startsWithAnyIgnoreCase(text?: string | null, prefixes?: Array<string | undefined | null>): boolean;
/**

@@ -611,3 +628,3 @@ * Returns the substring after the first occurrence of the given separator (the separator is not returned)

*/
static substringAfter(text?: string, separator?: string): string | undefined;
static substringAfter(text?: string | null, separator?: string | null): string | undefined;
/**

@@ -624,3 +641,3 @@ * Returns the substring after the last occurrence of the given separator (the separator is not returned)

*/
static substringAfterLast(text?: string, separator?: string): string | undefined;
static substringAfterLast(text?: string | null, separator?: string | null): string | undefined;
/**

@@ -636,3 +653,3 @@ * Returns the substring before the first occurrence of the given separator (the separator is not returned)

*/
static substringBefore(text?: string, separator?: string): string | undefined;
static substringBefore(text?: string | null, separator?: string | null): string | undefined;
/**

@@ -649,3 +666,3 @@ * Returns the substring before the last occurrence of the given separator (the separator is not returned)

*/
static substringBeforeLast(text?: string, separator?: string): string | undefined;
static substringBeforeLast(text?: string | null, separator?: string | null): string | undefined;
/**

@@ -663,3 +680,3 @@ * Returns the camel case representation of the given string

*/
static toCamelCase(text?: string, pattern?: RegExp | string): string | undefined;
static toCamelCase(text?: string | null, pattern?: RegExp | string): string | undefined | null;
/**

@@ -677,3 +694,3 @@ * Returns the kebab case representation of the given string

*/
static toKebabCase(text?: string, pattern?: RegExp | string): string | undefined;
static toKebabCase(text?: string | null, pattern?: RegExp | string): string | undefined | null;
/**

@@ -690,3 +707,3 @@ * Returns a string that trimmed from the given string

*/
static trim(text?: string, emptyAsNull?: boolean): string | null | undefined;
static trim(text?: string | null, emptyAsNull?: boolean): string | undefined | null;
}

@@ -250,3 +250,3 @@ var __defProp = Object.defineProperty;

static capitalizeFirst(text) {
return !text || text.length === 0 ? void 0 : text.substring(0, 1).toUpperCase() + text.substring(1);
return !text ? text : text.substring(0, 1).toUpperCase() + text.substring(1);
}

@@ -262,2 +262,3 @@ /**

* StringUtils.defaultString(undefined); // ''
* StringUtils.defaultString(null); // ''
*/

@@ -382,2 +383,3 @@ static defaultString(text) {

* @example
* StringUtils.equals(undefined, null); // false
* StringUtils.equals('foo', 'foo'); // true

@@ -387,3 +389,3 @@ * StringUtils.equals('foo', 'bar'); // false

static equals(text, comparison) {
if (text === comparison || !text && !comparison) {
if (text === comparison) {
return true;

@@ -408,3 +410,3 @@ }

static equalsIgnoreCase(text, comparison) {
if (text === comparison || !text && !comparison) {
if (text === comparison) {
return true;

@@ -659,2 +661,29 @@ }

/**
* Returns the joined string with the given texts and delimiter
*
* @param {string | Array<string>} texts the source string or strings to inspect
* @param {string} separator the delimiter string to append between each of the given texts
* @param {function} filter the filter to check each of the given texts should be included
*
* @return {string} the joined string with the given texts and delimiter
*
* @example
* StringUtils.joinWith('foobar'); // 'foobar'
* StringUtils.joinWith(['foo', 'bar'], undefined); // 'foobar'
* StringUtils.joinWith(['foo', 'bar', 'world'], undefined, (text => text !== 'world')); // 'foobar'
*/
static joinWith(texts, separator, filter) {
if (!texts || Array.isArray(texts) && texts.length === 0) {
return void 0;
}
if (Array.isArray(texts)) {
if (!filter) {
return texts.join(this.defaultString(separator));
}
const array = texts.filter(filter);
return !array || array.length === 0 ? void 0 : array.join(this.defaultString(separator));
}
return !filter ? texts : filter(texts) ? texts : void 0;
}
/**
* Returns a string that concat the given prefix and text

@@ -661,0 +690,0 @@ *

@@ -111,3 +111,3 @@ /**

*/
static includes<T>(array?: T[] | null, element?: T | null): boolean;
static includes<E>(array?: E[] | null, element?: E | null): boolean;
/**

@@ -146,3 +146,3 @@ * Returns the max length of the given arrays

*/
static remove<T>(array?: T[], excludes?: T[]): T[] | undefined;
static remove<E>(array?: E[] | null, excludes?: E[] | null): E[] | undefined | null;
/**

@@ -149,0 +149,0 @@ * Reverses the given array

@@ -20,3 +20,3 @@ /**

*/
static isJsonString(text: string): boolean;
static isJsonString(text: string | null): boolean;
/**

@@ -23,0 +23,0 @@ * Returns a JSON string that represents the given object

@@ -17,3 +17,3 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";

try {
if (_typeof(JSON.parse(text)) === 'object') {
if (typeof text === 'string' && _typeof(JSON.parse(text)) === 'object') {
return true;

@@ -20,0 +20,0 @@ }

@@ -296,3 +296,3 @@ /**

*/
static keys(object?: any): Array<string>;
static keys(object?: any): string[];
/**

@@ -299,0 +299,0 @@ * Returns the string representation of the given object

@@ -39,3 +39,3 @@ /**

*/
static randomElements(array: Array<any>, size: number): any[];
static randomElements(array: any[], size: number): any[];
/**

@@ -42,0 +42,0 @@ * Returns a random integer that between the min value (inclusive) and the max value (exclusive)

@@ -19,3 +19,3 @@ /**

*/
static extractWords(text?: string, pattern?: RegExp | string): string[] | undefined;
static extractWords(text?: string | null, pattern?: RegExp | string): string[] | undefined;
}

@@ -11,3 +11,3 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";

var pattern = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
return !text || text.length === 0 ? undefined : text.match(pattern) || undefined;
return !text ? undefined : text.match(pattern) || undefined;
}

@@ -14,0 +14,0 @@ }]);

@@ -15,3 +15,3 @@ /**

*/
static getLength(text?: string): number;
static getLength(text?: string | null): number;
/**

@@ -28,3 +28,3 @@ * Returns whether the given string is empty

*/
static isEmpty(text?: string): boolean;
static isEmpty(text?: string | null): boolean;
/**

@@ -40,3 +40,3 @@ * Returns whether the given string is not empty

*/
static isNotEmpty(text?: string): boolean;
static isNotEmpty(text?: string | null): boolean;
/**

@@ -55,3 +55,3 @@ * Returns whether the given string is blank

*/
static isBlank(text?: string): boolean;
static isBlank(text?: string | null): boolean;
/**

@@ -67,3 +67,3 @@ * Returns whether the given string is not blank

*/
static isNotBlank(text?: string): boolean;
static isNotBlank(text?: string | null): boolean;
/**

@@ -80,3 +80,3 @@ * Returns whether all the given texts are empty

*/
static allEmpty(...texts: Array<string | undefined>): boolean;
static allEmpty(...texts: Array<string | undefined | null>): boolean;
/**

@@ -94,3 +94,3 @@ * Returns whether all the given texts are not empty

*/
static allNotEmpty(...texts: Array<string | undefined>): boolean;
static allNotEmpty(...texts: Array<string | undefined | null>): boolean;
/**

@@ -107,3 +107,3 @@ * Returns whether any of the given texts is empty

*/
static anyEmpty(...texts: Array<string | undefined>): boolean;
static anyEmpty(...texts: Array<string | undefined | null>): boolean;
/**

@@ -120,3 +120,3 @@ * Returns whether any of the given texts is not empty

*/
static anyNotEmpty(...texts: Array<string | undefined>): boolean;
static anyNotEmpty(...texts: Array<string | undefined | null>): boolean;
/**

@@ -133,3 +133,3 @@ * Returns whether all the given texts are blank

*/
static allBlank(...texts: Array<string | undefined>): boolean;
static allBlank(...texts: Array<string | undefined | null>): boolean;
/**

@@ -147,3 +147,3 @@ * Returns whether all the given texts are not blank

*/
static allNotBlank(...texts: Array<string | undefined>): boolean;
static allNotBlank(...texts: Array<string | undefined | null>): boolean;
/**

@@ -160,3 +160,3 @@ * Returns whether any of the given texts is blank

*/
static anyBlank(...texts: Array<string | undefined>): boolean;
static anyBlank(...texts: Array<string | undefined | null>): boolean;
/**

@@ -173,3 +173,3 @@ * Returns whether any of the given texts is not blank

*/
static anyNotBlank(...texts: Array<string | undefined>): boolean;
static anyNotBlank(...texts: Array<string | undefined | null>): boolean;
/**

@@ -187,3 +187,3 @@ * Returns a string that concat the given text and suffix

*/
static appendIfMissing(text?: string, suffix?: string): string | undefined;
static appendIfMissing(text?: string | null, suffix?: string | null): string | undefined | null;
/**

@@ -201,3 +201,3 @@ * Returns a string that concat the given text and suffix, case-insensitive

*/
static appendIfMissingIgnoreCase(text?: string, suffix?: string): string | undefined;
static appendIfMissingIgnoreCase(text?: string | null, suffix?: string | null): string | undefined | null;
/**

@@ -213,3 +213,3 @@ * Returns the first letter capitalized representation of the given string

*/
static capitalizeFirst(text?: string): string | undefined;
static capitalizeFirst(text?: string | null): string | undefined | null;
/**

@@ -224,4 +224,5 @@ * Returns an empty value if the given text is undefined

* StringUtils.defaultString(undefined); // ''
* StringUtils.defaultString(null); // ''
*/
static defaultString(text?: string): string;
static defaultString(text?: string | null): string;
/**

@@ -238,3 +239,3 @@ * Returns the default value if the given text is empty, or the text self if it is not empty

*/
static defaultIfEmpty(text?: string, defaultValue?: string): string | undefined;
static defaultIfEmpty(text?: string | null, defaultValue?: string | null): string | undefined | null;
/**

@@ -251,3 +252,3 @@ * Returns the default value if the given text is blank, or the text self if it is not blank

*/
static defaultIfBlank(text?: string, defaultValue?: string): string | undefined;
static defaultIfBlank(text?: string | null, defaultValue?: string | null): string | undefined | null;
/**

@@ -265,3 +266,3 @@ * Returns whether the given string ends with the suffix

*/
static endsWith(text?: string, suffix?: string): boolean;
static endsWith(text?: string | null, suffix?: string | null): boolean;
/**

@@ -279,3 +280,3 @@ * Returns whether the given string ends with the suffix, case-insensitive

*/
static endsWithIgnoreCase(text?: string, suffix?: string): boolean;
static endsWithIgnoreCase(text?: string | null, suffix?: string | null): boolean;
/**

@@ -293,3 +294,3 @@ * Returns whether the given string ends with any of the suffixes

*/
static endsWithAny(text?: string, suffixes?: Array<string | undefined>): boolean;
static endsWithAny(text?: string | null, suffixes?: Array<string | undefined | null>): boolean;
/**

@@ -307,3 +308,3 @@ * Returns whether the given string ends with any of the suffixes, case-insensitive

*/
static endsWithAnyIgnoreCase(text?: string, suffixes?: Array<string | undefined>): boolean;
static endsWithAnyIgnoreCase(text?: string | null, suffixes?: Array<string | undefined | null>): boolean;
/**

@@ -318,6 +319,7 @@ * Returns whether the given strings are equal

* @example
* StringUtils.equals(undefined, null); // false
* StringUtils.equals('foo', 'foo'); // true
* StringUtils.equals('foo', 'bar'); // false
*/
static equals(text?: string, comparison?: string): boolean;
static equals(text?: string | null, comparison?: string | null): boolean;
/**

@@ -334,3 +336,3 @@ * Returns whether the given strings are equal, case-insensitive

*/
static equalsIgnoreCase(text?: string, comparison?: string): boolean;
static equalsIgnoreCase(text?: string | null, comparison?: string | null): boolean;
/**

@@ -347,3 +349,3 @@ * Returns whether the given string equals to any of the comparison strings

*/
static equalsAny(text?: string, comparisons?: Array<string | undefined>): boolean;
static equalsAny(text?: string | null, comparisons?: Array<string | undefined | null>): boolean;
/**

@@ -360,3 +362,3 @@ * Returns whether the given text equals to any of the comparison strings, case-insensitive

*/
static equalsAnyIgnoreCase(text?: string, comparisons?: Array<string | undefined>): boolean;
static equalsAnyIgnoreCase(text?: string | null, comparisons?: Array<string | undefined | null>): boolean;
/**

@@ -375,3 +377,3 @@ * Returns the replaced string of the source string ("{}" placeholder) with the given parameters

*/
static formatBrace(text?: string, ...params: Array<any>): string | undefined;
static formatBrace(text?: string | null, ...params: Array<any>): string | undefined | null;
/**

@@ -392,3 +394,3 @@ * Returns the replaced string of the source string ("%" placeholder) with the given parameters

*/
static formatPercent(text?: string, ...params: Array<any>): string | undefined;
static formatPercent(text?: string | null, ...params: Array<any>): string | undefined | null;
/**

@@ -408,5 +410,5 @@ * Returns the replaced string of the source string (named placeholder) with the given parameters

*/
static formatPlaceholder(text?: string, params?: {
static formatPlaceholder(text?: string | null, params?: {
[key: string]: any;
}): string | undefined;
}): string | undefined | null;
/**

@@ -423,3 +425,3 @@ * Returns whether the given text includes the comparison string

*/
static includes(text?: string, comparison?: string): boolean;
static includes(text?: string | null, comparison?: string | null): boolean;
/**

@@ -436,3 +438,3 @@ * Returns whether the given text includes the comparison string, case-insensitive

*/
static includesIgnoreCase(text?: string, comparison?: string): boolean;
static includesIgnoreCase(text?: string | null, comparison?: string | null): boolean;
/**

@@ -449,3 +451,3 @@ * Returns whether the given text includes to any of the comparison strings

*/
static includesAny(text?: string, comparisons?: Array<string | undefined>): boolean;
static includesAny(text?: string | null, comparisons?: Array<string | undefined | null>): boolean;
/**

@@ -462,4 +464,19 @@ * Returns whether the given text includes to any of the comparison strings, case-insensitive

*/
static includesAnyIgnoreCase(text?: string, comparisons?: Array<string | undefined>): boolean;
static includesAnyIgnoreCase(text?: string | null, comparisons?: Array<string | undefined | null>): boolean;
/**
* Returns the joined string with the given texts and delimiter
*
* @param {string | Array<string>} texts the source string or strings to inspect
* @param {string} separator the delimiter string to append between each of the given texts
* @param {function} filter the filter to check each of the given texts should be included
*
* @return {string} the joined string with the given texts and delimiter
*
* @example
* StringUtils.joinWith('foobar'); // 'foobar'
* StringUtils.joinWith(['foo', 'bar'], undefined); // 'foobar'
* StringUtils.joinWith(['foo', 'bar', 'world'], undefined, (text => text !== 'world')); // 'foobar'
*/
static joinWith(texts?: string | string[] | null, separator?: string | null, filter?: (text?: string) => boolean): string | undefined;
/**
* Returns a string that concat the given prefix and text

@@ -476,3 +493,3 @@ *

*/
static prependIfMissing(text?: string, prefix?: string): string | undefined;
static prependIfMissing(text?: string | null, prefix?: string): string | undefined | null;
/**

@@ -490,3 +507,3 @@ * Returns a string that concat the given prefix and text, case-insensitive

*/
static prependIfMissingIgnoreCase(text?: string, prefix?: string): string | undefined;
static prependIfMissingIgnoreCase(text?: string | null, prefix?: string): string | undefined | null;
/**

@@ -503,3 +520,3 @@ * Returns the array that excludes the elements which equals to any of the given exclusions

*/
static removeEquals(texts?: string[], excludes?: string[]): string[] | undefined;
static removeEquals(texts?: string[] | null, excludes?: string[] | null): string[] | undefined | null;
/**

@@ -516,3 +533,3 @@ * Returns the array that excludes the elements which equals to any of the given exclusions, case-insensitive

*/
static removeEqualsIgnoreCase(texts?: string[], excludes?: string[]): string[] | undefined;
static removeEqualsIgnoreCase(texts?: string[] | null, excludes?: string[] | null): string[] | undefined | null;
/**

@@ -529,3 +546,3 @@ * Returns the array that excludes the elements which includes any of the given exclusions

*/
static removeIncludes(texts?: string[], excludes?: string[]): string[] | undefined;
static removeIncludes(texts?: string[] | null, excludes?: string[] | null): string[] | undefined | null;
/**

@@ -542,3 +559,3 @@ * Returns the array that excludes the elements which includes any of the given exclusions, case-insensitive

*/
static removeIncludesIgnoreCase(texts?: string[], excludes?: string[]): string[] | undefined;
static removeIncludesIgnoreCase(texts?: string[] | null, excludes?: string[] | null): string[] | undefined | null;
/**

@@ -556,3 +573,3 @@ * Returns whether the given string starts with the prefix

*/
static startsWith(text?: string, prefix?: string): boolean;
static startsWith(text?: string | null, prefix?: string | null): boolean;
/**

@@ -570,3 +587,3 @@ * Returns whether the given string starts with the prefix, case-insensitive

*/
static startsWithIgnoreCase(text?: string, prefix?: string): boolean;
static startsWithIgnoreCase(text?: string | null, prefix?: string | null): boolean;
/**

@@ -584,3 +601,3 @@ * Returns whether the given string starts with any of the prefixes

*/
static startsWithAny(text?: string, prefixes?: Array<string | undefined>): boolean;
static startsWithAny(text?: string | null, prefixes?: Array<string | undefined | null>): boolean;
/**

@@ -598,3 +615,3 @@ * Returns whether the given string starts with any of the prefixes, case-insensitive

*/
static startsWithAnyIgnoreCase(text?: string, prefixes?: Array<string | undefined>): boolean;
static startsWithAnyIgnoreCase(text?: string | null, prefixes?: Array<string | undefined | null>): boolean;
/**

@@ -611,3 +628,3 @@ * Returns the substring after the first occurrence of the given separator (the separator is not returned)

*/
static substringAfter(text?: string, separator?: string): string | undefined;
static substringAfter(text?: string | null, separator?: string | null): string | undefined;
/**

@@ -624,3 +641,3 @@ * Returns the substring after the last occurrence of the given separator (the separator is not returned)

*/
static substringAfterLast(text?: string, separator?: string): string | undefined;
static substringAfterLast(text?: string | null, separator?: string | null): string | undefined;
/**

@@ -636,3 +653,3 @@ * Returns the substring before the first occurrence of the given separator (the separator is not returned)

*/
static substringBefore(text?: string, separator?: string): string | undefined;
static substringBefore(text?: string | null, separator?: string | null): string | undefined;
/**

@@ -649,3 +666,3 @@ * Returns the substring before the last occurrence of the given separator (the separator is not returned)

*/
static substringBeforeLast(text?: string, separator?: string): string | undefined;
static substringBeforeLast(text?: string | null, separator?: string | null): string | undefined;
/**

@@ -663,3 +680,3 @@ * Returns the camel case representation of the given string

*/
static toCamelCase(text?: string, pattern?: RegExp | string): string | undefined;
static toCamelCase(text?: string | null, pattern?: RegExp | string): string | undefined | null;
/**

@@ -677,3 +694,3 @@ * Returns the kebab case representation of the given string

*/
static toKebabCase(text?: string, pattern?: RegExp | string): string | undefined;
static toKebabCase(text?: string | null, pattern?: RegExp | string): string | undefined | null;
/**

@@ -690,3 +707,3 @@ * Returns a string that trimmed from the given string

*/
static trim(text?: string, emptyAsNull?: boolean): string | null | undefined;
static trim(text?: string | null, emptyAsNull?: boolean): string | undefined | null;
}

@@ -136,3 +136,3 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";

value: function capitalizeFirst(text) {
return !text || text.length === 0 ? undefined : text.substring(0, 1).toUpperCase() + text.substring(1);
return !text ? text : text.substring(0, 1).toUpperCase() + text.substring(1);
}

@@ -201,3 +201,3 @@ }, {

value: function equals(text, comparison) {
if (text === comparison || !text && !comparison) {
if (text === comparison) {
return true;

@@ -213,3 +213,3 @@ }

value: function equalsIgnoreCase(text, comparison) {
if (text === comparison || !text && !comparison) {
if (text === comparison) {
return true;

@@ -390,2 +390,17 @@ }

}, {
key: "joinWith",
value: function joinWith(texts, separator, filter) {
if (!texts || Array.isArray(texts) && texts.length === 0) {
return undefined;
}
if (Array.isArray(texts)) {
if (!filter) {
return texts.join(this.defaultString(separator));
}
var array = texts.filter(filter);
return !array || array.length === 0 ? undefined : array.join(this.defaultString(separator));
}
return !filter ? texts : filter(texts) ? texts : undefined;
}
}, {
key: "prependIfMissing",

@@ -392,0 +407,0 @@ value: function prependIfMissing(text, prefix) {

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TsLangUtils=t():e.TsLangUtils=t()}(self,(function(){return function(){var e={317:function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.__esModule=!0,e.exports.default=e.exports},486:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},702:function(e,t,n){var r=n(281);function u(e,t){for(var n=0;n<t.length;n++){var u=t[n];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,r(u.key),u)}}e.exports=function(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},746:function(e,t,n){var r=n(508);e.exports=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var u=0,o=function(){};return{s:o,n:function(){return u>=e.length?{done:!0}:{done:!1,value:e[u++]}},e:function(e){throw e},f:o}}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(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}},e.exports.__esModule=!0,e.exports.default=e.exports},224:function(e,t,n){var r=n(944).default;e.exports=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var u=n.call(e,t||"default");if("object"!=r(u))return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},281:function(e,t,n){var r=n(944).default,u=n(224);e.exports=function(e){var t=u(e,"string");return"symbol"==r(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},944:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},508:function(e,t,n){var r=n(317);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function n(r){var u=t[r];if(void 0!==u)return u.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return function(){"use strict";n.r(r),n.d(r,{ArrayUtils:function(){return v},BooleanUtils:function(){return h},DateUtils:function(){return g},JsonUtils:function(){return p},NumberUtils:function(){return d},ObjectUtils:function(){return f},RandomUtils:function(){return m},RegexUtils:function(){return c},StringUtils:function(){return y},ThreadUtils:function(){return k}});var e=n(746),t=n.n(e),u=n(944),o=n.n(u),i=n(486),a=n.n(i),l=n(702),s=n.n(l),f=function(){function e(){a()(this,e)}return s()(e,null,[{key:"isNil",value:function(e){return null==e}},{key:"isNotNil",value:function(e){return!this.isNil(e)}},{key:"isNull",value:function(e){return null===e}},{key:"isNotNull",value:function(e){return!this.isNull(e)}},{key:"isUndefined",value:function(e){return void 0===e}},{key:"isNotUndefined",value:function(e){return!this.isUndefined(e)}},{key:"isEmpty",value:function(e){return!e||("string"==typeof e||Array.isArray(e)?0===e.length:e instanceof Map||e instanceof Set?0===e.size:"object"===o()(e)&&0===(null===(t=this.keys(e))||void 0===t?void 0:t.length));var t}},{key:"isNotEmpty",value:function(e){return!this.isEmpty(e)}},{key:"isPlainObject",value:function(e){return"object"===o()(e)&&"[object Object]"===Object.prototype.toString.call(e)}},{key:"isPromiseObject",value:function(e){return"object"===o()(e)&&"[object Promise]"===Object.prototype.toString.call(e)}},{key:"isPrototype",value:function(e){if("object"!==o()(e))return!1;var t=e.constructor;return e===("function"==typeof t?t.prototype:e.prototype)}},{key:"allNil",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isEmpty(n)||!n.some((function(t){return e.isNotNil(t)}))}},{key:"allNotNil",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&!n.some((function(t){return e.isNil(t)}))}},{key:"anyNil",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isEmpty(n)||n.some((function(t){return e.isNil(t)}))}},{key:"anyNotNil",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&n.some((function(t){return e.isNotNil(t)}))}},{key:"allEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isEmpty(n)||!n.some((function(t){return e.isNotEmpty(t)}))}},{key:"allNotEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&!n.some((function(t){return e.isEmpty(t)}))}},{key:"anyEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isEmpty(n)||n.some((function(t){return e.isEmpty(t)}))}},{key:"anyNotEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&n.some((function(t){return e.isNotEmpty(t)}))}},{key:"firstNonNil",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t||0===t.length)return null;for(var r=0,u=t;r<u.length;r++){var o=u[r];if(this.isNotNil(o))return o}return null}},{key:"getProperty",value:function(e,t){if("object"===o()(e)&&t&&0!==(null==t?void 0:t.length)){var n=t.replace(/\[/g,".").replace(/]/g,"").split(".");if(n&&0!==(null==n?void 0:n.length))return 1===(null==n?void 0:n.length)?e[n[0]]:n.reduce((function(e,t){return(e||{})[t]}),e)}}},{key:"hasProperty",value:function(e,t){return"object"===o()(e)&&!!t&&(null==t?void 0:t.length)>0&&Object.prototype.hasOwnProperty.call(e,t)}},{key:"setProperty",value:function(e,t,n){this.isPlainObject(e)&&t&&(e[t]=n)}},{key:"keys",value:function(e){if(!e)return[];if(!this.isPrototype(e))return Object.keys(e);var t=[];for(var n in Object(e))"constructor"!==n&&this.hasProperty(e,n)&&t.push(n);return t}},{key:"toString",value:function(e,t){return e?e.toString():t}}]),e}(),c=function(){function e(){a()(this,e)}return s()(e,null,[{key:"extractWords",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;return e&&0!==e.length&&e.match(t)||void 0}}]),e}(),y=function(){function e(){a()(this,e)}return s()(e,null,[{key:"getLength",value:function(e){return e?e.length:0}},{key:"isEmpty",value:function(e){return!e||0===e.length}},{key:"isNotEmpty",value:function(e){return!this.isEmpty(e)}},{key:"isBlank",value:function(e){return!e||0===(null==e?void 0:e.length)||/^\s*$/.test(e)}},{key:"isNotBlank",value:function(e){return!this.isBlank(e)}},{key:"allEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return!n||0===n.length||!n.some((function(t){return e.isNotEmpty(t)}))}},{key:"allNotEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n&&n.length>0&&!n.some((function(t){return e.isEmpty(t)}))}},{key:"anyEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return!n||0===n.length||n.some((function(t){return e.isEmpty(t)}))}},{key:"anyNotEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n&&(null==n?void 0:n.length)>0&&n.some((function(t){return e.isNotEmpty(t)}))}},{key:"allBlank",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return!n||0===n.length||!n.some((function(t){return e.isNotBlank(t)}))}},{key:"allNotBlank",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n&&n.length>0&&!n.some((function(t){return e.isBlank(t)}))}},{key:"anyBlank",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return!n||0===n.length||n.some((function(t){return e.isBlank(t)}))}},{key:"anyNotBlank",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n&&n.length>0&&n.some((function(t){return e.isNotBlank(t)}))}},{key:"appendIfMissing",value:function(e,t){return!e||this.isEmpty(t)||this.endsWith(e,t)?e:e+t}},{key:"appendIfMissingIgnoreCase",value:function(e,t){return!e||this.isEmpty(t)||this.endsWithIgnoreCase(e,t)?e:e+t}},{key:"capitalizeFirst",value:function(e){return e&&0!==e.length?e.substring(0,1).toUpperCase()+e.substring(1):void 0}},{key:"defaultString",value:function(e){return e||""}},{key:"defaultIfEmpty",value:function(e,t){return this.isEmpty(e)?t:e}},{key:"defaultIfBlank",value:function(e,t){return this.isBlank(e)?t:e}},{key:"endsWith",value:function(e,t){return e&&t?!(e.length<t.length)&&e.endsWith(t):e===t}},{key:"endsWithIgnoreCase",value:function(e,t){return e&&t?!(e.length<t.length)&&e.toLowerCase().endsWith(t.toLowerCase()):e===t}},{key:"endsWithAny",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&t.some((function(t){return n.endsWith(e,t)}))}},{key:"endsWithAnyIgnoreCase",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&t.some((function(t){return n.endsWithIgnoreCase(e,t)}))}},{key:"equals",value:function(e,t){return e===t||!e&&!t||!(!e||!t||(null==e?void 0:e.length)!==(null==t?void 0:t.length))&&e===t}},{key:"equalsIgnoreCase",value:function(e,t){return e===t||!e&&!t||!(!e||!t||(null==e?void 0:e.length)!==(null==t?void 0:t.length))&&(null==e?void 0:e.toUpperCase())===(null==t?void 0:t.toUpperCase())}},{key:"equalsAny",value:function(e,t){return v.includes(t,e)}},{key:"equalsAnyIgnoreCase",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&t.some((function(t){return n.equalsIgnoreCase(e,t)}))}},{key:"formatBrace",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(!e||e.length<=2||!n||0===n.length)return e;for(var u=e,o=0,i=n;o<i.length;o++){var a=i[o];u=u.replace("{}",f.toString(a,""))}return u}},{key:"formatPercent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(!e||e.length<=2||!n||0===n.length)return e;var u=e.match(/%[bcdfjosxX]/g)||[],o=v.minLength(u,n);if(0===o)return e;for(var i=e,a=0;a<o;a++){var l=n[a],s=u[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(e){throw new TypeError("Invalid parameter type of '".concat(l,"', index ").concat(a))}break;case"f":try{var y=void 0;"string"==typeof l?y=Number.parseFloat(l):l instanceof String?y=Number.parseFloat(l.toString()):"number"==typeof l&&(y=l),y&&(i=i.replace("%".concat(s),"0x"+y.toString()))}catch(e){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(e,t){if(!e||e.length<=2||!t)return e;var n=e;for(var r in t){var u=new RegExp("\\{".concat(r,"\\}"),"g"),o=t[r];n=n.replace(u,o?o.toString():"")}return n}},{key:"includes",value:function(e,t){return e===t||!!e&&!!t&&e.includes(t)}},{key:"includesIgnoreCase",value:function(e,t){var n;return e===t||!!e&&!!t&&(null==e||null===(n=e.toUpperCase())||void 0===n?void 0:n.includes(null==t?void 0:t.toUpperCase()))}},{key:"includesAny",value:function(e,t){var n=this;return!(!e||!t)&&(null==t?void 0:t.some((function(t){return n.includes(e,t)})))}},{key:"includesAnyIgnoreCase",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&(null==t?void 0:t.some((function(t){return n.includesIgnoreCase(e,t)})))}},{key:"prependIfMissing",value:function(e,t){return!e||this.isEmpty(t)||this.startsWith(e,t)?e:t+e}},{key:"prependIfMissingIgnoreCase",value:function(e,t){return!e||this.isEmpty(t)||this.startsWithIgnoreCase(e,t)?e:t+e}},{key:"removeEquals",value:function(e,t){return v.remove(e,t)}},{key:"removeEqualsIgnoreCase",value:function(e,t){var n=this;return e&&0!==e.length&&t&&0!==t.length?e.filter((function(e){return!t.some((function(t){return n.equalsIgnoreCase(e,t)}))})):e}},{key:"removeIncludes",value:function(e,t){var n=this;return e&&0!==e.length&&t&&0!==t.length?e.filter((function(e){return!t.some((function(t){return n.includes(e,t)}))})):e}},{key:"removeIncludesIgnoreCase",value:function(e,t){var n=this;return e&&0!==e.length&&t&&0!==t.length?e.filter((function(e){return!t.some((function(t){return n.includesIgnoreCase(e,t)}))})):e}},{key:"startsWith",value:function(e,t){return e&&t?!(e.length<t.length)&&e.startsWith(t):e===t}},{key:"startsWithIgnoreCase",value:function(e,t){return e&&t?!(e.length<t.length)&&e.toLowerCase().startsWith(t.toLowerCase()):e===t}},{key:"startsWithAny",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&t.some((function(t){return n.startsWith(e,t)}))}},{key:"startsWithAnyIgnoreCase",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&t.some((function(t){return n.startsWithIgnoreCase(e,t)}))}},{key:"substringAfter",value:function(e,t){if(e&&t&&0!==t.length){var n=e.indexOf(t);return-1===n?void 0:e.substring(n+t.length)}}},{key:"substringAfterLast",value:function(e,t){if(e&&t&&0!==t.length){var n=e.lastIndexOf(t);return-1===n?void 0:e.substring(n+t.length)}}},{key:"substringBefore",value:function(e,t){if(e&&t&&0!==t.length){var n=e.indexOf(t);return-1===n?void 0:e.substring(0,n)}}},{key:"substringBeforeLast",value:function(e,t){if(e&&t&&0!==t.length){var n=e.lastIndexOf(t);return-1===n?void 0:e.substring(0,n)}}},{key:"toCamelCase",value:function(e,t){var n=this;if(!e||0===e.length)return e;var r=c.extractWords(e,t);return r?r.reduce((function(e,t,r){return t=t.toLowerCase(),e+(r>0?n.capitalizeFirst(t):t)}),""):void 0}},{key:"toKebabCase",value:function(e,t){if(!e||0===e.length)return e;var n=c.extractWords(e,t);return n?n.reduce((function(e,t,n){return e+(n>0?"-":"")+t.toLowerCase()}),""):void 0}},{key:"trim",value:function(e,t){if(!e)return e;var n=e.trim();return t&&this.isEmpty(n)?null:n}}]),e}(),v=function(){function e(){a()(this,e)}return s()(e,null,[{key:"asArray",value:function(e){return e?[e]:void 0}},{key:"getFirst",value:function(e){return e&&0!==e.length?e[0]:void 0}},{key:"getLast",value:function(e){return e&&0!==e.length?e[e.length-1]:void 0}},{key:"getLength",value:function(e){return e?e.length:0}},{key:"getTypeof",value:function(e){if(!this.isEmpty(e))return null==e?void 0:e.map((function(e){return Array.isArray(e)?"array":"object"===o()(e)?null===e?"null":"object":o()(e)}))}},{key:"isEmpty",value:function(e){return!e||0===e.length}},{key:"isNotEmpty",value:function(e){return!this.isEmpty(e)}},{key:"isTypeof",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!this.isEmpty(e)&&!y.isBlank(t)&&(null==e?void 0:e.every((function(e){return o()(e)===t||n&&null===e&&y.equalsAny(t,["string","object"])})))}},{key:"includes",value:function(e,t){return!!e&&!!t&&e.includes(t)}},{key:"maxLength",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(this.isEmpty(t))return 0;for(var r=0,u=0,o=t;u<o.length;u++){var i=o[u];r=Math.max(r,this.getLength(i))}return r}},{key:"minLength",value:function(){for(var e,n=arguments.length,r=new Array(n),u=0;u<n;u++)r[u]=arguments[u];if(this.isEmpty(r))return 0;var o,i=null===(e=r[0])||void 0===e?void 0:e.length,a=t()(r.slice(1));try{for(a.s();!(o=a.n()).done;){var l=o.value;if(0===(i=Math.min(i,this.getLength(l))))break}}catch(e){a.e(e)}finally{a.f()}return i}},{key:"remove",value:function(e,t){return e&&0!==e.length&&t&&0!==t.length?e.filter((function(e){return!t.includes(e)})):e}},{key:"reverse",value:function(e,t,n){if(!this.isEmpty(e))for(var r=Math.max(t||0,0),u=Math.min(n||this.getLength(e),this.getLength(e))-1;e&&u>r;){var o=e[u];e[u]=e[r],e[r]=o,u--,r++}}}]),e}(),h=function(){function e(){a()(this,e)}return s()(e,null,[{key:"isTrue",value:function(e){return"boolean"==typeof e?e:"number"==typeof e?e>0:"string"==typeof e&&y.equalsAnyIgnoreCase(e,["true","yes","on","y","t","1"])}},{key:"isNotTrue",value:function(e){return null==e||("boolean"==typeof e?!e:this.isFalse(e))}},{key:"isFalse",value:function(e){return"boolean"==typeof e?!e:"number"==typeof e?e<=0:"string"==typeof e&&y.equalsAnyIgnoreCase(e,["false","no","off","n","f","0"])}},{key:"isNotFalse",value:function(e){return null==e||("boolean"==typeof e?e:this.isTrue(e))}},{key:"toString",value:function(e,t,n,r){return f.isNil(e)?r:e?t:n}},{key:"toStringTrueFalse",value:function(e){return this.toString(e,"true","false",void 0)}},{key:"toStringOnOff",value:function(e){return this.toString(e,"on","off",void 0)}},{key:"toStringYesNo",value:function(e){return this.toString(e,"yes","no",void 0)}},{key:"toStringYN",value:function(e){return this.toString(e,"Y","N",void 0)}},{key:"toStringTF",value:function(e){return this.toString(e,"T","F",void 0)}},{key:"toString10",value:function(e){return this.toString(e,"1","0",void 0)}}]),e}(),g=function(){function e(){a()(this,e)}return s()(e,null,[{key:"addYear",value:function(e,t){if(!t)return e;var n=new Date(e);return n.setFullYear(e.getFullYear()+t),n}},{key:"addMonth",value:function(e,t){if(!t)return e;var n=new Date(e);return n.setMonth(e.getMonth()+t),n}},{key:"addDay",value:function(e,t){if(!t)return e;var n=new Date(e);return n.setDate(e.getDate()+t),n}},{key:"formatDateTime",value:function(e,t){if(!y.isBlank(t)){var n={"y+":e.getFullYear(),"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours()%12==0?12:e.getHours()%12,"H+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()},r=t;for(var u in n){var o=new RegExp("(".concat(u,")")).exec(r);o&&(r=/(y+)/.test(u)?r.replace(o[1],n[u].toString().substring(4-o[1].length)):r.replace(o[1],1===o[1].length?n[u].toString():n[u].toString().padStart(o[1].length,"0")))}return r}}},{key:"getCurrentDate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd";return this.formatDateTime(new Date,e)}},{key:"getCurrentDateTime",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd hh:mm:ss";return this.formatDateTime(new Date,e)}},{key:"getCurrentTime",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"hh:mm:ss";return this.formatDateTime(new Date,e)}},{key:"getStartOfYear",value:function(e){var t=new Date(e);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}},{key:"getStartOfMonth",value:function(e){var t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),t}},{key:"getStartOfDay",value:function(e){var t=new Date(e);return t.setHours(0,0,0,0),t}},{key:"getEndOfYear",value:function(e){var t=new Date(e);return t.setFullYear(e.getFullYear()+1,0,0),t.setHours(23,59,59,999),t}},{key:"getEndOfMonth",value:function(e){var t=new Date(e);return t.setFullYear(e.getFullYear(),e.getMonth()+1,0),t.setHours(23,59,59,999),t}},{key:"getEndOfDay",value:function(e){var t=new Date(e);return t.setHours(23,59,59,999),t}},{key:"getTimezone",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getTimezoneOffset(),n=Math.abs(t),r=Math.floor(n/60),u=n%60,o=u>0?":"+("0"+u).slice(-2):"";return(t<0?"+":"-")+r+o}},{key:"isFirstDayOfMonth",value:function(e){return 1===e.getDate()}},{key:"isLastDayOfMonth",value:function(e){return this.isSameDay(this.getEndOfDay(e),this.getEndOfMonth(e))}},{key:"isLeapYear",value:function(e){var t=e instanceof Date?e.getFullYear():e;return!((t%4||!(t%100))&&t%400)}},{key:"isSameYear",value:function(e,t){return e.getFullYear()===t.getFullYear()}},{key:"isSameMonth",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return e.getMonth()===t.getMonth()&&(!n||e.getFullYear()===t.getFullYear())}},{key:"isSameDay",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return e.getDate()===t.getDate()&&(!n||e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth())}},{key:"isWeekend",value:function(e){return 0===e.getDay()||6===e.getDay()}},{key:"isYesterday",value:function(e){return this.isSameDay(new Date,this.addDay(e,1))}},{key:"isTomorrow",value:function(e){return this.isSameDay(new Date,this.addDay(e,-1))}}]),e}(),p=function(){function e(){a()(this,e)}return s()(e,null,[{key:"isJsonString",value:function(e){if(y.isBlank(e))return!1;try{if("object"===o()(JSON.parse(e)))return!0}catch(e){}return!1}},{key:"toJsonString",value:function(e){if("string"==typeof e&&e.length>0)try{var t=JSON.parse(e);if("object"===o()(t))return JSON.stringify(t)}catch(e){}if(f.isPlainObject(e))return JSON.stringify(e)}}]),e}(),d=function(){function e(){a()(this,e)}return s()(e,null,[{key:"isInteger",value:function(e){return!!e&&Math.floor(e)===Math.ceil(e)}},{key:"toInteger",value:function(e){if(e)try{var t=Number.parseInt(e);return Number.isNaN(t)?void 0:t}catch(e){}}},{key:"toFloat",value:function(e){if(e)try{var t=Number.parseFloat(e);return Number.isNaN(t)?void 0:t}catch(e){}}},{key:"max",value:function(e){if(e&&0!==(null==e?void 0:e.length)){for(var t=e[0],n=1;n<e.length;n++)t<e[n]&&(t=e[n]);return t}}},{key:"min",value:function(e){if(e&&0!==(null==e?void 0:e.length)){for(var t=e[0],n=1;n<e.length;n++)t>e[n]&&(t=e[n]);return t}}},{key:"sum",value:function(e){return e.reduce((function(e,t){return e+t}))}},{key:"average",value:function(e){return this.sum(e)/e.length}}]),e}(),m=function(){function e(){a()(this,e)}return s()(e,null,[{key:"randomBoolean",value:function(){return Math.random()>=.5}},{key:"randomElement",value:function(e){return v.isNotEmpty(e)?e.at(this.randomInteger(0,e.length)):void 0}},{key:"randomElements",value:function(e,t){if(v.isEmpty(e)||t<=0)return[];if(v.getLength(e)<=t)return e;for(var n=new Set;n.size<t;)n.add(this.randomInteger(0,e.length));return e.filter((function(e,t){return n.has(t)}))}},{key:"randomInteger",value:function(e,t){return Math.floor(this.randomNumber(e,t))}},{key:"randomIntegers",value:function(e,t,n){if(e<=0)return[];for(var r=[],u=0;u<e;u++)r.push(this.randomInteger(t,n));return r}},{key:"randomNumber",value:function(e,t){var n=e||0,r=t||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(e,t,n){if(e<=0)return[];for(var r=[],u=0;u<e;u++)r.push(this.randomNumber(t,n));return r}}]),e}(),k=function(){function e(){a()(this,e)}return s()(e,null,[{key:"sleep",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;return new Promise((function(t){setTimeout(t,e)}))}}]),e}()}(),r}()}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TsLangUtils=t():e.TsLangUtils=t()}(self,(function(){return function(){var e={317:function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.__esModule=!0,e.exports.default=e.exports},486:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},702:function(e,t,n){var r=n(281);function u(e,t){for(var n=0;n<t.length;n++){var u=t[n];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,r(u.key),u)}}e.exports=function(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},746:function(e,t,n){var r=n(508);e.exports=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var u=0,o=function(){};return{s:o,n:function(){return u>=e.length?{done:!0}:{done:!1,value:e[u++]}},e:function(e){throw e},f:o}}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(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}},e.exports.__esModule=!0,e.exports.default=e.exports},224:function(e,t,n){var r=n(944).default;e.exports=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var u=n.call(e,t||"default");if("object"!=r(u))return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},281:function(e,t,n){var r=n(944).default,u=n(224);e.exports=function(e){var t=u(e,"string");return"symbol"==r(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},944:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},508:function(e,t,n){var r=n(317);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function n(r){var u=t[r];if(void 0!==u)return u.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return function(){"use strict";n.r(r),n.d(r,{ArrayUtils:function(){return v},BooleanUtils:function(){return h},DateUtils:function(){return g},JsonUtils:function(){return p},NumberUtils:function(){return d},ObjectUtils:function(){return f},RandomUtils:function(){return m},RegexUtils:function(){return c},StringUtils:function(){return y},ThreadUtils:function(){return k}});var e=n(746),t=n.n(e),u=n(944),o=n.n(u),i=n(486),a=n.n(i),l=n(702),s=n.n(l),f=function(){function e(){a()(this,e)}return s()(e,null,[{key:"isNil",value:function(e){return null==e}},{key:"isNotNil",value:function(e){return!this.isNil(e)}},{key:"isNull",value:function(e){return null===e}},{key:"isNotNull",value:function(e){return!this.isNull(e)}},{key:"isUndefined",value:function(e){return void 0===e}},{key:"isNotUndefined",value:function(e){return!this.isUndefined(e)}},{key:"isEmpty",value:function(e){return!e||("string"==typeof e||Array.isArray(e)?0===e.length:e instanceof Map||e instanceof Set?0===e.size:"object"===o()(e)&&0===(null===(t=this.keys(e))||void 0===t?void 0:t.length));var t}},{key:"isNotEmpty",value:function(e){return!this.isEmpty(e)}},{key:"isPlainObject",value:function(e){return"object"===o()(e)&&"[object Object]"===Object.prototype.toString.call(e)}},{key:"isPromiseObject",value:function(e){return"object"===o()(e)&&"[object Promise]"===Object.prototype.toString.call(e)}},{key:"isPrototype",value:function(e){if("object"!==o()(e))return!1;var t=e.constructor;return e===("function"==typeof t?t.prototype:e.prototype)}},{key:"allNil",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isEmpty(n)||!n.some((function(t){return e.isNotNil(t)}))}},{key:"allNotNil",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&!n.some((function(t){return e.isNil(t)}))}},{key:"anyNil",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isEmpty(n)||n.some((function(t){return e.isNil(t)}))}},{key:"anyNotNil",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&n.some((function(t){return e.isNotNil(t)}))}},{key:"allEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isEmpty(n)||!n.some((function(t){return e.isNotEmpty(t)}))}},{key:"allNotEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&!n.some((function(t){return e.isEmpty(t)}))}},{key:"anyEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isEmpty(n)||n.some((function(t){return e.isEmpty(t)}))}},{key:"anyNotEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.isNotEmpty(n)&&n.some((function(t){return e.isNotEmpty(t)}))}},{key:"firstNonNil",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t||0===t.length)return null;for(var r=0,u=t;r<u.length;r++){var o=u[r];if(this.isNotNil(o))return o}return null}},{key:"getProperty",value:function(e,t){if("object"===o()(e)&&t&&0!==(null==t?void 0:t.length)){var n=t.replace(/\[/g,".").replace(/]/g,"").split(".");if(n&&0!==(null==n?void 0:n.length))return 1===(null==n?void 0:n.length)?e[n[0]]:n.reduce((function(e,t){return(e||{})[t]}),e)}}},{key:"hasProperty",value:function(e,t){return"object"===o()(e)&&!!t&&(null==t?void 0:t.length)>0&&Object.prototype.hasOwnProperty.call(e,t)}},{key:"setProperty",value:function(e,t,n){this.isPlainObject(e)&&t&&(e[t]=n)}},{key:"keys",value:function(e){if(!e)return[];if(!this.isPrototype(e))return Object.keys(e);var t=[];for(var n in Object(e))"constructor"!==n&&this.hasProperty(e,n)&&t.push(n);return t}},{key:"toString",value:function(e,t){return e?e.toString():t}}]),e}(),c=function(){function e(){a()(this,e)}return s()(e,null,[{key:"extractWords",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;return e&&e.match(t)||void 0}}]),e}(),y=function(){function e(){a()(this,e)}return s()(e,null,[{key:"getLength",value:function(e){return e?e.length:0}},{key:"isEmpty",value:function(e){return!e||0===e.length}},{key:"isNotEmpty",value:function(e){return!this.isEmpty(e)}},{key:"isBlank",value:function(e){return!e||0===(null==e?void 0:e.length)||/^\s*$/.test(e)}},{key:"isNotBlank",value:function(e){return!this.isBlank(e)}},{key:"allEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return!n||0===n.length||!n.some((function(t){return e.isNotEmpty(t)}))}},{key:"allNotEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n&&n.length>0&&!n.some((function(t){return e.isEmpty(t)}))}},{key:"anyEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return!n||0===n.length||n.some((function(t){return e.isEmpty(t)}))}},{key:"anyNotEmpty",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n&&(null==n?void 0:n.length)>0&&n.some((function(t){return e.isNotEmpty(t)}))}},{key:"allBlank",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return!n||0===n.length||!n.some((function(t){return e.isNotBlank(t)}))}},{key:"allNotBlank",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n&&n.length>0&&!n.some((function(t){return e.isBlank(t)}))}},{key:"anyBlank",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return!n||0===n.length||n.some((function(t){return e.isBlank(t)}))}},{key:"anyNotBlank",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n&&n.length>0&&n.some((function(t){return e.isNotBlank(t)}))}},{key:"appendIfMissing",value:function(e,t){return!e||this.isEmpty(t)||this.endsWith(e,t)?e:e+t}},{key:"appendIfMissingIgnoreCase",value:function(e,t){return!e||this.isEmpty(t)||this.endsWithIgnoreCase(e,t)?e:e+t}},{key:"capitalizeFirst",value:function(e){return e?e.substring(0,1).toUpperCase()+e.substring(1):e}},{key:"defaultString",value:function(e){return e||""}},{key:"defaultIfEmpty",value:function(e,t){return this.isEmpty(e)?t:e}},{key:"defaultIfBlank",value:function(e,t){return this.isBlank(e)?t:e}},{key:"endsWith",value:function(e,t){return e&&t?!(e.length<t.length)&&e.endsWith(t):e===t}},{key:"endsWithIgnoreCase",value:function(e,t){return e&&t?!(e.length<t.length)&&e.toLowerCase().endsWith(t.toLowerCase()):e===t}},{key:"endsWithAny",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&t.some((function(t){return n.endsWith(e,t)}))}},{key:"endsWithAnyIgnoreCase",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&t.some((function(t){return n.endsWithIgnoreCase(e,t)}))}},{key:"equals",value:function(e,t){return e===t||!(!e||!t||(null==e?void 0:e.length)!==(null==t?void 0:t.length))&&e===t}},{key:"equalsIgnoreCase",value:function(e,t){return e===t||!(!e||!t||(null==e?void 0:e.length)!==(null==t?void 0:t.length))&&(null==e?void 0:e.toUpperCase())===(null==t?void 0:t.toUpperCase())}},{key:"equalsAny",value:function(e,t){return v.includes(t,e)}},{key:"equalsAnyIgnoreCase",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&t.some((function(t){return n.equalsIgnoreCase(e,t)}))}},{key:"formatBrace",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(!e||e.length<=2||!n||0===n.length)return e;for(var u=e,o=0,i=n;o<i.length;o++){var a=i[o];u=u.replace("{}",f.toString(a,""))}return u}},{key:"formatPercent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(!e||e.length<=2||!n||0===n.length)return e;var u=e.match(/%[bcdfjosxX]/g)||[],o=v.minLength(u,n);if(0===o)return e;for(var i=e,a=0;a<o;a++){var l=n[a],s=u[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(e){throw new TypeError("Invalid parameter type of '".concat(l,"', index ").concat(a))}break;case"f":try{var y=void 0;"string"==typeof l?y=Number.parseFloat(l):l instanceof String?y=Number.parseFloat(l.toString()):"number"==typeof l&&(y=l),y&&(i=i.replace("%".concat(s),"0x"+y.toString()))}catch(e){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(e,t){if(!e||e.length<=2||!t)return e;var n=e;for(var r in t){var u=new RegExp("\\{".concat(r,"\\}"),"g"),o=t[r];n=n.replace(u,o?o.toString():"")}return n}},{key:"includes",value:function(e,t){return e===t||!!e&&!!t&&e.includes(t)}},{key:"includesIgnoreCase",value:function(e,t){var n;return e===t||!!e&&!!t&&(null==e||null===(n=e.toUpperCase())||void 0===n?void 0:n.includes(null==t?void 0:t.toUpperCase()))}},{key:"includesAny",value:function(e,t){var n=this;return!(!e||!t)&&(null==t?void 0:t.some((function(t){return n.includes(e,t)})))}},{key:"includesAnyIgnoreCase",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&(null==t?void 0:t.some((function(t){return n.includesIgnoreCase(e,t)})))}},{key:"joinWith",value:function(e,t,n){if(e&&(!Array.isArray(e)||0!==e.length)){if(Array.isArray(e)){if(!n)return e.join(this.defaultString(t));var r=e.filter(n);return r&&0!==r.length?r.join(this.defaultString(t)):void 0}return n?n(e)?e:void 0:e}}},{key:"prependIfMissing",value:function(e,t){return!e||this.isEmpty(t)||this.startsWith(e,t)?e:t+e}},{key:"prependIfMissingIgnoreCase",value:function(e,t){return!e||this.isEmpty(t)||this.startsWithIgnoreCase(e,t)?e:t+e}},{key:"removeEquals",value:function(e,t){return v.remove(e,t)}},{key:"removeEqualsIgnoreCase",value:function(e,t){var n=this;return e&&0!==e.length&&t&&0!==t.length?e.filter((function(e){return!t.some((function(t){return n.equalsIgnoreCase(e,t)}))})):e}},{key:"removeIncludes",value:function(e,t){var n=this;return e&&0!==e.length&&t&&0!==t.length?e.filter((function(e){return!t.some((function(t){return n.includes(e,t)}))})):e}},{key:"removeIncludesIgnoreCase",value:function(e,t){var n=this;return e&&0!==e.length&&t&&0!==t.length?e.filter((function(e){return!t.some((function(t){return n.includesIgnoreCase(e,t)}))})):e}},{key:"startsWith",value:function(e,t){return e&&t?!(e.length<t.length)&&e.startsWith(t):e===t}},{key:"startsWithIgnoreCase",value:function(e,t){return e&&t?!(e.length<t.length)&&e.toLowerCase().startsWith(t.toLowerCase()):e===t}},{key:"startsWithAny",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&t.some((function(t){return n.startsWith(e,t)}))}},{key:"startsWithAnyIgnoreCase",value:function(e,t){var n=this;return!(!e||!t||0===t.length)&&t.some((function(t){return n.startsWithIgnoreCase(e,t)}))}},{key:"substringAfter",value:function(e,t){if(e&&t&&0!==t.length){var n=e.indexOf(t);return-1===n?void 0:e.substring(n+t.length)}}},{key:"substringAfterLast",value:function(e,t){if(e&&t&&0!==t.length){var n=e.lastIndexOf(t);return-1===n?void 0:e.substring(n+t.length)}}},{key:"substringBefore",value:function(e,t){if(e&&t&&0!==t.length){var n=e.indexOf(t);return-1===n?void 0:e.substring(0,n)}}},{key:"substringBeforeLast",value:function(e,t){if(e&&t&&0!==t.length){var n=e.lastIndexOf(t);return-1===n?void 0:e.substring(0,n)}}},{key:"toCamelCase",value:function(e,t){var n=this;if(!e||0===e.length)return e;var r=c.extractWords(e,t);return r?r.reduce((function(e,t,r){return t=t.toLowerCase(),e+(r>0?n.capitalizeFirst(t):t)}),""):void 0}},{key:"toKebabCase",value:function(e,t){if(!e||0===e.length)return e;var n=c.extractWords(e,t);return n?n.reduce((function(e,t,n){return e+(n>0?"-":"")+t.toLowerCase()}),""):void 0}},{key:"trim",value:function(e,t){if(!e)return e;var n=e.trim();return t&&this.isEmpty(n)?null:n}}]),e}(),v=function(){function e(){a()(this,e)}return s()(e,null,[{key:"asArray",value:function(e){return e?[e]:void 0}},{key:"getFirst",value:function(e){return e&&0!==e.length?e[0]:void 0}},{key:"getLast",value:function(e){return e&&0!==e.length?e[e.length-1]:void 0}},{key:"getLength",value:function(e){return e?e.length:0}},{key:"getTypeof",value:function(e){if(!this.isEmpty(e))return null==e?void 0:e.map((function(e){return Array.isArray(e)?"array":"object"===o()(e)?null===e?"null":"object":o()(e)}))}},{key:"isEmpty",value:function(e){return!e||0===e.length}},{key:"isNotEmpty",value:function(e){return!this.isEmpty(e)}},{key:"isTypeof",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!this.isEmpty(e)&&!y.isBlank(t)&&(null==e?void 0:e.every((function(e){return o()(e)===t||n&&null===e&&y.equalsAny(t,["string","object"])})))}},{key:"includes",value:function(e,t){return!!e&&!!t&&e.includes(t)}},{key:"maxLength",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(this.isEmpty(t))return 0;for(var r=0,u=0,o=t;u<o.length;u++){var i=o[u];r=Math.max(r,this.getLength(i))}return r}},{key:"minLength",value:function(){for(var e,n=arguments.length,r=new Array(n),u=0;u<n;u++)r[u]=arguments[u];if(this.isEmpty(r))return 0;var o,i=null===(e=r[0])||void 0===e?void 0:e.length,a=t()(r.slice(1));try{for(a.s();!(o=a.n()).done;){var l=o.value;if(0===(i=Math.min(i,this.getLength(l))))break}}catch(e){a.e(e)}finally{a.f()}return i}},{key:"remove",value:function(e,t){return e&&0!==e.length&&t&&0!==t.length?e.filter((function(e){return!t.includes(e)})):e}},{key:"reverse",value:function(e,t,n){if(!this.isEmpty(e))for(var r=Math.max(t||0,0),u=Math.min(n||this.getLength(e),this.getLength(e))-1;e&&u>r;){var o=e[u];e[u]=e[r],e[r]=o,u--,r++}}}]),e}(),h=function(){function e(){a()(this,e)}return s()(e,null,[{key:"isTrue",value:function(e){return"boolean"==typeof e?e:"number"==typeof e?e>0:"string"==typeof e&&y.equalsAnyIgnoreCase(e,["true","yes","on","y","t","1"])}},{key:"isNotTrue",value:function(e){return null==e||("boolean"==typeof e?!e:this.isFalse(e))}},{key:"isFalse",value:function(e){return"boolean"==typeof e?!e:"number"==typeof e?e<=0:"string"==typeof e&&y.equalsAnyIgnoreCase(e,["false","no","off","n","f","0"])}},{key:"isNotFalse",value:function(e){return null==e||("boolean"==typeof e?e:this.isTrue(e))}},{key:"toString",value:function(e,t,n,r){return f.isNil(e)?r:e?t:n}},{key:"toStringTrueFalse",value:function(e){return this.toString(e,"true","false",void 0)}},{key:"toStringOnOff",value:function(e){return this.toString(e,"on","off",void 0)}},{key:"toStringYesNo",value:function(e){return this.toString(e,"yes","no",void 0)}},{key:"toStringYN",value:function(e){return this.toString(e,"Y","N",void 0)}},{key:"toStringTF",value:function(e){return this.toString(e,"T","F",void 0)}},{key:"toString10",value:function(e){return this.toString(e,"1","0",void 0)}}]),e}(),g=function(){function e(){a()(this,e)}return s()(e,null,[{key:"addYear",value:function(e,t){if(!t)return e;var n=new Date(e);return n.setFullYear(e.getFullYear()+t),n}},{key:"addMonth",value:function(e,t){if(!t)return e;var n=new Date(e);return n.setMonth(e.getMonth()+t),n}},{key:"addDay",value:function(e,t){if(!t)return e;var n=new Date(e);return n.setDate(e.getDate()+t),n}},{key:"formatDateTime",value:function(e,t){if(!y.isBlank(t)){var n={"y+":e.getFullYear(),"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours()%12==0?12:e.getHours()%12,"H+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()},r=t;for(var u in n){var o=new RegExp("(".concat(u,")")).exec(r);o&&(r=/(y+)/.test(u)?r.replace(o[1],n[u].toString().substring(4-o[1].length)):r.replace(o[1],1===o[1].length?n[u].toString():n[u].toString().padStart(o[1].length,"0")))}return r}}},{key:"getCurrentDate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd";return this.formatDateTime(new Date,e)}},{key:"getCurrentDateTime",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"yyyy-MM-dd hh:mm:ss";return this.formatDateTime(new Date,e)}},{key:"getCurrentTime",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"hh:mm:ss";return this.formatDateTime(new Date,e)}},{key:"getStartOfYear",value:function(e){var t=new Date(e);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}},{key:"getStartOfMonth",value:function(e){var t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),t}},{key:"getStartOfDay",value:function(e){var t=new Date(e);return t.setHours(0,0,0,0),t}},{key:"getEndOfYear",value:function(e){var t=new Date(e);return t.setFullYear(e.getFullYear()+1,0,0),t.setHours(23,59,59,999),t}},{key:"getEndOfMonth",value:function(e){var t=new Date(e);return t.setFullYear(e.getFullYear(),e.getMonth()+1,0),t.setHours(23,59,59,999),t}},{key:"getEndOfDay",value:function(e){var t=new Date(e);return t.setHours(23,59,59,999),t}},{key:"getTimezone",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getTimezoneOffset(),n=Math.abs(t),r=Math.floor(n/60),u=n%60,o=u>0?":"+("0"+u).slice(-2):"";return(t<0?"+":"-")+r+o}},{key:"isFirstDayOfMonth",value:function(e){return 1===e.getDate()}},{key:"isLastDayOfMonth",value:function(e){return this.isSameDay(this.getEndOfDay(e),this.getEndOfMonth(e))}},{key:"isLeapYear",value:function(e){var t=e instanceof Date?e.getFullYear():e;return!((t%4||!(t%100))&&t%400)}},{key:"isSameYear",value:function(e,t){return e.getFullYear()===t.getFullYear()}},{key:"isSameMonth",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return e.getMonth()===t.getMonth()&&(!n||e.getFullYear()===t.getFullYear())}},{key:"isSameDay",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return e.getDate()===t.getDate()&&(!n||e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth())}},{key:"isWeekend",value:function(e){return 0===e.getDay()||6===e.getDay()}},{key:"isYesterday",value:function(e){return this.isSameDay(new Date,this.addDay(e,1))}},{key:"isTomorrow",value:function(e){return this.isSameDay(new Date,this.addDay(e,-1))}}]),e}(),p=function(){function e(){a()(this,e)}return s()(e,null,[{key:"isJsonString",value:function(e){if(y.isBlank(e))return!1;try{if("string"==typeof e&&"object"===o()(JSON.parse(e)))return!0}catch(e){}return!1}},{key:"toJsonString",value:function(e){if("string"==typeof e&&e.length>0)try{var t=JSON.parse(e);if("object"===o()(t))return JSON.stringify(t)}catch(e){}if(f.isPlainObject(e))return JSON.stringify(e)}}]),e}(),d=function(){function e(){a()(this,e)}return s()(e,null,[{key:"isInteger",value:function(e){return!!e&&Math.floor(e)===Math.ceil(e)}},{key:"toInteger",value:function(e){if(e)try{var t=Number.parseInt(e);return Number.isNaN(t)?void 0:t}catch(e){}}},{key:"toFloat",value:function(e){if(e)try{var t=Number.parseFloat(e);return Number.isNaN(t)?void 0:t}catch(e){}}},{key:"max",value:function(e){if(e&&0!==(null==e?void 0:e.length)){for(var t=e[0],n=1;n<e.length;n++)t<e[n]&&(t=e[n]);return t}}},{key:"min",value:function(e){if(e&&0!==(null==e?void 0:e.length)){for(var t=e[0],n=1;n<e.length;n++)t>e[n]&&(t=e[n]);return t}}},{key:"sum",value:function(e){return e.reduce((function(e,t){return e+t}))}},{key:"average",value:function(e){return this.sum(e)/e.length}}]),e}(),m=function(){function e(){a()(this,e)}return s()(e,null,[{key:"randomBoolean",value:function(){return Math.random()>=.5}},{key:"randomElement",value:function(e){return v.isNotEmpty(e)?e.at(this.randomInteger(0,e.length)):void 0}},{key:"randomElements",value:function(e,t){if(v.isEmpty(e)||t<=0)return[];if(v.getLength(e)<=t)return e;for(var n=new Set;n.size<t;)n.add(this.randomInteger(0,e.length));return e.filter((function(e,t){return n.has(t)}))}},{key:"randomInteger",value:function(e,t){return Math.floor(this.randomNumber(e,t))}},{key:"randomIntegers",value:function(e,t,n){if(e<=0)return[];for(var r=[],u=0;u<e;u++)r.push(this.randomInteger(t,n));return r}},{key:"randomNumber",value:function(e,t){var n=e||0,r=t||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(e,t,n){if(e<=0)return[];for(var r=[],u=0;u<e;u++)r.push(this.randomNumber(t,n));return r}}]),e}(),k=function(){function e(){a()(this,e)}return s()(e,null,[{key:"sleep",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;return new Promise((function(t){setTimeout(t,e)}))}}]),e}()}(),r}()}));
{
"name": "@yookue/ts-lang-utils",
"version": "0.1.21",
"version": "0.1.22",
"title": "TsLangUtils",

@@ -42,3 +42,3 @@ "description": "Common Lang Utilities for TypeScript",

"dependencies": {
"@babel/runtime": "^7.23.9"
"@babel/runtime": "^7.24.0"
},

@@ -45,0 +45,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc