Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

js-cool

saqqdy583MIT5.23.1TypeScript support: included

Collection of common JavaScript / TypeScript utilities

js-cool, es6, utilities, utils, typescript, javascript, js-library, js-lib, js-tools, saqqdy

readme

js-cool

Collection of common JavaScript / TypeScript utilities

[![NPM version][npm-image]][npm-url] [![Codacy Badge][codacy-image]][codacy-url] [![tree shaking][tree-shaking-image]][tree-shaking-url] ![typescript][typescript-url] [![Test coverage][codecov-image]][codecov-url] [![npm download][download-image]][download-url] [![gzip][gzip-image]][gzip-url] [![License][license-image]][license-url]

[![Sonar][sonar-image]][sonar-url]

DocumentationChange Log

Read this in other languages: English | 简体中文

Installation

# use pnpm
pnpm install js-cool

## use npm
npm install --save js-cool

Usage

ES6 module

import { osVersion } from 'js-cool'

osVersion()

Node.js require

const { osVersion } = require('js-cool')

osVersion()

Using unpkg CDN

<script src="https://unpkg.com/js-cool@latest/dist/index.global.prod.js"></script>
<script>
  jsCool.browserVersion()
</script>

API Reference

Global Parameters

client

The client method returns a browser result object

  • Since: 1.0.1

  • Arguments: none

  • Returns: object

  • Example:

import { client } from 'js-cool'

client.get(['device', 'browser', 'engine', 'os']) // { device: 'xxx', browser: 'xxx', os: 'xxx', engine: 'xxx' }
client.get('device') // { device: 'xxx' }
  • Types:
declare class Client {
  matchMap: Record<InfoKeys, boolean>
  root: Window & typeof globalThis
  navigator: Navigator
  constructor(options: ClientOptions)

  get(names?: InfoTypes | InfoTypes[]): Partial<{
    device: InfoKeys | undefined
    os: InfoKeys | undefined
    browser: InfoKeys | undefined
    engine: InfoKeys | undefined
    language: any
    network: any
    orientation: string | undefined
  }>

  getInfoByType(infoKey: InfoKey): InfoKeys | undefined
  getOrientationStatus(): 'vertical' | 'horizontal' | undefined
  getNetwork(): any
  getLanguage(): any
}

pattern

Collection of common regular expressions

v5.21.2 pattern support mac/ip4/ip4_pri

  • Since: 1.0.1

  • Arguments: none

  • Returns: none

  • Example:

pattern.number.test('333') // true
  • Types:
declare const pattern: {
  any: RegExp
  number: RegExp
  string: RegExp
  postcode: RegExp
  url: RegExp
  username: RegExp
  float: RegExp
  email: RegExp
  mobile: RegExp
  chinese: RegExp
  tel: RegExp
  qq: RegExp
  pass: RegExp
  json: RegExp
  arrjson: RegExp
  array: RegExp
  isjson: RegExp
  textarea: RegExp
  mac: RegExp
  ip4: RegExp
  ip4_pri: RegExp
}

Extras for String & Array & Object & Function

clearAttr

Remove all attributes of HTML tags

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
string string with html tags string - true -
  • Returns: string

  • Example:

clearAttr('<div id="testID">test</div>')
// '<div>test</div>'
  • Types:
declare function clearAttr(string: string): string

clearHtml

Remove HTML tags

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
string string with html tags string - true -
  • Returns: string

  • Example:

clearHtml('<div>test<br />string</div>')
// 'teststring'
  • Types:
declare function clearHtml(string: string): string

escape

Escaping HTML Special Characters

  • Since: 5.5.0

  • Arguments:

Parameters Description Type Optional Required Default
string string with html tags string - true -
  • Returns: string

  • Example:

escape('<div>test<br />string</div>')
// '&lt;div&gt;test&lt;br /&gt;string&lt;/div&gt;'
  • Types:
declare function escape(string: string): string

unescape

Restore HTML Special Characters

  • Since: 5.5.0

  • Arguments:

Parameters Description Type Optional Required Default
string string string - true -
  • Returns: string

  • Example:

unescape('&lt;div&gt;test&lt;br /&gt;string&lt;/div&gt;')
// '<div>test<br />string</div>'
  • Types:
declare function unescape(string: string): string

getNumber

Get the number in the string

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
string pass in a string with a number string - true -
  • Returns: string

  • Example:

getNumber('Chrome123.33')
// '123.33'

getNumber('234test.88')
// '234.88'
  • Types:
declare function getNumber(string: string): string

camel2Dash

Converts humped strings to -spaced and all lowercase Dash pattern

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
string the string to be converted string - true -
  • Returns: string

  • Example:

camel2Dash('jsCool') // js-cool
  • Types:
declare function camel2Dash(string: string): string

dash2Camel

Converts -spaced and all lowercase Dash patterns to humped strings

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
string the string to be converted string - true -
  • Returns: string

  • Example:

dash2Camel('js-cool') // jsCool
  • Types:
declare function dash2Camel(string: string): string

randomColor

Generate random hexadecimal colors

Support for custom color value ranges starting with version 5.17.0, which can be used to customize the generation of darker, lighter, warmer colors, etc.

  • Since: 5.5.0

  • Arguments:

Parameters Description Type Optional Required Default
min the minimum value of the random numbers number / [number, number, number] - false -
max the maximum value of the random numbers number / [number, number, number] - false -
  • Returns: string

  • Example:

randomColor()
// #bf444b

randomColor(200)
// #d6e9d7

randomColor(200, 255)
// #d3f9e4

randomColor([0, 0, 0], [255, 255, 255])
// #e2f2f3
  • Types:
declare function randomColor(
  min?: number | [number, number, number],
  max?: number | [number, number, number]
): string

randomNumber

Get a random number

  • Since: 5.0.0

  • Arguments:

Parameters Description Type Optional Required Default
min the minimum value of the random number number - false 1
max the maximum value of the random number number - false 10
  • Returns: number

  • Example:

