js-assist
TypeScript icon, indicating that this package has built-in type declarations

1.0.14 • Public • Published

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.

para type description
min number min value of the given range
max number max value of the given range

isNumber(str)

Judge whether a string is number.

para type description
str string given string

floor(input, num)

Floor to decimal with specific length

para type description
input number input number
num number Number of decimal places to keep

round(input, num)

Rounded to decimal with specific length

para type description
input number input number
num number Number of decimal places to keep

ceil(input, num)

Ceil to decimal with specific length

para type description
input number input number
num number Number of decimal places to keep

String Utils


firstLetterUppercase(str)

Capitalize the first letter of the given string.

para type description
str string input string

toHyphen(str)

Camel to hyphen.

para type description
str string input string

Array Utils


shuffle(arr)

Shuffle an array.

para type description
arr Array input array

randSeries(count)

Generate a series of numbers without repetition.

para type description
count number length of the target array

removeRept(arr)

Remove repetition in the array.

para type description
arr Array input array

sameArrays(arr1, arr2)

Judge whether two arrays are identical.

para type description
arr1 Array input array
arr2 Array input array

sameSets(set1, set2)

Judge whether two sets are identical.

para type description
set1 Set input set
set2 Set input set

isChild(targetArr, inputArr)

Check whether inputArr is an item in targetArr.

para type description
targetArr Array target array
inputArr Array input array

arrayContained(arr1, arr2)

Whether arr1 contains arr2.

para type description
arr1 Array input array
arr2 Array input array

excludeArray(arr1, arr2)

Remove arr2 from arr1.

para type description
arr1 Array input array
arr2 Array input array

containObj(objArr, obj)

Check whether an array contains an object.

para type description
objArr Array<{ [key: string]: any }> input array
obj { [key: string]: any } input object

Map Utils


sameMaps(map1, map2)

Check whether two maps are same.

para type description
map1 Map input map
map2 Map input map

Object Utils


isEmptyObj(obj)

Check whether an object is empty.

para type description
obj any input object

deepClone(obj)

Deep clone.

para type description
obj any input object

getType(var)

Get type of the input variable.

para type description
var any input variable

Color Utils


hexToRgb(hex)

Hex to rgb.

para type description
hex string color in hex string

rgbToHex(rgb)

Rgb to hex.

para type description
rgb string color in rgb string

Spacial Utils

Time Utils

SVG Utils

Readme

Keywords

none

Package Sidebar

Install

npm i js-assist

Weekly Downloads

1

Version

1.0.14

License

ISC

Unpacked Size

41.4 kB

Total Files

32

Last publish

Collaborators

  • tge