From 7b5b24bd73a9a54e9854c470b47b9e18c7b37b95 Mon Sep 17 00:00:00 2001 From: Scott Newcomer Date: Thu, 15 Oct 2020 07:50:02 -0500 Subject: [PATCH 1/3] [Bug]: use isArray for better Ember Array detection --- addon/utils/is-object.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addon/utils/is-object.js b/addon/utils/is-object.js index 86b62f59..e324ac02 100644 --- a/addon/utils/is-object.js +++ b/addon/utils/is-object.js @@ -1,9 +1,10 @@ +import { isArray } from '@ember/array'; + export default function isObject(val) { return ( val !== null && typeof val === 'object' && !(val instanceof Date || val instanceof RegExp) && - !Array.isArray(val) && - !val.toArray + !isArray(val) ); } From 7360d817d8c2e982a6e660506e8bf80f98cb3d48 Mon Sep 17 00:00:00 2001 From: Scott Newcomer Date: Thu, 15 Oct 2020 09:45:20 -0500 Subject: [PATCH 2/3] add comment; --- addon/utils/is-object.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addon/utils/is-object.js b/addon/utils/is-object.js index e324ac02..69da6685 100644 --- a/addon/utils/is-object.js +++ b/addon/utils/is-object.js @@ -1,5 +1,9 @@ import { isArray } from '@ember/array'; +/** + * Employ Ember strategies for isObject detection + * @method isObject + */ export default function isObject(val) { return ( val !== null && From 10477ff5cc7715e339ed30b63489f471e0133b84 Mon Sep 17 00:00:00 2001 From: Scott Newcomer Date: Thu, 15 Oct 2020 21:08:00 -0500 Subject: [PATCH 3/3] fix lint --- addon/utils/is-object.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/addon/utils/is-object.js b/addon/utils/is-object.js index 69da6685..7609faa3 100644 --- a/addon/utils/is-object.js +++ b/addon/utils/is-object.js @@ -5,10 +5,5 @@ import { isArray } from '@ember/array'; * @method isObject */ export default function isObject(val) { - return ( - val !== null && - typeof val === 'object' && - !(val instanceof Date || val instanceof RegExp) && - !isArray(val) - ); + return val !== null && typeof val === 'object' && !(val instanceof Date || val instanceof RegExp) && !isArray(val); }