randomNumber() // 8
randomNumber(0.1, 0.9) // 0.8
  • Types:
declare function randomNumber(min?: number, max?: number): number

randomNumbers

Generate n random integers that sum to a fixed sum

  • Since: 5.4.0

  • Arguments:

Parameters Description Type Optional Required Default
n Number of generated integers number - false 1
sum Sum of generated integers number - false 100
noZero Generate integers that are not zero boolean - false true
  • Returns: Array<number>

  • Example:

randomNumbers()
// [8]

randomNumbers(4, 5)
// [1, 1, 2, 1]

randomNumbers(4, 5, false)
// [0, 1, 2, 2]
  • Types:
declare function randomNumbers(n?: number, sum?: number): number[]

randomString

Get a random string

v5.4.0 widthSpecialChar changed to options, still compatible with old usage, widthSpecialChar=true equivalent to { charTypes: ['uppercase', 'lowercase', 'number', 'special'] }

  • Since: 5.0.0

  • Arguments:

Parameters Description Type Optional Required Default
len the length of the random string that needs to be obtained number - false 32
options randomString options RandomStringOptions boolean - false { charTypes: ['uppercase', 'lowercase', 'number'] }
  • Returns: string

  • Example:

// 1. No parameters are passed, a 32-bit (possibly) string containing upper and lower case letters and numbers is generated by default
randomString()
// PVSjz902EqYbmxaLtvDnggtnlvt5uFTZ

// 2. Generate a 16-bit random string
randomString(16)
// coTgZy0mqqMJ1sMM

// 3. Same effect as #2 above
randomString({
  length: 16
})
// ngCI5aPqJm84t90d

// 4. Generate containing special characters (old way of passing values, not recommended)
randomString(true)
// 0Uby@op3B-sK5]dHl4S|15As.OlHiNXd

// 5. Same effect as #4 above (recommended)
randomString({
  charTypes: ['uppercase', 'lowercase', 'number', 'special']
})
// m,2^vpkrE,F,DbcSFk0=vr&@DJ27j9XK

// 6. Same effect as #4 above, Limit string length to 16 bits
randomString(16, true)
// dXz[J_sYM^3d8fnA

// 7. Generate a 16-bit random number
randomString({
  length: 16,
  charTypes: 'number'
})
// 7450026301030286

// 8. Elimination of confusing characters: oOLl,9gq,Vv,Uu,I1
randomString({
  length: 16,
  noConfuse: true
})
// 8DEGna8ppC4mqyew

// 9. The generated random string must contain at least 1 character of each type of character specified, e.g. to generate a 16-bit password that must contain upper and lower case letters, numbers, and special characters.
randomString({
  length: 16,
  strict: true
})
// PFYAPD5KFqOHIADL
  • Types:
declare function randomString(len?: number, options?: RandomStringOptions | boolean): string

declare function randomString(
  len?: RandomStringOptions | boolean,
  options?: RandomStringOptions | boolean
): string

declare type RandomStringCharType = 'uppercase' | 'lowercase' | 'number' | 'special'

declare interface RandomStringOptions {
  length?: number
  charTypes?: RandomStringCharType | ArrayOneMore<RandomStringCharType>
  /**
   * Elimination of confusing characters: oOLl,9gq,Vv,Uu,I1
   */
  noConfuse?: boolean
  /**
   * The generated random string must contain each of the listed character types
   */
  strict?: boolean
}

shuffle

shuffling algorithm, Reordering arrays or strings

  • Since: 5.4.0

  • Arguments:

Parameters Description Type Optional Required Default
value arrays or strings array string - true -
size new array or string length number - false -
  • Returns: array | string

  • Example:

const str = 'abcde'
const arr = [1, 2, 3]

shuffle(str)
// cdbse

shuffle(arr)
// [3, 1, 2]

shuffle(arr, 2)
// [3, 2]
  • Types:
declare function shuffle(value: string, size?: number): string

declare function shuffle<T extends unknown[] = unknown[]>(value: T, size?: number): T

fingerprint

Generating Browser Fingerprints

  • Since: 5.2.0

  • Arguments:

Parameters Description Type Optional Required Default
domain key string string - false location.host
  • Returns: string

  • Example:

fingerprint('www.saqqdy.com') // wc7sWJJA8
  • Types:
declare function fingerprint(domain?: string): string | null

getCHSLength

Get the length of the string, Chinese counts as 2 characters

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
str input string string - true -
  • Returns: number

  • Example:

getCHSLength('测试') // 2
  • Types:
declare function getCHSLength(str: string): number

cutCHSString

Intercept string, Chinese counts as 2 bytes

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
str the string to be intercepted string - true -
len length number - false -
hasDot output with dot boolean - false false
  • Returns: string

  • Example:

cutCHSString('测试', 1) // 测
cutCHSString('测试', 1, true) // 测...
  • Types:
declare function cutCHSString(str: string, len?: number, hasDot?: boolean): string

upperFirst

First letter capitalized

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
string the string to be converted string - true -
  • Returns: string

  • Example:

upperFirst('saqqdy') // Saqqdy
  • Types:
declare function upperFirst(string: string): string

Determine

isDigitals

Determine if a string is a number

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
str the string to be tested string - true -
  • Returns: boolean

  • Example:

isDigitals('2.11') // true
isDigitals('2.3x') // false
  • Types:
declare function isDigitals(str: string): boolean

isExitsFunction

Determine if a function is defined

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
name function name string - true -
  • Returns: boolean

  • Example:

isExitsFunction('test') // false
isExitsFunction('console.log') // true
  • Types:
declare function isExitsFunction(name: string): boolean

isExitsVariable

Determine if a variable is defined

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
name variable name string - true -
  • Returns: boolean

  • Example:

isExitsVariable('test') // false
isExitsVariable('window') // true
  • Types:
declare function isExitsVariable(name: string): boolean

isEqual

