Replaced uses of var with const/let
This commit is contained in:
@@ -4,7 +4,7 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
||||
getDefaultStrategyFn,
|
||||
getMatchersUtil
|
||||
) {
|
||||
var self = this;
|
||||
const self = this;
|
||||
|
||||
this.createSpy = function(name, originalFn) {
|
||||
return j$.Spy(name, getMatchersUtil(), {
|
||||
@@ -15,7 +15,7 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
||||
};
|
||||
|
||||
this.createSpyObj = function(baseName, methodNames, propertyNames) {
|
||||
var baseNameIsCollection =
|
||||
const baseNameIsCollection =
|
||||
j$.isObject_(baseName) || j$.isArray_(baseName);
|
||||
|
||||
if (baseNameIsCollection) {
|
||||
@@ -24,22 +24,21 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
||||
baseName = 'unknown';
|
||||
}
|
||||
|
||||
var obj = {};
|
||||
var spy, descriptor;
|
||||
const obj = {};
|
||||
|
||||
var methods = normalizeKeyValues(methodNames);
|
||||
for (var i = 0; i < methods.length; i++) {
|
||||
spy = obj[methods[i][0]] = self.createSpy(
|
||||
const methods = normalizeKeyValues(methodNames);
|
||||
for (let i = 0; i < methods.length; i++) {
|
||||
const spy = (obj[methods[i][0]] = self.createSpy(
|
||||
baseName + '.' + methods[i][0]
|
||||
);
|
||||
));
|
||||
if (methods[i].length > 1) {
|
||||
spy.and.returnValue(methods[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
var properties = normalizeKeyValues(propertyNames);
|
||||
for (var i = 0; i < properties.length; i++) {
|
||||
descriptor = {
|
||||
const properties = normalizeKeyValues(propertyNames);
|
||||
for (let i = 0; i < properties.length; i++) {
|
||||
const descriptor = {
|
||||
enumerable: true,
|
||||
get: self.createSpy(baseName + '.' + properties[i][0] + '.get'),
|
||||
set: self.createSpy(baseName + '.' + properties[i][0] + '.set')
|
||||
@@ -60,13 +59,13 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
||||
}
|
||||
|
||||
function normalizeKeyValues(object) {
|
||||
var result = [];
|
||||
const result = [];
|
||||
if (j$.isArray_(object)) {
|
||||
for (var i = 0; i < object.length; i++) {
|
||||
for (let i = 0; i < object.length; i++) {
|
||||
result.push([object[i]]);
|
||||
}
|
||||
} else if (j$.isObject_(object)) {
|
||||
for (var key in object) {
|
||||
for (const key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
result.push([key, object[key]]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user