projen
Version:
CDK for software projects
26 lines (24 loc) • 968 B
TypeScript
/**
* A key-value pair object.
*/
export type KeyValuePairObject = Record<string, string>;
/**
* Converts the content of a `.properties` file to a key-value pair object.
*
* This is a self-contained, zero-dependency parser optimized for minimal
* bundle size. It implements the Java `java.util.Properties` specification:
*
* - BOM detection and skipping
* - Comment lines (`#` or `!`)
* - Line continuations (trailing odd backslash)
* - Key-value separator detection (`=`, `:`, or whitespace)
* - Escape sequence processing (`\\n`, `\\t`, `\\r`, `\\f`, `\\\\`, `\\uXXXX`)
* - Last-value-wins semantics for duplicate keys
*
* @param content - The content of a `.properties` file.
*
* @returns A key/value object representing the content of a `.properties` file.
*/
export declare const getProperties: (content: string | Buffer) => KeyValuePairObject;
// Enables type recognition for direct `.properties` file imports.
import './properties-file.d.ts'