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

View File

@@ -87,7 +87,7 @@ describe('Runner', function() {
function arrayNotContaining(item) {
return {
asymmetricMatch(other, matchersUtil) {
if (!jasmine.private.isArray(other)) {
if (!Array.isArray(other)) {
return false;
}

View File

@@ -1,20 +1,4 @@
describe('util', function() {
describe('isArray', function() {
it('should return true if the argument is an array', function() {
expect(privateUnderTest.isArray([])).toBe(true);
expect(privateUnderTest.isArray(['a'])).toBe(true);
});
it('should return false if the argument is not an array', function() {
expect(privateUnderTest.isArray(undefined)).toBe(false);
expect(privateUnderTest.isArray({})).toBe(false);
expect(privateUnderTest.isArray(function() {})).toBe(false);
expect(privateUnderTest.isArray('foo')).toBe(false);
expect(privateUnderTest.isArray(5)).toBe(false);
expect(privateUnderTest.isArray(null)).toBe(false);
});
});
describe('isObject', function() {
it('should return true if the argument is an object', function() {
expect(privateUnderTest.isObject({})).toBe(true);