- getType
- hasKey
- random
- is
- isNumber
- isString
- isBoolean
- isFunction
- isObject
- isArray
- isDate
- isRegExp
- isUndefined
- isNull
- isNaN
- isPrimitive
- isEmptyValue
- isMathEqual
- isEqual
- isLeapYear
- clone
- dateFormatter
- timeAgo
- bytesToSize
- sizeToBytes
- hexToRgb
- rgbToHex
- paging
- getUrlQuery
- parseUrl
grammar: getType([value])
param:
- value<any>
return: String
returns a boolean indicating whether the object has the specified property as its own property
grammar: hasKey(object, key)
param:
- object<Object>
- key<String>
return: Boolean
returns a number in the range [min - max]
grammar: random(min, max)
param:
- min<Number(int)>
- max<Number(int)>
return: Number(int)
get or compare a data type, If the parameter type is passed, the data type is compared, otherwise the data type of the parameter value is returned.
grammar: is(value[, type])
param:
- value<any>
- type<String>
return: String or Boolean
grammar: isNumber(value)
param:
- value<any>
return: Boolean
grammar: isString(value)
param:
- value<any>
return: Boolean
grammar: isBoolean(value)
param:
- value<any>
return: Boolean
grammar: isFunction(value)
param:
- value<any>
return: Boolean
grammar: isObject(value)
param:
- value<any>
return: Boolean
grammar: isArray(value)
param:
- value<any>
return: Boolean
grammar: isDate(value)
param:
- value<any>
return: Boolean
grammar: isRegExp(value)
param:
- value<any>
return: Boolean
grammar: isUndefined(value)
param:
- value<any>
return: Boolean
grammar: isNull(value)
param:
- value<any>
return: Boolean
grammar: isNaN(value)
param:
- value<any>
return: Boolean
grammar: isPrimitive(value)
param:
- value<any>
return: Boolean
The following values will return true: undefined, null, NaN, "", " "
grammar: isEmptyValue(value)
param:
- value<any>
return: Boolean
grammar: isMathEqual(a, b)
param:
- a<Number>
- b<Number>
return: Boolean
grammar: isEqual(a, b)
param:
- a<any>
- b<any>
return: Boolean
grammar: isLeapYear(value)
param:
- value<Number>
return: Boolean
grammar: clone(value)
param:
- value<any>
return: Number,String,Boolean,null,undefined,Symbol,BigInt, Date,RegExp,Array,Object
grammar: dateFormatter(date[, format])
param:
- date<Date,String>
- format<String>: default: YYYY-MM-DD hh:mm:ss
return: String, NaN
replacement in the format
replacement | remarks |
---|---|
YY | Two-digit year |
YYYY | full year |
MM | month |
DD | the day of the month |
hh | hours |
mm | minutes |
ss | seconds |
ms | milliseconds |
da | the day of the week |
ts | timestamp |
rough calculation of date difference
grammar: timeAgo(oldDate[, nowDate])
param:
- oldDate<Date, String>
- nowDate<Date, String>: default: Date.now()
return: String
format the number of bytes into a file size with units
grammar: bytesToSize(bytes[, base])
param:
- bytes<Number>
- base<Number>: default: 1000
return: String, NaN
the file size with units is formatted as bytes
grammar: sizeToBytes(size[, base])
param:
- size<String>
- base<Number>: default: 1000
return: Number, NaN
convert hex to RGB
grammar: hexToRgb(hex[, digit])
param:
- hex<String>
- digit<Number>: default: 1
return: String
convert RGB to hex
grammar: rgbToHex(r, g, b)
param:
- r<Number>
- g<Number>
- b<Number>
return: String
convert a one-dimensional array to a two-dimensional array
grammar: paging(data, size)
param:
- data<Array>
- size<Number>
return: Array(two-dimensional)
parse the query string from the url into an object
grammar: getUrlQuery(url)
param:
- url<String>
return: Object
parse the url into an object
grammar: parseUrl(url)
param:
- url<String>
return: Object
ObjectItem
key | type | remarks |
---|---|---|
href | String | url |
scheme | String | url scheme |
username | String | url username |
password | String | url password |
host | String | url hostname |
port | String | url port |
path | String | url path |
search | String | url search |
hash | String | url hash |
query | Object |