@rr0/time
Version:
EDTF parsing
89 lines • 2.95 kB
text/typescript
export class Level1ComponentParseResult extends Level0ComponentParseResult {
/**
* The data component value, or induced value interval.
*
* @type {number|{start: number, end: number}}
*/
value: number | {
start: number;
end: number;
};
/**
* The component (say, month) and all its subcomponents (say, day, hour, minutes and seconds) are uncertain.
*
* @optional
* @type boolean
*/
uncertain: boolean;
/**
* The component (say, month) and all its subcomponents (say, day, hour, minutes and seconds) are approximate.
*
* @optional
* @type boolean
*/
approximate: boolean;
}
/**
* Parses a date component according to level 1 EDTF standard, which provides support for:
* - uncertainty group ("?" to the right of a component, thus apply to all components on the right)
* - approximation group ("~" to the right of a component, thus apply to all components on the right)
* - uncertainty + approximation on a group ("%" to the right of a component, thus apply to all components on the right)
*
* @template P extends Level1YearParseResult = Level1YearParseResult
*/
export class Level1ComponentParser<P> extends Level0ComponentParser<any> {
/**
* @readonly
* @type {string}
*/
static readonly uncertainGroup: string;
/**
* @readonly
* @type {string}
*/
static readonly approximateGroup: string;
/**
* @readonly
* @type {string}
*/
static readonly uncertainAndApproximateGroup: string;
/**
* Produces an optional group expecting a given char.
*
* @param {string} name The group name
* @param {string} char The char to optionally expect.
* @return {string} The relevant regex pattern.
*/
static qualifierFormat(name: string, char: string): string;
/**
* @param {string} name The group name
* @return {string} The relevant regex pattern.
*/
static formatSuffix(name: string): string;
/**
* @param {string} count
* @param {string} name The group name
* @param {string} prefix This can be allowed signs or "Y"
* @return {string} The relevant regex pattern.
*/
static numberFormat(name: string, count: string, prefix: string): string;
/**
* @protected
* @param groups
* @return {{valueStr: string, sign: number}}
*/
protected getValueAndSign(groups: any): {
valueStr: string;
sign: number;
};
/**
* @param {{ [p: string]: string }} groups
* @return {Level1ComponentParseResult}
*/
parseGroups(groups: {
[p: string]: string;
}): Level1ComponentParseResult;
}
import { Level0ComponentParseResult } from "../../level0/component/Level0ComponentParser.mjs";
import { Level0ComponentParser } from "../../level0/component/Level0ComponentParser.mjs";
//# sourceMappingURL=Level1ComponentParser.d.mts.map