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

hyperz-utils

v1.0.7

Published

A simple utilities package that offers many different functions that could be of use to you when writing ExpressJS websites or Discord bots!

Downloads

61

Readme

Hyperz Utilities

A simple utilities package that offers many different functions that could be of use to you when writing ExpressJS websites or Discord bots!


Functions / Exports


figlify

Used to turn text into art!

    const utils = require('hyperz-utils');
    await utils.figlify("Hello World!", { randFont: true, font: undefined });

mdConvert

Converts raw text/md to HTML compatible.

    const utils = require('hyperz-utils');
    let text = "# Hello world!";
    let webPageContent = await utils.mdConvert(text);
    res.render('index.ejs', { content: webPageContent }); // ExpressJS Framework Example

generateRandom

Generate a random string of acceptable characters.

    const utils = require('hyperz-utils');
    let random = await utils.generateRandom(12) // How long the string should be
    console.log(random);

sanitize

Make a string of text MySQL compatible to avoid injections.

    const utils = require('hyperz-utils');
    let text = "oh hello world`; DROP DATABASE main;";
    let cleansed = await utils.sanitize(text, false) // boolean for <script> replacement in HTML
    await con.query(cleansed, function(err, row) {
        if(err) throw err;
    });

saveFile

Download and save a file from a URL. (NodeJS File Downloader)

    const utils = require('hyperz-utils');
    utils.saveFile("https://hyperz.net/assets/logo.png", "hyperzlogo", "png", "./public/images", false); // boolean is to clone files or not

getDate

Get the date and convert to string with NodeJS.

    const utils = require('hyperz-utils');
    let date = await utils.getDate();
    console.log(date);

fetchTime

Fetch the current time from a certain time zone.

    const utils = require('hyperz-utils');
    let time = await utils.fetchTime("America/New_York", "MM-DD-YYYY"); // https://github.com/Itz-Hyperz/big-ben-bot/blob/main/timezones.json look at values
    console.log(date);

getRandomArray

Get a random element from an array of strings.

    const utils = require('hyperz-utils');
    let array = ["a", "b", "c", "d", "e", "f"];
    let random = await utils.getRandomArray(array);
    console.log(`you got: ${random}!`);

checkIfHex

Check if the provided string is a valid color hex.

    const utils = require('hyperz-utils');
    let hex = "#FFFFFF";
    let check = await utils.checkIfHex(hex);
    if(!check.pass) hex = check.item; // Set to the proper hex value if it's not
    console.log(hex);

dirSize

View the directory size of a folder.

    const utils = require('hyperz-utils');
    let size = await utils.dirSize("./src/images");
    console.log(size);

getDiscountedValue

Get the discounted amount of a total value.

const utils = require('hyperz-utils');
let totalValue = 34.99; // Price
let discount = 30; // 30%
let newValue = await utils.getDiscountedValue(totalValue, discount);
console.log(newValue) // 10.497 (30% of 34.99)

randomColor

Get a random color logged to the console.

const utils = require('hyperz-utils');
utils.randomColor("Wow a random color!!!");

Credits

@Hyperz - Creating the package.