From 56db6934541d7985963db33603ca0a8b0d018afa Mon Sep 17 00:00:00 2001 From: Anatoliy Chakkaev Date: Tue, 19 Feb 2013 16:33:09 +0800 Subject: [PATCH] List support for non-object values --- lib/list.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/list.js b/lib/list.js index 3de6daec..f985185a 100644 --- a/lib/list.js +++ b/lib/list.js @@ -174,7 +174,11 @@ List.prototype.map = function(cb) { }; function ListItem(data, parent) { - for (var i in data) this[i] = data[i]; + if (typeof data === 'object') { + for (var i in data) this[i] = data[i]; + } else { + this.id = data; + } Object.defineProperty(this, 'parent', { writable: false, enumerable: false,