Merge pull request #210 from anatoliychakkaev/master

Amends for list and version exposing
This commit is contained in:
Anatoliy Chakkaev 2013-02-19 00:52:51 -08:00
commit ee6bc85e75
4 changed files with 16 additions and 4 deletions

View File

@ -25,7 +25,7 @@ try {
if (process.versions.node < '0.6') {
exports.version = JSON.parse(fs.readFileSync(__dirname + '/package.json')).version;
} else {
exports.version = require('../package').version;
exports.version = require('./package').version;
}
} catch (e) {}

View File

@ -174,7 +174,11 @@ List.prototype.map = function(cb) {
};
function ListItem(data, parent) {
for (var i in data) this[i] = data[i];
if (typeof data === 'object') {
for (var i in data) this[i] = data[i];
} else {
this.id = data;
}
Object.defineProperty(this, 'parent', {
writable: false,
enumerable: false,

8
test/jugglingdb_test.js Normal file
View File

@ -0,0 +1,8 @@
var juggling = require('../index');
require('./spec_helper').init(module.exports);
it('should expose version', function (test) {
console.log('version:', juggling.version);
test.ok(juggling.version);
test.done();
});

View File

@ -11,7 +11,7 @@ try {
}
var group_name = false, EXT_EXP;
function it (should, test_case) {
function it(should, test_case) {
check_external_exports();
if (group_name) {
EXT_EXP[group_name][should] = test_case;
@ -39,7 +39,7 @@ function context(name, tests) {
global.context = context;
exports.init = function (external_exports) {
exports.init = function init(external_exports) {
EXT_EXP = external_exports;
if (external_exports.done) {
external_exports.done();