Run Prettier on all files
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user