MCPcopy Create free account
hub / github.com/TruthHun/BookStack / isClass

Function isClass

static/word2md/mammoth.browser.js:9365–9385  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

9363
9364var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
9365function isClass(fn) {
9366 try {
9367 if (typeof fn === "function") {
9368 var keys = es5.names(fn.prototype);
9369
9370 var hasMethods = es5.isES5 && keys.length > 1;
9371 var hasMethodsOtherThanConstructor = keys.length > 0 &&
9372 !(keys.length === 1 && keys[0] === "constructor");
9373 var hasThisAssignmentAndStaticMethods =
9374 thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
9375
9376 if (hasMethods || hasMethodsOtherThanConstructor ||
9377 hasThisAssignmentAndStaticMethods) {
9378 return true;
9379 }
9380 }
9381 return false;
9382 } catch (e) {
9383 return false;
9384 }
9385}
9386
9387function toFastProperties(obj) {
9388 /*jshint -W027,-W055,-W031*/

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected