import { type Fns } from '../../mod.js'; /** ## functor : 函数解析器,用于简化函数调用 - 启发于Swift的闭包简写,可以将函数表达式转换为函数对象,并且可以传入参数 ; 将难看的闭包调用转换为简单的字符串表达式,增加代码可读性 @example ```ts // 1. 简单的函数调用 const Arr = [1, 2, 3, 4] const val = 1 const res = Arr.map(functor`$0+${val}`) assertEquals(res, [2, 3, 4, 5]) // 2. 函数嵌套 const res1 = pipe( 1, functor`$0*2`, functor`{name:'jiojio',age:$0}`, functor`{ result: $0 }` ) assertEquals(res1, { result: { name: 'jiojio', age: 2 } }) // 3. 类型提示 const user = { info: { name: 'jiojio', age: 18, address: { before: 'ZXaaa', now: 'xxxUAaaa', }, }, } const now_address = pipe(user, functor`${($0 as typeof user).info.address.now}`) assertEquals(now_address, 'xxxUAaaa') ``` */ export declare const functor: (strings: TemplateStringsArray, ...args: any[]) => Fns; //# sourceMappingURL=functor.d.ts.map