From 1a71a82b8f18e21b425396bcbc5f943e4febbf31 Mon Sep 17 00:00:00 2001 From: Anatoliy Chakkaev Date: Sat, 14 Jan 2012 12:24:24 +0400 Subject: [PATCH] Safe require package.json --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 6a5d74de..d8135b65 100644 --- a/index.js +++ b/index.js @@ -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) {}