Skip to content

Commit

Permalink
perf(): optimize isComplexType
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Aug 9, 2019
1 parent 1aadbed commit a13f45d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export const toTitleCase = (str: string) => str.charAt(0).toUpperCase() + str.sl
export const noop = (): any => { /* noop*/ };

export const isComplexType = (o: any) => {
o = (typeof o)[0];
// https://jsperf.com/typeof-fn-object/5
o = typeof o;
return o === 'o' || o === 'f';
};

Expand Down

0 comments on commit a13f45d

Please sign in to comment.