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

ffg-utils

v1.0.1

Published

Simple utilities for speedy coding.

Downloads

3

Readme

input()

Gets input from the user

| type | name | description | | ------ | -------- | -------------------------------- | | string | question | Statement in front of the cursor |

Example

const {input} = require("ffg-utils");
input("How was your day? ").then(ans => { /* Stuff to do */ });

random()

Returns a random number between two values

| type | name | description | | ------ | -------- | ------------------------------------ | | Number | minimum | Minimum number of random (inclusive) | | Number | maximum | Maximum number of random (exclusive) |

Example

// Random number between 10 and 20
const {random} = require("ffg-utils");
var _num = random(10, 20);

choose()

Chooses a random value from arguments

| type | name | description | | -------- | -------- | ------------------------------------ | | anything | args... | Minimum number of random (inclusive) |

Example

// Chooses from arguments
const {choose} = require("ffg-utils");
var _foo = choose("Hello", "World", "!");

Grid

Grid object

Methods

| name | arguments | description | | ------------- | ---------------- | ---------------------------------------------------------- | | constructor | w, h, defaultval | Width, height and default value of all grid cells | | entry | x, y | Returns entry at grid (x, y) position | | value | x, y, ?val | Returns value at grid (x, y) position, value sets position | | swap | x1, y1, x2, y2 | Swaps two grid cells | | move | x, y, xinc, yinc | Increases given cell position by xinc and yinc |

Static methods

| name | arguments | description | | ------- | ----------------------- | ----------------------------------------------------------- | | fetch | index | Returns Grid from Grid.GRIDS at index | | entry | index, x, y | Returns entry at grid (x, y) position | | value | index, x, y, ?val | Returns value at grid (x, y) position, value sets position | | swap | index, x1, y1, x2, y2 | Swaps two grid cells | | move | index, x, y, xinc, yinc | Increases given cell position by xinc and yinc | | release | index | Sets the grid at index in Grid.GRIDS to null |

Variables

| type | name | description | | -------- | -------- | ------------------------------- | | Number | width | Width of grid | | Number | height | Height of grid | | Object | entries | Array of all grid cells | | Number | id | Index of the grid in Grid.GRIDS |

Static variables

| type | name | description | | -------- | ------ | ------------------------- | | Number | COUNT | Next index of Grid.GRIDS | | Object | GRIDS | Array of all Grids | | Number | SIZE | Length of Grid.GRIDS |

Example

// Create a 3x3 grid with default value 'apple'
const {Grid} = require("ffg-utils");
var _grid = new Grid(3, 3, "apple");

Vector

Vector object

Methods

| name | arguments | description | | ------------- | ---------------- | -------------------------------------- | | constructor | ?x, ?y, ?z | Creates a vector of x, y, and z (all optional, 0 by default) | | add | a | Adds a Number or Vector to this | | sub | a | Subtracts a Number or Vector from this | | mult | a | Multiplies a Number or Vector by this | | div | a | Divides this by a Number or Vector |

Static methods

| name | arguments | description | | ------ | --------- | ------------------------------------- | | fetch | index | Returns Vector from Vector.VECTORS at index | | release | index | Sets Vector.VECTORS at index to null | | add | index, a | Adds a Number or Vector to index at Vector.VECTORS | | sub | index, a | Subtracts a Number or Vector from index at Vector.VECTORS | | mult | index, a | Multiplies a Number or Vector by index at Vector.VECTORS | | div | index, a | Divides index at Vector.VECTORS by a Number or Vector |

Variables

| type | name | description | | -------- | -------- | ----------------------- | | Number | x | Value of x | | Number | y | Value of y | | Number | z | Value of z |

Static variables

| type | name | description | | -------- | -------- | ----------------------- | | Number | COUNT | Next index of Vector.VECTORS | | Object | VECTORS | Array of all Vectos | | Number | SIZE | Length of Vector.VECTORS |

Example

// Create a vector of (3, 5, 0)
const {Vector} = require("ffg-utils");
var _vec2 = new Vector(3, 5);