Skip to content
On this page

String

individual package can be found here @riadh-adrani/str-utils.


capitalize()

capitalize the given string.

ts
function capitalize(str: string): string;
  • str : string.

throws when str is not a function.

isEmpty()

checks if a string have no characters.

ts
function isEmpty(value: string): boolean;

isString()

checks if an object is a string.

ts
function isString(o: unknown): boolean;
  • o : object.

isBlank()

checks if a string is blank or not.

a blank string is the one having no characters after being trimmed.

ts
function isBlank(value: string): boolean;
  • value : string.

wrap()

wrap a string.

ts
function wrap(value: string, wrapper: string, wrapperEnd?: string): string;
  • value : string.
  • wrapper : wrapper.
  • wrapperEnd : the end wrapper. by default it takes the value of the wrapper.

ellipsify()

Trim and append ellipsis to the end of a string if the length is superior to the maximum provided.

ts
function ellipsify(text: string, max: number): string;
  • text : input string.
  • max : maximum length.

throws when text is not a string. > throws when max is not a number.

Released under the MIT License.