Replaced uses of var with const/let

This commit is contained in:
Steve Gravrock
2022-06-08 19:07:43 -07:00
parent 4af86f5398
commit 135ff20123
73 changed files with 1384 additions and 1391 deletions

View File

@@ -1,5 +1,5 @@
getJasmineRequireObj().toThrowError = function(j$) {
var getErrorMsg = j$.formatErrorMsg(
const getErrorMsg = j$.formatErrorMsg(
'<toThrowError>',
'expect(function() {<expectation>}).toThrowError(<ErrorConstructor>, <message>)'
);
@@ -21,13 +21,14 @@ getJasmineRequireObj().toThrowError = function(j$) {
function toThrowError(matchersUtil) {
return {
compare: function(actual) {
var errorMatcher = getMatcher.apply(null, arguments),
thrown;
const errorMatcher = getMatcher.apply(null, arguments);
if (typeof actual != 'function') {
throw new Error(getErrorMsg('Actual is not a Function'));
}
let thrown;
try {
actual();
return fail('Expected function to throw an Error.');
@@ -50,7 +51,7 @@ getJasmineRequireObj().toThrowError = function(j$) {
};
function getMatcher() {
var expected, errorType;
let expected, errorType;
if (arguments[2]) {
errorType = arguments[1];
@@ -106,15 +107,15 @@ getJasmineRequireObj().toThrowError = function(j$) {
}
}
var errorTypeDescription = errorType
const errorTypeDescription = errorType
? j$.fnNameFor(errorType)
: 'an exception';
function thrownDescription(thrown) {
var thrownName = errorType
? j$.fnNameFor(thrown.constructor)
: 'an exception',
thrownMessage = '';
const thrownName = errorType
? j$.fnNameFor(thrown.constructor)
: 'an exception';
let thrownMessage = '';
if (expected) {
thrownMessage = ' with message ' + matchersUtil.pp(thrown.message);
@@ -176,7 +177,7 @@ getJasmineRequireObj().toThrowError = function(j$) {
return false;
}
var Surrogate = function() {};
const Surrogate = function() {};
Surrogate.prototype = type.prototype;
return j$.isError_(new Surrogate());
}