Determine if 2 objects are equal

  • Since: 5.12.0

  • Arguments:

Parameters Description Type Optional Required Default
a source any - true -
b compare any - true -
  • Returns: boolean

  • Example:

isEqual({ a: 22, b: {} }, { b: {}, a: 22 })
// true

isEqual([1, 2], [2, 1])
// false

isEqual(NaN, NaN)
// true
  • Types:
declare function isEqual<T, P>(a: T, b: P): boolean

isWindow

Determine if window object

  • Since: 5.0.0

  • Arguments:

Parameters Description Type Optional Required Default
target any target any - true -
  • Returns: boolean

  • Example:

isWindow({}) // false
isWindow(window) // true
  • Types:
declare function isWindow<T = any>(target: T): target is Window

isPlainObject

Determine if target is an plain object

  • Since: 5.0.0

  • Arguments:

Parameters Description Type Optional Required Default
target any target any - true -
  • Returns: boolean

  • Example:

isPlainObject({}) // true
isPlainObject(window) // false
  • Types:
type Primitive = bigint | boolean | null | number | string | symbol | undefined

type JSONValue = Primitive | PlainObject | JSONArray

// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
interface PlainObject {
  [key: string]: JSONValue
}

interface JSONArray extends Array<JSONValue> {}

declare function isPlainObject(target: unknown): target is PlainObject

isDarkMode

Determine if dark color mode

  • Since: 5.5.0

  • Arguments: none

  • Returns: boolean

  • Example:

isDarkMode() // false
  • Types:
declare function isDarkMode(): boolean

isObject

Determine if target is an object

  • Since: 5.0.0

  • Arguments:

Parameters Description Type Optional Required Default
target any target any - true -
  • Returns: boolean

  • Example:

isObject({}) // true
  • Types:
declare function isObject<T = any>(target: T): target is Object

isDate

Determine if target is Date

  • Since: 5.15.0

  • Arguments:

Parameters Description Type Optional Required Default
target any target any - true -
  • Returns: boolean

  • Example:

const now = new Date()

isDate(now)
// true
  • Types:
declare function isDate<T = any>(target: T): target is Date

isRegExp

Determine if target is RegExp

  • Since: 5.15.0

  • Arguments:

Parameters Description Type Optional Required Default
target any target any - true -
  • Returns: boolean

  • Example:

isRegExp(/\d/) // true
  • Types:
declare function isRegExp<T = any>(target: T): target is RegExp

isArray

Determine if it is an array

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
target any target any - true -
  • Returns: boolean

  • Example:

isArray([]) // true
  • Types:
declare function isIterable(target: any): target is any[]

isIterable

Determine if it is iterable

  • Since: 5.7.0

  • Arguments:

Parameters Description Type Optional Required Default
target any target any - true -
  • Returns: boolean

  • Example:

isIterable([]) // true
  • Types:
declare function isIterable<T = any>(target: T | Iterable<T>): target is Iterable<T>

inBrowser

Determine if it is running on the browser side

  • Since: 4.5.0

  • Arguments: none

  • Returns: boolean

  • Example:

function test() {
  if (!inBrowser) return null
  // ...
}
  • Types:
declare const inBrowser: boolean

inNodeJs

Determine if it is running on node.js

  • Since: 5.13.0

  • Arguments: none

  • Returns: boolean

  • Example:

if (inNodeJs) {
  //
}
  • Types:
declare const inNodeJs: boolean

isNumberBrowser

Detect if the client is a 360 browser

  • Since: 5.22.0

  • Arguments:

Parameters Description Type Optional Required Default
userAgent ua or any ua like string, allowed to be undefined string - false navigator.userAgent
  • Returns: boolean

  • Example:

// 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36 QIHU 360EE'
// true

// 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36'
// true
  • Types:
declare function isNumberBrowser(userAgent?: string): boolean

windowSize

Get the window size

  • Since: 1.0.1

  • Arguments: none

  • Returns: { width, height }

  • Example:

windowSize()
// { width: 1280, height: 800 }
  • Types:
declare interface WindowSizeObj {
  width: number
  height: number
}

declare function windowSize(): WindowSizeObj

getAppVersion

Get the APP version number

deprecated please use 'appVersion' instead

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
appName app name string - true -
withApp whether to bring the name boolean - false -
userAgent ua or any ua like string, allowed to be undefined string - false navigator.userAgent
  • Returns: string | boolean | null

  • Example:

// navigator.userAgent => '5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 AppName/1.0.0-beta.8'

getAppVersion('Chrome') // 114.0.0.0
getAppVersion('Safari', true) // Safari/537.36
  • Types:
declare function getAppVersion(
  appName: string,
  withApp?: boolean,
  userAgent?: string
): string | boolean | null

appVersion

Get the app version number

  • Since: 5.1.0

  • Arguments:

Parameters Description Type Optional Required Default
appName app name string - true -
ua ua or any ua like string, allowed to be undefined string - false navigator.userAgent
ignoreCase whether to ignore case boolean true/false false true
  • Returns: string | null

  • Example:

// navigator.userAgent => '5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 AppName/1.0.0-beta.8'

appVersion('Chrome') // 114.0.0.0
appVersion('Safari') // 537.36
appVersion('appname', false) // null
appVersion('appname') // 1.0.0-beta.8
  • Types:
declare function appVersion(appName: string): string | null
declare function appVersion(appName: string, ua: string): string | null
declare function appVersion(appName: string, ua: boolean): string | null
declare function appVersion(appName: string, ua: string, ignoreCase: boolean): string | null

getOsVersion

Get the phone system version

deprecated: please use 'osVersion' instead

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
osName system type string Android, iPod, iWatch or iPhone string - true -
withOS whether to bring the name string - false -
userAgent ua or any ua like string, allowed to be undefined string - false navigator.userAgent
  • Returns: string | boolean | null

  • Example:

getOsVersion('iPhone')
// '13.2.3'

getOsVersion('iPhone', true)
// 'iPhone/13.2.3'
  • Types:
