Function
| Static Public Summary | ||
| public |
|
|
| public |
|
|
| public |
usage - react list render |
|
| public |
angle2deg(angle: *): * |
|
| public |
assert(condition: *, message: *) |
|
| public |
batchSetStyle(args: ...*) |
|
| public |
charLength(str: String, charset: String): Number |
|
| public |
|
|
| public |
compose(fns: ...*): * |
|
| public |
|
|
| public |
dashToCamel(dashStr: *): * |
|
| public |
|
|
| public |
deepCopy(obj: *): * |
|
| public |
a way to tell if two object hold the same value recursively. |
|
| public |
deg2angle(deg: *): * |
|
| public |
|
|
| public |
drawArc(objectPattern: {"innerRadius": *, "outerRadius": *, "startAngle": *, "endAngle": *}): * |
|
| public |
drawEquilateral(objectPattern: {"radius": *, "startAngle": *, "sidesNum": *}): * |
|
| public |
|
|
| public |
echo(arg: Any): Any mimic command echo |
|
| public |
excludeProps(obj: *, exclude: *[]): * |
|
| public |
extend(target: *, args: ...*): * |
|
| public |
|
|
| public |
guard(test: *, safeValue: *): * |
|
| public |
|
|
| public |
isArray(obj: *): * |
|
| public |
check the format for the input email |
|
| public |
|
|
| public |
isEmptyArray(arr: *): * |
|
| public |
isEmptyObject(obj: *): * |
|
| public |
isEmptyString(str: *): * |
|
| public |
isFunction(obj: *): * |
|
| public |
isNumber(obj: *): * |
|
| public |
isObject(obj: *): * |
|
| public |
we assume Undefined or Null as unsetted value |
|
| public |
isString(obj: *): * |
|
| public |
|
|
| public |
we assume Undefined or Null as unsetted value |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
noop() a empty function doing nothing when called |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
parseQuery(queryString: *): * |
|
| public |
propCompact(obj: *): * |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
rem(objectPattern: {"designWidth": *, "designDPR": *, "rem2px": *, "bodyFontSize": *, "win": *, "doc": *}) |
|
| public |
reverse(obj: *): * |
|
| public |
selectProps(obj: *, select: *[]): * |
|
| public |
|
|
| public |
shallowEqual(a: *, b: *): boolean |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
timestamp(): *
|
|
| public |
|
|
| public |
typeOf(obj: *): * |
|
| public |
|
|
Static Public
public IDFactory(startValue: Number): Function source
import {IDFactory} from 'mytoolkit/src/utils.js'Params:
| Name | Type | Attribute | Description |
| startValue | Number |
|
start value for generating ids |
public addComma(num: String | Number): String source
import {addComma} from 'mytoolkit/src/utils.js'public addKey(collection: Array<Object>, prefix: String): Array<Object> source
import {addKey} from 'mytoolkit/src/array.js'usage - react list render
public angle2deg(angle: *): * source
import {angle2deg} from 'mytoolkit/src/utils.js'Params:
| Name | Type | Attribute | Description |
| angle | * |
Return:
| * |
public assert(condition: *, message: *) source
import {assert} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| condition | * | ||
| message | * |
public batchSetStyle(args: ...*) source
import {batchSetStyle} from 'mytoolkit/src/dom.js'Params:
| Name | Type | Attribute | Description |
| args | ...* |
public charLength(str: String, charset: String): Number source
import {charLength} from 'mytoolkit/src/string.js'See:
- https://www.cnblogs.com/dearxinli/p/7657512.html 计算字符串所占的内存字节数,默认使用UTF-8的编码方式计算,也可制定为UTF-16 UTF-8 是一种可变长度的 Unicode 编码格式,使用一至四个字节为每个字符编码 000000 - 00007F(128个代码) 0zzzzzzz(00-7F) 一个字节 000080 - 0007FF(1920个代码) 110yyyyy(C0-DF) 10zzzzzz(80-BF) 两个字节 000800 - 00D7FF 00E000 - 00FFFF(61440个代码) 1110xxxx(E0-EF) 10yyyyyy 10zzzzzz 三个字节 010000 - 10FFFF(1048576个代码) 11110www(F0-F7) 10xxxxxx 10yyyyyy 10zzzzzz 四个字节 注: Unicode在范围 D800-DFFF 中不存在任何字符
- http://zh.wikipedia.org/wiki/UTF-8 UTF-16 大部分使用两个字节编码,编码超出 65535 的使用四个字节 000000 - 00FFFF 两个字节 010000 - 10FFFF 四个字节
- http://zh.wikipedia.org/wiki/UTF-16
public compact(array: Array): Array source
import {compact} from 'mytoolkit/src/array.js'Params:
| Name | Type | Attribute | Description |
| array | Array | a simple array |
public compose(fns: ...*): * source
import {compose} from 'mytoolkit/src/func.js'Params:
| Name | Type | Attribute | Description |
| fns | ...* |
Return:
| * |
public dashToCamel(dashStr: *): * source
import {dashToCamel} from 'mytoolkit/src/string.js'Params:
| Name | Type | Attribute | Description |
| dashStr | * |
Return:
| * |
public debounce(func: Function, wait: Number, immediate: Boolean): Function source
import {debounce} from 'mytoolkit/src/func.js'Return:
| Function | a wrapper of func, multiple called wrapper during wait time, it will only call func one time. |
public deepCopy(obj: *): * source
import {deepCopy} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| obj | * | any type in javascript |
Return:
| * | the copy of obj |
public deepEqual(a: *, b: *): boolean source
import {deepEqual} from 'mytoolkit/src/base.js'a way to tell if two object hold the same value recursively.
Params:
| Name | Type | Attribute | Description |
| a | * | ||
| b | * |
public deg2angle(deg: *): * source
import {deg2angle} from 'mytoolkit/src/utils.js'Params:
| Name | Type | Attribute | Description |
| deg | * |
Return:
| * |
public delay(func: Function, wait: Number, args: ...any): Number source
import {delay} from 'mytoolkit/src/func.js'public drawArc(objectPattern: {"innerRadius": *, "outerRadius": *, "startAngle": *, "endAngle": *}): * source
import {drawArc} from 'mytoolkit/src/draw.js'Params:
| Name | Type | Attribute | Description |
| objectPattern | {"innerRadius": *, "outerRadius": *, "startAngle": *, "endAngle": *} |
|
Return:
| * |
public drawEquilateral(objectPattern: {"radius": *, "startAngle": *, "sidesNum": *}): * source
import {drawEquilateral} from 'mytoolkit/src/draw.js'Params:
| Name | Type | Attribute | Description |
| objectPattern | {"radius": *, "startAngle": *, "sidesNum": *} |
|
Return:
| * |
public drawLine(points: *): string source
import {drawLine} from 'mytoolkit/src/draw.js'Params:
| Name | Type | Attribute | Description |
| points | * |
public echo(arg: Any): Any source
import {echo} from 'mytoolkit/src/func.js'mimic command echo
Params:
| Name | Type | Attribute | Description |
| arg | Any | currently only accept and return the first arg |
Return:
| Any | arg |
public excludeProps(obj: *, exclude: *[]): * source
import {excludeProps} from 'mytoolkit/src/object.js'Params:
| Name | Type | Attribute | Description |
| obj | * | ||
| exclude | *[] |
|
Return:
| * |
public extend(target: *, args: ...*): * source
import {extend} from 'mytoolkit/src/object.js'Params:
| Name | Type | Attribute | Description |
| target | * | ||
| args | ...* |
Return:
| * |
public getProp(obj: *, nameArray: *, defaultValue: string): * source
import {getProp} from 'mytoolkit/src/object.js'Params:
| Name | Type | Attribute | Description |
| obj | * | ||
| nameArray | * | ||
| defaultValue | string |
|
Return:
| * |
public guard(test: *, safeValue: *): * source
import {guard} from 'mytoolkit/src/func.js'Params:
| Name | Type | Attribute | Description |
| test | * |
|
|
| safeValue | * |
Return:
| * |
public head(list: *, size: number): * source
import {head} from 'mytoolkit/src/array.js'Params:
| Name | Type | Attribute | Description |
| list | * | ||
| size | number |
|
Return:
| * |
public isArray(obj: *): * source
import {isArray} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| obj | * |
Return:
| * |
public isEmail(emailAddress: *): Boolean source
import {isEmail} from 'mytoolkit/src/base.js'check the format for the input email
Params:
| Name | Type | Attribute | Description |
| emailAddress | * |
public isEmpty(any: *): boolean source
import {isEmpty} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| any | * |
public isEmptyArray(arr: *): * source
import {isEmptyArray} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| arr | * |
Return:
| * |
public isEmptyObject(obj: *): * source
import {isEmptyObject} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| obj | * |
Return:
| * |
public isEmptyString(str: *): * source
import {isEmptyString} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| str | * |
Return:
| * |
public isFunction(obj: *): * source
import {isFunction} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| obj | * |
Return:
| * |
public isNumber(obj: *): * source
import {isNumber} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| obj | * |
Return:
| * |
public isObject(obj: *): * source
import {isObject} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| obj | * |
Return:
| * |
public isSet(value: *): Boolean source
import {isSet} from 'mytoolkit/src/base.js'we assume Undefined or Null as unsetted value
Params:
| Name | Type | Attribute | Description |
| value | * |
public isString(obj: *): * source
import {isString} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| obj | * |
Return:
| * |
public isUInt(uint: Number | String): * source
import {isUInt} from 'mytoolkit/src/base.js'Return:
| * | (true | false) |
public isUnset(value: *): Boolean source
import {isUnset} from 'mytoolkit/src/base.js'we assume Undefined or Null as unsetted value
Params:
| Name | Type | Attribute | Description |
| value | * |
public midIndex(list: Array): Int source
import {midIndex} from 'mytoolkit/src/array.js'Params:
| Name | Type | Attribute | Description |
| list | Array | a simple array |
Return:
| Int | the index of the middle item in the list |
public middle(list: Array): Any source
import {middle} from 'mytoolkit/src/array.js'Params:
| Name | Type | Attribute | Description |
| list | Array | a simple array |
Return:
| Any | any type in the list |
public nlargest(list: Array, num: Number): Array source
import {nlargest} from 'mytoolkit/src/array.js'public noop() source
import {noop} from 'mytoolkit/src/func.js'a empty function doing nothing when called
public nsmallest(list: Array, num: Number): Array source
import {nsmallest} from 'mytoolkit/src/array.js'public obj2qs(obj: Object): String source
import {obj2qs} from 'mytoolkit/src/object.js'Params:
| Name | Type | Attribute | Description |
| obj | Object | a plain object |
public padZero(num: Number | String, size: NUmber): String source
import {padZero} from 'mytoolkit/src/string.js'public parseQuery(queryString: *): * source
import {parseQuery} from 'mytoolkit/src/utils.js'Params:
| Name | Type | Attribute | Description |
| queryString | * |
Return:
| * |
public propCompact(obj: *): * source
import {propCompact} from 'mytoolkit/src/object.js'Params:
| Name | Type | Attribute | Description |
| obj | * |
Return:
| * |
public queryJoin(left: String, right: String): String source
import {queryJoin} from 'mytoolkit/src/utils.js'public quickSort(list: Array, func: Function): Array source
import {quickSort} from 'mytoolkit/src/array.js'public randInt(min: Number, max: Number): Number source
import {randInt} from 'mytoolkit/src/utils.js'public randStr(size: Number, sourceCode: String): String source
import {randStr} from 'mytoolkit/src/utils.js'public rem(objectPattern: {"designWidth": *, "designDPR": *, "rem2px": *, "bodyFontSize": *, "win": *, "doc": *}) source
import {rem} from 'mytoolkit/src/dom.js'Params:
| Name | Type | Attribute | Description |
| objectPattern | {"designWidth": *, "designDPR": *, "rem2px": *, "bodyFontSize": *, "win": *, "doc": *} |
|
public reverse(obj: *): * source
import {reverse} from 'mytoolkit/src/utils.js'Params:
| Name | Type | Attribute | Description |
| obj | * |
Return:
| * |
public selectProps(obj: *, select: *[]): * source
import {selectProps} from 'mytoolkit/src/object.js'Params:
| Name | Type | Attribute | Description |
| obj | * | ||
| select | *[] |
|
Return:
| * |
public setStyle(ele: HTMLElement, name: String, value: String | Number) source
import {setStyle} from 'mytoolkit/src/dom.js'Example:
setStyle(document.body, 'fontSize', '16px')
setStyle(doucment.body, {
backgroundColor: '#ffffff',
minHeight: '100vh'
})
public shallowEqual(a: *, b: *): boolean source
import {shallowEqual} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| a | * | ||
| b | * |
public shuffle(list: Array): Array source
import {shuffle} from 'mytoolkit/src/array.js'Params:
| Name | Type | Attribute | Description |
| list | Array | a simple array |
public strToDate(dateString: String, format: String): Date source
import {strToDate} from 'mytoolkit/src/utils.js'public strToTime(dateString: Sting, format: String, seconds: Boolean): String source
import {strToTime} from 'mytoolkit/src/utils.js'public tail(list: Array, size: Number): Any | Array source
import {tail} from 'mytoolkit/src/array.js'Return:
| Any | Array | the trancated list or the last item |
public timeToStr(time: String | Number, format: String): String source
import {timeToStr} from 'mytoolkit/src/utils.js'public timestamp(): * source
import {timestamp} from 'mytoolkit/src/utils.js'- like currentTime but its seconds not miniseconds
Return:
| * | seconds since 00:00:00 UTC on January 1, 1970 |
public trim(str: String): String source
import {trim} from 'mytoolkit/src/string.js'Params:
| Name | Type | Attribute | Description |
| str | String | a string that to be trim spaces at begin or end of the string. |
public typeOf(obj: *): * source
import {typeOf} from 'mytoolkit/src/base.js'Params:
| Name | Type | Attribute | Description |
| obj | * |
Return:
| * |