@okxweb3/coin-base
Version:
A base package for @ok/coin-*
33 lines • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertIsString = exports.assertIsArray = exports.assertIsBuffer = exports.assertIsHexString = void 0;
const internal_1 = require("./internal");
const assertIsHexString = function (input) {
if (!(0, internal_1.isHexString)(input)) {
const msg = `This method only supports 0x-prefixed hex strings but input was: ${input}`;
throw new Error(msg);
}
};
exports.assertIsHexString = assertIsHexString;
const assertIsBuffer = function (input) {
if (!Buffer.isBuffer(input)) {
const msg = `This method only supports Buffer but input was: ${input}`;
throw new Error(msg);
}
};
exports.assertIsBuffer = assertIsBuffer;
const assertIsArray = function (input) {
if (!Array.isArray(input)) {
const msg = `This method only supports number arrays but input was: ${input}`;
throw new Error(msg);
}
};
exports.assertIsArray = assertIsArray;
const assertIsString = function (input) {
if (typeof input !== 'string') {
const msg = `This method only supports strings but input was: ${input}`;
throw new Error(msg);
}
};
exports.assertIsString = assertIsString;
//# sourceMappingURL=helpers.js.map