summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-06-29 23:19:06 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-06-29 23:19:06 +0200
commite925f5623c8f3c60b4fee704f93538c24964a6a7 (patch)
tree29ea9a647e739c0513a61eeefa546c751875949c
parent7a244dd2af1375af9197188aa84f13bc215b4065 (diff)
downloadcollection_json.js-e925f5623c8f3c60b4fee704f93538c24964a6a7.tar.gz
collection_json.js-e925f5623c8f3c60b4fee704f93538c24964a6a7.tar.bz2
collection_json.js-e925f5623c8f3c60b4fee704f93538c24964a6a7.tar.xz
collection_json.js-e925f5623c8f3c60b4fee704f93538c24964a6a7.zip
o Making sure each item as an array of links.
-rw-r--r--index.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/index.js b/index.js
index 583d5ae..c0d0378 100644
--- a/index.js
+++ b/index.js
@@ -13,6 +13,10 @@ function fromObject(root) {
c.queries = _.isArray(c.queries) ? c.queries : [];
c.templates = _.isArray(c.templates) ? c.templates : [];
+ _.each(c.items, function(item) {
+ item.links = _.isArray(item.links) ? item.links : [];
+ });
+
// TODO: make un-enumerable
root.mapItemData = function(f) {
return _.map(this.collection.items, function(item) {