List support for non-object values
This commit is contained in:
parent
b9eaba0166
commit
56db693454
|
@ -174,7 +174,11 @@ List.prototype.map = function(cb) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function ListItem(data, parent) {
|
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', {
|
Object.defineProperty(this, 'parent', {
|
||||||
writable: false,
|
writable: false,
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
|
|
Loading…
Reference in New Issue