1. 把一个值转换为数字

      1. const toNumber = (val: any):any => {
      2. const n = parseFloat(val);
      3. return isNaN(n) ? val: n;
      4. }
    2. 执行所有一个数组里的函数

      1. const invokeArrayFns = (fns: Function[], args: any):void => {
      2. for(let i = 0; i < fns.length; i++) {
      3. fns[i](args)
      4. }
      5. }
    3. 常用的类型判断函数

      1. const isFunction = (val: unknown): val is Function => typeof val === 'Function'