Skip to content

Commit

Permalink
perf(vdom): avoid creating an array in isComplexType
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Aug 7, 2019
1 parent d6eded2 commit fbcd405
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/helpers.ts
Expand Up @@ -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 = <T>(array: T[], prop: ((item: T) => string | number)) => {
return array.slice().sort((a, b) => {
Expand Down

0 comments on commit fbcd405

Please sign in to comment.