Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Delete goog.isArray.
Browse files Browse the repository at this point in the history
RELNOTES[INC]: goog.isArray has been deleted. Use Array.isArray instead.

PiperOrigin-RevId: 319036229
  • Loading branch information
kjin authored and 12wrigja committed Jul 6, 2020
1 parent bf043b9 commit 5315f7b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 47 deletions.
11 changes: 0 additions & 11 deletions closure/goog/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1328,17 +1328,6 @@ goog.typeOf = function(value) {
};


/**
* Returns true if the specified value is an array.
* @param {?} val Variable to test.
* @return {boolean} Whether variable is an array.
* @deprecated Use Array.isArray instead.
*/
goog.isArray = function(val) {
return Array.isArray(val);
};


/**
* Returns true if the object looks like an array. To qualify as array like
* the value needs to be either a NodeList or an object with a Number length
Expand Down
36 changes: 0 additions & 36 deletions closure/goog/base_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,42 +288,6 @@ testSuite({
// frames.
},

testIsArray() {
const array = [1, 2, 3];
const arrayWithLengthSet = [1, 2, 3];
arrayWithLengthSet.length = 2;
const objWithArrayFunctions = {slice: function() {}, length: 0};
const object = {a: 1, b: 2, c: 3};
const nullVar = null;
let notDefined;
const elem = document.getElementById('elem');
const text = document.getElementById('text').firstChild;
const impostor = document.body.getElementsByTagName('BOGUS');
impostor.push = Array.prototype.push;
impostor.pop = Array.prototype.pop;
impostor.slice = Array.prototype.slice;
impostor.splice = Array.prototype.splice;

assertTrue('array should be an array', goog.isArray(array));
assertTrue(
'arrayWithLengthSet should be an array',
goog.isArray(arrayWithLengthSet));
assertFalse(
'object with array functions should not be an array unless ' +
'length is not enumerable',
goog.isArray(objWithArrayFunctions));
assertFalse('object should not be an array', goog.isArray(object));
assertFalse('null should not be an array', goog.isArray(nullVar));
assertFalse('undefined should not be an array', goog.isArray(notDefined));
assertFalse(
'NodeList should not be an array', goog.isArray(elem.childNodes));
assertFalse('TextNode should not be an array', goog.isArray(text));
assertTrue(
'Array of nodes should be an array',
goog.isArray([elem.firstChild, elem.lastChild]));
assertFalse('An impostor should not be an array', goog.isArray(impostor));
},

testTypeOfAcrossWindow() {
if (userAgent.IE && userAgent.isVersionOrHigher('10') &&
!userAgent.isVersionOrHigher('11')) {
Expand Down

0 comments on commit 5315f7b

Please sign in to comment.