is-eq-zero
Version:
Returns true if the given number is 0, false otherwise.
38 lines (29 loc) • 845 B
JavaScript
module.exports = is0;
const isNumber = require('is-number');
const isString = require('is-string');
const isUndefined = require('is-undefined');
const isNull = require('is-null');
global.jQuery = require('jquery');
require('jquery-basic-arithmetic-plugin');
const isTrue = require('is-true');
function is0(x) {
// Check if given object is undefined
if (isUndefined(x)) {
return false;
}
// Check if given object is null
if (isNull(x)) {
return false;
}
// Check if given object is string
if (isString(x)) {
return false;
}
// Check if given object is number
if (!isNumber(x)) {
return false;
}
// Check if given number is 0
return isTrue({result: jQuery.equals(x, 0)}, 'result');
}
;