mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[d3-format] v1.1
* [Enhancement] Add optional `numerals` property to `FormatLocaleDefinition` * [Enhancement] Replaced union type of `decimal` and `thousand` with `string` type in `FormatLocaleDefinition` to generalize * Bumped minor version number
This commit is contained in:
parent
868ecf81e9
commit
082f42fd5b
@ -63,11 +63,6 @@ num = d3Format.precisionRound(0.0005, 3000);
|
||||
// Test Locale Definition
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
let decimal: '.' | ',' = localeDef.decimal;
|
||||
let thousands: '.' | ',' | '\u00a0' | "'" = localeDef.thousands;
|
||||
let grouping: Array<number> = localeDef.grouping;
|
||||
let currency: [string, string] = localeDef.currency;
|
||||
|
||||
localeDef = {
|
||||
decimal: ',',
|
||||
thousands: '.',
|
||||
@ -75,6 +70,20 @@ localeDef = {
|
||||
currency: ['EUR', '']
|
||||
};
|
||||
|
||||
localeDef = {
|
||||
decimal: "\u066b",
|
||||
thousands: "\u066c",
|
||||
grouping: [3],
|
||||
currency: ["", ""],
|
||||
numerals : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"]
|
||||
}
|
||||
|
||||
let decimal: string = localeDef.decimal;
|
||||
let thousands: string = localeDef.thousands;
|
||||
let grouping: Array<number> = localeDef.grouping;
|
||||
let currency: [string, string] = localeDef.currency;
|
||||
let numerals: string[] | undefined = localeDef.numerals;
|
||||
|
||||
localeObj = d3Format.formatLocale(localeDef);
|
||||
|
||||
localeObj = d3Format.formatDefaultLocale(localeDef);
|
||||
|
||||
12
d3-format/index.d.ts
vendored
12
d3-format/index.d.ts
vendored
@ -1,8 +1,10 @@
|
||||
// Type definitions for D3JS d3-format module v1.0.2
|
||||
// Type definitions for D3JS d3-format module 1.1
|
||||
// Project: https://github.com/d3/d3-format/
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.1.0
|
||||
|
||||
/**
|
||||
* Specification of locale to use when creating a new FormatLocaleObject
|
||||
*/
|
||||
@ -10,12 +12,12 @@ export interface FormatLocaleDefinition {
|
||||
/**
|
||||
* The decimal point (e.g., ".")
|
||||
*/
|
||||
decimal: '.' | ',';
|
||||
decimal: string;
|
||||
/**
|
||||
* The group separator (e.g., ","). Note that the thousands property is a misnomer, as\
|
||||
* the grouping definition allows groups other than thousands.
|
||||
*/
|
||||
thousands: '.' | ',' | '\u00a0' | "'";
|
||||
thousands: string;
|
||||
/**
|
||||
* The array of group sizes (e.g., [3]), cycled as needed.
|
||||
*/
|
||||
@ -24,6 +26,10 @@ export interface FormatLocaleDefinition {
|
||||
* The currency prefix and suffix (e.g., ["$", ""])
|
||||
*/
|
||||
currency: [string, string];
|
||||
/**
|
||||
* An array of ten strings to replace the numerals 0-9.
|
||||
*/
|
||||
numerals?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user