name-suggestion-index
Version:
Canonical common brand names for OpenStreetMap
46 lines • 2.13 kB
TypeScript
import type { DissolvedMap, NsiData } from './types.ts';
/** Options for {@link buildJOSMPresets}. */
export interface BuildJOSMPresetsOptions {
/** Project version stamped into the `<presets version="...">` attribute. */
version: string;
/** Project description stamped into the `<presets description="...">` attribute. */
description: string;
/** Map of NSI item id → dissolved record. Items present here are excluded from the output. */
dissolved?: DissolvedMap;
}
/** Options for {@link JOSMPresetsSerializer.serialize}. */
export interface JOSMPresetsSerializerOptions {
/** If `true`, produce indented, human-readable XML; if absent or `false`, produce compact single-line XML. */
prettyPrint?: boolean;
}
/**
* Returned by {@link buildJOSMPresets}. Holds the built-up preset data and can
* serialize it to XML on demand, with or without pretty-printing.
*/
export interface JOSMPresetsSerializer {
/**
* Serialize the presets to an XML string beginning with the UTF-8 declaration.
* @param opts - Serialization options
* @returns An XML string. Pass `{ prettyPrint: true }` for indented output;
* omit or pass `false` for compact single-line output.
*/
serialize(opts?: JOSMPresetsSerializerOptions): string;
}
/**
* Build JOSM tagging presets from NSI data, organised into nested groups
* by `tree → key → value`.
*
* Returns a {@link JOSMPresetsSerializer}; call `result.serialize({ prettyPrint: true })`
* for indented output or `result.serialize()` for compact single-line output.
*
* This is a pure function: it does no I/O, performs no console output, and does not
* mutate any of its inputs.
*
* @see https://josm.openstreetmap.de/wiki/TaggingPresets
*
* @param data - NSI category data indexed by `tree/key/value` path
* @param opts - Project metadata and optional dissolution map
* @returns A serializer that produces either pretty-printed or minified XML
*/
export declare function buildJOSMPresets(data: NsiData, opts: BuildJOSMPresetsOptions): JOSMPresetsSerializer;
//# sourceMappingURL=presets_josm.d.ts.map