declare function getOsVersion(
  osName: string,
  withOS?: boolean,
  userAgent?: string
): string | boolean | null

osVersion

get the system version

  • Since: 5.1.0

  • Arguments:

Parameters Description Type Optional Required Default
ua ua or any ua like string, allowed to be undefined string - false navigator.userAgent
  • Returns: OsVersion | null

  • Example:

// ipad => 'Mozilla/5.0 (iPad; CPU OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1'
osVersion() // \{ name: 'iOS', version: '13.3' \}
// iphone => 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'
osVersion() // \{ name: 'iOS', version: '13.2.3' \}
//  mac os => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'
osVersion() // \{ name: 'MacOS', version: '10.15.7' \}
// windows => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'
osVersion() // \{ name: 'Windows', version: '10.0' \}
// windows xp => 'Mozilla/5.0 (Windows NT 5.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'
osVersion() // \{ name: 'Windows', version: 'XP' \}
// windows phone => 'Mozilla/5.0 (Windows Phone OS 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36'
osVersion() // \{ name: 'WindowsPhone', version: '10.0' \}
  • Types:
declare interface OsVersion {
  name: 'Windows' | 'MacOS' | 'Android' | 'iOS' | 'WindowsPhone' | 'Debian' | 'WebOS' | 'Harmony'
  version: string
}

declare function osVersion(ua?: string): OsVersion | null

browserVersion

Get the browser name and version

  • Since: 5.2.0

  • Arguments:

Parameters Description Type Optional Required Default
ua ua or any ua like string, allowed to be undefined string - false navigator.userAgent
  • Returns: BrowserVersion | null

  • Example:

// Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Ap…KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
browserVersion() // \{ name: 'Chrome', version: '114.0.0.0' \}
  • Types:
declare interface BrowserVersion {
  name:
    | 'Safari'
    | 'Chrome'
    | 'IE'
    | 'Edge'
    | 'Firefox'
    | 'Firefox Focus'
    | 'Chromium'
    | 'Opera'
    | 'Vivaldi'
    | 'Yandex'
    | 'Arora'
    | 'Lunascape'
    | 'QupZilla'
    | 'Coc Coc'
    | 'Kindle'
    | 'Iceweasel'
    | 'Konqueror'
    | 'Iceape'
    | 'SeaMonkey'
    | 'Epiphany'
    | '360'
    | '360SE'
    | '360EE'
    | 'Maxthon'
    | 'QQBrowser'
    | 'QQ'
    | 'Baidu'
    | 'UC'
    | 'Sogou'
    | 'Liebao'
    | 'LBBROWSER'
    | '2345Explorer'
    | '115Browser'
    | 'TheWorld'
    | 'XiaoMi'
    | 'Vivo'
    | 'Quark'
    | 'Qiyu'
    | 'Wechat'
    | 'WechatWork'
    | 'Taobao'
    | 'Alipay'
    | 'Weibo'
    | 'Douban'
    | 'Suning'
    | 'iQiYi'
    | 'DingTalk'
    | 'Huawei'
  version: string
}

declare function browserVersion(ua?: string): BrowserVersion | null

compareVersion

v5.8.0 support compare tag version

Version number size comparison, tag version: rc > beta > alpha > other

  • Since: 4.7.0

  • Arguments:

Parameters Description Type Optional Required Default
input input version string - true -
compare compare version string - true -
  • Returns: 0 | 1 | -1

  • Example:

compareVersion('1.11.0', '1.9.9')
// => 1: 1=Version 1.11.0 is newer than 1.9.9

compareVersion('1.11.0', '1.11.0')
// => 0: 0=Versions 1.11.0 and 1.11.0 are the same

compareVersion('1.11.0', '1.99.0')
// => -1: -1=Version 1.11.0 is older than 1.99.0

compareVersion('1.0.0.0.0.10', '1.0')
// => -1

// compare tag version: rc > beta > alpha > other
compareVersion('1.11.0', '1.11.0-beta.1')
// => -1

compareVersion('1.11.0-beta.1', '1.11.0')
// => -1

compareVersion('1.11.0-beta.10', '1.11.0-beta.10')
// => 0

compareVersion('1.11.0-alpha.10', '1.11.0-beta.1')
// => -1

compareVersion('1.11.0-alpha.10', '1.11.0-rc.1')
// => -1

compareVersion('1.11.0-tag.10', '1.11.0-alpha.1')
// => -1

compareVersion('1.11.0-tag.10', '1.11.0-tag.1')
// => 1

compareVersion('1.11.0-release.10', '1.11.0-tag.1')
// => 1
  • Types:
declare function compareVersion(input: string, compare: string): 0 | 1 | -1

parseUrlParam

parse url params. (If covert is passed true: Scientific notation, binary, octal and hexadecimal types of data are not converted, like: 0b111, 0o13, 0xFF, 1e3, -1e-2)

  • Since: 5.0.0

  • Arguments:

Parameters Description Type Optional Required Default
url url string (like: ?key1=value1&key2=value2) string - true -
covert Converts a specific string to a corresponding value boolean true/false false false
  • Returns: object

  • Example:

parseUrlParam(
  '?key1=100&key2=true&key3=null&key4=undefined&key5=NaN&key6=10.888&key7=Infinity&key8=test'
)
// \{"key1":"100","key2":"true","key3":"null","key4":"undefined","key5":"NaN","key6":"10.888","key7":"Infinity","key8":"test"\}

parseUrlParam(
  '?key1=100&key2=true&key3=null&key4=undefined&key5=NaN&key6=10.888&key7=Infinity&key8=test',
  true
)
// \{"key1":100,"key2":true,"key3":null,"key5":NaN,"key6":10.888,"key7":Infinity,"key8":"test"\}
  • Types:
declare function parseUrlParam(url: string, covert?: boolean): Record<string, unknown>

spliceUrlParam

Splice URL parameters (single layer only)

