projen
Version:
CDK for software projects
24 lines (23 loc) • 898 B
TypeScript
import type { PropertiesNode } from './nodes.js';
/** Result of parsing a `.properties` file. */
export type ParseResult = {
/** Whether the content starts with a BOM character. */
hasBom: boolean;
/** The detected end-of-line character sequence. */
eolCharacter: string;
/** All parsed nodes in file order. */
nodes: PropertiesNode[];
};
/**
* Parse a `.properties` file into a lossless sequence of nodes.
*
* Every element in the file — properties, comments, and blank lines — is
* preserved in order. Duplicate keys are all retained. The original content
* can be reconstructed exactly by joining node raw lines with the EOL
* character.
*
* @param content - The content of a `.properties` file.
*
* @returns The parse result with BOM info, detected EOL, and ordered nodes.
*/
export declare const parseDocument: (content: string | Buffer) => ParseResult;