Permalink
Browse files

fix bug: Object method conflict with Mongoose

  • Loading branch information...
1 parent f66f5b9 commit 9e8fe12464812fa7f88911bf447b9d0c721a7336 @shaunlee committed Apr 30, 2011
Showing with 8 additions and 10 deletions.
  1. +7 −9 lib/jst.js
  2. +1 −1 package.json
View
@@ -8,7 +8,7 @@ var fs = require('fs'),
crypto = require('crypto'),
filters = require('./filters');
-exports.version = '0.0.6';
+exports.version = '0.0.7';
var _cache = {},
_files = {},
@@ -105,7 +105,7 @@ var renderFile = exports.renderFile = function(filename, args, fn) {
_files[fk] = _files[fk] || {};
- if (_files[fk].isEmpty() || _files[fk].ctime < stats.ctime) {
+ if (isempty(_files[fk]) || _files[fk].ctime < stats.ctime) {
fs.readFile(filename, 'utf8', function(err, ctx) {
if (err)
return fn(err);
@@ -125,12 +125,10 @@ var renderFile = exports.renderFile = function(filename, args, fn) {
});
}
-if (typeof Object.prototype.isEmpty === 'undefined') {
- Object.prototype.isEmpty = function() {
- for (var prop in this)
- if (this.hasOwnProperty(prop))
- return false;
- return true;
- }
+function isempty(o) {
+ for (var prop in o)
+ if (o.hasOwnProperty(prop))
+ return false;
+ return true;
}
View
@@ -1,7 +1,7 @@
{
"name": "jst",
"description": "Node JavaScript Template, A pretty high performance template engine",
- "version": "0.0.6",
+ "version": "0.0.7",
"author": "Shaun Li <shonhen@gmail.com>",
"keywords": ["template", "engine", "jst"],
"main": "./lib/jst.js"

0 comments on commit 9e8fe12

Please sign in to comment.