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

namedays

v3.0.0

Published

A minimal namedays API

Downloads

18

Readme

namedays

A minimal API for namedays.

Installation

# npm
npm install namedays

# yarn
yarn add namedays

# pnpm
pnpm add namedays

Usage

The interface that all namedays adhere to is called Nameday and looks like this:

interface Nameday {
	id: string
	countryCode: CountryCode
	name: string
	date: {
		month: number
		day: number
	}
}

CountryCode is the union type of country codes currently supported fully or partly.

Nameday is available for usage if needed:

import { Nameday } from "namedays"

All

namedays.all is a function that returns all namedays.

Parameters

  • Optional settings: An object where country code can be set.

Returns

All namedays.

Example

import { namedays } from "namedays"

// all namedays, regardless of which country
namedays.all()

Today

namedays.today is a function that returns namedays of the current day.

Parameters

  • Optional settings: An object where country code can be set.

Returns

The namedays of today.

import { namedays } from "namedays"

// all namedays of current day, regardless of country
namedays.today()

// all Swedish namedays of current day
namedays.today({
	countryCode: "SE",
})

When

namedays.when is a function that returns the nameday of a specific name.

Parameters

  • name: The name or names you want the nameday for.
  • Optional settings: An object where country code can be set.

Returns

The nameday of the passed name.

Examples

import { namedays } from "namedays"

// all Filip's namedays, regardless of country
namedays.when("Filip")

// Filip's Swedish nameday
namedays.when("Filip", {
	countryCode: "SE",
})

// all Filip's and Ida's namedays, regardless of country
namedays.when(["Filip", "Ida"])

Who

namedays.who is a function that returns the nameday of a specific ID.

Parameters

  • id: The ID of the nameday you want.

Returns

The nameday of a specific ID. If ID doesn't exist, undefined is returned.

Examples

import { namedays } from "namedays"

// nameday with id SE-5-2-1, `undefined` if there are no nameday with that id
namedays.who("SE-5-2-1")

On

namedays.on is a function that returns the namedays of a specific day.

Parameters

  • on: The month and/or day you want the namedays for.
  • Optional settings: An object where country code can be set.

Returns

The namedays of a specific day.

Examples

import { namedays } from "namedays"

// all namedays in May, regardless of country
namedays.on({
	month: 5,
})

// all namedays the 2nd every month, regardless of country
namedays.on({
	day: 2,
})

// all namedays May 2nd, regardless of country
namedays.on({
	month: 5,
	day: 2,
})

// all Swedish namedays May 2nd
namedays.on(
	{
		month: 5,
		day: 2,
	},
	{
		countryCode: "SE",
	},
)

License

MIT