Browse Source

Replaced all `arr instanceof Array` with `Array.isArray(arr)`

v3_develop
jos 10 years ago
parent
commit
f7f032df0c
9 changed files with 5156 additions and 5051 deletions
  1. +5131
    -5026
      dist/vis.js
  2. +1
    -1
      dist/vis.map
  3. +14
    -14
      dist/vis.min.js
  4. +2
    -2
      lib/network/Network.js
  5. +3
    -3
      lib/network/dotparser.js
  6. +1
    -1
      lib/network/mixins/physics/PhysicsMixin.js
  7. +1
    -1
      lib/timeline/Graph2d.js
  8. +1
    -1
      lib/timeline/Timeline.js
  9. +2
    -2
      lib/util.js

+ 5131
- 5026
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


+ 14
- 14
dist/vis.min.js
File diff suppressed because it is too large
View File


+ 2
- 2
lib/network/Network.js View File

@ -1341,7 +1341,7 @@ Network.prototype._setNodes = function(nodes) {
if (nodes instanceof DataSet || nodes instanceof DataView) {
this.nodesData = nodes;
}
else if (nodes instanceof Array) {
else if (Array.isArray(nodes)) {
this.nodesData = new DataSet();
this.nodesData.add(nodes);
}
@ -1472,7 +1472,7 @@ Network.prototype._setEdges = function(edges) {
if (edges instanceof DataSet || edges instanceof DataView) {
this.edgesData = edges;
}
else if (edges instanceof Array) {
else if (Array.isArray(edges)) {
this.edgesData = new DataSet();
this.edgesData.add(edges);
}

+ 3
- 3
lib/network/dotparser.js View File

@ -700,9 +700,9 @@ function chop (text, maxLength) {
* @param {function} fn
*/
function forEach2(array1, array2, fn) {
if (array1 instanceof Array) {
if (Array.isArray(array1)) {
array1.forEach(function (elem1) {
if (array2 instanceof Array) {
if (Array.isArray(array2)) {
array2.forEach(function (elem2) {
fn(elem1, elem2);
});
@ -713,7 +713,7 @@ function forEach2(array1, array2, fn) {
});
}
else {
if (array2 instanceof Array) {
if (Array.isArray(array2)) {
array2.forEach(function (elem2) {
fn(array1, elem2);
});

+ 1
- 1
lib/network/mixins/physics/PhysicsMixin.js View File

@ -689,7 +689,7 @@ function showValueOfRange (id,map,constantsVariableName) {
var valueId = id + "_value";
var rangeValue = document.getElementById(id).value;
if (map instanceof Array) {
if (Array.isArray(map)) {
document.getElementById(valueId).value = map[parseInt(rangeValue)];
this._overWriteGraphConstants(constantsVariableName,map[parseInt(rangeValue)]);
}

+ 1
- 1
lib/timeline/Graph2d.js View File

@ -20,7 +20,7 @@ var LineGraph = require('./component/LineGraph');
*/
function Graph2d (container, items, groups, options) {
// if the third element is options, the forth is groups (optionally);
if (!(groups instanceof Array || groups instanceof DataSet) && groups instanceof Object) {
if (!(Array.isArray(groups) || groups instanceof DataSet) && groups instanceof Object) {
var forthArgument = options;
options = groups;
groups = forthArgument;

+ 1
- 1
lib/timeline/Timeline.js View File

@ -24,7 +24,7 @@ function Timeline (container, items, groups, options) {
}
// if the third element is options, the forth is groups (optionally);
if (!(groups instanceof Array || groups instanceof DataSet) && groups instanceof Object) {
if (!(Array.isArray(groups) || groups instanceof DataSet) && groups instanceof Object) {
var forthArgument = options;
options = groups;
groups = forthArgument;

+ 2
- 2
lib/util.js View File

@ -426,7 +426,7 @@ exports.getType = function(object) {
if (object instanceof String) {
return 'String';
}
if (object instanceof Array) {
if (Array.isArray(object)) {
return 'Array';
}
if (object instanceof Date) {
@ -506,7 +506,7 @@ exports.removeClassName = function(elem, className) {
exports.forEach = function(object, callback) {
var i,
len;
if (object instanceof Array) {
if (Array.isArray(object)) {
// array
for (i = 0, len = object.length; i < len; i++) {
callback(object[i], i, object);

Loading…
Cancel
Save