json-rpc-protocol
Version:
JSON-RPC 2 protocol messages parsing and formatting
23 lines • 961 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.isObject = exports.isString = exports.isInteger = exports.isNumber = void 0;
var negativeInf = Number.NEGATIVE_INFINITY;
var positiveInf = Number.POSITIVE_INFINITY;
// ===================================================================
exports.isNumber = function (value) {
var type = typeof value;
return type === 'number' && value > negativeInf && value < positiveInf;
};
// -------------------------------------------------------------------
exports.isInteger = function (value) {
return exports.isNumber(value) && value % 1 === 0;
};
// -------------------------------------------------------------------
exports.isString = function (value) {
return typeof value === 'string';
};
exports.isObject = function (value) {
var type = typeof value;
return value !== null && (type === 'object' || type === 'function');
};
//# sourceMappingURL=types.js.map
;