Skip to main content
Glama
dictionary.js•872 B
import { tuple } from './tuple.js'; import { uniqueArray } from './uniqueArray.js'; import { keyValuePairsToObjectMapper, keyValuePairsToObjectUnmapper } from './_internals/mappers/KeyValuePairsToObject.js'; import { constant } from './constant.js'; import { boolean } from './boolean.js'; function dictionaryKeyExtractor(entry) { return entry[0]; } export function dictionary(keyArb, valueArb, constraints = {}) { const noNullPrototype = constraints.noNullPrototype !== false; return tuple(uniqueArray(tuple(keyArb, valueArb), { minLength: constraints.minKeys, maxLength: constraints.maxKeys, size: constraints.size, selector: dictionaryKeyExtractor, depthIdentifier: constraints.depthIdentifier, }), noNullPrototype ? constant(false) : boolean()).map(keyValuePairsToObjectMapper, keyValuePairsToObjectUnmapper); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Digital-Defiance/mcp-screenshot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server