Permalink
Cannot retrieve contributors at this time
19 lines (17 sloc)
637 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/create-matcher/assert-method-exists.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"; | |
/** | |
* Throws a TypeError when expected method doesn't exist | |
* | |
* @private | |
* @param {*} value A value to examine | |
* @param {string} method The name of the method to look for | |
* @param {name} name A name to use for the error message | |
* @param {string} methodPath The name of the method to use for error messages | |
* @throws {TypeError} When the method doesn't exist | |
*/ | |
function assertMethodExists(value, method, name, methodPath) { | |
if (value[method] === null || value[method] === undefined) { | |
throw new TypeError(`Expected ${name} to have method ${methodPath}`); | |
} | |
} | |
module.exports = assertMethodExists; |