UNPKG

yini-parser

Version:

Node.js parser for YINI — a clean, structured INI alternative with types, simple section nesting, comments, and strict mode.

43 lines (42 loc) 1.51 kB
/** * This file contains general string helper functions (utils). * @note More specific YINI helper functions should go into yiniHelpers.ts-file. */ /** * Splits a string into an array of lines, handling both LF and CRLF newlines. * @param content The input string. * @returns Array of lines (strings). */ export declare function splitLines(content: string): string[]; /** * If a string starts and ends with a backtick `, if so trims the * first and last character (the backticks). */ export declare const trimBackticks: (str: string) => string; /** * Returns true if the provided string is enclosed in backticks, e.g. `name`. */ export declare const isEnclosedInBackticks: (str: string) => boolean; /** * Check if the character is A-Z or a-z. * @note The string must be of length 1. * @param character A character in a string. */ export declare const isAlpha: (character: string) => boolean; /** * Check if the character is a digit (number): 0-9. * @note The string must be of length 1. * @param character A character in a string. */ export declare const isDigit: (character: string) => boolean; /** * @returns Returns the beginning up to (but not including) any first * encountered newline. * @note If no newline is found, returns the whole string. * @example * `SectionName1 * //value = 11` * => 'SectionName1' * @deprecated This seems not useful anymore, use stripCommentsAndAfter(..) instead. */ export declare const stripNLAndAfter: (line: string) => string;