diff --git a/lib/list.js b/lib/list.js index 3e6faa1e..4c4158eb 100644 --- a/lib/list.js +++ b/lib/list.js @@ -13,7 +13,7 @@ function List(items, itemType, parent) { try { items = JSON.parse(items); } catch (e) { - throw new Error('could not create List from JSON string: ', items); + throw new Error(util.format('could not create List from JSON string: %j', items)); } } @@ -22,7 +22,7 @@ function List(items, itemType, parent) { items = items || []; if (!Array.isArray(items)) { - throw new Error('Items must be an array: ' + items); + throw new Error(util.format('Items must be an array: %j', items)); } if(!itemType) { @@ -92,12 +92,3 @@ List.prototype.toString = function () { return JSON.stringify(this.toJSON()); }; -/* - var strArray = new List(['1', 2], String); - strArray.push(3); - console.log(strArray); - console.log(strArray.length); - - console.log(strArray.toJSON()); - console.log(strArray.toString()); - */