import { AbstractAsyncMap } from "./AbstractAsyncMap.js";

/**
 * Wraps synchronous {@link Map}-implementing object
 * @template K,V
 */
export class AsyncMapWrapper extends AbstractAsyncMap {

    /**
     *
     * @type {Map<K,V>}
     * @private
     */
    #source = null;


    /**
     *
     * @param {Map<K,V>} [source]
     */
    constructor(source = new Map()) {
        super();
        this.#source = source;
    }

    async get(key) {
        return this.#source.get(key);
    }

    async set(key, value) {
        this.#source.set(key, value);
    }
}
