Nodejs String to Hex Convert hex()

Here you can find the source of hex()

Method Source Code

String.prototype.hex = function() {
   return bigInt(this.substr(0)).toHex()
}

Related

  1. hex10()
    String.prototype.hex10 = function() {
      var x= (/^\#/.test(this))? this.substring(1): this;
      return parseInt(x,16);
    
  2. hex2Dec()
    String.prototype.hex2Dec = function() {
      return parseInt(this,16);
    };
    
  3. toHex()
    String.prototype.toHex = function () {
        var self = this,
            hex, regex = /\(([^)]+)\)/,
            rgb = regex.exec(self)[1].split(','),
            red = parseInt(rgb[0]), 
            green = parseInt(rgb[1]), 
            blue = parseInt(rgb[2]); 
        function toHEX(r, g, b) {
            r = r.toString(16).length ==1 ? r.toString(16)+r.toString(16):r.toString(16);
    ...
    
  4. toHex()
    String.prototype.toHex = function() {
      for (var i = 1, j = this.length, $ = this.charCodeAt(0).toString(16); i<j; i++) $ += ' ' + this.charCodeAt(i).toString(16);
      return $;
    };