Comparing version 0.0.5 to 0.0.6
@@ -11,3 +11,16 @@ 'use strict'; | ||
async.forEach(_.keys(obj), function(field, next) { | ||
if (_.isObject(obj[field])) { | ||
if (_.isArray(obj[field])) { | ||
var results = []; | ||
async.forEach(obj[field], function(object, arrNext) { | ||
underscore(object, function(err, underscored) { | ||
if (err) return arrNext(err); | ||
results.push(underscored); | ||
return arrNext(); | ||
}); | ||
}, function() { | ||
serialized[S(field).underscore().s] = results; | ||
next(); | ||
}); | ||
} else if (_.isObject(obj[field])) { | ||
underscore(obj[field], function(err, subObj) { | ||
@@ -14,0 +27,0 @@ serialized[S(field).underscore().s] = subObj; |
@@ -5,3 +5,3 @@ { | ||
"description": "jiggler provides a simple and flexible interface for defining representations for your JavaScript objects.", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -520,2 +520,5 @@ var J = require('../lib/index') | ||
}); | ||
user.highSchools.push({ | ||
graduationYear: 2010 | ||
}); | ||
@@ -532,2 +535,3 @@ J.convert.underscore(user, function(err, rep) { | ||
rep.should.have.property('high_schools'); | ||
rep.high_schools.should.be.instanceOf(Array); | ||
rep.high_schools[0].should.have.property('graduation_year', 2001); | ||
@@ -534,0 +538,0 @@ done(); |
27677
631