oidc-provider
Version:
OAuth 2.0 Authorization Server implementation for Node.js with OpenID Connect
20 lines (16 loc) • 416 B
JavaScript
export default function htmlSafe(input) {
if (typeof input === 'number' && Number.isFinite(input)) {
return `${input}`;
}
if (typeof input === 'string') {
return input.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
if (typeof input === 'boolean') {
return input.toString();
}
return '';
}