Skip to content

Latest commit

 

History

History
135 lines (82 loc) · 2.76 KB

README.md

File metadata and controls

135 lines (82 loc) · 2.76 KB

Funk

A web tool function kits.
Funk contains several usual functions you may use under web enviromment.

Dependency

  • jQuery 3.x

API documentation

System/Environment

test

String Format

Debug


System/Environment

Function :

jf_client(ua)

Description

get client device type/os/browser

Arguments

ua(string) : navigator.userAgent | request.headers['user-agent']

Returns

{

device(string) : 'desktop|mobile(phone)|mobile(tablet)', os(string) : 'Windows|MacOS|iOS|Android|Linux|others', browser(string) : 'Chrome|Firefox|IE|Edge|Safari|Opera|others'

}

String Format

Function :

jf_intFill(num, len, stuff = ' ', dir = true)

Description

output formatted string of integer

Arguments

num(string|number) : number to be formatted len(integer) : output string length >stuff : char to be filled if the length is less than len dir(bool) : true for leading filled|false for trail filled

Returns

formatted string(string), won't change if the original length greater than len

Function :

jf_floatFill(num, len, deciaml = 0, stuff = ' ', dir = true)

Description

output formatted string of float

Arguments

num(string|number) : number to be formatted len(integer) : total length of output string decimal(integer) : counts of decimal, fill 0 if length is less than decimal stuff(string) : char to be filled if the length is less than len dir(bool) ; true for leading fill|false for trail fill

Returns

formatted string(string), won't change if the original length greater than len

Debug

Function :

jf_dbgCheck(tag, mute = false)

Description

print current timestamp with tag and the interval from last checked point

Arguments

tag(string) : tag name >mute(bool) : put data into array without printing to console.

Returns

N/A

Function :

jf_dbgDump()

Description

dump data to console from the beginning

Arguments

N/A

Returns

N/A

Function :

jf_dbgReset()

Description

clear checked history

Arguments

N/A

Returns

N/A

License

Code released under the MIT license