UNPKG

@utilify/core

Version:

Modern, strongly typed, and safe utility function library for JavaScript and TypeScript. Includes type checking, manipulation of arrays, objects, strings, dates, colors, numbers, regular expressions, and more. Compatible with Browser, Node.js, Deno, and B

19 lines 845 B
/** * Options for the template function. * @property {RegExp} [pattern] - The pattern to match template variables. * @property {(value: string, key: string) => string} [escape] - Function to escape values. */ interface TemplateOptions { pattern?: RegExp; escape?: (value: string, key: string) => string; } /** * Creates a template function that interpolates values into a string. * @param {string} str - The template string. * @param {TemplateOptions} options - Options for interpolation. * @returns {(data: Record<string, any>) => string} The template function. * @throws {TypeError} If str is not a string, pattern is not a RegExp, or escape is not a function. */ export default function template(str: string, options: TemplateOptions): (data: Record<string, any>) => string; export {}; //# sourceMappingURL=template.d.ts.map