index.js 368 B

123456789101112131415161718192021
  1. 'use strict';
  2. const constants = exports;
  3. // Helper
  4. constants._reverse = function reverse(map) {
  5. const res = {};
  6. Object.keys(map).forEach(function(key) {
  7. // Convert key to integer if it is stringified
  8. if ((key | 0) == key)
  9. key = key | 0;
  10. const value = map[key];
  11. res[value] = key;
  12. });
  13. return res;
  14. };
  15. constants.der = require('./der');