Refactor enumerableMap generate and tests (#4760)
This commit is contained in:
18
scripts/generate/templates/EnumerableMap.opts.js
Normal file
18
scripts/generate/templates/EnumerableMap.opts.js
Normal file
@ -0,0 +1,18 @@
|
||||
const mapType = str => (str == 'uint256' ? 'Uint' : `${str.charAt(0).toUpperCase()}${str.slice(1)}`);
|
||||
const formatType = (keyType, valueType) => ({
|
||||
name: `${mapType(keyType)}To${mapType(valueType)}Map`,
|
||||
keyType,
|
||||
valueType,
|
||||
});
|
||||
|
||||
const TYPES = [
|
||||
['uint256', 'uint256'],
|
||||
['uint256', 'address'],
|
||||
['address', 'uint256'],
|
||||
['bytes32', 'uint256'],
|
||||
].map(args => formatType(...args));
|
||||
|
||||
module.exports = {
|
||||
TYPES,
|
||||
formatType,
|
||||
};
|
||||
Reference in New Issue
Block a user