Nodejs String Decode decode()

Here you can find the source of decode()

Method Source Code

String.prototype.decode = function () {
    if (!arguments.length)
        return this;

    var result = arguments.length % 2 !== 0 ? arguments[arguments.length - 1] : '';
    for (var i = 0; i < arguments.length; i++) {
        if (this === arguments[i]) {
            result = arguments[i + 1];
            i++;//from  w  ww.  j av a2  s  .  co m
            break;
        }
    }

    return result;
};

Related

  1. decode()
    String.prototype.decode = function() {
      var regExp = "%26#([0-9]*);";
      var thisStr = this;
      while (true) {
        var data = thisStr.match( unescape(regExp) );
        if (!data) break;
        thisStr = thisStr.replace( data[0], String.fromCharCode( data[1] ) );
      return thisStr;
    ...