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 🙏

© 2025 – Pkg Stats / Ryan Hefner

wtc-utility-helpers

v4.0.2

Published

Javascript helpers, perfect for non-jquery projects.

Readme

Functions

floatRandomBetween(min, max) ⇒ number

Kind: global function
Returns: number - Random number.

| Param | Type | Description | | --- | --- | --- | | min | number | Minimum value. | | max | number | Maximum value. |

randomBetween(min, max) ⇒ number

Kind: global function
Returns: number - Random number.

| Param | Type | Description | | --- | --- | --- | | min | number | Minimum value. | | max | number | Maximum value. |

lerp(x, y, amount) ⇒ number

Kind: global function
Returns: number - The interpolated value

| Param | Type | Description | | --- | --- | --- | | x | number | The lower value | | y | number | The upper value | | amount | number | the amount to interpolate. The expected value is a unit interval (a float between 0 and 1), but this will work with higher and lower values as well. |

clampfunction(min, max, value) ⇒ number

Kind: global function
Returns: number - A number in the range [min, max]

| Param | Type | Description | | --- | --- | --- | | min | number | The lower bound | | max | number | The upper bound | | value | number | The value to clamp. |

shuffleArray(array, [modifyOriginal]) ⇒ array

Kind: global function
Returns: array - Shuffled array.

| Param | Type | Description | | --- | --- | --- | | array | Array | Arrray to be shuffled. | | [modifyOriginal] | Boolean | A boolean indicating whether the original array should be modified or whether a copy should be created. (default True) |

fireCustomEvent(name, data, [bubbles], [cancelable])

Kind: global function

| Param | Type | Description | | --- | --- | --- | | name | string | Name of the event. | | data | object | Object to be passed to the event. | | [bubbles] | Boolean | Indicates whether the event bubbles (default True) | | [cancelable] | Boolean | Indicates whether the event is cancellable default True) |

getElementPosition(element, [toWorld]) ⇒ Object

Kind: global function
Returns: Object - the element coordinates.

| Param | Type | Description | | --- | --- | --- | | element | DOMNode | Element. | | [toWorld] | Boolean | indicates whether the calculation of the element offset should be to the page or to the offset parent. (default True) |

isChildOf(element, parentElement, [toWorld]) ⇒ Boolean

Kind: global function
Returns: Boolean - true is the parentElement is parent (or ancestor) to Element

| Param | Type | Description | | --- | --- | --- | | element | DomNode | The element to test with | | parentElement | DomNode | The parent element to test against | | [toWorld] | Boolean | Whether to test this up the DOM hierarchy |

getSiblings(e) ⇒

Kind: global function
Returns: Returns a list with the element's siblings.

| Param | Type | Description | | --- | --- | --- | | e | DOMElement | Element |

getAncestors(e, [toBody], [ancestors])

Kind: global function

| Param | Type | Description | | --- | --- | --- | | e | DOMElement | The element to retrieve the ancestors for | | [toBody] | boolean | whether to only test to the body (default True) | | [ancestors] | array | the list of already existing elements to pass. This is nromally only used internally |

getSelectorForElement(el) ⇒ String

Kind: global function
Returns: String - The CSS selector the describes exactly where to find the element

| Param | Type | Description | | --- | --- | --- | | el | DOMElement | The DOM node to find a selector for |

fixWidows()

Kind: global function

serializeArray(form) ⇒ Array

Kind: global function
Returns: Array - Serialized data

| Param | Type | Description | | --- | --- | --- | | form | DOMElement | The DOM node |

asyncImageLoadfunction(props) ⇒ Promise

Kind: global function
Returns: Promise - A promise

| Param | Type | Description | | --- | --- | --- | | props | Object | Image properties | | props.src | String | The image SRC |

floatRandomBetween(min, max) ⇒ number

Kind: global function
Returns: number - Random number.

| Param | Type | Description | | --- | --- | --- | | min | number | Minimum value. | | max | number | Maximum value. |

randomBetween(min, max) ⇒ number

Kind: global function
Returns: number - Random number.

| Param | Type | Description | | --- | --- | --- | | min | number | Minimum value. | | max | number | Maximum value. |

lerp(x, y, amount) ⇒ number

Kind: global function
Returns: number - The interpolated value

| Param | Type | Description | | --- | --- | --- | | x | number | The lower value | | y | number | The upper value | | amount | number | the amount to interpolate. The expected value is a unit interval (a float between 0 and 1), but this will work with higher and lower values as well. |

clampfunction(min, max, value) ⇒ number

Kind: global function
Returns: number - A number in the range [min, max]

| Param | Type | Description | | --- | --- | --- | | min | number | The lower bound | | max | number | The upper bound | | value | number | The value to clamp. |

shuffleArray(array, [modifyOriginal]) ⇒ array

Kind: global function
Returns: array - Shuffled array.

| Param | Type | Description | | --- | --- | --- | | array | Array | Arrray to be shuffled. | | [modifyOriginal] | Boolean | A boolean indicating whether the original array should be modified or whether a copy should be created. (default True) |

fireCustomEvent(name, data, [bubbles], [cancelable])

Kind: global function

| Param | Type | Description | | --- | --- | --- | | name | string | Name of the event. | | data | object | Object to be passed to the event. | | [bubbles] | Boolean | Indicates whether the event bubbles (default True) | | [cancelable] | Boolean | Indicates whether the event is cancellable default True) |

getElementPosition(element, [toWorld]) ⇒ Object

Kind: global function
Returns: Object - the element coordinates.

| Param | Type | Description | | --- | --- | --- | | element | DOMNode | Element. | | [toWorld] | Boolean | indicates whether the calculation of the element offset should be to the page or to the offset parent. (default True) |

isChildOf(element, parentElement, [toWorld]) ⇒ Boolean

Kind: global function
Returns: Boolean - true is the parentElement is parent (or ancestor) to Element

| Param | Type | Description | | --- | --- | --- | | element | DomNode | The element to test with | | parentElement | DomNode | The parent element to test against | | [toWorld] | Boolean | Whether to test this up the DOM hierarchy |

getSiblings(e) ⇒

Kind: global function
Returns: Returns a list with the element's siblings.

| Param | Type | Description | | --- | --- | --- | | e | DOMElement | Element |

getAncestors(e, [toBody], [ancestors])

Kind: global function

| Param | Type | Description | | --- | --- | --- | | e | DOMElement | The element to retrieve the ancestors for | | [toBody] | boolean | whether to only test to the body (default True) | | [ancestors] | array | the list of already existing elements to pass. This is nromally only used internally |

getSelectorForElement(el) ⇒ String

Kind: global function
Returns: String - The CSS selector the describes exactly where to find the element

| Param | Type | Description | | --- | --- | --- | | el | DOMElement | The DOM node to find a selector for |

fixWidows()

Kind: global function

serializeArray(form) ⇒ Array

Kind: global function
Returns: Array - Serialized data

| Param | Type | Description | | --- | --- | --- | | form | DOMElement | The DOM node |

asyncImageLoadfunction(props) ⇒ Promise

Kind: global function
Returns: Promise - A promise

| Param | Type | Description | | --- | --- | --- | | props | Object | Image properties | | props.src | String | The image SRC |