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

jstuff

v1.1.0

Published

some useful stuff javascript is missing

Downloads

1

Readme

Jstuff

Javascript is missing a lot, so I made this.

Use in Node.js

npm install jstuff

Then, require the whole package:

    const jstuff = require('jstuff')

Or pick specific sections:

    const jstuff = require('jstuff/math')

Or even just use specific methods:

    const { log } = require('jstuff/math')

Use in javascript

Source the main script:

<script src='unpkg.com/jstuff/jstuff.js'></script>

Or pick specific sections:

<script src='unpkg.com/jstuff/math.js'></script>

Docs generated with jsdoc2md.

API

Array functions

riffle(...args) ⇒ Array

Riffle shuffle two or more arrays

Kind: global function
Returns: Array - Shuffled array

| Param | Type | Description | | --- | --- | --- | | ...args | Array | Arrays to be shuffled |

max(array) ⇒ num

Largest number in array

Kind: global function
Returns: num - Max of array

| Param | Type | Description | | --- | --- | --- | | array | Array | Array to find max of |

min(array) ⇒ num

Smallest number in array

Kind: global function
Returns: num - Min of array

| Param | Type | Description | | --- | --- | --- | | array | Array | Array to find min of |

mean(array) ⇒ num

Average of array

Kind: global function
Returns: num - Mean of array

| Param | Type | Description | | --- | --- | --- | | array | Array | Array to find mean of |

order(array) ⇒ Array

Sorts numerical array

Kind: global function
Returns: Array - sorted array

| Param | Type | Description | | --- | --- | --- | | array | Array | Array to sort |

median(array) ⇒ num

Median of numerical array

Kind: global function
Returns: num - Median of array

| Param | Type | Description | | --- | --- | --- | | array | Array | Array to find median of |

mode(array) ⇒ string | number

Most common value (string/number) in array

Kind: global function
Returns: string | number - Most common value

| Param | Type | Description | | --- | --- | --- | | array | Array | Array to find mode of |

unique(array) ⇒ Array

Remove duplicate values

Kind: global function
Returns: Array - Array with no duplicates

| Param | Type | Description | | --- | --- | --- | | array | Array | Input array |

rlencode(array) ⇒ string

Run length encodes an array into a string

Kind: global function
Returns: string - Run length encoded string

| Param | Type | Description | | --- | --- | --- | | array | Array | Array to encode (string only) |

range(array) ⇒ number

Finds the range of an array

Kind: global function

| Param | Type | | --- | --- | | array | Array |

String functions

log(num, base) ⇒ number

Take the logarithm, with a certain base, of a certain number

Kind: global function
Returns: number - Logarithm of num, base base.

| Param | Type | Description | | --- | --- | --- | | num | number | Number to take log of | | base | number | Base of log |

parseBigInt(str, radix) ⇒ BigInt

Parse a string into a bigint

Kind: global function
Returns: BigInt - Resulting bigint

| Param | Type | Description | | --- | --- | --- | | str | string | String to parse | | radix | number | Radix to parse by |

factorial(num) ⇒ number | BigInt

Takes the factorial of a number or bigint. Returns bigint if bigint is inputted, otherwise number

Kind: global function
Returns: number | BigInt - Factorial of number

| Param | Type | Description | | --- | --- | --- | | num | number | BigInt | Number to take factorial of |

random(min, max, step) ⇒ number

Generate a random number between two numbers.

Kind: global function
Returns: number - Random number

| Param | Type | Description | | --- | --- | --- | | min | number | Lower bound of number. Inclusive. | | max | number | Upper bound of number. Exclusive. | | step | number | Difference between possible numbers. |

Functions

log(num, base) ⇒ number

Take the logarithm, with a certain base, of a certain number

Kind: global function
Returns: number - Logarithm of num, base base.

| Param | Type | Description | | --- | --- | --- | | num | number | Number to take log of | | base | number | Base of log |

parseBigInt(str, radix) ⇒ BigInt

Parse a string into a bigint

Kind: global function
Returns: BigInt - Resulting bigint

| Param | Type | Description | | --- | --- | --- | | str | string | String to parse | | radix | number | Radix to parse by |

factorial(num) ⇒ number | BigInt

Takes the factorial of a number or bigint. Returns bigint if bigint is inputted, otherwise number

Kind: global function
Returns: number | BigInt - Factorial of number

| Param | Type | Description | | --- | --- | --- | | num | number | BigInt | Number to take factorial of |

random(min, max, step) ⇒ number

Generate a random number between two numbers.

Kind: global function
Returns: number - Random number

| Param | Type | Description | | --- | --- | --- | | min | number | Lower bound of number. Inclusive. | | max | number | Upper bound of number. Exclusive. | | step | number | Difference between possible numbers. |

bkeith@Bs-MacBook-Air useful % jsdoc2md string.js

String functions

reverse(str) ⇒ string

Reverses a string

Kind: global function
Returns: string - Reversed string

| Param | Type | Description | | --- | --- | --- | | str | string | String to reverse |

chunk(str, num) ⇒ Array

Split a string into chunks

Kind: global function
Returns: Array - Array of chunks

| Param | Type | Description | | --- | --- | --- | | str | string | String to split | | num | number | Length of each chunk |

rot(str, num) ⇒

Rotate a string's alphabet characters.

Kind: global function
Returns: String with alphabet characters rotated by given number

| Param | Type | Description | | --- | --- | --- | | str | string | String to rotate | | num | number | Num to rotate by, default is 13 |

rldecode(str) ⇒ Array

Run length decodes a string

Kind: global function
Returns: Array - Array of values

| Param | Type | Description | | --- | --- | --- | | str | string | String to decode |

changeCase(string, to) ⇒

Convert a string from one case to another. Options: camelCase, PascalCase, kebab-case, SCREAMING-KEBAB-CASE, snake_case, SCREAMING_SNAKE_CASE

Kind: global function
Returns: String changed to different case

| Param | Type | Description | | --- | --- | --- | | string | string | String to change case | | to | string | Case to change. options: 'camel', 'pascal', 'kebab', 'screamkebab', 'snake', 'screamsnake' |