[gjs/ewlsh/whatwg-timers: 1/3] maint: Prefer Array.isArray rather than instanceof Array
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/ewlsh/whatwg-timers: 1/3] maint: Prefer Array.isArray rather than instanceof Array
- Date: Fri, 14 Jan 2022 20:27:52 +0000 (UTC)
commit 8ff33118145f7f1a6e31f62da230292606c014c5
Author: Evan Welsh <contact evanwelsh com>
Date: Fri Jan 14 12:08:28 2022 -0800
maint: Prefer Array.isArray rather than instanceof Array
installed-tests/js/testGLib.js | 2 +-
installed-tests/js/testLegacyClass.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/installed-tests/js/testGLib.js b/installed-tests/js/testGLib.js
index d8c80a34..4e6ee4a9 100644
--- a/installed-tests/js/testGLib.js
+++ b/installed-tests/js/testGLib.js
@@ -34,7 +34,7 @@ describe('GVariant constructor', function () {
expect(unpacked[2]).toEqual('asig');
expect(unpacked[3] instanceof GLib.Variant).toBeTruthy();
expect(unpacked[3].deepUnpack()).toEqual('variant');
- expect(unpacked[4] instanceof Array).toBeTruthy();
+ expect(Array.isArray(unpacked[4])).toBeTruthy();
expect(unpacked[4].length).toEqual(2);
});
diff --git a/installed-tests/js/testLegacyClass.js b/installed-tests/js/testLegacyClass.js
index 4ca1c242..44543027 100644
--- a/installed-tests/js/testLegacyClass.js
+++ b/installed-tests/js/testLegacyClass.js
@@ -326,7 +326,7 @@ describe('Class framework', function () {
let instance = new CustomConstruct(1, 2);
- expect(instance instanceof Array).toBeTruthy();
+ expect(Array.isArray(instance)).toBeTruthy();
expect(instance instanceof CustomConstruct).toBeFalsy();
expect(instance).toEqual([1, 2]);
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]