Skip to content

Commit

Permalink
Merge 1da34d4 into a4c1898
Browse files Browse the repository at this point in the history
  • Loading branch information
David Ellis committed Mar 19, 2014
2 parents a4c1898 + 1da34d4 commit 6a281e4
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions lib/localize.js
Expand Up @@ -2,15 +2,8 @@
// is a GNU gettext-inspired (but not conformant) localization library for
// Node.js

// Libraries, if in a CommonJS environment
if(typeof(require) !== 'undefined') {
var path = require('path');
var fs = require('fs');
// Path ``fs`` to use ``path.exists`` and ``path.existsSync`` if ``fs.exists`` and ``fs.existsSync`` don't exist.
// Reason? So Node 0.8.x-compliant code will run on Node 0.6.x, 0.4.x, etc.
fs.exists = fs.exists ? fs.exists : path.exists;
fs.existsSync = fs.existsSync ? fs.existsSync : path.existsSync;
}
var path = require('path');
var fs = require('fs');

function Localize(translations, dateFormats, defaultLocale) {

Expand Down Expand Up @@ -409,8 +402,5 @@ function Localize(translations, dateFormats, defaultLocale) {
return this;
}

// Publish as a module, if in a CommonJS environment
if(typeof(module) !== 'undefined') {
Localize.source = fs.readFileSync(require.resolve('./localize'), 'utf8'); // Append a source string to the Localize object for easy exporting to the client
module.exports = Localize;
}
Localize.source = Localize.toString();
module.exports = Localize;

0 comments on commit 6a281e4

Please sign in to comment.