declare global { interface String { params(vars: Record | any[] | Set | Map): string; params(...vars: any[]): string; } } /** * 添加一个params参数,使字符串可以进行变量插值替换, 基本用法: "this is {a}+{b}".params({a:1,b:2}) --> this is 1+2 "this is {a}+{b}".params(1,2) --> this is 1+2 "this is {}+{}".params([1,2]) --> this is 1+2 字符 当插值中包含非字符时会原样保留原始字符,例如: "this is {(a)}{[b]}".params({a:1,b:2}) --> this is (1)[2] "this is {a}{,b}".params({a:1,b:2}) --> this is 1,2 处理undefined与null 如果插件变量=undefined或null,则不输出插值占位 "this is {(a)}{[b]}".params() --> this is 如果插件变量是一个函数,则会执行 * */ declare function params(str: string, ...args: any): string; export { params };