mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2024-12-02 13:00:29 -05:00
41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
//This file is a copy of https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Specs/equalsMethodEqualityTester.js
|
|
/*eslint strict: ["error", "function"]*/
|
|
/*eslint-env amd*/
|
|
define([
|
|
'Cesium/Core/defined'
|
|
], function(
|
|
defined) {
|
|
'use strict';
|
|
|
|
return function(a, b) {
|
|
var to_run;
|
|
// if either a or b have an equals method, call it.
|
|
if (a !== null && defined(a)) {
|
|
if (typeof a.equals === 'function') {
|
|
return a.equals(b);
|
|
} else if(a instanceof Object) {
|
|
// Check if the current object has a static function named 'equals'
|
|
to_run = Object.getPrototypeOf(a).constructor.equals;
|
|
if( typeof to_run === 'function') {
|
|
return to_run(a, b);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (b !== null && defined(b)) {
|
|
if (typeof b.equals === 'function') {
|
|
return b.equals(a);
|
|
} else if(b instanceof Object) {
|
|
// Check if the current object has a static function named 'equals'
|
|
to_run = Object.getPrototypeOf(b).constructor.equals;
|
|
if( typeof to_run === 'function') {
|
|
return to_run(b, a);
|
|
}
|
|
}
|
|
}
|
|
|
|
// fall back to default equality checks.
|
|
return undefined;
|
|
};
|
|
});
|