Skip to content

Commit fbcd405

Browse files
committed
perf(vdom): avoid creating an array in isComplexType
1 parent d6eded2 commit fbcd405

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/utils/helpers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ export const toTitleCase = (str: string) => str.charAt(0).toUpperCase() + str.sl
1313

1414
export const noop = (): any => { /* noop*/ };
1515

16-
export const isComplexType = (o: any) => ['object', 'function'].includes(typeof o);
16+
export const isComplexType = (o: any) => {
17+
o = (typeof o)[0];
18+
return o === 'o' || o === 'f';
19+
};
1720

1821
export const sortBy = <T>(array: T[], prop: ((item: T) => string | number)) => {
1922
return array.slice().sort((a, b) => {

0 commit comments

Comments
 (0)