input-cleaner
v1.0.0
Published
A simple input cleaner.
Downloads
1
Readme
A simple input cleaner. Remove trailing and leading whitespace, escape HTML characters, and limit the string length (defaults to 25).
Example usage:
const userInput = " <script>alert('XSS!')</script> ";
const { trimmed, escaped, limited } = InputCleaner(userInput, 20);
console.log("Trimmed:", trimmed); // "<script>alert('XSS!')</script>"
console.log("Escaped:", escaped); // "<script>alert('XSS!')</script>"
console.log("Limited:", limited); // "<script>alert('"