Rocky_Mountain_Vending/.pnpm-store/v10/files/5d/66b56d84231fe27c2d4e236411cc1cf3bd528dae8132fe031bf14f705facaae4e12de1c8b3b6a830e8665d6b6b4ea3ba7fd22861df71fc7e7a3d93e188a580
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

80 lines
No EOL
1.9 KiB
Text

// Copyright (c) 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
export const inverse = function (map) {
const result = new Multimap();
for (const [key, value] of map.entries()) {
result.set(value, key);
}
return result;
};
export class Multimap {
map = new Map();
set(key, value) {
let set = this.map.get(key);
if (!set) {
set = new Set();
this.map.set(key, set);
}
set.add(value);
}
get(key) {
return this.map.get(key) || new Set();
}
has(key) {
return this.map.has(key);
}
hasValue(key, value) {
const set = this.map.get(key);
if (!set) {
return false;
}
return set.has(value);
}
get size() {
return this.map.size;
}
delete(key, value) {
const values = this.get(key);
if (!values) {
return false;
}
const result = values.delete(value);
if (!values.size) {
this.map.delete(key);
}
return result;
}
deleteAll(key) {
this.map.delete(key);
}
keysArray() {
return [...this.map.keys()];
}
keys() {
return this.map.keys();
}
valuesArray() {
const result = [];
for (const set of this.map.values()) {
result.push(...set.values());
}
return result;
}
clear() {
this.map.clear();
}
}
/**
* Gets value for key, assigning a default if value is falsy.
*/
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export function getWithDefault(map, key, defaultValueFactory) {
let value = map.get(key);
if (value === undefined || value === null) {
value = defaultValueFactory(key);
map.set(key, value);
}
return value;
}
//# sourceMappingURL=MapUtilities.js.map