spws
Version:
SharePoint Web Services Wrapper
29 lines • 938 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @name escapeHtml
* @description Escaping HTML is required when sending data to a SharePoint via a web request.
* @param {String} string The string to be escaped.
* @return {String} Returns a string with escaped HTML
* @example
* import escapeHtml from "objectpoint-ui/lib/utils/escapeHtml";
*
* // Escape the & (ampersand) in the string
* escapeHtml("Operations & Development")
*
* // Returns
* "Operations & Development"
*/
var escapeXml = function (xml) {
// If not a string, cast to string
if (typeof xml === "number")
xml = xml.toString();
return xml
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
};
exports.default = escapeXml;
//# sourceMappingURL=escapeXml.js.map