Safe require package.json

This commit is contained in:
Anatoliy Chakkaev 2012-01-14 12:24:24 +04:00
parent efc10db664
commit 1a71a82b8f
1 changed files with 3 additions and 1 deletions

View File

@ -2,4 +2,6 @@ exports.Schema = require('./lib/schema').Schema;
exports.AbstractClass = require('./lib/abstract-class').AbstractClass;
exports.Validatable = require('./lib/validatable').Validatable;
exports.version = JSON.parse(require('fs').readFileSync('./package.json')).version;
try {
exports.version = require('./package.json').version;
} catch(e) {}