How to use the isNumber function from underscore

Find comprehensive JavaScript underscore.isNumber code examples handpicked from public code repositorys.

10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
  return isFinite(obj) && !isNaN(parseFloat(obj));
};

// Is the given value `NaN`? (NaN is the only number which does not equal itself).
_.isNaN = function(obj) {
  return _.isNumber(obj) && obj !== +obj;
};

// Is a given value a boolean?
_.isBoolean = function(obj) {
fork icon1
star icon1
watch icon2

+ 9 other calls in file

2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
  return isFinite(obj) && !isNaN(parseFloat(obj));
};

// Is the given value `NaN`? (NaN is the only number which does not equal itself).
_.isNaN = function(obj) {
  return _.isNumber(obj) && obj != +obj;
};

// Is a given value a boolean?
_.isBoolean = function(obj) {
fork icon0
star icon2
watch icon0

71
72
73
74
75
76
77
78
79
80
      return _.isObject(obj);
    });
  };
  break;
case 'stringOrNumber':
  validator = value => (_.isString(value) && !_.isEmpty(value)) || _.isNumber(value);
  break;
case 'buttons':
  validator = function(value) {
    return _.isArray(value) && !_.isEmpty(value) && _(value).all(function(button) {
fork icon0
star icon1
watch icon1

172
173
174
175
176
177
178
179
180
181
const renderItem = (item, language) => {
  if (_.isString(item)) {
    return renderString(item, language);
  } else if (!options.preserveNumbers && _.isNumber(item)) {
    return renderString(String(item), language);
  } else if (options.preserveNumbers && _.isNumber(item)) {
    return item;
  } else if (_.isArray(item)) {
    return renderArray(item, language);
  } else if (item instanceof Buffer) {
fork icon0
star icon1
watch icon1

107
108
109
110
111
112
113
114
115
116
117
118
119


var formatNumber = function(num){
    if(_.isUndefined(num) || num == 0)
        num = '00';


    if(_.isString(num) || _.isNumber(num))
        num = new BigNumber(String(num));


    if(isBigNumber(num))
        num = num.toString(16);
fork icon0
star icon0
watch icon1

65
66
67
68
69
70
71
72
73
74
75
        this.c3.load({
            columns: [['data', data * 100]],
        });
    }
    static isValid(data) {
        return _.isNumber(data) && (data <= 1);
    }
}


class BarDataView extends C3DataView {
fork icon0
star icon0
watch icon2

+ 2 other calls in file