session maxage generator
INSTALL
npm i maxage
GET STARTED
const maxage = require("maxage");
/*
usage: maxage(x?: number, flag?: string)
flags:
years|year
months|month
weeks|week
days|day
hours|hour
minutes|minute
seconds|second
milliseconds|millisecond|ms
examples:
maxage(1, "year")
maxage("1", "years")
maxage("1 year")
maxage("1 years")
*/
console.log(maxage(1, "year"));
console.log(maxage("1", "years"));
// => 31536000000
console.log(maxage("1 year"));
console.log(maxage("1 years"));
// => 31536000000
console.log(maxage(1));
console.log(maxage("1"));
// => 1
console.log(maxage());
console.log(maxage("one"));
console.log(maxage("one", "year"));
console.log(maxage("one", "years"));
console.log(maxage("one years"));
// => NaN