Truncates the given string if it's longer than the given maximum string length.
Syntax
TypeScript
import { truncate } from '@opentf/std'; truncate( str: string, length = 30, omission = '...' ): string;
length must be a non-negative finite integer.
Examples
TypeScript
truncate('hi-package', 8) //=> 'hi-pa...' truncate('hi-package', 5, '---') //=> 'hi---'