Replace isArray helper with native Array.isArray

This commit is contained in:
Steve Gravrock
2025-11-28 08:09:51 -08:00
parent 4371081763
commit f5e9b61f73
12 changed files with 27 additions and 63 deletions
@@ -6,7 +6,7 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
}
ArrayContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
if (!j$.private.isArray(this.sample)) {
if (!Array.isArray(this.sample)) {
throw new Error(
'You must provide an array to arrayContaining, not ' +
j$.private.basicPrettyPrinter(this.sample) +
@@ -17,7 +17,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$.private.isArray(other) && this.sample.length > 0) {
if (!Array.isArray(other) && this.sample.length > 0) {
return false;
}
@@ -9,7 +9,7 @@ getJasmineRequireObj().ArrayWithExactContents = function(j$) {
other,
matchersUtil
) {
if (!j$.private.isArray(this.sample)) {
if (!Array.isArray(this.sample)) {
throw new Error(
'You must provide an array to arrayWithExactContents, not ' +
j$.private.basicPrettyPrinter(this.sample) +
+1 -1
View File
@@ -6,7 +6,7 @@ getJasmineRequireObj().Empty = function(j$) {
Empty.prototype.asymmetricMatch = function(other) {
if (
j$.private.isString(other) ||
j$.private.isArray(other) ||
Array.isArray(other) ||
j$.private.isTypedArray(other)
) {
return other.length === 0;
+1 -1
View File
@@ -6,7 +6,7 @@ getJasmineRequireObj().NotEmpty = function(j$) {
NotEmpty.prototype.asymmetricMatch = function(other) {
if (
j$.private.isString(other) ||
j$.private.isArray(other) ||
Array.isArray(other) ||
j$.private.isTypedArray(other)
) {
return other.length !== 0;