web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
926 B

  1. 'use strict';
  2. var isObject = require('../internals/is-object');
  3. var definePropertyModule = require('../internals/object-define-property');
  4. var getPrototypeOf = require('../internals/object-get-prototype-of');
  5. var wellKnownSymbol = require('../internals/well-known-symbol');
  6. var HAS_INSTANCE = wellKnownSymbol('hasInstance');
  7. var FunctionPrototype = Function.prototype;
  8. // `Function.prototype[@@hasInstance]` method
  9. // https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance
  10. if (!(HAS_INSTANCE in FunctionPrototype)) {
  11. definePropertyModule.f(FunctionPrototype, HAS_INSTANCE, { value: function (O) {
  12. if (typeof this != 'function' || !isObject(O)) return false;
  13. if (!isObject(this.prototype)) return O instanceof this;
  14. // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
  15. while (O = getPrototypeOf(O)) if (this.prototype === O) return true;
  16. return false;
  17. } });
  18. }