UNPKG

node-groupme

Version:

The only GroupMe API library that isn't a million years old.

34 lines 897 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const __1 = require(".."); class BaseManager { constructor(client, holds) { this.client = client; this.holds = holds; this.cache = new __1.Collection(); } resolve(data) { if (data instanceof this.holds) return data; if (typeof data === 'string') return this.cache.get(data) ?? null; return null; } resolveId(data) { return this.resolve(data)?.id ?? null; } _upsert(data) { let obj = this.cache.get(data.id); if (obj) Object.assign(obj, data); else obj = data; this.cache.set(obj.id, obj); return obj; } _remove(data) { return this.cache.delete(data.id); } } exports.default = BaseManager; //# sourceMappingURL=BaseManager.js.map