Update proto

This commit is contained in:
Nicolas Dextraze
2017-10-17 14:31:26 -07:00
parent 18e35c56f9
commit 990351738c
8 changed files with 11403 additions and 10741 deletions

View File

@ -1,3 +1,5 @@
var Long = require('long');
module.exports.notNullOrEmpty = function(value, name) {
if (value === null)
throw new TypeError(name + " should not be null.");
@ -10,11 +12,19 @@ module.exports.notNull = function(value, name) {
throw new TypeError(name + " should not be null.");
};
module.exports.isInteger = function(value, name) {
module.exports.isInteger = function isInteger(value, name) {
if (typeof value !== 'number' || value % 1 !== 0)
throw new TypeError(name + " should be an integer.");
};
module.exports.isLongOrInteger = function(value, name) {
if (typeof value === 'number') {
return isInteger(value, name);
} else if (!Long.isLong(value)) {
throw new TypeError(name + " should be a Long|number.");
}
};
module.exports.isArrayOf = function(expectedType, value, name) {
if (!Array.isArray(value))
throw new TypeError(name + " should be an array.");