UNPKG

fast-string-width

Version:

A fast function for calculating the visual width of a string once printed to the terminal.

15 lines (14 loc) 367 B
/* IMPORT */ import fastStringTruncatedWidth from 'fast-string-truncated-width'; /* HELPERS */ const NO_TRUNCATION = { limit: Infinity, ellipsis: '', ellipsisWidth: 0, }; /* MAIN */ const fastStringWidth = (input, options = {}) => { return fastStringTruncatedWidth(input, NO_TRUNCATION, options).width; }; /* EXPORT */ export default fastStringWidth;