summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-07-05 22:30:18 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-07-05 22:30:18 +0200
commit4f4ef10a6bbbcc68ab89d81291faddf57b650928 (patch)
tree7bf99c450e1077fdd335f8b027cacb94417e3034
parentc8758323adeecea8271ad950e5e6fabc6b34f2fc (diff)
downloadcollection_json.js-4f4ef10a6bbbcc68ab89d81291faddf57b650928.tar.gz
collection_json.js-4f4ef10a6bbbcc68ab89d81291faddf57b650928.tar.bz2
collection_json.js-4f4ef10a6bbbcc68ab89d81291faddf57b650928.tar.xz
collection_json.js-4f4ef10a6bbbcc68ab89d81291faddf57b650928.zip
o Adding findLinkByRel.
-rw-r--r--index.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/index.js b/index.js
index bcc6927..f467018 100644
--- a/index.js
+++ b/index.js
@@ -36,6 +36,11 @@ function fromObject(root) {
return f(map);
});
};
+ root.findLinkByRel = function(rel) {
+ return _.find(this.collection.links, function(link) {
+ return rel === link.rel;
+ });
+ }
return root;
}