UNPKG

lisk-framework

Version:

Lisk blockchain application platform

48 lines 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getContextStoreString = exports.getContextStoreNumber = exports.getContextStoreBigInt = exports.getContextStoreBool = void 0; const getContextStoreBool = (contextStore, key) => { const val = contextStore.get(key); if (val === undefined) { return false; } if (typeof val !== 'boolean') { throw new Error('Invalid context value.'); } return val; }; exports.getContextStoreBool = getContextStoreBool; const getContextStoreBigInt = (contextStore, key) => { const val = contextStore.get(key); if (val === undefined) { return BigInt(0); } if (typeof val !== 'bigint') { throw new Error('Invalid context value.'); } return val; }; exports.getContextStoreBigInt = getContextStoreBigInt; const getContextStoreNumber = (contextStore, key) => { const val = contextStore.get(key); if (val === undefined) { return 0; } if (typeof val !== 'number') { throw new Error('Invalid context value.'); } return val; }; exports.getContextStoreNumber = getContextStoreNumber; const getContextStoreString = (contextStore, key) => { const val = contextStore.get(key); if (val === undefined) { return ''; } if (typeof val !== 'string') { throw new Error('Invalid context value.'); } return val; }; exports.getContextStoreString = getContextStoreString; //# sourceMappingURL=utils.js.map