Nodejs String Encode encode()

Here you can find the source of encode()

Method Source Code

String.prototype.encode = function() {
    //  w ww  .  j  a v  a2  s .co m
    return encodeURIComponent( String( this ) );
};

Related

  1. encode()
    String.prototype.encode = function() {
      var reference = "abcdefghijklmnopqrstuvwxyz !'.?;,";
      var encoding = ",;?.'! zyxwvutsrqponmlkjihgfedcba";
      var input = this.valueOf().toLowerCase();
      var output = "";
      var n, p;
      for (n=0; n<input.length; n++) {
        p = reference.indexOf(input.charAt(n));
        output += encoding.charAt(p);
    ...
    
  2. encode(str)
    String.prototype.encode = function(str) {
      var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
      var encoded = [];
      var c = 0;
      while (c < str.length) {
          var b0 = str.charCodeAt(c++);
          var b1 = str.charCodeAt(c++);
          var b2 = str.charCodeAt(c++);
          var buf = (b0 << 16) + ((b1 || 0) << 8) + (b2 || 0);
    ...