yini-parser
Version:
Readable configuration without YAML foot-guns or JSON noise. The official Node.js parser for YINI config format — An INI-inspired configuration format with clear nesting, explicit types, and predictable parsing.
40 lines • 1.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultUserOptions = void 0;
const getDefaultUserOptions = (mode) => mode === 'strict' ? { ...DEFAULT_STRICT_OPTS } : { ...DEFAULT_LENIENT_OPTS };
exports.getDefaultUserOptions = getDefaultUserOptions;
// Base (mode-agnostic) defaults.
const BASE_DEFAULTS = {
strictMode: false,
failLevel: 'auto',
includeMetadata: false,
includeDiagnostics: false,
includeTiming: false,
preserveUndefinedInMeta: false,
onDuplicateKey: 'error',
requireDocTerminator: 'optional',
treatEmptyValueAsNull: 'allow-with-warning',
quiet: false, // Suppress warnings in console (does not affect warnings in meta data).
silent: false,
//@todo: Change default throwOnError to false
throwOnError: true, // Will throw on first parse error encountered.
};
const DEFAULT_LENIENT_OPTS = {
...BASE_DEFAULTS,
strictMode: false,
failLevel: 'ignore-errors',
// Below are options for pure rules:
onDuplicateKey: 'warn-and-keep-first',
requireDocTerminator: 'optional',
treatEmptyValueAsNull: 'allow',
};
const DEFAULT_STRICT_OPTS = {
...BASE_DEFAULTS,
strictMode: true,
failLevel: 'errors',
// Below are options for pure rules:
onDuplicateKey: 'error',
requireDocTerminator: 'optional',
treatEmptyValueAsNull: 'disallow',
};
//# sourceMappingURL=defaultParserOptions.js.map