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

cjs-booster

v1.0.1

Published

This package will takes your Common JS projects to the next level. Discover lot of methods to do things easily.

Downloads

11

Readme

CJS Booster

This package will take your CJS Javascript projects to the next level. Discover lot of methods to do things easily.

Methods list

allTrue(array)

allTrue() checks if all elements of an array are truthy. If so, it will return true. othewise, false.

anyTrue(array)

allTrue() checks if at least one element of an array is truthy. If so, it will return true. othewise, false.

capitalize(string)

capitalize() returns a string where each word has an initial capitalized letter.

getFormat(mimetype:string)

getFormat() returns the file format related to the mimtype.

isDigit(string)

isDigit() checks if the string contains only digits.

isEmpty(array or object)

isEmpty() checks if an array is empty or an object has no property.

isNull(any types)

isNull() checks if the parameter is truthy or falsy.

isObject(any types)

isObject() checks if the parameter is an object or not.

mapFor(array, prop:string)

mapFor() returns an array containing only the properties in the second parameter. The second parameter can take several properties, separated by a space. This function works only with objects' array.

maxValue(array, prop:string)

maxValue() returns the array's element with the higher value (or the object with the higher prop's value).

minValue(array, prop:string)

minValue() returns the array's element with the lower value (or the object with the lower prop's value).

randomInd(array)

randomInd() returns a random element from the array.

range(integer)

range() returns an array with a number of indexes equivalent to the integer.

reduceFor(array, prop:string, init:number)

reduceFor() returns the accumulated sum of all elements in the array. If the array contains objects, the parameter "prop" is needed to targed the object property. A third parameter "init" can be defined.

shuffle(array)

shuffle() returns an array where all element has changed index.

sortAsc(array, prop:string)

sortAsc() returns an array sorted in ascending order. If the array contains object, the parameter "prop" is needed to target the object property.

sortDesc(array, prop:string)

sortAsc() returns an array sorted in descending order. If the array contains object, the parameter "prop" is needed to target the object property.

splitLines(string, lines:number)

splitLines() splits a string into the number of line defined in the second parameter. The lines are push into an array before being returned.

title(string)

title() returns every word from the string with an initial capitalized letter.

toArray(object)

toArray() takes an object in parameter and returns an array, with all properties as elements.

toBool(string)

toBool() transforms a "true" string or a "false" string into a boolean true or a boolean false.

toObject(array)

toObject() takes an object in parameter and returns an object, with all elements as values and the indexes as properties.

toSlug(string, withTimestamps:booolean)

toSlug() tranforms a string into a slug.

typeOf(any data)

typeOf() return the type of the data in parameters (array, object, float, integer, string, boolean).

<<<<<<< HEAD

uid()

=======

uid()

12b5e7094ad1eef2333fe10f0412f4b9bf6314c9 uid() return a random id based on the timestamp.