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

quoti-scripts

v0.4.0

Published

Utility functions to be used in `quoti` ecosystem

Downloads

4

Readme

Quoti-scripts

Utility functions to be used in quoti ecosystem

Quoti

Badges

GitHub language count GitHub top language npm bundle size npm bundle size GitHub code size in bytes GitHub repo size Lines of code npm npm npm GitHub commit merge status GitHub issues GitHub pull requests GitHub GitHub package.json version node-current GitHub commit activity GitHub last commit npm collaborators

Twitter Follow

Functions

isDue

startDate: string | number | Date | Dayjs;
currentDate: string | number | Date | Dayjs;
frequencyType: "D" | "d" | "W" | "w" | "M" | "m" | "Y" | "y";
frequencyValue: number;
// day of the weeks, 0 (sun) to 6 (sat)
dayOfWeek?: number[] = [];
const { isDue } = require("quoti-scripts");

// Tue Nov 20 2012
const startDate = new Date(2012, 10, 20)
// Fri Nov 23 2012
const currentDate = new Date(2012, 10, 23);

// Every 3 days
console.log(isDue(startDate, currentDate, "D", 3)); // true
const { isDue } = require("quoti-scripts");

// Tue Nov 20 2012
const startDate = new Date(2012, 10, 20)
// Fri Nov 23 2012
const currentDate = new Date(2012, 10, 23);

// Fri & Sat, every 5 weeks
const weekdays = [5, 6]
console.log(isDue(startDate, currentDate, "W", 3, [5])); // true
const { isDue } = require("quoti-scripts");

// Tue Nov 20 2012
const startDate = new Date(2012, 10, 20);

// Wed Mar 20 2013
const currentDate = new Date(2013, 2, 20);

// Every 5 months
console.log(isDue(startDate, currentDate, "M", 5)); // true
const { isDue } = require("quoti-scripts");

// Sun Apr 28 2013
const startDate = new Date(2013, 3, 28);

// Wed Apr 28 2021
const currentDate = new Date(2021, 3, 28);

// Every 8 years
console.log(isDue(startDate, currentDate, "Y", 8)); // true

color

darken and lighten

Adjust the shade of the colour to a lighter or darker shade.

color: string;
percent?: number - default value is 20
type?: "rgb" | "hsl" | "hex" | "keyword" - default value is "hex"

the default value of type is hex

const { darkenColor } = require("quoti-scripts")

// css colour keywords
const initialColour = "blue";
const finalColour = darkenColor(initialColour, 50, "keyword")

console.log(finalColour); // "#000080"
const { lightenColor } = require("quoti-scripts")

// hex colour
const initialColour = "#fa5a51";
const finalColour = lightenColor(initialColour, 45)

console.log(finalColour); // "#FEE4E3"
const { darkenColor } = require("quoti-scripts")

// hsl
const initialColour = "hsl(234 79% 55%)";
const finalColour = darkenColor(initialColour, 45, "hsl")

console.log(finalColour); // "hsl(234deg 79% 30.25%)"
const { lightenColor } = require("quoti-scripts")

// rgb
const initialColour = "rgb(140, 37, 14)";
const finalColour = lightenColor(initialColour, 45, "rgb")

console.log(finalColour); // "rgb(202, 53, 20)"

contrastColor

Returns a contrast colour that is best for accessibility. It only returns white if the colour provided is too dark or black if the colour is too light.

color: string;
type?: "rgb" | "hsl" | "hex" | "keyword";
const { contrastColor } = require("quoti-scripts")

const firstColour = "rgb(140, 37, 14)";
const secondColour = "rgb(202, 100, 120)";

const firstResult = contrastColor(firstColour, "rgb");
const secondResult = contrastColor(secondColour, "rgb");

console.log(firstResult); // white
console.log(secondResult); // black
const { contrastColor } = require("quoti-scripts")

const firstColour = "hsl(140deg 37% 14%)";
const secondColour = "hsl(202deg 100% 78%)";

const firstResult = contrastColor(firstColour, "hsl");
const secondResult = contrastColor(secondColour, "hsl");

console.log(firstResult); // white
console.log(secondResult); // black
const { contrastColor } = require("quoti-scripts")

const firstColour = "#ade";
const secondColour = "#ad301a";

const firstResult = contrastColor(firstColour);
const secondResult = contrastColor(secondColour);

console.log(firstResult); // black
console.log(secondResult); // white
const { contrastColor } = require("quoti-scripts")

const firstColour = "pink";
const secondColour = "forestgreen";

const firstResult = contrastColor(firstColour, "keyword");
const secondResult = contrastColor(secondColour, "keyword");

console.log(firstResult); // black
console.log(secondResult); // white