List support for non-object values

This commit is contained in:
Anatoliy Chakkaev 2013-02-19 16:33:09 +08:00
parent b9eaba0166
commit 56db693454
1 changed files with 5 additions and 1 deletions

View File

@ -174,7 +174,11 @@ List.prototype.map = function(cb) {
};
function ListItem(data, parent) {
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,