UNPKG

@azizbecha/strkit

Version:

strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.

18 lines 562 B
/** * Removes all spaces from a given string. * * This function removes all whitespace characters, including spaces, * tabs, and newlines, from the input string. * * @param str - The input string to process. * @returns The string with all spaces removed. * * @example * removeSpaces('hello world'); // "helloworld" * removeSpaces(' this is a test '); // "thisisatest" * removeSpaces('\nhello\tworld '); // "helloworld" */ export default function removeSpaces(str) { return str.replace(/\s+/g, ''); } //# sourceMappingURL=removeSpaces.js.map