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

wetbox

v0.3.5

Published

A collection of prototype tools

Downloads

24

Readme

alt text

Setup

npm install wetbox
let WET = require( 'wetbox' )

Functions

getVersion()
Returns the current in-use version of the library

getUrl( url, callback )
Fetches an external API url (typically json) and performs callback( status, response ) when loaded.
Status being a nubmer (ie 400), and response being the data.

zeros( n )
Returns an array of zeros of lenth n

sequence( n )
Returns an array of numbers from 0 .. n-1

randInt( n )
Returns a random int from 0 .. n-1

clearEmptyElements( array )
Remove all zero and falsy values from an array

randomizeArray( array )
Returns array with random-ordered elements using the Fisher-Yates-Knuth shuffle.

leftPad( str, len, fillerChar )
Pads a string up to length len, with single-char: fillerChar (defaults to space character)

toRadians( x )
Convert x degrees to radians

toDegrees( x )
Convert x radians to degrees

hasDuplicates( n ) Returns true if array contains duplicates

choose( n, k ) The mathematical choose function. One-indexed

ithIteration( n, k, i ) Alias for ithCombination( n, k, i )

inverseIthIteration( n, combinationArray ) Alias for inverseIthCombination( n, combinationArray )

ithCombination( n, k, i ) Given a set of n items, k choices, and an index i, give me a k-sized array of the ith combination. 0 <= i < n.

inverseIthCombination( n, combinationArray ) Given a number n and combinationArray, convert the array into an ith ordering. k is infered from combinationArrays length.

Classes

new WET.game( THREE, gameTitle )
Given a three.js library let THREE = require( 'three' ), initialize a basic game environment using threejs. ie in index.js

WET = require( 'wetbox' )
THREE = require( 'three' )
game = new WET.Game( THREE, 'Wizzy boi' )

Window ~~lickers~~ listeners

keyListen( isEnable, up, left, down, right, crouch, space, esc, tab, enter )
Adds some keyboard listeners to the page for typical game commands. All input params are callback functions, first 5 are mandatory.

WET.keyListen( 
  enabled => { return true },
  up      => { console.log( 'up' ) },
  left    => { console.log( 'left' ) },
  down    => { console.log( 'down' ) },
  right   => { console.log( 'right' ) },
  crouch  => { console.log( 'crouch' ) },
  space   => { console.log( 'space' ) },
  esc     => { console.log( 'esc' ) },
  tab     => { console.log( 'tab' ) },
  enter   => { console.log( 'enter' ) },
)

keyUpListen( up, left, down, right, crouch )
Adds key-release listeners for switch-keys, all args are callbacks and always enabled.

WET.keyUpListen(
  releaseUp     => { console.log( 'release up' ) },
  releaseLeft   => { console.log( 'release left' ) },
  releaseDown   => { console.log( 'release down' ) },
  releaseRight  => { console.log( 'release right' ) },
  releaseCrouch => { console.log( 'release crouch' ) },
)

Administration

Updating npm publish --dry-run npm publish