@liskhq/lisk-validator
Advanced tools
Comparing version 0.5.0 to 0.5.1
export declare const hex: (data: unknown) => boolean; | ||
export declare const bytes: (data: unknown) => boolean; | ||
export declare const int64: (data: string) => boolean; | ||
@@ -3,0 +4,0 @@ export declare const uint64: (data: string) => boolean; |
@@ -5,2 +5,3 @@ "use strict"; | ||
exports.hex = validation_1.isHexString; | ||
exports.bytes = validation_1.isBytes; | ||
exports.int64 = (data) => validation_1.isNumberString(data) && validation_1.isSInt64(BigInt(data)); | ||
@@ -7,0 +8,0 @@ exports.uint64 = (data) => validation_1.isNumberString(data) && validation_1.isUInt64(BigInt(data)); |
import { gte as isVersionGte, gtr as isGreaterThanVersionInRange, ltr as isLessThanVersionInRange } from 'semver'; | ||
export declare const isNumberString: (num: unknown) => boolean; | ||
export declare const isString: (data: unknown) => boolean; | ||
export declare const isBoolean: (data: unknown) => boolean; | ||
export declare const isSInt32: (data: unknown) => boolean; | ||
export declare const isUInt32: (data: unknown) => boolean; | ||
export declare const isSInt64: (data: unknown) => boolean; | ||
export declare const isUInt64: (data: unknown) => boolean; | ||
export declare const isBytes: (data: unknown) => boolean; | ||
export declare const isValidInteger: (num: unknown) => boolean; | ||
@@ -18,8 +25,1 @@ export declare const isHexString: (data: unknown) => boolean; | ||
export declare const isCsv: (data: string) => boolean; | ||
export declare const isString: (data: unknown) => boolean; | ||
export declare const isBoolean: (data: unknown) => boolean; | ||
export declare const isSInt32: (data: unknown) => boolean; | ||
export declare const isUInt32: (data: unknown) => boolean; | ||
export declare const isSInt64: (data: unknown) => boolean; | ||
export declare const isUInt64: (data: unknown) => boolean; | ||
export declare const isBytes: (data: unknown) => boolean; |
@@ -12,2 +12,19 @@ "use strict"; | ||
}; | ||
exports.isString = (data) => typeof data === 'string'; | ||
exports.isBoolean = (data) => typeof data === 'boolean'; | ||
exports.isSInt32 = (data) => { | ||
if (typeof data === 'number' && Number.isInteger(data)) { | ||
return data <= constants_1.MAX_SINT32 && data >= constants_1.MIN_SINT32; | ||
} | ||
return false; | ||
}; | ||
exports.isUInt32 = (data) => { | ||
if (typeof data === 'number' && Number.isInteger(data)) { | ||
return data <= constants_1.MAX_UINT32 && data >= 0; | ||
} | ||
return false; | ||
}; | ||
exports.isSInt64 = (data) => typeof data === 'bigint' ? data <= constants_1.MAX_SINT64 && data >= constants_1.MIN_SINT64 : false; | ||
exports.isUInt64 = (data) => typeof data === 'bigint' ? data <= constants_1.MAX_UINT64 && data >= BigInt(0) : false; | ||
exports.isBytes = (data) => Buffer.isBuffer(data); | ||
exports.isValidInteger = (num) => typeof num === 'number' ? Math.floor(num) === num : false; | ||
@@ -50,19 +67,2 @@ exports.isHexString = (data) => { | ||
}; | ||
exports.isString = (data) => typeof data === 'string'; | ||
exports.isBoolean = (data) => typeof data === 'boolean'; | ||
exports.isSInt32 = (data) => { | ||
if (typeof data === 'number' && Number.isInteger(data)) { | ||
return data <= constants_1.MAX_SINT32 && data >= constants_1.MIN_SINT32; | ||
} | ||
return false; | ||
}; | ||
exports.isUInt32 = (data) => { | ||
if (typeof data === 'number' && Number.isInteger(data)) { | ||
return data <= constants_1.MAX_UINT32 && data >= 0; | ||
} | ||
return false; | ||
}; | ||
exports.isSInt64 = (data) => typeof data === 'bigint' ? data <= constants_1.MAX_SINT64 && data >= constants_1.MIN_SINT64 : false; | ||
exports.isUInt64 = (data) => typeof data === 'bigint' ? data <= constants_1.MAX_UINT64 && data >= BigInt(0) : false; | ||
exports.isBytes = (data) => Buffer.isBuffer(data); | ||
//# sourceMappingURL=validation.js.map |
{ | ||
"name": "@liskhq/lisk-validator", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Validation library according to the Lisk protocol", | ||
@@ -40,3 +40,3 @@ "author": "Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>", | ||
"dependencies": { | ||
"@liskhq/lisk-cryptography": "^3.0.0", | ||
"@liskhq/lisk-cryptography": "^3.0.1", | ||
"@types/node": "12.12.11", | ||
@@ -43,0 +43,0 @@ "@types/semver": "7.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
40538
620