[Pkg-javascript-commits] [backbone] 148/173: code golf modelId example a bit more
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 07:44:14 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository backbone.
commit 712b42b4f378d7e187712dac6d9c4c5a0c0a9a78
Author: Adam Krebs <amk528 at cs.nyu.edu>
Date: Wed Mar 2 13:14:52 2016 -0500
code golf modelId example a bit more
---
index.html | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/index.html b/index.html
index 25f8391..89ebd95 100644
--- a/index.html
+++ b/index.html
@@ -1795,10 +1795,7 @@ var Library = Backbone.Collection.extend({
<pre class="runnable">
var Library = Backbone.Collection.extend({
modelId: function(attrs) {
- if (attrs.type === 'dvd') {
- return 'dvd' + attrs.id;
- }
- return 'vhs' + attrs.id;
+ return attrs.type + attrs.id;
}
});
@@ -1810,7 +1807,6 @@ var library = new Library([
var dvdId = library.get('dvd1').id;
var vhsId = library.get('vhs1').id;
alert('dvd: ' + dvdId + ', vhs: ' + vhsId);
-
</pre>
<p id="Collection-constructor">
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git
More information about the Pkg-javascript-commits
mailing list