v5.20.0 Breaking change: remove encodeURIComponent
v5.21.0 Breaking change: covert support boolean & SpliceUrlParamOptions

  • Since: 5.3.0

  • Arguments:

Parameters Description Type Optional Required Default
params json object object - true -
covert Convert a null value type (null/undefined/) to an empty string or spliceUrlParamOptions boolean | SpliceUrlParamOptions - false false
  • Returns: string

  • Example:

spliceUrlParam({ key1: '100', key2: true, key3: null, key4: undefined, key5: '测试' })
// ?key1=100&key2=true&key3=null&key4=undefined&key5=测试

spliceUrlParam(
  { key1: '100', key2: true, key3: null, key4: undefined, key5: '测试' },
  { encode: true }
)
// ?key1=100&key2=true&key3=null&key4=undefined&key5=%E6%B5%8B%E8%AF%95

spliceUrlParam({ key1: '100', key2: true, key3: null, key4: undefined }, true)
// ?key1=100&key2=true&key3=&key4=

spliceUrlParam(
  { key1: '100', key2: true, key3: null, key4: undefined },
  { covert: true, withQuestionsMark: false }
)
// key1=100&key2=true&key3=&key4=
  • Types:
declare function spliceUrlParam<T extends Record<string, unknown>>(
  params: T,
  covert?: SpliceUrlParamOptions | boolean
): string

declare interface SpliceUrlParamOptions {
  covert?: boolean
  encode?: boolean
  withQuestionsMark?: boolean
}

safeParse

Secure parsing of JSON strings

support BigInt since v5.17.1

  • Since: 5.16.0

  • Arguments:

Parameters Description Type Optional Required Default
data JSON string string - true -
covert Whether to convert data boolean true/false false true
  • Returns: Object

  • Example:

safeParse('100')
// 100

safeParse('{"a":"undefined","b":"NaN","c":"Infinity","d":"9007199254740993"}')
// { b: NaN, c: Infinity, d: 9007199254740993n }
  • Types:
declare function safeParse(data: string, covert?: boolean): any

safeStringify

Secure stringify of JSON Object

support BigInt since v5.17.1

  • Since: 5.16.0

  • Arguments:

Parameters Description Type Optional Required Default
data JSON Object any - true -
covert Whether to convert data boolean true/false false true
  • Returns: string

  • Example:

safeStringify(100)
// "100"

safeStringify(undefined)
// "undefined"

safeStringify(NaN)
// "NaN"

safeStringify(Infinity)
// "Infinity"

safeStringify({ a: undefined, b: NaN, c: Infinity, d: BigInt(Number.MAX_SAFE_INTEGER) + 2n })
// {"a":"undefined","b":"NaN","c":"Infinity","d":"9007199254740993"}
  • Types:
declare function safeStringify(data: any, covert?: boolean): string

getDirParam

Get the URL parameter in the form of a directory

It will be refactored and renamed getDirParams in the next major release.

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
url http url object - true -
  • Returns: object

  • Example:

//
  • Types:
declare interface DirParamType {
  path?: string[]
  host?: string
}

declare function getDirParam(url: string): DirParamType

getQueryParam

Get a single query parameter (behind "#")

  • Since: 5.0.0

  • Arguments:

Parameters Description Type Optional Required Default
key key name string - true -
url pass in the url string string - false location.href
  • Returns: string

  • Example:

getQueryParam('key1')
// key1 => xxx

getQueryParam('key1', 'https://test.com?key1=100#/home?key1=200')
// key1 => 200
  • Types:
declare function getQueryParam(key: string): string | undefined

declare function getQueryParam(key: string, url: string): string | undefined

getQueryParams

Get all query parameters (behind "#"). (If covert is passed true: Scientific notation, binary, octal and hexadecimal types of data are not converted, like: 0b111, 0o13, 0xFF, 1e3, -1e-2)

  • Since: 5.0.0

  • Arguments:

Parameters Description Type Optional Required Default
url pass in the url string string - false location.href
covert Converts a specific string to a corresponding value boolean true/false false false
  • Returns: object

  • Example:

getQueryParams('https://test.com?key1=100#/home?key1=200')
// \{"key1":"200"\}

getQueryParams('https://test.com?key1=100#/home?key1=200', true)
// \{"key1":200\}

getQueryParams(true)
// \{"key1":200\}
  • Types:
declare function getQueryParams(url?: string, covert?: boolean): Record<string, unknown> | null

getUrlParam

Get a single URL parameter (from the "location.search", before "#")

  • Since: 5.0.0

  • Arguments:

Parameters Description Type Optional Required Default
key key name string - true -
url pass in the url string string - false location.href
  • Returns: string

  • Example:

getUrlParam('key1')
// key1 => xxx

getUrlParam('key1', 'https://test.com?key1=100#/home?key1=200')
// key1 => 100
  • Types:
declare function getUrlParam(key: string): string | undefined

declare function getUrlParam(key: string, url: string): string | undefined

getUrlParams

Get all URL parameters (from the "location.search", before "#"). (If covert is passed true: Scientific notation, binary, octal and hexadecimal types of data are not converted, like: 0b111, 0o13, 0xFF, 1e3, -1e-2)

  • Since: 5.0.0

  • Arguments:

Parameters Description Type Optional Required Default
url pass in the url string string - false location.href
covert Converts a specific string to a corresponding value boolean true/false false false
  • Returns: object

  • Example:

getUrlParams('https://test.com?key1=100#/home?key1=200')
// \{"key1":"100"\}

getUrlParams('https://test.com?key1=100#/home?key1=200', true)
// \{"key1":100\}

getUrlParams(true)
// \{"key1":100\}
  • Types:
declare function getUrlParams(url?: string, covert?: boolean): Record<string, unknown> | null

getCache

Get the cache, if the deposited is Object, the retrieved is also Object, no need to convert again

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
name cache key name string - true -
  • Returns: any

  • Example:

import { getCache, setCache } from 'js-cool'

