Run Prettier on all files

This commit is contained in:
Steve Gravrock
2020-09-29 18:05:38 -07:00
parent 7d5ca27b9d
commit d27bb8fa96
108 changed files with 4399 additions and 2926 deletions

View File

@@ -1,10 +1,9 @@
getJasmineRequireObj().Any = function(j$) {
function Any(expectedObject) {
if (typeof expectedObject === 'undefined') {
throw new TypeError(
'jasmine.any() expects to be passed a constructor function. ' +
'Please pass one or use jasmine.anything() to match any object.'
'Please pass one or use jasmine.anything() to match any object.'
);
}
this.expectedObject = expectedObject;

View File

@@ -1,5 +1,4 @@
getJasmineRequireObj().Anything = function(j$) {
function Anything() {}
Anything.prototype.asymmetricMatch = function(other) {

View File

@@ -5,7 +5,11 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
ArrayContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
if (!j$.isArray_(this.sample)) {
throw new Error('You must provide an array to arrayContaining, not ' + j$.pp(this.sample) + '.');
throw new Error(
'You must provide an array to arrayContaining, not ' +
j$.pp(this.sample) +
'.'
);
}
// If the actual parameter is not an array, we can fail immediately, since it couldn't
@@ -25,8 +29,8 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
return true;
};
ArrayContaining.prototype.jasmineToString = function (pp) {
return '<jasmine.arrayContaining(' + pp(this.sample) +')>';
ArrayContaining.prototype.jasmineToString = function(pp) {
return '<jasmine.arrayContaining(' + pp(this.sample) + ')>';
};
return ArrayContaining;

View File

@@ -1,12 +1,18 @@
getJasmineRequireObj().ArrayWithExactContents = function(j$) {
function ArrayWithExactContents(sample) {
this.sample = sample;
}
ArrayWithExactContents.prototype.asymmetricMatch = function(other, matchersUtil) {
ArrayWithExactContents.prototype.asymmetricMatch = function(
other,
matchersUtil
) {
if (!j$.isArray_(this.sample)) {
throw new Error('You must provide an array to arrayWithExactContents, not ' + j$.pp(this.sample) + '.');
throw new Error(
'You must provide an array to arrayWithExactContents, not ' +
j$.pp(this.sample) +
'.'
);
}
if (this.sample.length !== other.length) {

View File

@@ -1,8 +1,7 @@
getJasmineRequireObj().Empty = function (j$) {
getJasmineRequireObj().Empty = function(j$) {
function Empty() {}
Empty.prototype.asymmetricMatch = function (other) {
Empty.prototype.asymmetricMatch = function(other) {
if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) {
return other.length === 0;
}
@@ -17,7 +16,7 @@ getJasmineRequireObj().Empty = function (j$) {
return false;
};
Empty.prototype.jasmineToString = function () {
Empty.prototype.jasmineToString = function() {
return '<jasmine.empty>';
};

View File

@@ -1,5 +1,4 @@
getJasmineRequireObj().Falsy = function(j$) {
function Falsy() {}
Falsy.prototype.asymmetricMatch = function(other) {

View File

@@ -1,7 +1,9 @@
getJasmineRequireObj().MapContaining = function(j$) {
function MapContaining(sample) {
if (!j$.isMap(sample)) {
throw new Error('You must provide a map to `mapContaining`, not ' + j$.pp(sample));
throw new Error(
'You must provide a map to `mapContaining`, not ' + j$.pp(sample)
);
}
this.sample = sample;
@@ -17,8 +19,8 @@ getJasmineRequireObj().MapContaining = function(j$) {
var hasMatch = false;
j$.util.forEachBreakable(other, function(oBreakLoop, oValue, oKey) {
if (
matchersUtil.equals(oKey, key)
&& matchersUtil.equals(oValue, value)
matchersUtil.equals(oKey, key) &&
matchersUtil.equals(oValue, value)
) {
hasMatch = true;
oBreakLoop();

View File

@@ -1,8 +1,7 @@
getJasmineRequireObj().NotEmpty = function (j$) {
getJasmineRequireObj().NotEmpty = function(j$) {
function NotEmpty() {}
NotEmpty.prototype.asymmetricMatch = function (other) {
NotEmpty.prototype.asymmetricMatch = function(other) {
if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) {
return other.length !== 0;
}
@@ -18,7 +17,7 @@ getJasmineRequireObj().NotEmpty = function (j$) {
return false;
};
NotEmpty.prototype.jasmineToString = function () {
NotEmpty.prototype.jasmineToString = function() {
return '<jasmine.notEmpty>';
};

View File

@@ -1,5 +1,4 @@
getJasmineRequireObj().ObjectContaining = function(j$) {
function ObjectContaining(sample) {
this.sample = sample;
}
@@ -17,7 +16,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
}
function hasProperty(obj, property) {
if (!obj || typeof(obj) !== 'object') {
if (!obj || typeof obj !== 'object') {
return false;
}
@@ -29,12 +28,22 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
}
ObjectContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); }
if (typeof(other) !== 'object') { return false; }
if (typeof this.sample !== 'object') {
throw new Error(
"You must provide an object to objectContaining, not '" +
this.sample +
"'."
);
}
if (typeof other !== 'object') {
return false;
}
for (var property in this.sample) {
if (!hasProperty(other, property) ||
!matchersUtil.equals(this.sample[property], other[property])) {
if (
!hasProperty(other, property) ||
!matchersUtil.equals(this.sample[property], other[property])
) {
return false;
}
}
@@ -51,7 +60,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
}
var filteredOther = {};
Object.keys(this.sample).forEach(function (k) {
Object.keys(this.sample).forEach(function(k) {
// eq short-circuits comparison of objects that have different key sets,
// so include all keys even if undefined.
filteredOther[k] = other[k];

View File

@@ -1,7 +1,9 @@
getJasmineRequireObj().SetContaining = function(j$) {
function SetContaining(sample) {
if (!j$.isSet(sample)) {
throw new Error('You must provide a set to `setContaining`, not ' + j$.pp(sample));
throw new Error(
'You must provide a set to `setContaining`, not ' + j$.pp(sample)
);
}
this.sample = sample;

View File

@@ -1,5 +1,4 @@
getJasmineRequireObj().StringMatching = function(j$) {
function StringMatching(expected) {
if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
throw new Error('Expected is not a String or a RegExp');

View File

@@ -1,5 +1,4 @@
getJasmineRequireObj().Truthy = function(j$) {
function Truthy() {}
Truthy.prototype.asymmetricMatch = function(other) {