Move private APIs to private namespace

Fixes #2078
This commit is contained in:
Steve Gravrock
2025-09-27 13:21:09 -07:00
parent fbec066837
commit 168ff0a751
183 changed files with 2627 additions and 2459 deletions

View File

@@ -38,7 +38,7 @@ getJasmineRequireObj().Any = function(j$) {
};
Any.prototype.jasmineToString = function() {
return '<jasmine.any(' + j$.fnNameFor(this.expectedObject) + ')>';
return '<jasmine.any(' + j$.private.fnNameFor(this.expectedObject) + ')>';
};
return Any;

View File

@@ -4,10 +4,10 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
}
ArrayContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
if (!j$.isArray_(this.sample)) {
if (!j$.private.isArray(this.sample)) {
throw new Error(
'You must provide an array to arrayContaining, not ' +
j$.basicPrettyPrinter_(this.sample) +
j$.private.basicPrettyPrinter(this.sample) +
'.'
);
}
@@ -15,7 +15,7 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
// If the actual parameter is not an array, we can fail immediately, since it couldn't
// possibly be an "array containing" anything. However, we also want an empty sample
// array to match anything, so we need to double-check we aren't in that case
if (!j$.isArray_(other) && this.sample.length > 0) {
if (!j$.private.isArray(other) && this.sample.length > 0) {
return false;
}

View File

@@ -7,10 +7,10 @@ getJasmineRequireObj().ArrayWithExactContents = function(j$) {
other,
matchersUtil
) {
if (!j$.isArray_(this.sample)) {
if (!j$.private.isArray(this.sample)) {
throw new Error(
'You must provide an array to arrayWithExactContents, not ' +
j$.basicPrettyPrinter_(this.sample) +
j$.private.basicPrettyPrinter(this.sample) +
'.'
);
}

View File

@@ -2,15 +2,19 @@ getJasmineRequireObj().Empty = function(j$) {
function Empty() {}
Empty.prototype.asymmetricMatch = function(other) {
if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) {
if (
j$.private.isString(other) ||
j$.private.isArray(other) ||
j$.private.isTypedArray(other)
) {
return other.length === 0;
}
if (j$.isMap(other) || j$.isSet(other)) {
if (j$.private.isMap(other) || j$.private.isSet(other)) {
return other.size === 0;
}
if (j$.isObject_(other)) {
if (j$.private.isObject(other)) {
return Object.keys(other).length === 0;
}
return false;

View File

@@ -1,9 +1,9 @@
getJasmineRequireObj().MapContaining = function(j$) {
function MapContaining(sample) {
if (!j$.isMap(sample)) {
if (!j$.private.isMap(sample)) {
throw new Error(
'You must provide a map to `mapContaining`, not ' +
j$.basicPrettyPrinter_(sample)
j$.private.basicPrettyPrinter(sample)
);
}
@@ -11,7 +11,7 @@ getJasmineRequireObj().MapContaining = function(j$) {
}
MapContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
if (!j$.isMap(other)) {
if (!j$.private.isMap(other)) {
return false;
}

View File

@@ -2,15 +2,19 @@ getJasmineRequireObj().NotEmpty = function(j$) {
function NotEmpty() {}
NotEmpty.prototype.asymmetricMatch = function(other) {
if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) {
if (
j$.private.isString(other) ||
j$.private.isArray(other) ||
j$.private.isTypedArray(other)
) {
return other.length !== 0;
}
if (j$.isMap(other) || j$.isSet(other)) {
if (j$.private.isMap(other) || j$.private.isSet(other)) {
return other.size !== 0;
}
if (j$.isObject_(other)) {
if (j$.private.isObject(other)) {
return Object.keys(other).length !== 0;
}

View File

@@ -40,7 +40,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
};
ObjectContaining.prototype.valuesForDiff_ = function(other, pp) {
if (!j$.isObject_(other)) {
if (!j$.private.isObject(other)) {
return {
self: this.jasmineToString(pp),
other: other

View File

@@ -1,9 +1,9 @@
getJasmineRequireObj().SetContaining = function(j$) {
function SetContaining(sample) {
if (!j$.isSet(sample)) {
if (!j$.private.isSet(sample)) {
throw new Error(
'You must provide a set to `setContaining`, not ' +
j$.basicPrettyPrinter_(sample)
j$.private.basicPrettyPrinter(sample)
);
}
@@ -11,7 +11,7 @@ getJasmineRequireObj().SetContaining = function(j$) {
}
SetContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
if (!j$.isSet(other)) {
if (!j$.private.isSet(other)) {
return false;
}

View File

@@ -1,6 +1,6 @@
getJasmineRequireObj().StringContaining = function(j$) {
function StringContaining(expected) {
if (!j$.isString_(expected)) {
if (!j$.private.isString(expected)) {
throw new Error('Expected is not a String');
}
@@ -8,7 +8,7 @@ getJasmineRequireObj().StringContaining = function(j$) {
}
StringContaining.prototype.asymmetricMatch = function(other) {
if (!j$.isString_(other)) {
if (!j$.private.isString(other)) {
// Arrays, etc. don't match no matter what their indexOf returns.
return false;
}

View File

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