Nodejs Hex to Number hexNumber()

Here you can find the source of hexNumber()

Method Source Code

//hex_number should return true if given object is a hexadecimal number, false otherwise.
///*www. j  a  v a 2 s. c  om*/
//Hexadecimal numbers consist of one or more digits from range 0-9 A-F (in any case), optionally prefixed by 0x.

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

Related

  1. hexToNumber()
    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;
      return s;
    ...