rich-domain
Version:
This package provide utils file and interfaces to assistant build a complex application with domain driving design
27 lines • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RemoveSpaces = void 0;
const remove_chars_util_1 = require("./remove-chars.util");
/**
* @description Removes all spaces from a given string. It utilizes the `RemoveChars` utility function,
* passing a condition to identify spaces as the characters to remove.
*
* @param target The input string from which spaces will be removed.
*
* @returns A new string with all spaces removed. If the input is not a valid string, it will return the input as is.
*
* @example
* ```typescript
* const result = RemoveSpaces("Hello, World!");
* console.log(result); // "Hello,World!"
*
* const anotherResult = RemoveSpaces(" Open AI ");
* console.log(anotherResult); // "OpenAI"
* ```
*/
const RemoveSpaces = (target) => {
return (0, remove_chars_util_1.default)(target, (char) => char === ' ');
};
exports.RemoveSpaces = RemoveSpaces;
exports.default = exports.RemoveSpaces;
//# sourceMappingURL=remove-spaces.util.js.map