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.

31 lines 1.03 kB
/** * 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" */ (function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = removeSpaces; function removeSpaces(str) { return str.replace(/\s+/g, ''); } }); //# sourceMappingURL=removeSpaces.js.map