dagens-namn

1.1.0 • Public • Published

dagens-namn

Npm package for the name of the day according to Swedish calendar.

Requirements

This module has been tested with nodejs version 0.12.7, presumably it should work fine with newer versions.

Installation

Install this module for use in your projects:

npm install --save dagens-namn

or for use as a command line tool:

npm install --global dagens-namn

Usage

This code snippet shows how to use this module in a project.

var dagensnamn = require('dagens-namn');
 
// The today's name(s) with:
console.log(dagensnamn());
 
// Get the name(s) of a specific date with:
var date = new Date('2015-04-25');
console.log(dagensnamn(date));

To use it as a command line tool (after it's been installed with --global flag):

shell> dagens-namn
Hedvig, Hillevi
shell> dagens-namn 2015-01-15
Laura, Lorentz

Data file

The name data used by this module is stored in the data.json file. It has been derived from the Swedish Wikipedia page listing the names.

Format

The data file has the following format:

  • An object with a property named "1" to "12" for each month and an object its their value
  • Each month value object has a property for each day named "1" to "31" (at most, depending on length of month)
  • The value for each day is an array of zero or more strings.

Tests

If you want to run the unit tests for this package, run this command after you have cloned the repository:

npm test

Credits

dagens-namn npm package was created by Henrik Djärv.

License

MIT, see file LICENSE

/dagens-namn/

    Package Sidebar

    Install

    npm i dagens-namn

    Weekly Downloads

    1

    Version

    1.1.0

    License

    MIT

    Last publish

    Collaborators

    • hdjarv