All files / _internal getClass.ts

85.71% Statements 6/7
50% Branches 1/2
100% Functions 1/1
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13          2x 222x 222x 222x 222x      
 
/**
 * 判断类型
 * @param params 
 */
export const getClass = (params: unknown): string | null => {
  const str = Object.prototype.toString.call(params);
  const matchResult = /^\[object (.*)\]$/.exec(str);
  Eif (matchResult !== null) {
    return matchResult[1].toLowerCase();
  }
  return null;
}