/** @format */ // ---------MAP----------- interface Map { findKeyByValue(value: any): any keysArr(): any[] valuesArr(): any[] } Map.prototype.findKeyByValue = function (value: any) { const keys = this.keysArr() const values = this.valuesArr() let returnKeys = [] for (let i = 0; i < values.length; i++) { if (values[i] == value) { returnKeys.push(keys[i]) } } return returnKeys } Map.prototype.keysArr = function () { return Array.from(this.keys()) } Map.prototype.valuesArr = function () { return Array.from(this.values()) }