MapData.ts 378 B

12345678910111213141516
  1. import { Data } from "./Data";
  2. /**
  3. * 带类型定义的Map类型数据
  4. * @author 袁浩
  5. */
  6. export class MapData<K extends PropertyKey, V> extends Data {
  7. public set(key: K, value: V) {
  8. super.set(key, value);
  9. }
  10. public get(key: K): V {
  11. return super.get(key);
  12. }
  13. public has(key: K): boolean {
  14. return this.get(key) !== undefined;
  15. }
  16. }