Browse Source

Warn on incorrect input

codeClimate
Ludo Stellingwerff 9 years ago
parent
commit
e98f7b93a1
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      lib/DataSet.js

+ 5
- 1
lib/DataSet.js View File

@ -259,7 +259,11 @@ DataSet.prototype.update = function (data, senderId) {
if (Array.isArray(data)) { if (Array.isArray(data)) {
// Array // Array
for (var i = 0, len = data.length; i < len; i++) { for (var i = 0, len = data.length; i < len; i++) {
addOrUpdate(data[i]);
if (data[i] instanceof Object){
addOrUpdate(data[i]);
} else {
console.warn("Ignoring input item, which is not an object at index"+i);
}
} }
} }
else if (data instanceof Object) { else if (data instanceof Object) {

Loading…
Cancel
Save