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

@techtronics/qol

v1.0.1

Published

This is a host of quality of life features that take the load off of coding; A mix of random but cool functions!

Downloads

12

Readme

Deprecation Notice!

Newer versions of this package are now available at @cerebrusinc/qol. The @techtronics/qol version will no longer get updates, however, it will still be available on the registry so that no services using it get disrupted.

qol

Are you tired of making the same module in every project? Not a problem! Qol has your back.

A suite of random but useful functions that are aimed at giving you 'piece of cake' level comfortability.

Importing

// ES6 Module
import * as qol from "@techtronics/qol";

// ES6 Destructuring
import { randomColour } from "@techtronics/qol";

// ES5 Module
const qol = require("@techtronics/qol");

// ES5 Destructuring
const { randomColour } = require("@techtronics/qol");

Functions

randomColour

Get a random colour; For those scenarios where you couldn't care less!

Returns a string

const c = randomColour();
const cRGB = randomColour("rgb");
const cCMYK = randomColour("cmyk");
const cHSV = randomColour("hsv");
const cHSL = randomColour("hsl");

console.log(c, cRGB, cCMYK, cHSV, cHSL);
// #f7f7f7, rgb(247,247,247), cmyk(0%,0%,0%,3%), hsv(0,0%,97%), hsl(0,0%,97%)

| Parameter | Default Setting | Required? | Definition | Options | | --------- | --------------- | --------- | ------------------------------------------ | ---------------------------------- | | setting | hex | No | The type of colour you would like returned | hex, rgb, cmyk, hsv, hsl |

parseDate

Send in date parameters and receive either an object with their metadata, or a parsed date (e.g 2 Sep 2020); American formatting is possible (e.g Sep 2 2020).

NOTE: You do not need to add 1 to the day or month, it will do that for you.

Returns a string or DateObject

const d = new Date();

const dateArr = [d.getDate(), d.getDay(), d.getMonth(), d.getFullYear()];

const pD = parseDate(...dateArr, "nll", true);
const pDfull = parseDate(...dateArr, "lll");

console.log(pD, pDfull);
// October 24 2022, Monday 24th October 2022
interface DateObject {
	day: {
		short: string;
		long: string;
		ordinalMonth: string;
		ordinalWeek: string;
		weekNumber: number;
		monthNumber: number;
	};
	month: {
		short: string;
		long: string;
		ordinal: string;
		number: number;
	};
	year: {
		short: number;
		long: number;
	};
}

| Parameter | Default Setting | Required? | Definition | Options | | --------- | --------------- | --------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | | monthDay | none | Yes | The day of the month | type number | | weekDay | none | Yes | The day of the week | type number | | month | none | Yes | The numeric month | type number | | year | none | Yes | The full numeric year | type number | | format | none | No | The date format you would like | n = numeric, s = shorthand text, l = full text; nns, nnl, sss, ssl, lll, nss, nsl, nls, nll | | american | false | No | Whether or not you would like the format to be 'Americanised' | true, false |

numParse

Convert a number into a string as if it's MS Excel!

Returns a string

const num = numParse(2100.45, "space");
const numEurope = numParse(2100.45, "punct");
const numCustom = numParse(2100.45, "-" as any);

console.log(num, numEurope, numCustom);
// 2 100.45, 2.100,45, 2-100.45)

| Parameter | Default Setting | Required? | Definition | Options | | --------- | --------------- | --------- | -------------------------------- | ---------------------------------------------------------- | | value | undefined | Yes | The number you want to be parsed | none | | setting | comma | No | The delimiter for the number | space, comma, punct, any other delimiter as a string |

Changelog

v1.0.x

  • numParse() updates; Breaking change
    • You can now send the value as a string
    • To use a custom seperator, you must declare it as any
    • The setting parameter is now options, it defaults to a comma
    • Parity with our python qolpy package
  • Added icon to README

v0.1.x

  • Fully added numParse()
    • Add delimiters to your numbers, ideal for frontend
  • Fully added parseDate()
    • Get date params (e.g long text version and numeric verison) in an object or a parsed date as text e.g '2 Sep 2020'
    • Can return in American format eg 'Sep 2 2020'
    • View the param options to see how many different types of date formats you can choose
  • Type hint updates
  • README restructuring
  • Source resturing
  • Update to randomColour()
    • Get the colour as a hex, rgb, cmyk, hsv, or hsl string
  • Parse date funtion (WIP)
  • Initial release
  • Sentence casing, title casing, and abrreviations added and typed