transKeys.js 359 B

12345678910111213141516171819
  1. export const groupKeysMap = keys => {
  2. const map = new Map();
  3. keys.forEach((key, index) => {
  4. map.set(key, index);
  5. });
  6. return map;
  7. };
  8. export const groupDisabledKeysMap = dataSource => {
  9. const map = new Map();
  10. dataSource.forEach(({
  11. disabled,
  12. key
  13. }, index) => {
  14. if (disabled) {
  15. map.set(key, index);
  16. }
  17. });
  18. return map;
  19. };