UNPKG

stringzy

Version:

A versatile string manipulation library providing a range of text utilities for JavaScript and Node.js applications.

13 lines (12 loc) 447 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.removeSpecialChars = removeSpecialChars; function removeSpecialChars(text, replacement = '') { if (typeof text !== "string") { throw new Error("Invalid argument. Expected a string."); } if (typeof replacement !== "string") { throw new Error("Replacement must be a string."); } return text.replace(/[^\w\s]/gi, replacement); }