fe-utils
collect all kinds of utility functions that are often used by us.
Installation
In a browser:
Using npm:
$ npm i -g npm$ npm i --save fe-utils
Usage:
// Load method categories.var cookie = var date = ...
allMethods:
-
NumberToChinese
// '一万二千三百四十五'// '壹万贰仟叁佰肆十伍' -
cookie
-
date
// dateFormat(new Date(), 'YYYY年MM月DD日 hh:mm:ss') -
detectedInfos
isAndroid / isIOS / isWindowPhone / isWX / isWeibo / isMobile / isPC -
preventViewScroll
-
urlQuery
const url = 'http://live.tinfinite.com:8080/path/chat-studio.html?liveshowId=592e4e2bf84e6e26c1cf97dd&group=live#123'queryOne// queryOne('liveshowId', url) -> '592e4e2bf84e6e26c1cf97dd'queryAll// queryAll(url) -> { liveshowId: '592e4e2bf84e6e26c1cf97dd', group: 'live' }update// update({ group: 'voice', referer: 'list' }, url) ->// {query:liveshowId: '592e4e2bf84e6e26c1cf97dd'group: 'voice'referer: 'list'url: 'http://live.tinfinite.com:8080/path/chat-studio.html?liveshowId=592e4e2bf84e6e26c1cf97dd&group=voice&referer=list#123'}del// del('liveshowId', url) ->// {query:group: 'live'url: 'http://live.tinfinite.com:8080/path/chat-studio.html?group=live#123'}// del(['liveshowId', 'group'], url) ->// {query: {}search: 'http://live.tinfinite.com:8080/path/chat-studio.html#123'} -
toRoman
// 'XXV' -
getVersionOfIOS
// '10.3' -
relProtocol
// '//xxx.com' -
logger
-
mediaError
// for error-listener-callback of audio and video -
loadJs