@pho9ubenaa/remark-mask-text-beta
Version:
A remark plugin to mask text content with block characters
43 lines (42 loc) • 1.36 kB
TypeScript
import type { RemarkMaskTextOptions } from "./types/index.js";
import remarkMaskText from "../index.js";
export type Options = RemarkMaskTextOptions;
/**
* Type-safe helper for creating remark-mask-text plugin configurations
*
* This function ensures that the options object contains only valid
* properties, providing compile-time type checking and auto-completion.
*
* @example
* const remarkPlugins = [
* createMaskTextPlugin({
* maskCharacter: '*',
* maskDelimiter: '||',
* // test: 'invalid' // ❌ TypeScript error
* })
* ];
*/
export declare function createMaskTextPlugin(options?: Options): [typeof remarkMaskText, Options | undefined];
/**
* Type guard to ensure options are valid
*
* @example
* const config = { maskCharacter: '*', test: 'invalid' };
* if (isValidMaskTextOptions(config)) {
* // config is now typed as Options
* }
*/
export declare function isValidMaskTextOptions(obj: unknown): obj is Options;
/**
* Strict options factory that prevents extra properties at compile time
*
* @example
* const options = createStrictOptions({
* maskCharacter: '*',
* maskDelimiter: '||',
* // test: 'invalid' // ❌ TypeScript error
* });
*/
export declare function createStrictOptions<T extends Options>(options: T & {
[K in keyof T]: K extends keyof Options ? T[K] : never;
}): Options;