npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-assist

v1.0.14

Published

A modern JavaScript utility library.

Downloads

8

Readme

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