Git Product home page Git Product logo

namedays's Introduction

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

namedays's People

Contributors

dependabot[bot] avatar filiptammergard avatar github-actions[bot] avatar renovate[bot] avatar

Watchers

 avatar  avatar

namedays's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/release.yml
  • actions/checkout v4
  • pnpm/action-setup v2
  • actions/setup-node v4
  • changesets/action v1
.github/workflows/review.yml
  • actions/checkout v4
  • pnpm/action-setup v2
  • actions/setup-node v4
npm
package.json
  • @changesets/cli 2.27.1
  • @tammergard/eslint-config-base 5.0.6
  • @tammergard/prettier-config 2.1.0
  • @tammergard/tsconfig 2.8.0
  • eslint 8.57.0
  • prettier 3.2.5
  • tsup 8.0.2
  • typescript 5.4.5
  • vitest 1.5.0

  • Check this box to trigger a request for Renovate to run again on this repository

README error

Documentation of on method shows import of date.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.