legal-markdown-js
Version:
Node.js implementation of LegalMarkdown for processing legal documents with markdown and YAML - Complete feature parity with Ruby version
61 lines • 1.91 kB
TypeScript
/**
* Functional Programming Utilities
*
* This module provides functional programming utilities and patterns
* for the Legal Markdown processing system.
*
* Features:
* - Function debouncing for performance optimization
* - Deep object merging for configuration handling
* - Type guards and utility functions
*
* @example
* ```typescript
* import { debounce, deepMerge } from './functional.js';
*
* // Create debounced function
* const debouncedSave = debounce(saveDocument, 300);
*
* // Merge configuration objects
* const config = deepMerge(defaultConfig, userConfig);
* ```
*
* @module
*/
/**
* Creates a debounced version of a function that delays execution
*
* @param {T} func - The function to debounce
* @param {number} wait - The delay in milliseconds
* @returns {Function} The debounced function
* @example
* ```typescript
* const debouncedSave = debounce(saveDocument, 300);
* debouncedSave(content); // Will only execute after 300ms of inactivity
* ```
*/
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
/**
* Performs a deep merge of objects, combining nested properties
*
* @param {T} target - The target object to merge into
* @param {...Partial<T>} sources - The source objects to merge from
* @returns {T} The merged object
* @example
* ```typescript
* const merged = deepMerge(
* { a: { b: 1 } },
* { a: { c: 2 } }
* );
* // Returns: { a: { b: 1, c: 2 } }
* ```
*/
export declare function deepMerge<T extends Record<string, any>>(target: T, ...sources: Partial<T>[]): T;
/**
* Type guard to check if an item is a plain object
*
* @param {any} item - The item to check
* @returns {boolean} True if the item is a plain object, false otherwise
*/
export declare function isObject(item: any): item is Record<string, any>;
//# sourceMappingURL=functional.d.ts.map