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

View file

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