Nodejs String to Int Convert to_integer(defaultValue)

Here you can find the source of to_integer(defaultValue)

Method Source Code

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;
};

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_i()
    String.prototype.to_i = function() {
      return parseInt(this,10);