projects
/
limn.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
4f4de19
)
Adds Backbone Base docs.
author
dsc
<dsc@wikimedia.org>
Thu, 12 Apr 2012 20:13:04 +0000 (13:13 -0700)
committer
dsc
<dsc@wikimedia.org>
Thu, 12 Apr 2012 20:13:04 +0000 (13:13 -0700)
lib/base.co
patch
|
blob
|
history
lib/util/underscore/kv.co
patch
|
blob
|
history
diff --git
a/lib/base.co
b/lib/base.co
index
225ea6e
..
cc62b1f
100644
(file)
--- a/
lib/base.co
+++ b/
lib/base.co
@@
-75,8
+75,11
@@
BaseModel = exports.BaseModel = Backbone.Model.extend do # {{{
*/
toKVPairs: ->
kvo = _.collapseObject @toJSON()
- for k, v in kvo
- kvo[k] = @serialize v
+ if v and _.isObject v
+ for k, v in kvo
+ kvo[k] = @serialize v unless typeof v is 'function'
+ else
+ @serialize v
kvo
/**
diff --git
a/lib/util/underscore/kv.co
b/lib/util/underscore/kv.co
index
fdc31ba
..
4eb5389
100644
(file)
--- a/
lib/util/underscore/kv.co
+++ b/
lib/util/underscore/kv.co
@@
-32,7
+32,7
@@
_kv = do
{}
/**
- * Copies and flattens any sub-objects into namespaced keys on the parent object, such
+ * Copies and flattens a tree of sub-objects into namespaced keys on the parent object, such
* that `{ "foo":{ "bar":1 } }` becomes `{ "foo.bar":1 }`.
*/
collapseObject: (obj, parent={}, prefix='') ->