How to structure utility class

前端 未结 5 749
深忆病人
深忆病人 2020-12-12 19:48

I have several utility functions. What is the best way to package these up, and then import them?

This is what I am trying to do:

import * as util f         


        
5条回答
  •  盖世英雄少女心
    2020-12-12 20:13

    Or you could export is as an object literal:

    export const Util = {
        doSomething(val: string){ return val;},
        doSomethingElse(val: string{ return val;}
    }
    

提交回复
热议问题