// Generated by bynkc — do not edit by hand.
// commons shop

import { Ok, Err, Some, None, type Result, type Option, type ValidationError } from "../runtime.js";

import { contains, getOr, values } from "../bynk/map.js";

export function tally(names: readonly string[]): ReadonlyMap<string, number> {
  const init: ReadonlyMap<string, number> = new Map<string, number>();
  return ((__xs: readonly string[], __acc: ReadonlyMap<string, number>, __f: (acc: ReadonlyMap<string, number>, x: string) => ReadonlyMap<string, number>) => { for (const __x of __xs) __acc = __f(__acc, __x); return __acc; })(names, init, (acc, name) => new Map(acc).set(name, getOr(acc, name, 0) + 1));
}

export function allValues(m: ReadonlyMap<string, number>): readonly number[] {
  return values(m);
}

export function hasEntry(m: ReadonlyMap<string, number>, name: string): boolean {
  return contains(m, name);
}