const data1 = 100
const data2 = { a: 10 }
const data3 = null

setCache('data1', data1)
setCache('data2', data2)
setCache('data3', data3)

getCache('data1') // 100
getCache('data2') // {a:10}
getCache('data3') // null

getCache('data4') // null
  • Types:
declare function getCache(name: string): any

setCache

Set the cache, if the deposited is Object, the retrieved is also Object, no need to convert again

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
name cache key name string - true -
value cache data, can be passed directly into Object any - true -
seconds cache time (seconds) number - false -
  • Returns: void

  • Example:

import { getCache, setCache } from 'js-cool'

const data1 = 100
const data2 = { a: 10 }
const data3 = null

setCache('data1', data1)
setCache('data2', data2, 10)

getCache('data1') // 100
getCache('data2') // {a:10}

setTimeout(() => {
  getCache('data2') // null
}, 15000)
  • Types:
declare function setCache<T = unknown>(name: string, value: T, seconds?: number | string): void

delCache

Delete localStorage

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
name cache key name string - true -
  • Returns: void

  • Example:

delCache('data')
  • Types:
declare function delCache(name: string): void

getSession

Get the session, if the deposited is Object, the retrieved is also Object, no need to convert again

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
name session key name string - true -
  • Returns: any

  • Example:

const data1 = 100
const data2 = { a: 10 }
const data3 = null

setSession('data1', data1)
setSession('data2', data2)
setSession('data3', data3)

getSession('data1') // 100
getSession('data2') // {a:10}
getSession('data3') // null

getSession('data4') // null
  • Types:
declare function getSession(name: string): any

setSession

Set the session, if the deposited is Object, the retrieved is also Object, no need to convert again

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
name session key name string - true -
value session data, can be passed directly into Object any - true -
seconds session time (seconds) number - false -
  • Returns: void

  • Example:

import { getSession, setSession } from 'js-cool'

const data1 = 100
const data2 = { a: 10 }
const data3 = null

setSession('data1', data1)
setSession('data2', data2, 10)

getSession('data1') // 100
getSession('data2') // {a:10}

setTimeout(() => {
  getSession('data2') // null
}, 15000)
  • Types:
declare function setSession<T = unknown>(name: string, value: T, seconds?: number | string): void

delSession

Delete sessionStorage

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
name session key name string - true -
  • Returns: void

  • Example:

delSession('data')
  • Types:
declare function delSession(name: string): void

getCookie

Get cookie by name

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
name cookie key name string - true -
  • Returns: any

  • Example:

getCookie('data1') // 100
  • Types:
declare function getCookie(name: string): string

getCookies

Get all cookies

  • Since: 5.6.0

  • Arguments: 'none'

  • Returns: object

  • Example:

getCookies()
// { token: 'xxx', name: 'saqqdy' }
  • Types:
declare function getCookies(): Record<string, string>

setCookie

Set cookie

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
name cookie key name string - true -
value cookie data, can be passed directly into Object any - true -
seconds cookie time (seconds) number - false -
path cookie path string - false /
samesite SameSite type string Strict/Lax /None false None
  • Returns: void

  • Example:

import { getCookie, setCookie } from 'js-cool'

const data1 = 100
const data2 = 200

setCookie('data1', data1)
setCookie('data2', data2, 10)

getCookie('data1') // 100
getCookie('data2') // 200

setTimeout(() => {
  getCookie('data2') // null
}, 15000)
  • Types:
declare function setCookie<T extends string | number | boolean>(
  name: string,
  value: T,
  seconds: string | number,
  path?: string,
  samesite?: boolean
): void

delCookie

Delete cookie

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
name cookie key name string - true -
  • Returns: void

  • Example:

delCookie('data')
  • Types:
declare function delCookie(name: string): void

Base64 & UTF8

encodeBase64

convert strings, numbers to base64

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
input the string to be encoded string/number - true -
  • Returns: void

  • Example:

encodeBase64('data')
  • Types:
declare function encodeBase64(name: string): string

decodeBase64

base64 decoding

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
input the string to be decoded string/number - true -
  • Returns: void

  • Example:

decodeBase64('data')
  • Types:
declare function decodeBase64(name: string): string

encodeUtf8

convert strings, numbers to utf8

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
input the string to be encoded string/number - true -
  • Returns: void

  • Example:

encodeUtf8('data')
  • Types:
declare function encodeUtf8(name: string): string

decodeUtf8

utf8 decoding

  • Since: 1.0.1

  • Arguments:

Parameters Description Type Optional Required Default
input the string to be decoded string/number - true -
  • Returns: void

  • Example:

decodeUtf8('data')
  • Types:
declare function decodeUtf8(name: string): string

Events

stopBubble

stop bubbling

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
e dom's event object Event - true -
  • Returns: boolean

  • Example:

stopBubble(event)
  • Types:
declare function stopBubble(e: Event): boolean

stopDefault

stop default events

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
e dom's event object Event - true -
  • Returns: boolean

  • Example:

stopDefault(event)
  • Types:
declare function stopDefault(e: Event): boolean

addEvent

event delegate, support multiple delegates

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
element js dom object HTMLElement - true -
type The type of the event. No need to add on string - true -
handler Callback method function - true -
  • Returns: void

  • Example:

addEvent(document, 'click', functionName)
  • Types:
declare function addEvent(element: AnyObject, type: string, handler: AnyFunction): void

removeEvent

removeEvent removes the event delegate created by addEvent

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
element js dom object HTMLElement - true -
type The type of the event. No need to add on string - true -
handler Callback method function - true -
  • Returns: void

  • Example:

removeEvent(document, 'click', functionName)
  • Types:
declare function removeEvent(element: AnyObject, type: string, handler: AnyFunction): void

getScrollPosition

Get slide to top and bottom return 'top' 'bottom', recommend using limit flow

  • Since: 1.0.2

  • Arguments: none

  • Returns: 'top' | 'bottom' | undefined

  • Example:

