UNPKG

legal-markdown-js

Version:

Node.js implementation of LegalMarkdown for processing legal documents with markdown and YAML - Complete feature parity with Ruby version

168 lines 6.64 kB
/** * @fileoverview Extensions Helpers Module - Node.js Enhancements * * This module provides advanced helper functions that extend beyond the basic * functionality of the original Ruby legal-markdown. These are Node.js specific * enhancements for complex document processing and formatting. * * Extended helpers include: * - Advanced date manipulation and formatting * - Currency and number formatting utilities * - String manipulation and text processing * - Legal document specific formatting functions * * For basic Ruby-compatible helpers, see src/core/helpers/ * * @example * ```typescript * import { formatCurrency, addYears, capitalize } from '@extensions/helpers'; * * // Advanced functionality not in Ruby legal-markdown * const price = formatCurrency(1234.56, 'USD'); * const futureDate = addYears(new Date(), 5); * const title = capitalize('legal document'); * ``` */ export * from './advanced-date-helpers'; export * from './number-helpers'; export * from './string-helpers'; import { addYears, addMonths, addDays, formatDate } from './advanced-date-helpers'; import { formatInteger, formatPercent, formatCurrency, formatEuro, formatDollar, formatPound, numberToWords, round } from './number-helpers'; import { capitalize, capitalizeWords, upper, lower, titleCase, kebabCase, snakeCase, camelCase, pascalCase, truncate, clean, pluralize, padStart, padEnd, contains, replaceAll, initials } from './string-helpers'; /** * Registry of extension helper functions for template processing * * This object provides all the advanced helper functions that extend * beyond the Ruby legal-markdown capabilities. It includes the complete * set of Node.js specific enhancements for document processing. * * {Object} extensionHelpers * @example * ```typescript * import { extensionHelpers } from '@extensions/helpers'; * * // Use advanced helpers in template processing * const currency = extensionHelpers.formatCurrency(1000, 'EUR'); * const future = extensionHelpers.addYears(new Date(), 3); * const title = extensionHelpers.titleCase('document title'); * ``` */ export declare const extensionHelpers: { addYears: typeof addYears; addMonths: typeof addMonths; addDays: typeof addDays; formatDate: typeof formatDate; DateFormats: { readonly LEGAL: "Do day of MMMM, YYYY"; readonly FORMAL: "dddd, MMMM Do, YYYY"; readonly SPANISH: "D de MMMM_ES de YYYY"; readonly US: "MM/DD/YYYY"; readonly EU: "DD/MM/YYYY"; readonly ISO: "YYYY-MM-DD"; readonly LONG: "MMMM D, YYYY"; readonly SHORT: "MMM D, YYYY"; readonly YEAR: "YYYY"; readonly MONTH_YEAR: "MMMM YYYY"; }; formatInteger: typeof formatInteger; formatPercent: typeof formatPercent; formatCurrency: typeof formatCurrency; formatEuro: typeof formatEuro; formatDollar: typeof formatDollar; formatPound: typeof formatPound; numberToWords: typeof numberToWords; round: typeof round; capitalize: typeof capitalize; capitalizeWords: typeof capitalizeWords; upper: typeof upper; lower: typeof lower; titleCase: typeof titleCase; kebabCase: typeof kebabCase; snakeCase: typeof snakeCase; camelCase: typeof camelCase; pascalCase: typeof pascalCase; truncate: typeof truncate; clean: typeof clean; pluralize: typeof pluralize; padStart: typeof padStart; padEnd: typeof padEnd; contains: typeof contains; replaceAll: typeof replaceAll; initials: typeof initials; }; /** * Combined helpers registry including both core and extension helpers * * This provides a unified interface to all helper functions, combining * the Ruby-compatible core helpers with the Node.js extension helpers. * Extension helpers take precedence over core helpers when there are conflicts. * * {Object} allHelpers * @example * ```typescript * import { allHelpers } from '@extensions/helpers'; * * // Access any helper function through unified interface * const today = allHelpers.today(); // from core * const formatted = allHelpers.formatDate(today, 'MMMM Do, YYYY'); // from extensions * const currency = allHelpers.formatCurrency(100, 'USD'); // from extensions * ``` */ export declare const allHelpers: { addYears: typeof addYears; addMonths: typeof addMonths; addDays: typeof addDays; formatDate: typeof formatDate; DateFormats: { readonly LEGAL: "Do day of MMMM, YYYY"; readonly FORMAL: "dddd, MMMM Do, YYYY"; readonly SPANISH: "D de MMMM_ES de YYYY"; readonly US: "MM/DD/YYYY"; readonly EU: "DD/MM/YYYY"; readonly ISO: "YYYY-MM-DD"; readonly LONG: "MMMM D, YYYY"; readonly SHORT: "MMM D, YYYY"; readonly YEAR: "YYYY"; readonly MONTH_YEAR: "MMMM YYYY"; }; formatInteger: typeof formatInteger; formatPercent: typeof formatPercent; formatCurrency: typeof formatCurrency; formatEuro: typeof formatEuro; formatDollar: typeof formatDollar; formatPound: typeof formatPound; numberToWords: typeof numberToWords; round: typeof round; capitalize: typeof capitalize; capitalizeWords: typeof capitalizeWords; upper: typeof upper; lower: typeof lower; titleCase: typeof titleCase; kebabCase: typeof kebabCase; snakeCase: typeof snakeCase; camelCase: typeof camelCase; pascalCase: typeof pascalCase; truncate: typeof truncate; clean: typeof clean; pluralize: typeof pluralize; padStart: typeof padStart; padEnd: typeof padEnd; contains: typeof contains; replaceAll: typeof replaceAll; initials: typeof initials; }; /** * Extension helper function names for validation and processing * * List of helper function names that are part of the Node.js extension * functionality. Used for validating template expressions and determining * which helpers are available in extension processing. * * {string[]} EXTENSION_HELPER_NAMES */ export declare const EXTENSION_HELPER_NAMES: readonly ["addYears", "addMonths", "addDays", "formatDate", "formatInteger", "formatPercent", "formatCurrency", "formatEuro", "formatDollar", "formatPound", "numberToWords", "round", "capitalize", "capitalizeWords", "upper", "lower", "titleCase", "kebabCase", "snakeCase", "camelCase", "pascalCase", "truncate", "clean", "pluralize", "padStart", "padEnd", "contains", "replaceAll", "initials"]; /** * Type definition for extension helper function names */ export type ExtensionHelperName = (typeof EXTENSION_HELPER_NAMES)[number]; //# sourceMappingURL=index.d.ts.map