-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
532 additions
and
527 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import * as Jstd from './lib/jstd'; | ||
export * from './lib/jstd'; | ||
export * as Jstd from './lib/jstd'; | ||
export default Jstd; | ||
import * as Jstd from './lib/jstd'; | ||
export * from './lib/jstd'; | ||
export * as Jstd from './lib/jstd'; | ||
export default Jstd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
import { NumberDict, OptionalPropertyArray } from '../typing/index'; | ||
/** | ||
* To determine a var is an array or not empty array | ||
* @param array - var to determine | ||
* @param length - length equals true ? not empty array : array, default is true | ||
*/ | ||
export declare const arrayable: (array: any, length?: boolean) => boolean; | ||
/** | ||
* Retrieve unique elemens from an array | ||
* @param array var to determine | ||
* @param nested whether element in array is a nested object, default is false | ||
*/ | ||
export declare const arrayUnique: <T>(array: any, nested?: boolean) => T[]; | ||
/** | ||
* Retrieve elements exists count from an array | ||
* @param array var to determine | ||
*/ | ||
export declare const arrValsCount: <T>(array: any) => NumberDict; | ||
/** | ||
* Count the number of occurrences of an element in the array | ||
* @param array var to determine | ||
* @param key clue for the count of var | ||
*/ | ||
export declare const arrValCount: <T>(array: any, key: T) => number; | ||
/** | ||
* Flatten an array recursively up to the specified depth. | ||
* @param array | ||
* @param depth depth of recurrence default is Infinity | ||
*/ | ||
export declare const flat: <T>(array: any, depth?: number) => OptionalPropertyArray<T>; | ||
import { NumberDict, OptionalPropertyArray } from '../typing/index'; | ||
/** | ||
* To determine a var is an array or not empty array | ||
* @param array - var to determine | ||
* @param length - length equals true ? not empty array : array, default is true | ||
*/ | ||
export declare const arrayable: (array: any, length?: boolean) => boolean; | ||
/** | ||
* Retrieve unique elemens from an array | ||
* @param array var to determine | ||
* @param nested whether element in array is a nested object, default is false | ||
*/ | ||
export declare const arrayUnique: <T>(array: any, nested?: boolean) => T[]; | ||
/** | ||
* Retrieve elements exists count from an array | ||
* @param array var to determine | ||
*/ | ||
export declare const arrValsCount: <T>(array: any) => NumberDict; | ||
/** | ||
* Count the number of occurrences of an element in the array | ||
* @param array var to determine | ||
* @param key clue for the count of var | ||
*/ | ||
export declare const arrValCount: <T>(array: any, key: T) => number; | ||
/** | ||
* Flatten an array recursively up to the specified depth. | ||
* @param array | ||
* @param depth depth of recurrence default is Infinity | ||
*/ | ||
export declare const flat: <T>(array: any, depth?: number) => OptionalPropertyArray<T>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
interface InvalidCharacterErrorInterface extends Error { | ||
name: string; | ||
message: string; | ||
} | ||
export declare class InvalidCharacterError implements InvalidCharacterErrorInterface { | ||
name: string; | ||
message: string; | ||
constructor(message: string); | ||
} | ||
declare let _btoa: (data: string) => string; | ||
declare let _atob: (data: string) => string; | ||
export { _btoa, _atob }; | ||
interface InvalidCharacterErrorInterface extends Error { | ||
name: string; | ||
message: string; | ||
} | ||
export declare class InvalidCharacterError implements InvalidCharacterErrorInterface { | ||
name: string; | ||
message: string; | ||
constructor(message: string); | ||
} | ||
declare let _btoa: (data: string) => string; | ||
declare let _atob: (data: string) => string; | ||
export { _btoa, _atob }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { Dict } from '../typing/index'; | ||
/** | ||
* Convert a string url to blob | ||
* @param url | ||
*/ | ||
export declare const url2Blob: (url: string) => Blob | never; | ||
/** | ||
* convert a string to buffer<Uint8Array> | ||
* @param str argv string | ||
*/ | ||
export declare const str2Buffer: (str: string) => Uint8Array | undefined; | ||
/** | ||
* convert a buffer<Uint8Array> to a string | ||
* @param buff argv buffer<Uint8Array> | ||
*/ | ||
export declare const buffer2Str: (buff: Uint8Array | Dict<number> | string) => string | undefined; | ||
import { Dict } from '../typing/index'; | ||
/** | ||
* Convert a string url to blob | ||
* @param url | ||
*/ | ||
export declare const url2Blob: (url: string) => Blob | never; | ||
/** | ||
* convert a string to buffer<Uint8Array> | ||
* @param str argv string | ||
*/ | ||
export declare const str2Buffer: (str: string) => Uint8Array | undefined; | ||
/** | ||
* convert a buffer<Uint8Array> to a string | ||
* @param buff argv buffer<Uint8Array> | ||
*/ | ||
export declare const buffer2Str: (buff: Uint8Array | Dict<number> | string) => string | undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { Types as T } from '../enum/index'; | ||
/** | ||
* Determine the type of a value | ||
* @param v argv | ||
*/ | ||
export declare const typeis: (v: any) => T[keyof T]; | ||
/** | ||
* Regexp test function | ||
* @param regxp argv of regexp pattern | ||
* @param val argv to test | ||
*/ | ||
export declare const re: (regxp: RegExp, val: any) => boolean; | ||
import { Types as T } from '../enum/index'; | ||
/** | ||
* Determine the type of a value | ||
* @param v argv | ||
*/ | ||
export declare const typeis: (v: any) => T[keyof T]; | ||
/** | ||
* Regexp test function | ||
* @param regxp argv of regexp pattern | ||
* @param val argv to test | ||
*/ | ||
export declare const re: (regxp: RegExp, val: any) => boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
/** | ||
* To determine a var is Date type | ||
* @param date var to determine | ||
* @param validDate validDate equals true ? not invalid Date : Date, default is true | ||
*/ | ||
export declare const dateable: (date?: any, validDate?: boolean) => boolean; | ||
/** | ||
* Date format | ||
* @param date argv of type Date/String | ||
* @param format [Y, yyyy, M, MM, d, dd, h, hh, m, mm, s, ss] and [-/\s] separator supports, default is 'yyyy-MM-dd hh:mm:ss' | ||
*/ | ||
export declare const formatDate: (date?: Date | string, format?: string) => string; | ||
/** | ||
* Retrieve a date with specify timezone | ||
* @param year argv year, default is 0 | ||
* @param month argv month, default is 0 | ||
* @param day argv day, default is 0 | ||
* @param hour argv hour, default is 0 | ||
* @param minute argv minute, default is 0 | ||
* @param second argv second, default is 0 | ||
* @param timezone argv timezone like 'America/New_York' | ||
*/ | ||
export declare const timezoneDate: (year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, timezone?: string) => Date | undefined; | ||
/** | ||
* Retrieve a quarter string with another quarter and delta quarters which are used to calculate | ||
* @param quarter given quarter, eg. '2021Q3' | ||
* @param delta calculation quarter number, negative means backward, positive means forward. eg. 3, -1, 10, -7 | ||
* @param separator separator for year and quarter, default is 'Q' | ||
* @returns string | undefined | ||
*/ | ||
export declare const quarterable: (quarter: any, delta?: number, separator?: string) => string | undefined; | ||
/** | ||
* To determine a var is Date type | ||
* @param date var to determine | ||
* @param validDate validDate equals true ? not invalid Date : Date, default is true | ||
*/ | ||
export declare const dateable: (date?: any, validDate?: boolean) => boolean; | ||
/** | ||
* Date format | ||
* @param date argv of type Date/String | ||
* @param format [Y, yyyy, M, MM, d, dd, h, hh, m, mm, s, ss] and [-/\s] separator supports, default is 'yyyy-MM-dd hh:mm:ss' | ||
*/ | ||
export declare const formatDate: (date?: Date | string, format?: string) => string; | ||
/** | ||
* Retrieve a date with specify timezone | ||
* @param year argv year, default is 0 | ||
* @param month argv month, default is 0 | ||
* @param day argv day, default is 0 | ||
* @param hour argv hour, default is 0 | ||
* @param minute argv minute, default is 0 | ||
* @param second argv second, default is 0 | ||
* @param timezone argv timezone like 'America/New_York' | ||
*/ | ||
export declare const timezoneDate: (year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, timezone?: string) => Date | undefined; | ||
/** | ||
* Retrieve a quarter string with another quarter and delta quarters which are used to calculate | ||
* @param quarter given quarter, eg. '2021Q3' | ||
* @param delta calculation quarter number, negative means backward, positive means forward. eg. 3, -1, 10, -7 | ||
* @param separator separator for year and quarter, default is 'Q' | ||
* @returns string | undefined | ||
*/ | ||
export declare const quarterable: (quarter: any, delta?: number, separator?: string) => string | undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,85 @@ | ||
import { Dict } from '../typing/index'; | ||
/** | ||
* enum of type's descriptions | ||
*/ | ||
export declare enum TypesDesc { | ||
'[object Number]' = "number", | ||
'[object String]' = "string", | ||
'[object Boolean]' = "bool", | ||
'[object Undefined]' = "undefined", | ||
'[object Null]' = "null", | ||
'[object Array]' = "array", | ||
'[object Uint8Array]' = "uint8Array", | ||
'[object Object]' = "object", | ||
'[object Function]' = "function", | ||
'[object AsyncFunction]' = "asyncFunction", | ||
'[object BigInt]' = "bigInt", | ||
'[object Date]' = "date", | ||
'[object WeakMap]' = "weakMap", | ||
'[object Map]' = "map", | ||
'[object WeakSet]' = "weakSet", | ||
'[object ArrayBuffer]' = "arrayBuffer", | ||
'[object Set]' = "set", | ||
'[object Symbol]' = "symbol", | ||
'[object DataView]' = "dataView", | ||
'[object Float32Array]' = "float32Array", | ||
'[object Float64Array]' = "float64Array", | ||
'[object Int8Array]' = "int8Array", | ||
'[object Int16Array]' = "int16Array", | ||
'[object Int32Array]' = "int32Array", | ||
'[object Uint8ClampedArray]' = "uint8ClampedArray", | ||
'[object Uint16Array]' = "uint16Array", | ||
'[object Uint32Array]' = "uint32Array", | ||
'[object BigInt64Array]' = "bigInt64Array", | ||
'[object BigUint64Array]' = "bigUint64Array", | ||
'[object RegExp]' = "regExp" | ||
} | ||
/** | ||
* enum of Types | ||
*/ | ||
export declare enum Types { | ||
/** basic */ | ||
number = "number", | ||
string = "string", | ||
bool = "bool", | ||
undefined = "undefined", | ||
null = "null", | ||
bigInt = "bigInt", | ||
/** complex */ | ||
object = "object", | ||
function = "function", | ||
asyncFunction = "asyncFunction", | ||
symbol = "symbol", | ||
arrayBuffer = "arrayBuffer", | ||
/** functional */ | ||
regExp = "regExp", | ||
date = "date", | ||
dataView = "dataView", | ||
/** map */ | ||
weakMap = "weakMap", | ||
map = "map", | ||
/** set */ | ||
weakSet = "weakSet", | ||
set = "set", | ||
/** array */ | ||
array = "array", | ||
uint8Array = "uint8Array", | ||
float32Array = "float32Array", | ||
float64Array = "float64Array", | ||
int8Array = "int8Array", | ||
int16Array = "int16Array", | ||
int32Array = "int32Array", | ||
uint8ClampedArray = "uint8ClampedArray", | ||
uint16Array = "uint16Array", | ||
uint32Array = "uint32Array", | ||
bigInt64Array = "bigInt64Array", | ||
bigUint64Array = "bigUint64Array", | ||
/** unknown */ | ||
unknown = "" | ||
} | ||
/** | ||
* To determine whether a key in an Enum | ||
* @param enums argv Enum | ||
* @param i argv key | ||
*/ | ||
export declare const inEnum: <T>(enums?: Dict<T>, i?: string | T) => boolean; | ||
import { Dict } from '../typing/index'; | ||
/** | ||
* enum of type's descriptions | ||
*/ | ||
export declare enum TypesDesc { | ||
'[object Number]' = "number", | ||
'[object String]' = "string", | ||
'[object Boolean]' = "bool", | ||
'[object Undefined]' = "undefined", | ||
'[object Null]' = "null", | ||
'[object Array]' = "array", | ||
'[object Uint8Array]' = "uint8Array", | ||
'[object Object]' = "object", | ||
'[object Function]' = "function", | ||
'[object AsyncFunction]' = "asyncFunction", | ||
'[object BigInt]' = "bigInt", | ||
'[object Date]' = "date", | ||
'[object WeakMap]' = "weakMap", | ||
'[object Map]' = "map", | ||
'[object WeakSet]' = "weakSet", | ||
'[object ArrayBuffer]' = "arrayBuffer", | ||
'[object Set]' = "set", | ||
'[object Symbol]' = "symbol", | ||
'[object DataView]' = "dataView", | ||
'[object Float32Array]' = "float32Array", | ||
'[object Float64Array]' = "float64Array", | ||
'[object Int8Array]' = "int8Array", | ||
'[object Int16Array]' = "int16Array", | ||
'[object Int32Array]' = "int32Array", | ||
'[object Uint8ClampedArray]' = "uint8ClampedArray", | ||
'[object Uint16Array]' = "uint16Array", | ||
'[object Uint32Array]' = "uint32Array", | ||
'[object BigInt64Array]' = "bigInt64Array", | ||
'[object BigUint64Array]' = "bigUint64Array", | ||
'[object RegExp]' = "regExp" | ||
} | ||
/** | ||
* enum of Types | ||
*/ | ||
export declare enum Types { | ||
/** basic */ | ||
number = "number", | ||
string = "string", | ||
bool = "bool", | ||
undefined = "undefined", | ||
null = "null", | ||
bigInt = "bigInt", | ||
/** complex */ | ||
object = "object", | ||
function = "function", | ||
asyncFunction = "asyncFunction", | ||
symbol = "symbol", | ||
arrayBuffer = "arrayBuffer", | ||
/** functional */ | ||
regExp = "regExp", | ||
date = "date", | ||
dataView = "dataView", | ||
/** map */ | ||
weakMap = "weakMap", | ||
map = "map", | ||
/** set */ | ||
weakSet = "weakSet", | ||
set = "set", | ||
/** array */ | ||
array = "array", | ||
uint8Array = "uint8Array", | ||
float32Array = "float32Array", | ||
float64Array = "float64Array", | ||
int8Array = "int8Array", | ||
int16Array = "int16Array", | ||
int32Array = "int32Array", | ||
uint8ClampedArray = "uint8ClampedArray", | ||
uint16Array = "uint16Array", | ||
uint32Array = "uint32Array", | ||
bigInt64Array = "bigInt64Array", | ||
bigUint64Array = "bigUint64Array", | ||
/** unknown */ | ||
unknown = "" | ||
} | ||
/** | ||
* To determine whether a key in an Enum | ||
* @param enums argv Enum | ||
* @param i argv key | ||
*/ | ||
export declare const inEnum: <T>(enums?: Dict<T>, i?: string | T) => boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* sleep in eventloop for milliseconds | ||
* @param ms argv(millisecond) to sleep, default is 16 | ||
*/ | ||
export declare const sleep: (ms?: number) => Promise<number>; | ||
/** | ||
* sleep in eventloop for milliseconds | ||
* @param ms argv(millisecond) to sleep, default is 16 | ||
*/ | ||
export declare const sleep: (ms?: number) => Promise<number>; |
Oops, something went wrong.