getScrollPosition() // ‘bottom’
  • Types:
declare function getScrollPosition(): string | void

Utilities

nextIndex

return the next zIndex value

change mix defaults to 0

  • Since: 1.0.2

  • Arguments:

Parameters Description Type Optional Required Default
min minimum value number - false 0
max maximum value number - false -
  • Returns: number

  • Example:

nextIndex() // 1

nextIndex(1000) // 1001

nextIndex(10, 100) // 100
  • Types:
declare function nextIndex(min?: number, max?: number): number

nextVersion

return the next version, Only version types with no more than 3 digits are supported. (Follow the npm version rules)

  • Since: 5.10.0

  • Arguments:

Parameters Description Type Optional Required Default
version version(like: 1.0.0) string - true -
type version type major | minor | patch | premajor | preminor | prepatch | prerelease - false patch
preid prerelease id string - false ''
  • Returns: string

  • Example:

nextVersion('1.2.33') // 1.2.34

nextVersion('1.2.33', 'major') // 2.0.0

nextVersion('1.2.33', 'premajor', 'alpha') // 2.0.0-alpha.1
  • Types:
declare function nextVersion(
  version: string,
  type?: 'major' | 'minor' | 'patch' | 'premajor' | 'preminor' | 'prepatch' | 'prerelease',
  preid?: string
): string

punctualTimer

punctual setInterval

v5.23.0 got returns of PunctualTimerReturns

  • Since: 5.18.0

  • Arguments:

Parameters Description Type Optional Required Default
handler A function to be executed after the timer expires. function - true -
delay The time, in

changelog

Change logs

2025.01.17 v5.23.1

  1. docs work
  2. upgrade all packages

2024.11.18 v5.23.0

  1. punctualTimer got returns of PunctualTimerReturns

2024.11.15 v5.22.1

  1. fix bugs of nextVersion

2024.10.16 v5.22.0

  1. new isNumberBrowser function, see: isNumberBrowser
  2. Default value of agent string for getOsVersion and getAppVersion changed to navigator.appVersion.

2024.08.27 v5.21.2

  1. pattern support mac/ip4/ip4_pri

2024.08.12 v5.21.1

  1. osVersion support Harmony

2024.08.09 v5.21.0

  1. spliceUrlParam Breaking change: SpliceUrlParamOptions

2024.08.09 v5.20.0

  1. spliceUrlParam Breaking change: remove encodeURIComponent

2024.05.30 v5.19.2

  1. upgrade await-to-done, fix types

2024.04.29 v5.19.1

  1. remove default params of arrayBufferToBase64

2024.04.27 v5.19.0

  1. getProperty support defaultValue
  2. fix types
  3. upgrade all packages

2024.03.11 v5.18.1

  1. fix types
  2. fix export error

2024.03.07 v5.18.0

  1. new punctualTimer function, see: punctualTimer

2024.01.21 v5.17.1

  1. safeParse safeStringify supports converting bigint

2024.01.22 v5.17.0

  1. randomColor supports a range of custom color values, which can be used to customize the generation of dark, light, warm, etc.

2024.01.21 v5.16.0

  1. new safeParse safeStringify function
  2. upgrade all packages

2023.11.13 v5.15.2

  1. move awaitTo to await-to-done function, see: await-to-done
  2. fix circle require

2023.11.06 v5.15.0

  1. new clone function, see: clone
  2. new isDate function, see: isDate
  3. new isRegExp function, see: isRegExp

2023.11.01 v5.14.1

  1. docs work

2023.10.31 v5.14.0

  1. new sorter function, see: sorter
  2. new sortPinyin function, see: sortPinyin
  3. upgrade all packages

2023.10.27 v5.13.0

  1. new arrayBufferToBase64 function, see: arrayBufferToBase64
  2. new arrayBufferToBlob function, see: arrayBufferToBlob
  3. new base64ToArrayBuffer function, see: base64ToArrayBuffer
  4. new base64ToBlob function, see: base64ToBlob
  5. new base64ToFile function, see: base64ToFile
  6. new blobToArrayBuffer function, see: blobToArrayBuffer
  7. new blobToBase64 function, see: blobToBase64
  8. new blobToUrl function, see: blobToUrl
  9. new fileToBase64 function, see: fileToBase64
  10. new svgToBlob function, see: svgToBlob
  11. new urlToBlob function, see: urlToBlob
  12. new inNodeJs function, see: inNodeJs

2023.10.09 v5.12.0

  1. new isEqual function, see: isEqual
  2. upgrade all packages

2023.10.09 v5.11.0

  1. new getFileType function, see: getFileType
  2. upgrade all packages

2023.09.23 v5.10.0

  1. new nextVersion function, see: nextVersion
  2. new promiseFactory function, see: promiseFactory

2023.09.20 v5.9.0

  1. new mapTemplate function, see: mapTemplate

2023.09.16 v5.8.1

  1. waiting support throw on timeout API Docs

2023.09.11 v5.8.0

  1. compareVersion support tag version API Docs

2023.09.06 v5.7.2

  1. fix regexp bug of appVersion

2023.09.01 v5.7.1

  1. revert nextIndex function

2023.08.22 v5.7.0

  1. new isIterable function, see: isIterable
  2. Extend awaitTo to support passing in multiple promises, see: awaitTo
  3. fix types
  4. upgrade all packages

2023.08.18 v5.6.0

  1. new getCookies function, see: getCookies
  2. some improvements for getType/getSession/getCache/fixNumber
  3. fix bugs: toThousands/parseUrlParam
  4. new pattern.number/nextIndex
  5. deprecated getScrollPosition
  6. fix types

2023.08.10 v5.5.0

  1. new preloader escape unescape randomColor isDarkMode waiting function, see: preloader, escape, unescape, randomColor, isDarkMode, waiting

2023.08.05 v5.4.0

  1. new shuffle randomNumbers function, see: shuffle, randomNumbers
  2. Band new randomString function, see: randomString

