1.0.14 • Published 4 years ago

js-assist v1.0.14

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Js-Assist

A modern JavaScript utility library.

Installation

Using npm

$ npm i --save lodash

Methods

Number Utils


randNum(min, max)

Generate random number in a certain range.

paratypedescription
minnumbermin value of the given range
maxnumbermax value of the given range

isNumber(str)

Judge whether a string is number.

paratypedescription
strstringgiven string

floor(input, num)

Floor to decimal with specific length

paratypedescription
inputnumberinput number
numnumberNumber of decimal places to keep

round(input, num)

Rounded to decimal with specific length

paratypedescription
inputnumberinput number
numnumberNumber of decimal places to keep

ceil(input, num)

Ceil to decimal with specific length

paratypedescription
inputnumberinput number
numnumberNumber of decimal places to keep

String Utils


firstLetterUppercase(str)

Capitalize the first letter of the given string.

paratypedescription
strstringinput string

toHyphen(str)

Camel to hyphen.

paratypedescription
strstringinput string

Array Utils


shuffle(arr)

Shuffle an array.

paratypedescription
arrArrayinput array

randSeries(count)

Generate a series of numbers without repetition.

paratypedescription
countnumberlength of the target array

removeRept(arr)

Remove repetition in the array.

paratypedescription
arrArrayinput array

sameArrays(arr1, arr2)

Judge whether two arrays are identical.

paratypedescription
arr1Arrayinput array
arr2Arrayinput array

sameSets(set1, set2)

Judge whether two sets are identical.

paratypedescription
set1Setinput set
set2Setinput set

isChild(targetArr, inputArr)

Check whether inputArr is an item in targetArr.

paratypedescription
targetArrArraytarget array
inputArrArrayinput array

arrayContained(arr1, arr2)

Whether arr1 contains arr2.

paratypedescription
arr1Arrayinput array
arr2Arrayinput array

excludeArray(arr1, arr2)

Remove arr2 from arr1.

paratypedescription
arr1Arrayinput array
arr2Arrayinput array

containObj(objArr, obj)

Check whether an array contains an object.

paratypedescription
objArrArray<{ key: string: any }>input array
obj{ key: string: any }input object

Map Utils


sameMaps(map1, map2)

Check whether two maps are same.

paratypedescription
map1Mapinput map
map2Mapinput map

Object Utils


isEmptyObj(obj)

Check whether an object is empty.

paratypedescription
objanyinput object

deepClone(obj)

Deep clone.

paratypedescription
objanyinput object

getType(var)

Get type of the input variable.

paratypedescription
varanyinput variable

Color Utils


hexToRgb(hex)

Hex to rgb.

paratypedescription
hexstringcolor in hex string

rgbToHex(rgb)

Rgb to hex.

paratypedescription
rgbstringcolor in rgb string

Spacial Utils

Time Utils

SVG Utils

1.0.14

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago