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

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

@ -700,9 +700,9 @@ function chop (text, maxLength) {
* @param {function} fn * @param {function} fn
*/ */
function forEach2(array1, array2, fn) { function forEach2(array1, array2, fn) {
if (array1 instanceof Array) {
if (Array.isArray(array1)) {
array1.forEach(function (elem1) { array1.forEach(function (elem1) {
if (array2 instanceof Array) {
if (Array.isArray(array2)) {
array2.forEach(function (elem2) { array2.forEach(function (elem2) {
fn(elem1, elem2); fn(elem1, elem2);
}); });
@ -713,7 +713,7 @@ function forEach2(array1, array2, fn) {
}); });
} }
else { else {
if (array2 instanceof Array) {
if (Array.isArray(array2)) {
array2.forEach(function (elem2) { array2.forEach(function (elem2) {
fn(array1, 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 valueId = id + "_value";
var rangeValue = document.getElementById(id).value; var rangeValue = document.getElementById(id).value;
if (map instanceof Array) {
if (Array.isArray(map)) {
document.getElementById(valueId).value = map[parseInt(rangeValue)]; document.getElementById(valueId).value = map[parseInt(rangeValue)];
this._overWriteGraphConstants(constantsVariableName,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) { function Graph2d (container, items, groups, options) {
// if the third element is options, the forth is groups (optionally); // 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; var forthArgument = options;
options = groups; options = groups;
groups = forthArgument; 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 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; var forthArgument = options;
options = groups; options = groups;
groups = forthArgument; groups = forthArgument;

+ 2
- 2
lib/util.js View File

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

Loading…
Cancel
Save