| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -253,6 +253,9 @@ string.js - Copyright (C) 2012-2014, JP Richardson <jprichardson@gmail.com> | |||
| 253 | 253 | }, | |
| 254 | 254 | ||
| 255 | 255 | escapeHTML: function() { //from underscore.string | |
| 256 | + if (!this.s) { | ||
| 257 | + return new this.constructor(this.s) | ||
| 258 | + } | ||
| 256 | 259 | return new this.constructor(this.s.replace(/[&<>"']/g, function(m){ return '&' + reversedEscapeChars[m] + ';'; })); | |
| 257 | 260 | }, | |
| 258 | 261 | ||
@@ -512,6 +515,9 @@ string.js - Copyright (C) 2012-2014, JP Richardson <jprichardson@gmail.com> | |||
| 512 | 515 | }, | |
| 513 | 516 | ||
| 514 | 517 | stripTags: function() { //from sugar.js | |
| 518 | + if (!this.s) { | ||
| 519 | + return new this.constructor(this.s) | ||
| 520 | + } | ||
| 515 | 521 | var s = this.s, args = arguments.length > 0 ? arguments : ['']; | |
| 516 | 522 | multiArgs(args, function(tag) { | |
| 517 | 523 | s = s.replace(RegExp('<\/?' + tag + '[^<>]*>', 'gi'), ''); | |
@@ -576,6 +582,9 @@ string.js - Copyright (C) 2012-2014, JP Richardson <jprichardson@gmail.com> | |||
| 576 | 582 | }, | |
| 577 | 583 | ||
| 578 | 584 | trim: function() { | |
| 585 | + if (!this.s) { | ||
| 586 | + return new this.constructor(this.s) | ||
| 587 | + } | ||
| 579 | 588 | var s; | |
| 580 | 589 | if (typeof __nsp.trim === 'undefined') | |
| 581 | 590 | s = this.s.replace(/(^\s*|\s*$)/g, '') | |
@@ -697,6 +706,9 @@ string.js - Copyright (C) 2012-2014, JP Richardson <jprichardson@gmail.com> | |||
| 697 | 706 | }, | |
| 698 | 707 | ||
| 699 | 708 | unescapeHTML: function() { //from underscore.string | |
| 709 | + if (!this.s) { | ||
| 710 | + return new this.constructor(this.s) | ||
| 711 | + } | ||
| 700 | 712 | return new this.constructor(this.s.replace(/\&([^;]+);/g, function(entity, entityCode){ | |
| 701 | 713 | var match; | |
| 702 | 714 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments