UNPKG

tastypie

Version:

Tastypie is a webservice API framework for Node.js based on Django's Tastypie Framework. It provides a convenient, yet powerful and highly customizable, abstraction for creating REST-style interfaces

19 lines (14 loc) 410 B
var toString = require('../lang/toString'); /** * Escapes a string for insertion into HTML. */ function escapeHtml(str){ str = toString(str) .replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/'/g, '&#39;') .replace(/"/g, '&quot;'); return str; } module.exports = escapeHtml;