sanitize
Functions
Function
Description
Example
Description
Usage Examples
HTML Sanitization
// Escape HTML special characters
const userInput = '<script>alert("XSS")</script>';
const safe = dphelper.sanitize.html(userInput);
// Output: "<script>alert("XSS")</script>"
// More examples
const html1 = dphelper.sanitize.html('<div class="test">Hello</div>');
// "<div class="test">Hello</div>"
const html2 = dphelper.sanitize.html('Use <br> for line breaks');
// "Use <br> for line breaks"
const html3 = dphelper.sanitize.html("It's a beautiful day");
// "It's a beautiful day"Display User Content Safely
Form Input Validation
Database Storage
Details
Last updated