vegan-ipsum
Version:
Generates passages of vegan-themed placeholder text suitable for use in web pages, graphics, and more. Works in the browser, NodeJS, and React Native.
68 lines (67 loc) • 2.47 kB
TypeScript
import { LoremFormat } from '../constants';
import { default as Generator, GeneratorOptions } from './generator';
/**
* A class for generating vegan ipsum text in various formats and units.
*/
declare class VeganIpsum {
format: LoremFormat;
suffix?: string | undefined;
generator: Generator;
/**
* Creates an instance of the `VeganIpsum` class.
*
* @param {GeneratorOptions} options - Configuration options for the text generator.
* @param {LoremFormat} format - The format of the generated text (e.g., plain or HTML).
* @param {string} [suffix] - A custom line ending or suffix for the generated text.
*
* @throws {Error} If the provided format is invalid.
*/
constructor(options?: GeneratorOptions, format?: LoremFormat, suffix?: string | undefined);
/**
* Determines the appropriate line ending based on the environment and suffix.
*
* @returns {string} The line ending to use.
*/
getLineEnding(): string;
/**
* Formats a single string based on the specified format (e.g., wraps in HTML tags if needed).
*
* @param {string} str - The string to format.
*
* @returns {string} The formatted string.
*/
formatString(str: string): string;
/**
* Formats an array of strings based on the specified format.
*
* @param {string[]} strings - The array of strings to format.
*
* @returns {string[]} The array of formatted strings.
*/
formatStrings(strings: string[]): string[];
/**
* Generates a specified number of words and formats them.
*
* @param {number} [num] - The number of words to generate. If not provided, a random number is used.
*
* @returns {string} A formatted string of generated words.
*/
generateWords(num?: number): string;
/**
* Generates a specified number of sentences and formats them.
*
* @param {number} [num] - The number of sentences to generate. If not provided, a random number is used.
*
* @returns {string} A formatted string of generated sentences.
*/
generateSentences(num?: number): string;
/**
* Generates a specified number of paragraphs and formats them.
*
* @param {number} num - The number of paragraphs to generate.
*
* @returns {string} A formatted string of generated paragraphs.
*/
generateParagraphs(num: number): string;
}
export default VeganIpsum;