Export strftime directly in Node, as module.exports, closes #10

This commit is contained in:
Sami Samhuri 2012-06-08 16:24:56 -07:00
parent b51b106177
commit c93f523951
2 changed files with 5 additions and 5 deletions

View file

@ -13,12 +13,12 @@ npm install strftime
Usage Usage
===== =====
var strftime = require('strftime').strftime var strftime = require('strftime')
console.log(strftime('%B %d, %y %H:%M:%S')) // => April 28, 2011 18:21:08 console.log(strftime('%B %d, %y %H:%M:%S')) // => April 28, 2011 18:21:08
If you want to localize it: If you want to localize it:
var strftime = require('strftime').strftime var strftime = require('strftime')
var it_IT = { var it_IT = {
days: [ 'domenica', 'lunedi', 'martedi', 'mercoledi', 'giovedi', 'venerdi', 'sabato' ], days: [ 'domenica', 'lunedi', 'martedi', 'mercoledi', 'giovedi', 'venerdi', 'sabato' ],
shortDays: [ 'dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab' ], shortDays: [ 'dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab' ],

View file

@ -11,8 +11,8 @@
var namespace; var namespace;
// CommonJS / Node module // CommonJS / Node module
if (typeof exports !== 'undefined') { if (typeof module !== 'undefined') {
namespace = exports; namespace = module.exports = strftime;
} }
// Browsers and other environments // Browsers and other environments
@ -41,7 +41,7 @@
, PM: 'PM' , PM: 'PM'
, am: 'am' , am: 'am'
, pm: 'pm' , pm: 'pm'
} };
function strftime(fmt, d, locale) { function strftime(fmt, d, locale) {
return _strftime(fmt, d, locale, false); return _strftime(fmt, d, locale, false);