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

@pangenerator/utils

v3.0.0

Published

A collection of functions and classes for creative coding and interactive projects

Downloads

55

Readme

Version Tests

Modules

Constants

Typedefs

PID

PID controller


piD.set(P, I, D)

Set PID gains

Kind: instance method of PID
Params

  • P number = 0 - Proportional Gain
  • I number = 0 - Integral Gain
  • D number = 0 - Derivative Gain

piD.update(current, target) ⇒ number

Update PID controller

Kind: instance method of PID
Returns: number - Output value
Params

  • current number - Current value
  • target number - Target value

copyArray ⇒ Array

Copy array

Kind: global constant
Returns: Array - copy of the array
Params

  • source Array - source array

shuffleArray ⇒ Array

Shuffle array

Kind: global constant
Returns: Array - shuffled array copy
Params

  • source Array - source array

filterUnique ⇒ Array

Filter array unique

Kind: global constant
Returns: Array - array with unique elements only
Params

  • source Array - source array

fuzzySearch ⇒ Array

Fuzzy search element in list

Kind: global constant
Returns: Array - elements matching search value
Params

  • list Array - Array of terms
  • searchValue String - search value to find

contains ⇒ boolean

Check if array contains

Kind: global constant
Returns: boolean - - true when element is in array
Params

  • elem any - element to find in array
  • arr Array - array to look in

lerpColor ⇒ String

Linear color interpolation

Kind: global constant
Returns: String - Interpolated color
Params

  • a String - First color
  • b String - Second color
  • amt Number - amount to interpolate

getQuarter ⇒ Array

Get quarter from date

Kind: global constant
Returns: Array - year and quarter (1-4)
Params

  • d Date - Date to get quarter from

quarterExtent ⇒ Array

Get quarter extent

Kind: global constant
Returns: Array - start and end date of quarter
Params

  • quarter Number - quarter (1-4)
  • year Number - full year

datesBetween ⇒ Array

Get all dates between two dates

Kind: global constant
Returns: Array - all dates between start and end
Params

  • start Date - start date
  • end Date - end date

lerp3 ⇒ Point

Linear interpolation in 3D

Kind: global constant
Returns: Point - Interpolated point
Params

  • A Point - First point
  • B Point - Second point
  • amt Number - amount to interpolate

lerpStops ⇒ Array.<Point>

Linear interpolation in 3D array

Kind: global constant
Returns: Array.<Point> - Interpolated points
Params

  • A Point - First point
  • B Point - Second point
  • count Number - Point count

dist ⇒ Number

Distance between two points (2D and 3D)

Kind: global constant
Returns: Number - distance between the points
Params


intersectLines ⇒ Point | Boolean

Find intersection point between two lines

Kind: global constant
Returns: Point | Boolean - intersection or false (if no intersection)
Params

  • p1 Point - first point of first line
  • p2 Point - second point of first line
  • p3 Point - first point of second line
  • p4 Point - second point of second line

intersectCircles ⇒ Array | Boolean

Find intersection points between two circles

Kind: global constant
Returns: Array | Boolean - intersection or false (if no intersection)
Params


polarToCartesian ⇒ Point

Convert coordinates from polar to cartesian

Kind: global constant
Returns: Point - cartesian coordinates
Params

  • r Number - radius
  • angle Number - angle

cartesianToPolar ⇒ Object

Convert coordinates from cartesian to polar

Kind: global constant
Returns: Object - polar coordinates
Params

  • P Point - cartesian coordinates

dist2 ⇒ Number

Distance between two points (2D and 3D) squared

Kind: global constant
Returns: Number - squared distance between the points
Params


distToSegment2 ⇒ Number

Distance between point and segment squared

Kind: global constant
Returns: Number - squared distance between the point and the segment
Params


distToSegment ⇒ Number

Distance between point and segment

Kind: global constant
Returns: Number - distance between the point and the segment
Params


map ⇒ Number

Map a number from one range to another

Kind: global constant
Returns: Number - Mapped number
Params

  • value Number - Number to map
  • low1 Number - Source range lower bound
  • high1 Number - Source range upper bound
  • low2 Number - Target range lower bound
  • high2 Number - Target range upper bound

clamp ⇒ Number

Clamp a number to range

Kind: global constant
Returns: Number - Clamped number
Params

  • value Number - Number to clamp
  • min Number - Range lower bound
  • max Number - Range upper bound

norm ⇒ Number

Normalize a number

Kind: global constant
Returns: Number - normalized number (0.0 - 1.0)
Params

  • value Number - value to normalize
  • start Number - Source range lower bound
  • stop Number - Source range upper bound

lerp ⇒ Number

Linear interpolation

Kind: global constant
Returns: Number - Interpolated value
Params

  • start Number - First value
  • stop Number - Second value
  • amt Number - amount to interpolate

square ⇒ Number

Square

Kind: global constant
Returns: Number - squared number
Params

  • a Number - Number to square

degrees ⇒ Number

Convert angle in radians to degrees

Kind: global constant
Returns: Number - angle in degrees
Params

  • radians Number - angle in radians

radians ⇒ Number

Convert angle in degrees to radians

Kind: global constant
Returns: Number - angle in radians
Params

  • degrees Number - angle in degrees

precision ⇒ Number

Round number to precision

Kind: global constant
Returns: Number - rounded number
Params

  • value Number - value to round
  • precision Number - decimal places

shallowCopyExcluding ⇒ Object

Copy object excluding property

Kind: global constant
Returns: Object - - copied object
Params

  • obj Object - Object to copy
  • prop string - property name

random ⇒ Number

Generate random number from range

Kind: global constant
Returns: Number - Random number
Params

  • [low] Number - Range lower bound
  • high Number - Range upper bound

randomDir ⇒ Number

Generate random direction (-1 or 1)

Kind: global constant
Returns: Number - Random direction


randomIndex ⇒ Number

Generate random index

Kind: global constant
Returns: Number - random index
Params

  • N Number - max index

randomName ⇒ String

Generate random name

Kind: global constant
Returns: String - random name
Params

  • N Number - length of the name

timestampName ⇒ String

Generate timestamp name

Kind: global constant
Returns: String - timestamp name


removeDiacritics ⇒ String

Remove polish diacritics

Kind: global constant
Returns: String - string without diacritics
Params

  • str String - string with diacritics

removeNonAlphaNumeric ⇒ String

Remove all non alphanumeric characters

Kind: global constant
Returns: String - string without non alphanumeric characters
Params

  • str String - string with non alphanumeric characters

splitChunks ⇒ Array

Split string to N sized chunks

Kind: global constant
Returns: Array - array of string chunks
Params

  • str String - string to split
  • n Number - chunk length
  • discard Boolean - discard chunks shorter than N

sepCase ⇒ string

Convert string to custom separator case

Kind: global constant
Returns: string - custom cased string
Params

  • str string - string to convert

snakeCase ⇒ string

Convert string to snake case

Kind: global constant
Returns: string - snake cased string
Params

  • str string - string to convert

kebabCase ⇒ string

Convert string to kebab case

Kind: global constant
Returns: string - kebab cased string
Params

  • str string - string to convert

camelCase ⇒ string

Convert string to camel case

Kind: global constant
Returns: string - camel cased string
Params

  • str string - string to convert

Point : Object

Kind: global typedef
Properties

  • x Number - x coordinate
  • y Number - y coordinate
  • z Number - z coordinate

Circle : Object

Kind: global typedef
Properties

  • x Number - x coordinate of the center point
  • y Number - y coordinate of the center point
  • r Number - radius

panGenerator 2024