Front end of the Slack clone application.

FastMap.js 622B

12345678910111213141516171819202122232425262728
  1. export class FastMap {
  2. constructor() {
  3. this.values = {};
  4. }
  5. delete(key) {
  6. this.values[key] = null;
  7. return true;
  8. }
  9. set(key, value) {
  10. this.values[key] = value;
  11. return this;
  12. }
  13. get(key) {
  14. return this.values[key];
  15. }
  16. forEach(cb, thisArg) {
  17. const values = this.values;
  18. for (let key in values) {
  19. if (values.hasOwnProperty(key) && values[key] !== null) {
  20. cb.call(thisArg, values[key], key);
  21. }
  22. }
  23. }
  24. clear() {
  25. this.values = {};
  26. }
  27. }
  28. //# sourceMappingURL=FastMap.js.map