-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
84fb3a0
commit a8a123c
Showing
4 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* MOST Web Framework | ||
* A JavaScript Web Framework | ||
* http://themost.io | ||
* | ||
* Copyright (c) 2019, THEMOST LP | ||
* | ||
* Released under the BSD3-Clause license | ||
* Date: 2014-07-16 | ||
*/ | ||
/** | ||
* @param {*} any | ||
* @param {Function} ctor | ||
* @returns {boolean} | ||
*/ | ||
function instanceOf(any, ctor) { | ||
// validate constructor | ||
if (typeof ctor !== 'function') { | ||
return false | ||
} | ||
// validate with instanceof | ||
if (any instanceof ctor) { | ||
return true; | ||
} | ||
return !!(any && any.constructor && any.constructor.name === ctor.name); | ||
} | ||
|
||
module.exports.instanceOf = instanceOf; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters