JAVASCRIPT   685

unescapeHtml.js

Guest on 27th August 2021 01:30:34 AM

  1. define(['../lang/toString'], function (toString) {
  2.  
  3.     /**
  4.      * Unescapes HTML special chars
  5.      */
  6.     function unescapeHtml(str){
  7.         str = toString(str)
  8.             .replace(/&/g , '&')
  9.             .replace(/&lt;/g  , '<')
  10.             .replace(/&gt;/g  , '>')
  11.             .replace(/&#39;/g , "'")
  12.             .replace(/&quot;/g, '"');
  13.         return str;
  14.     }
  15.  
  16.     return unescapeHtml;
  17.  
  18. });

Raw Paste


Login or Register to edit or fork this paste. It's free.