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 🙏

© 2026 – Pkg Stats / Ryan Hefner

util-funcs

v0.0.8

Published

Is a simple package with functions that can be useful to you!

Readme

Util-Funcs - is a simple package with functions that can be useful to you!

I will be adding functions that are useful to us for faster development constantly!


Instalation:

$ npm install util-funcs

$ yarn add util-funcs

Statements:

const utils = require("util-funcs");

Docs:

Strings, Numbers and Arrays manipulators/converters Methods:


Milisecond Converter Methods:


Methods Help:

Strings, Numbers and Arrays manipulators/converters Methods:

/*
All parameters are optional.
The default value for the {length} parameter is 10, the {type} parameter is 0, the {caseInsensitive} parameter is false, and the {capsLock} parameter is also false.
*/

utils.randomString();
//---> EXAMPLE RETURN: 'gtrulhgpcy'

utils.randomString(15);
//---> EXAMPLE RETURN: 'ygrabmdmxqancya'


/*
Define the type of string that will be returned by setting the parameter {type}.
*/

utils.randomString(15, 1);
//---> EXAMPLE RETURN: '488585235480207'

utils.randomString(15, 2);
//---> EXAMPLE RETURN: '77vygfta7znl9c3'

utils.randomString(15, 3);
//---> EXAMPLE RETURN: '@&9f5iu3,l$´h4w'

/*
Here is a list with the valid values ​​of the parameter {type}:
0 = Only Letters
1 = Only Numbers
2 = Alpha-Numeric
3 = Alpha-Numeric with special characters
*/


/*
If you want the string to contain uppercase and lowercase letters, set the parameter {caseInsensitive} to true, otherwise, set to false.
*/

utils.randomString(15, 2, true);
//---> EXAMPLE RETURN: '0MPhVKj4161umyI'

utils.randomString(15, 2, false);
//---> EXAMPLE RETURN: 'giejlqirg0c07j4'


/*
If you want all letters to be capital letters only, set the parameter {capsLock} to true, otherwise, set to false.
*/


utils.randomString(15, 2, false, true);
//---> EXAMPLE RETURN: '3GOXHUOGF891HMI'

utils.randomString(15, 2, false, false);
//---> EXAMPLE RETURN: 'ago347ca7oq9inf'

// With this function, you can return a random value with minimum and maximum.

utils.randomNumber(5, 20);
//---> EXAMPLE RETURN: 15.045860685796184

// If you do not want to return float numbers, set the parameter {float} to false.

utils.randomNumber(5, 20, false);
//---> EXAMPLE RETURN: 13

utils.randomNumber(5, 20, true);
//---> EXAMPLE RETURN: 19.529826353635208

// This function transforms a string into an array. It removes: Spaces, periods (.) and commas (,).

utils.toArray('hi');
//---> { content: [ 'hi' ], length: 1 }

utils.toArray('I am a frog, ribbet!');
//---> { content: [ 'I', 'am', 'a', 'frog', 'ribbet!' ], length: 5 }

// You can check if there are any characters in the string, see the examples:

utils.stringFind('hi', 'i');
//---> true

utils.stringFind('hi', 'hi')
//---> true

// This method uses Regular Expressions to find and check if the character exists, so if you try to search: 'ih', in 'hi', it will return false.

utils.stringFind('hi', 'ih')
//---> false

// However, if you try to check 'ih' in 'giht', it will return true.
utils.stringFind('Wait... what is "giht?"', 'ih')
//---> true

Milisecond Converter Methods:

utils.secondInMs(1);
//---> 1000
utils.minuteInMs(1);
//---> 60000
utils.hourInMs(1)
//---> 3600000
utils.dayInMs(1)
//---> 86400000
utils.weekInMs(1)
//---> 604800000
utils.monthInMs(1)
//---> 2592000000

//Do you can put the month days(30, or 31).
utils.monthInMs(1, 30)
//---> 2592000000
utils.monthInMs(1, 31)
//---> 2678400000
utils.yearInMs(1)
//---> 31536000000
// The {configs} paramether is optional, if do you not use, he is set to 'all'.

utils.time(31536000000)
//---> 1 years, 12 months, 52 weeks, 365 days, 8760 hours, 525600 minutes, 31536000 seconds

// You can use pre-set keys to filter years, months, weeks, days, hours, minutes and seconds!
// Examples:

utils.time(31536000000, 'days')
//---> 365 days

utils.time(31536000000, 'years')
//---> 1 years

// The existing pre-set keys are: 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years' and 'all'.