@asterdoc/format 0.0.0-stage → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +112 -2
- package/dist/index.d.ts +90 -0
- package/dist/index.js +2136 -0
- package/package.json +71 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Paradoc AI, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
**Trademark Notice**: This license does not grant permission to use the trade names, trademarks, service marks, logos, taglines, or product names of Asterdoc, except as required for reasonable and customary use in describing the origin of the Software.
|
package/README.md
CHANGED
|
@@ -1,3 +1,113 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://asterdoc.com?utm_source=github&utm_medium=format" target="_blank" rel="noopener noreferrer">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://assets.asterdoc.com/asterdoc-logo-400x400-dark.png" type="image/png">
|
|
5
|
+
<img src="https://assets.asterdoc.com/asterdoc-logo-400x400-dark.png" height="64" alt="Asterdoc logo">
|
|
6
|
+
</picture>
|
|
7
|
+
</a>
|
|
8
|
+
<br />
|
|
9
|
+
</p>
|
|
2
10
|
|
|
3
|
-
|
|
11
|
+
<h1 align="center">@asterdoc/format</h1>
|
|
12
|
+
|
|
13
|
+
<div align="center">
|
|
14
|
+
|
|
15
|
+
[](https://docs.asterdoc.com?utm_source=github&utm_medium=format)
|
|
16
|
+
[](https://x.com/asterdoc)
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
`@asterdoc/format` presents structured Asterdoc values as human-readable text. It keeps display policy separate from stored values, localized input parsing, currency conversion, and artifact validation.
|
|
21
|
+
|
|
22
|
+
The formatter presents numbers, money, percentage points, people, organizations, parties, phones, postal addresses, coordinates, bounding boxes, identifications, attachments, signatures, dates, datetimes, times, ISO 8601 durations, and the selection values a form field carries: booleans, single choices, multiple choices, and ratings. It is immutable and reusable, so repeated calls under one effective policy reuse bounded Intl formatter caches.
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { createFormatter } from '@asterdoc/format'
|
|
26
|
+
|
|
27
|
+
const formatter = createFormatter({ locale: 'de-DE' })
|
|
28
|
+
|
|
29
|
+
formatter.formatNumber(1234567.89) // '1.234.567,89'
|
|
30
|
+
formatter.formatMoney({ amount: 1500.5, currency: 'USD' }) // '1.500,50 $'
|
|
31
|
+
formatter.formatPercentage(8.25) // '8,25 %'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Contact and capture values use the same standalone and dynamic operations. This block uses an `en-US` formatter:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
const us = createFormatter({ locale: 'en-US' })
|
|
38
|
+
|
|
39
|
+
us.formatPerson({ firstName: 'Jane', lastName: 'Smith' }) // 'Jane Smith'
|
|
40
|
+
us.formatPhone({ number: '+442071838750', extension: '42' }) // '+442071838750 ext. 42'
|
|
41
|
+
us.formatAddress({
|
|
42
|
+
line1: '10 Downing Street',
|
|
43
|
+
locality: 'London',
|
|
44
|
+
region: 'Greater London',
|
|
45
|
+
postalCode: 'SW1A 2AA',
|
|
46
|
+
country: 'GB',
|
|
47
|
+
}) // '10 Downing Street, London, Greater London, SW1A 2AA, GB'
|
|
48
|
+
|
|
49
|
+
us.formatCoordinate({ lat: 40.7128, lon: -74.006 }) // '40.7128; -74.006'
|
|
50
|
+
us.formatBbox({
|
|
51
|
+
southWest: { lat: 40.4774, lon: -74.2591 },
|
|
52
|
+
northEast: { lat: 40.9176, lon: -73.7004 },
|
|
53
|
+
}) // '40.4774; -74.2591 | 40.9176; -73.7004'
|
|
54
|
+
us.formatIdentification({
|
|
55
|
+
type: 'passport',
|
|
56
|
+
number: 'A1',
|
|
57
|
+
issueDate: '2020-01-15',
|
|
58
|
+
}) // 'passport: A1 (issued Jan 15, 2020)'
|
|
59
|
+
us.formatAttachment({ name: 'contract.pdf', mimeType: 'application/pdf' }) // 'contract.pdf (application/pdf)'
|
|
60
|
+
us.formatSignature({ timestamp: '2026-09-04T15:30:00Z', method: 'drawn' }) // 'Signature (drawn) on Sep 4, 2026'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Coordinates use `latitude; longitude`; bounding boxes use `southWest | northEast`. The semicolon and pipe separators remain unambiguous when a locale uses a comma as its decimal separator. Coordinate values default to up to nine fractional digits and accept the same number precision options as `formatNumber`.
|
|
64
|
+
|
|
65
|
+
Address country and document locale are independent. The default `layout: 'country'` policy provides layouts for US, GB, DE, FR, and SA and returns an `unsupported` result for another country. Select `layout: 'generic'` when a component-preserving layout is appropriate, or provide a `countryLayouts` object whose ISO country-code keys map to formatter functions for another country. Party values with only the shared `name` member are ambiguous; use `partyType: 'person'` or provide a distinguishing person or organization member.
|
|
66
|
+
|
|
67
|
+
Money always supplies its currency. A bare amount is never assigned a default currency. Percentage values use Asterdoc's percentage-point scale, so `8.25` means `8.25%`, not `825%`.
|
|
68
|
+
|
|
69
|
+
Temporal values keep their declared meaning. A plain `YYYY-MM-DD` date is a calendar date and is never shifted by timezone. A `Date` object and a datetime string with `Z` or a numeric offset are instants and use the configured `timeZone`; an offsetless datetime string is a local calendar/clock value and stays unchanged. Times of day are formatted as clock values in UTC so the host timezone never changes them. All temporal formatters default to Gregorian calendar, UTC for instants, and the selected locale's numbering system. Per-call options can choose a supported `calendar`, `numberingSystem`, `timeZone`, or Intl precision option.
|
|
70
|
+
|
|
71
|
+
Durations use Asterdoc's canonical ISO 8601 syntax (`P[n]Y[n]M[n]W[n]DT[n]H[n]M[n]S`, with fractional seconds allowed). Zero components are omitted and a zero duration is shown as zero seconds. Duration components display with up to nine fractional digits by default; set `maximumFractionDigits` or related Intl number options to choose a different display precision without changing the stored duration. Duration unit labels are supplied for the initial English, German, French, and Arabic resources, and multiple components use the runtime's standard unit-list conventions. Additional locales must provide `duration.<unit>.<plural-category>` messages, such as `duration.day.one: '{value} day'`, or explicitly choose a configured `fallbackLocale` for package messages. The requested locale still controls number and list formatting when a message fallback is used. Without a supplied fallback language, missing package messages return `unsupported`.
|
|
72
|
+
|
|
73
|
+
Selection values are presented with what the field declares. A boolean prints the locale's own yes and no words, which `trueLabel` and `falseLabel` replace. An enum and a multiselect print the label of the option that carries the value; a value no option declares is `invalid`, unless `unknownOption: 'value'` explicitly prints it as itself. A multiselect joins those labels with the locale's own list conjunction and separator, in the locale's direction; `listType` (`conjunction`, `disjunction`, `unit`) and `listStyle` (`long`, `short`, `narrow`) choose the relation and its verbosity. A rating prints with the scale it was given on.
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
const services = [{ value: 'plumbing', label: 'Plumbing' }, { value: 'wiring', label: 'Wiring' }]
|
|
77
|
+
|
|
78
|
+
formatter.formatBoolean(true) // 'Ja' for de-DE
|
|
79
|
+
formatter.formatEnum('wiring', { options: services }) // 'Wiring'
|
|
80
|
+
formatter.formatMultiselect(['plumbing', 'wiring'], { options: services }) // 'Plumbing und Wiring' for de-DE
|
|
81
|
+
formatter.formatRating(4, { max: 5 }) // '4 von 5' for de-DE
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Two selection presentations can be unavailable rather than wrong, and both return an `unsupported` result the caller decides about. A rating with no `max` has no scale to print; a runtime whose locale data carries no list conjunction cannot join a multiselect. Asterdoc's renderers fall back to the plain number and to a comma join respectively, and keep the formatter's outcome on the value. The fallback join uses a plain comma on purpose: it only runs when the runtime holds no list data for the locale, so there is no locale-correct separator left to use.
|
|
85
|
+
|
|
86
|
+
Strict methods return text and throw a `FormatError` for missing, incomplete, invalid, unsupported, or unexpected values. Use the safe methods when a progressive flow needs structured diagnostics:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
const result = formatter.safeFormatMoney({ amount: 10 })
|
|
90
|
+
// { success: false, status: 'incomplete', issues: [...] }
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The safe methods are named `safeFormatMoney`, `safeFormatNumber`, `safeFormatPercentage`, `safeFormatAddress`, `safeFormatPhone`, `safeFormatPerson`, `safeFormatOrganization`, `safeFormatParty`, `safeFormatCoordinate`, `safeFormatBbox`, `safeFormatIdentification`, `safeFormatAttachment`, `safeFormatSignature`, `safeFormatDate`, `safeFormatDatetime`, `safeFormatTime`, `safeFormatDuration`, `safeFormatBoolean`, `safeFormatEnum`, `safeFormatMultiselect`, and `safeFormatRating`. Dynamic callers can use `formatValue(kind, value)` or `safeFormatValue(kind, value)`. A kind the formatter does not know returns `unsupported` with the code `unknown_kind`.
|
|
94
|
+
|
|
95
|
+
A bad option is `invalid` with the code `invalid_options`, like a bad value: a malformed locale, an unknown timezone, calendar, or numbering system, or an Intl option out of range. `unsupported` means the input is right and the runtime or the resources fall short: a locale the runtime has no data for (`unsupported_locale`), a missing package message (`missing_message`), or a country with no address layout (`unsupported_country_layout`).
|
|
96
|
+
|
|
97
|
+
A value family that formats through another kind, such as a signature's date, a bounding box's corners, a rating's number, or a multiselect's labels, passes only its own options. The other kind's formatter-level options do not apply, so `number: { maximumFractionDigits: 0 }` does not round a rating. Overrides of the other kind still apply.
|
|
98
|
+
|
|
99
|
+
Locale, numbering-system, calendar, and timezone choices are independent. The default locale is `en-US`, the default timezone `UTC`, and the default calendar Gregorian. An unsupported runtime locale fails at construction unless `unsupportedLocale: 'fallback'` and an explicit `fallbackLocale` are provided. `fallbackLocale` also supplies package-authored messages, for every value family, when the requested runtime locale is supported but has no matching messages; it does not change the requested locale used for Intl numbers, dates, times, or lists.
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
const amountOnly = formatter.compose({
|
|
103
|
+
money: { currencyDisplay: 'none' },
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
amountOnly.formatMoney({ amount: 1500.5, currency: 'USD' }) // '1.500,50'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`currencyDisplay: 'none'` drops the symbol and keeps the currency's fraction digits (two for USD, none for JPY) unless you set digits.
|
|
110
|
+
|
|
111
|
+
`compose` and `withOverrides` return independent formatter instances. Overrides can delegate to the previous implementation through the third callback argument, without recursively invoking themselves.
|
|
112
|
+
|
|
113
|
+
`cacheStats()` reports the size, hits, misses, and limit of each bounded cache: `number`, `money`, `percentage`, `date`, `datetime`, `time`, `timeZone`, `duration`, `durationPlural`, `durationList`, and `selectionList`. `cacheSize` (default 64, from 1 to 256) bounds each one; the least recently used entry is dropped first.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { FormatKind, FormatterOptions, Formatter, FormatInputByKind, FormatCallOptions, FormatResult, FormatStatus, FormatIssue } from '@asterdoc/types';
|
|
2
|
+
export { AddressFormatOptions, AddressLayoutContext, AddressLayoutFormatter, AddressLayoutPolicy, AttachmentFormatOptions, BboxFormatOptions, BooleanFormatOptions, CaptureFormatImplementation, CaptureFormatImplementationContext, CaptureFormatKind, CaptureValueByKind, ContactFormatImplementation, ContactFormatImplementationContext, ContactFormatKind, ContactValueByKind, CoordinateFormatOptions, DateFormatOptions, DatetimeFormatOptions, DurationFormatOptions, EnumFormatOptions, EnumOption, EnumOptionValue, FormatCallOptions, FormatImplementation, FormatImplementationContext, FormatInputByKind, FormatIssue, FormatKind, FormatOptionsByKind, FormatResult, FormatStatus, FormattedResult, Formatter, FormatterCacheBucket, FormatterCacheBucketStats, FormatterCacheStats, FormatterMessages, FormatterOptions, FormatterOverrides, FormatterProgressivePolicy, IdentificationFormatOptions, MoneyFormatOptions, MultiselectFormatOptions, NumberFormatOptions, NumericFormatKind, NumericValueByKind, OrganizationFormatOptions, PartyFormatOptions, PercentageFormatOptions, PersonFormatOptions, PhoneFormatOptions, RatingDisplay, RatingFormatOptions, SelectionFormatImplementation, SelectionFormatImplementationContext, SelectionFormatKind, SelectionListStyle, SelectionListType, SelectionValueByKind, SignatureFormatOptions, TemporalFormatImplementation, TemporalFormatImplementationContext, TemporalFormatKind, TemporalFormatOptions, TemporalValueByKind, TimeFormatOptions, UnformattedResult, UnknownOptionPolicy, UnsupportedLocalePolicy } from '@asterdoc/types';
|
|
3
|
+
|
|
4
|
+
/** Value families understood by the public formatter contract. */
|
|
5
|
+
declare const FORMAT_KINDS: readonly FormatKind[];
|
|
6
|
+
|
|
7
|
+
declare function createFormatter(options?: FormatterOptions): Formatter;
|
|
8
|
+
declare const defaultFormatter: Formatter;
|
|
9
|
+
declare function formatNumber(value: FormatInputByKind['number'], options?: FormatCallOptions<'number'>): string;
|
|
10
|
+
declare function formatAddress(value: FormatInputByKind['address'], options?: FormatCallOptions<'address'>): string;
|
|
11
|
+
declare function formatMoney(value: FormatInputByKind['money'], options?: FormatCallOptions<'money'>): string;
|
|
12
|
+
declare function formatPercentage(value: FormatInputByKind['percentage'], options?: FormatCallOptions<'percentage'>): string;
|
|
13
|
+
declare function formatPhone(value: FormatInputByKind['phone'], options?: FormatCallOptions<'phone'>): string;
|
|
14
|
+
declare function formatPerson(value: FormatInputByKind['person'], options?: FormatCallOptions<'person'>): string;
|
|
15
|
+
declare function formatOrganization(value: FormatInputByKind['organization'], options?: FormatCallOptions<'organization'>): string;
|
|
16
|
+
declare function formatParty(value: FormatInputByKind['party'], options?: FormatCallOptions<'party'>): string;
|
|
17
|
+
declare function formatDate(value: FormatInputByKind['date'], options?: FormatCallOptions<'date'>): string;
|
|
18
|
+
declare function formatDatetime(value: FormatInputByKind['datetime'], options?: FormatCallOptions<'datetime'>): string;
|
|
19
|
+
declare function formatTime(value: FormatInputByKind['time'], options?: FormatCallOptions<'time'>): string;
|
|
20
|
+
declare function formatDuration(value: FormatInputByKind['duration'], options?: FormatCallOptions<'duration'>): string;
|
|
21
|
+
declare function formatCoordinate(value: FormatInputByKind['coordinate'], options?: FormatCallOptions<'coordinate'>): string;
|
|
22
|
+
declare function formatBbox(value: FormatInputByKind['bbox'], options?: FormatCallOptions<'bbox'>): string;
|
|
23
|
+
declare function formatIdentification(value: FormatInputByKind['identification'], options?: FormatCallOptions<'identification'>): string;
|
|
24
|
+
declare function formatAttachment(value: FormatInputByKind['attachment'], options?: FormatCallOptions<'attachment'>): string;
|
|
25
|
+
declare function formatSignature(value: FormatInputByKind['signature'], options?: FormatCallOptions<'signature'>): string;
|
|
26
|
+
declare function formatBoolean(value: FormatInputByKind['boolean'], options?: FormatCallOptions<'boolean'>): string;
|
|
27
|
+
declare function formatEnum(value: FormatInputByKind['enum'], options?: FormatCallOptions<'enum'>): string;
|
|
28
|
+
declare function formatMultiselect(value: FormatInputByKind['multiselect'], options?: FormatCallOptions<'multiselect'>): string;
|
|
29
|
+
declare function formatRating(value: FormatInputByKind['rating'], options?: FormatCallOptions<'rating'>): string;
|
|
30
|
+
declare function formatValue<K extends FormatKind>(kind: K, value: FormatInputByKind[K], options?: FormatCallOptions<K>): string;
|
|
31
|
+
declare function safeFormatValue<K extends FormatKind>(kind: K, value: FormatInputByKind[K], options?: FormatCallOptions<K>): FormatResult;
|
|
32
|
+
declare function safeFormatNumber(value: FormatInputByKind['number'], options?: FormatCallOptions<'number'>): FormatResult;
|
|
33
|
+
declare function safeFormatAddress(value: FormatInputByKind['address'], options?: FormatCallOptions<'address'>): FormatResult;
|
|
34
|
+
declare function safeFormatMoney(value: FormatInputByKind['money'], options?: FormatCallOptions<'money'>): FormatResult;
|
|
35
|
+
declare function safeFormatPercentage(value: FormatInputByKind['percentage'], options?: FormatCallOptions<'percentage'>): FormatResult;
|
|
36
|
+
declare function safeFormatPhone(value: FormatInputByKind['phone'], options?: FormatCallOptions<'phone'>): FormatResult;
|
|
37
|
+
declare function safeFormatPerson(value: FormatInputByKind['person'], options?: FormatCallOptions<'person'>): FormatResult;
|
|
38
|
+
declare function safeFormatOrganization(value: FormatInputByKind['organization'], options?: FormatCallOptions<'organization'>): FormatResult;
|
|
39
|
+
declare function safeFormatParty(value: FormatInputByKind['party'], options?: FormatCallOptions<'party'>): FormatResult;
|
|
40
|
+
declare function safeFormatDate(value: FormatInputByKind['date'], options?: FormatCallOptions<'date'>): FormatResult;
|
|
41
|
+
declare function safeFormatDatetime(value: FormatInputByKind['datetime'], options?: FormatCallOptions<'datetime'>): FormatResult;
|
|
42
|
+
declare function safeFormatTime(value: FormatInputByKind['time'], options?: FormatCallOptions<'time'>): FormatResult;
|
|
43
|
+
declare function safeFormatDuration(value: FormatInputByKind['duration'], options?: FormatCallOptions<'duration'>): FormatResult;
|
|
44
|
+
declare function safeFormatCoordinate(value: FormatInputByKind['coordinate'], options?: FormatCallOptions<'coordinate'>): FormatResult;
|
|
45
|
+
declare function safeFormatBbox(value: FormatInputByKind['bbox'], options?: FormatCallOptions<'bbox'>): FormatResult;
|
|
46
|
+
declare function safeFormatIdentification(value: FormatInputByKind['identification'], options?: FormatCallOptions<'identification'>): FormatResult;
|
|
47
|
+
declare function safeFormatAttachment(value: FormatInputByKind['attachment'], options?: FormatCallOptions<'attachment'>): FormatResult;
|
|
48
|
+
declare function safeFormatSignature(value: FormatInputByKind['signature'], options?: FormatCallOptions<'signature'>): FormatResult;
|
|
49
|
+
declare function safeFormatBoolean(value: FormatInputByKind['boolean'], options?: FormatCallOptions<'boolean'>): FormatResult;
|
|
50
|
+
declare function safeFormatEnum(value: FormatInputByKind['enum'], options?: FormatCallOptions<'enum'>): FormatResult;
|
|
51
|
+
declare function safeFormatMultiselect(value: FormatInputByKind['multiselect'], options?: FormatCallOptions<'multiselect'>): FormatResult;
|
|
52
|
+
declare function safeFormatRating(value: FormatInputByKind['rating'], options?: FormatCallOptions<'rating'>): FormatResult;
|
|
53
|
+
|
|
54
|
+
/** A structured failure raised by a strict formatter operation. */
|
|
55
|
+
declare class FormatError extends Error {
|
|
56
|
+
readonly status: Exclude<FormatStatus, 'formatted'>;
|
|
57
|
+
readonly kind: FormatKind | string;
|
|
58
|
+
readonly issues: readonly FormatIssue[];
|
|
59
|
+
constructor(status: Exclude<FormatStatus, 'formatted'>, kind: FormatKind | string, issues: readonly FormatIssue[]);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A formatter or call option is not usable. Construction throws it; a safe
|
|
63
|
+
* call reports it as `invalid` / `invalid_options`.
|
|
64
|
+
*/
|
|
65
|
+
declare class FormatConfigurationError extends Error {
|
|
66
|
+
constructor(message: string, options?: ErrorOptions);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A well-formed locale this runtime has no data for. Construction throws it; a
|
|
70
|
+
* safe call reports it as `unsupported` / `unsupported_locale`, because the
|
|
71
|
+
* option is right and the runtime is what falls short.
|
|
72
|
+
*/
|
|
73
|
+
declare class UnsupportedLocaleError extends FormatConfigurationError {
|
|
74
|
+
constructor(message: string, options?: ErrorOptions);
|
|
75
|
+
}
|
|
76
|
+
declare function isFormatError(value: unknown): value is FormatError;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The `unsupported` outcome a rating with no declared scale returns. A caller
|
|
80
|
+
* that has a documented plain presentation keys its fallback off this code.
|
|
81
|
+
*/
|
|
82
|
+
declare const MISSING_RATING_SCALE = "missing_scale";
|
|
83
|
+
/**
|
|
84
|
+
* The `unsupported` outcome a multiselect returns when the runtime carries no
|
|
85
|
+
* list conjunction for the locale. A caller that has a documented plain join
|
|
86
|
+
* keys its fallback off this code.
|
|
87
|
+
*/
|
|
88
|
+
declare const UNSUPPORTED_LIST_JOIN = "unsupported_list";
|
|
89
|
+
|
|
90
|
+
export { FORMAT_KINDS, FormatConfigurationError, FormatError, MISSING_RATING_SCALE, UNSUPPORTED_LIST_JOIN, UnsupportedLocaleError, createFormatter, defaultFormatter, formatAddress, formatAttachment, formatBbox, formatBoolean, formatCoordinate, formatDate, formatDatetime, formatDuration, formatEnum, formatIdentification, formatMoney, formatMultiselect, formatNumber, formatOrganization, formatParty, formatPercentage, formatPerson, formatPhone, formatRating, formatSignature, formatTime, formatValue, isFormatError, safeFormatAddress, safeFormatAttachment, safeFormatBbox, safeFormatBoolean, safeFormatCoordinate, safeFormatDate, safeFormatDatetime, safeFormatDuration, safeFormatEnum, safeFormatIdentification, safeFormatMoney, safeFormatMultiselect, safeFormatNumber, safeFormatOrganization, safeFormatParty, safeFormatPercentage, safeFormatPerson, safeFormatPhone, safeFormatRating, safeFormatSignature, safeFormatTime, safeFormatValue };
|