mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 12:33:47 +08:00
- Update Sinon (breaking change does not affect us) - Update Mocha - Update Karma R=jacktfranklin@chromium.org Bug: none Change-Id: Ieb50ba55ce7a9e01e32ee553a6741e6323fcaaab Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3158223 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
20 lines
637 B
JavaScript
20 lines
637 B
JavaScript
"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;
|