escape-attribute.js
 1  /**
 2   * Escapes characters that can not be in an XML attribute.
 3   */
 4  function escapeAttribute(value) {
 5      return value.replace(/&/g, '&amp;').replace(/'/g, '&apos;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
 6  }
 7  
 8  /**
 9   * @api private
10   */
11  module.exports = {
12      escapeAttribute: escapeAttribute
13  };