From fbcd405e64455beac3a9c075d516223939e6ce2c Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Wed, 7 Aug 2019 20:32:40 +0200 Subject: [PATCH] perf(vdom): avoid creating an array in isComplexType --- src/utils/helpers.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index dc80cf3547f..7448d08116b 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -13,7 +13,10 @@ export const toTitleCase = (str: string) => str.charAt(0).toUpperCase() + str.sl export const noop = (): any => { /* noop*/ }; -export const isComplexType = (o: any) => ['object', 'function'].includes(typeof o); +export const isComplexType = (o: any) => { + o = (typeof o)[0]; + return o === 'o' || o === 'f'; +}; export const sortBy = (array: T[], prop: ((item: T) => string | number)) => { return array.slice().sort((a, b) => {