From c93f523951c9e5e95717023689030d8ae6838285 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Fri, 8 Jun 2012 16:24:56 -0700 Subject: [PATCH] Export strftime directly in Node, as module.exports, closes #10 --- Readme.md | 4 ++-- lib/index.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Readme.md b/Readme.md index 40ea846..15a1345 100644 --- a/Readme.md +++ b/Readme.md @@ -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' ], diff --git a/lib/index.js b/lib/index.js index 0cd5f50..ff9f255 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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);