UNPKG

@ribajs/core

Version:

Core module of Riba.js

17 lines (14 loc) 511 B
import { Formatter } from "../../types/index.js"; // babel misinterprets the "this" fake parameter, so we define it in this interfaces export type FormatterFuntionParam = (this: any, ...args: any[]) => any; /** * Calls a function with arguments * @param fn The function you wish to call * @param args the parameters you wish to call the function with */ export const callFormatter: Formatter = { name: "call", read(fn: FormatterFuntionParam, ...args: any[]) { return fn.apply(this, args); }, };