Nodejs Hex to Number hexToNumber()

Here you can find the source of hexToNumber()

Method Source Code

String.prototype.hexToNumber = function(){
   return Number(parseInt( this, 16 ));
};

Number.prototype.toBinaryString = function( length ){
   var s = Number(this).toString( 2 );
   while( length && s.length < length ){
      s = '0' + s;
   }/*from w  w w  .j  a  v a  2  s. c o m*/
   return s;
};

Number.prototype.toHexString = function( length ){
   var s = Number(this).toString( 16 );
   while( length && s.length < length ){
      s = '0' + s;
   }
   return s;
};

Number.prototype.truncate = function( length ){
   return this & ( ~( (-1) << length ) ); 
};

Related

  1. hexNumber()
    String.prototype.hexNumber = function() {
      return /^(0x)?[0-9a-f]*$/i.test(this);
    };