2023.08.02 v5.3.2

  1. Optimize usage of getQueryParams getUrlParams
  2. upgrade all packages

2023.07.31 v5.3.1

  1. fix appVersion bug

2023.07.18 v5.3.0

  1. new spliceUrlParam function
  2. deprecated isDigitals
  3. fix types & bugs
  4. docs work

2023.07.17 v5.2.0

  1. new awaitTo fingerprint browserVersion function
  2. fix bugs of osVersion
  3. deprecated trim pattern getDirParam
  4. docs work

2023.07.07 v5.1.0

  1. add appVersion osVersion
  2. deprecated getOsVersion getAppVersion

2023.07.05 v5.0.0

  1. add copy getQueryParam getQueryParams getUrlParams function
  2. change the params of getUrlParam
  3. add isWindow function
  4. add isObject isArray function
  5. remove getRandomStrWidthSpecialChar
  6. remove getParameter
  7. remove getIsAppVersionLastest, use compareVersion instead
  8. searchTreeObject rename to searchObject
  9. getRandomNum rename to randomNumber
  10. getRandomStr rename to randomString
  11. upgrade all packages

2023.06.14 v4.7.0

  1. add compareVersion API Docs
  2. upgrade all packages

2023.06.06 v4.6.0

  1. drop textareaInsertText & textareaMoveToEnd, If you still need to use it, we using grace-textarea

2023.06.05 v4.5.0

  1. add inBrowser API Docs
  2. some translate work
  3. upgrade all packages

2023.05.31 v4.4.1

  1. fix esm module

2023.05.23 v4.4.0

  1. fix outputs
  2. fix exports

2023.05.22 v4.3.0

  1. fix export default
  2. fix types
  3. upgrade all packages

2023.05.21 v4.2.0

  1. use use-downloads
  2. some translate work

2023.05.20 v4.1.0

  1. use load-source mount-css mount-image mount-script mount-style
  2. some translate work

2023.05.18 v4.0.0

  1. split csv into arrayToCSV CSVToArray CSVToJSON JSONToCSV
  2. split cache into setCache getCache delCache
  3. split sessioninto setSession getSession delSession
  4. split cookie into setCookie getCookie delCookie
  5. drop tslib package
  6. new build scripts & output

2023.04.07 v3.1.0

  1. Optimize build output by removing tslib from the package

2023.04.06 v3.0.0

  1. remove imgAdapt imgChoose throttle debounce enWxJumpLink enWxJumpLinkOld deWxJumpLink deWxJumpLinkOld clearHtmlExpSN clearHtmlN clearHtmlNS clearHtmlTag formatTime formatTimeStr getFileType clearBr
  2. move arrayToCSV CSVToArray CSVToJSON JSONToCSV to csv
  3. move setCache getCache delCache to cache
  4. move setSession getSession delSession to session
  5. move setCookie getCookie delCookie to cookie
  6. add isPlainObject function
  7. support const addEvent = require('js-cool/addEvent') This introduction method
  8. build product differentiate between esnext and es5, default output esnext
  9. splitThousand => toThousands
  10. getWindowSize => windowSize
  11. new extend function

2022.12.13 v2.8.0

  1. loadSource mountCss mountImg mountJs mountStyle new support for passing in custom properties, adjusting the input form, and improving the ts type, fixing IE compatibility issues
  2. dependency package upgrade

2022.12.07 v2.7.1

Extend the types supported by getType method.

2022.12.04 v2.7.0

  1. add setProperty method
  2. fix getProperty bug

2022.12.04 v2.6.0

  1. add loadSource mountCss mountImg mountJs mountStyle 5 methods
  2. upgrade the dependency package

2022.09.10 v2.5.0

  1. adjust exports export method, focus on supporting node esm mode
  2. optimize build scripts
  3. upgrade dependency packages

2022.08.23 v2.4.0

  1. upgrade dependency packages
  2. optimize the build process

2022.03.12 v2.3.2

  1. upgrade dependency packages
  2. optimize the documentation

2022.02.25 v2.3.1

  1. fix tslib package issue

2021.11.11 v2.3.0

  1. export module to keep default
  2. upgrade dependency package

2021.10.23 v2.2.4

  1. add getProperty method

2021.10.19 v2.2.3

  1. improve fillIPv6 method

2021.10.18 v2.2.2

  1. add fillIPv6 method

2021.10.15 v2.2.1

  1. add methods to find the intersection, concatenation, difference and complement of multiple arrays
  2. add contains method
  3. add a unique method for de-duplication

2021.09.21 v2.1.3

  1. build output banner

2021.09.10 v2.1.2

  1. improve typescript types
  2. upgrade dependency package

2021.09.02 v2.1.1

  1. refine typescript types

2021.08.29 v2.1.0

  1. add build es module

2021.08.28 v2.0.1

  1. fix several issues
  2. optimize code, optimize documentation

2021.08.26 v2.0.0

  1. refactor all the code to typescript
  2. rewrite method comments according to tsdoc specification

2021.07.26 v1.1.0

  1. use webpack to build umd package

2021.03.03 v1.0.9

  1. add all/any/RGBToHex/uuid methods
  2. add CSV to object conversion methods: arrayToCSV/CSVToArray/CSVToJSON/JSONtoCSV

2021.03.02 v1.0.8

  1. add splitThousand method

2021.03.01 v1.0.7

  1. fix nextIndex bug

2021.02.18 v1.0.6

  1. add openUrl method

2021.02.18 v1.0.5

  1. add download/searchTreeObject method

2021.02.08 v1.0.4

  1. update getCookie/setCookie methods

2021.02.01 v1.0.3

  1. handle bugs

2021.01.23 v1.0.2

  1. add nextIndex,fixNumber,delay,extend,getType,isArray,cleanData,getCache,setCache,delCache
  2. delete getLocal,setLocal,delLocal

2020.12.14 v1.0.1

  1. create project