2024-01-16 21:26:16 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const constants = exports;
|
2023-12-18 13:12:25 +08:00
|
|
|
|
|
|
|
// Helper
|
|
|
|
constants._reverse = function reverse(map) {
|
2024-01-16 21:26:16 +08:00
|
|
|
const res = {};
|
2023-12-18 13:12:25 +08:00
|
|
|
|
|
|
|
Object.keys(map).forEach(function(key) {
|
|
|
|
// Convert key to integer if it is stringified
|
|
|
|
if ((key | 0) == key)
|
|
|
|
key = key | 0;
|
|
|
|
|
2024-01-16 21:26:16 +08:00
|
|
|
const value = map[key];
|
2023-12-18 13:12:25 +08:00
|
|
|
res[value] = key;
|
|
|
|
});
|
|
|
|
|
|
|
|
return res;
|
|
|
|
};
|
|
|
|
|
|
|
|
constants.der = require('./der');
|