squarier
Version:
This package can help you format text in a square like manner.
24 lines (23 loc) • 659 B
TypeScript
declare type PadOptions = {
/**
* the symbol to pad the string with
*/
symbol: string;
/**
* pad mode `before`, `after` or `balanced`.
*/
mode: 'after' | 'before' | 'balanced';
/**
* if true add padding up to `len`.
*
* e.g.
*
* `pad("ariel", 7, {symbol: '_', include: true, mode: 'after'})` => `"ariel__"` (only 2 symbol added)
*
* `pad("ariel", 7, {symbol: '_', include: false, mode:'after'})` => `"ariel_______"` (all 7 symbol added)
*
*/
include: boolean;
};
declare function pad(str: string, len: number, options?: Partial<PadOptions>): string;
export default pad;