Nodejs String to Int Convert to_i()

Here you can find the source of to_i()

Method Source Code

String.prototype.to_i = function() {
   // MUST add the radix as parsing dates gives leading 0s with will cause it to be octal.
   return parseInt(this,10);
}

Related

  1. to_i()
    String.prototype.to_i = function (){
      return parseInt(this);
    function barInterval (){
      if (this.justStarted) {
        this.justStarted = false;
        return 0;
      } else {
        return this.meter.beat/this.meter.value*noteLength.call(this, 1);
    ...
    
  2. to_i()
    String.prototype.to_i = function () {
      return parseInt(this.valueOf());
    };
    
  3. to_integer(defaultValue)
    String.prototype.to_integer = function(defaultValue)
        var r = parseInt(this);
        if (r||r==0) return r;
        else if(defaultValue||defaultValue==0) return defaultValue;
        else return null;
    };