1.0.1 • Published 8 years ago

random-weekday v1.0.1

Weekly downloads
9
License
MIT
Repository
github
Last release
8 years ago

random-weekday

Generate a random weekday.

MIT License

build:? coverage:?

Install

$ npm install --save random-weekday 

Usage

var randomWeekday = require('random-weekday');
  
// API
// - randomWeekday([options]);
  
// options
// - workaday
// - raw
// - min
// - max

By default, returns just the weekday number from 1 to 7:

randomWeekday();
// => 5

Optionally specify raw to get the whole weekday object:

randomWeekday({ raw: true });
// => { name: 'Tuesday', short: 'TUE', number: 2 }

Optionally specify min, max, or both to limit the range.

randomWeekday({ min: 2 });
// => 4

randomWeekday({ max: 5 });
// => 3

randomWeekday({ min: 2, max: 5 });
// => 5

Related

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.