Skip to content

Npm package for the name of the day in the Swedish calendar.

License

Notifications You must be signed in to change notification settings

hdjarv/dagens-namn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Npm package for the name of the day in the Swedish calendar.

Resources

License

Stars

Watchers

Forks

Packages

No packages published