Permalink
Cannot retrieve contributors at this time
31 lines (29 sloc)
965 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/@sinonjs/samsam/lib/is-object.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
"use strict"; | |
/** | |
* Returns `true` when the value is a regular Object and not a specialized Object | |
* | |
* This helps speed up deepEqual cyclic checks | |
* | |
* The premise is that only Objects are stored in the visited array. | |
* So if this function returns false, we don't have to do the | |
* expensive operation of searching for the value in the the array of already | |
* visited objects | |
* | |
* @private | |
* @param {object} value The object to examine | |
* @returns {boolean} `true` when the object is a non-specialised object | |
*/ | |
function isObject(value) { | |
return ( | |
typeof value === "object" && | |
value !== null && | |
// none of these are collection objects, so we can return false | |
!(value instanceof Boolean) && | |
!(value instanceof Date) && | |
!(value instanceof Error) && | |
!(value instanceof Number) && | |
!(value instanceof RegExp) && | |
!(value instanceof String) | |
); | |
} | |
module.exports = isObject; |