@genesislcap/foundation-utils 14.33.1 → 14.33.2
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/dist/dts/formatters/index.d.ts +0 -1
- package/dist/dts/formatters/index.d.ts.map +1 -1
- package/dist/esm/formatters/index.js +0 -1
- package/docs/api/foundation-utils.md +0 -1
- package/docs/api-report.md +0 -9
- package/package.json +2 -2
- package/dist/dts/formatters/localeNumberParser.d.ts +0 -18
- package/dist/dts/formatters/localeNumberParser.d.ts.map +0 -1
- package/dist/esm/formatters/localeNumberParser.js +0 -31
- package/docs/api/foundation-utils.numberparser._constructor_.md +0 -20
- package/docs/api/foundation-utils.numberparser.hasseparator.md +0 -22
- package/docs/api/foundation-utils.numberparser.md +0 -26
- package/docs/api/foundation-utils.numberparser.parse.md +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/formatters/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/formatters/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
| --- | --- |
|
|
11
11
|
| [DefaultServerRowDTOMapper](./foundation-utils.defaultserverrowdtomapper.md) | The default <code>ServerRowDTOMapper</code>. |
|
|
12
12
|
| [InMemoryDatabase](./foundation-utils.inmemorydatabase.md) | An in memory database of specific DatabaseRecord types. |
|
|
13
|
-
| [NumberParser](./foundation-utils.numberparser.md) | |
|
|
14
13
|
| [SlottedStyles](./foundation-utils.slottedstyles.md) | A custom element that encapsulates a set of styles that can be applied to slotted elements. |
|
|
15
14
|
|
|
16
15
|
## Enumerations
|
package/docs/api-report.md
CHANGED
|
@@ -617,15 +617,6 @@ export interface LoggerOptions extends ConsolaOptions {
|
|
|
617
617
|
|
|
618
618
|
export { LogLevel }
|
|
619
619
|
|
|
620
|
-
// @public (undocumented)
|
|
621
|
-
export class NumberParser {
|
|
622
|
-
constructor(locale: string);
|
|
623
|
-
// (undocumented)
|
|
624
|
-
hasSeparator(localeNumber: string): boolean;
|
|
625
|
-
// (undocumented)
|
|
626
|
-
parse(localeNumber: string): number;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
620
|
// @public
|
|
630
621
|
export interface Observer<EventType> {
|
|
631
622
|
// (undocumented)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-utils",
|
|
3
3
|
"description": "Genesis Foundation Utils",
|
|
4
|
-
"version": "14.33.
|
|
4
|
+
"version": "14.33.2",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"customElements": "dist/custom-elements.json",
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "05ec400108143dea0930c2f08a5ce23c1563dae3"
|
|
39
39
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
*/
|
|
4
|
-
export declare class NumberParser {
|
|
5
|
-
/**
|
|
6
|
-
* reference: https://observablehq.com/\@mbostock/localized-number-parsing
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
private _group;
|
|
10
|
-
private _decimal;
|
|
11
|
-
private _separator;
|
|
12
|
-
private _numeral;
|
|
13
|
-
private _index;
|
|
14
|
-
constructor(locale: string);
|
|
15
|
-
parse(localeNumber: string): number;
|
|
16
|
-
hasSeparator(localeNumber: string): boolean;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=localeNumberParser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localeNumberParser.d.ts","sourceRoot":"","sources":["../../../src/formatters/localeNumberParser.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,YAAY;IACvB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAM;gBACR,MAAM,EAAE,MAAM;IAY1B,KAAK,CAAC,YAAY,EAAE,MAAM;IAS1B,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;CAG5C"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const FORMAT_PARTS = 12345.6;
|
|
2
|
-
const FORMAT_NUMERALS = 9876543210;
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export class NumberParser {
|
|
7
|
-
constructor(locale) {
|
|
8
|
-
const parts = new Intl.NumberFormat(locale).formatToParts(FORMAT_PARTS);
|
|
9
|
-
const numerals = [
|
|
10
|
-
...new Intl.NumberFormat(locale, { useGrouping: false }).format(FORMAT_NUMERALS),
|
|
11
|
-
].reverse();
|
|
12
|
-
const index = new Map(numerals.map((d, i) => [d, i]));
|
|
13
|
-
this._group = new RegExp(`[${parts.find((d) => d.type === 'group').value}]`, 'g');
|
|
14
|
-
this._decimal = new RegExp(`[${parts.find((d) => d.type === 'decimal').value}]`);
|
|
15
|
-
this._separator = new RegExp(`[$${parts.find((d) => d.type === 'decimal').value}]$`);
|
|
16
|
-
this._numeral = new RegExp(`[${numerals.join('')}]`, 'g');
|
|
17
|
-
this._index = (d) => index.get(d);
|
|
18
|
-
}
|
|
19
|
-
parse(localeNumber) {
|
|
20
|
-
return (localeNumber = localeNumber
|
|
21
|
-
.trim()
|
|
22
|
-
.replace(this._group, '')
|
|
23
|
-
.replace(this._decimal, '.')
|
|
24
|
-
.replace(this._numeral, this._index))
|
|
25
|
-
? +localeNumber
|
|
26
|
-
: NaN;
|
|
27
|
-
}
|
|
28
|
-
hasSeparator(localeNumber) {
|
|
29
|
-
return this._separator.test(localeNumber);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [NumberParser](./foundation-utils.numberparser.md) > [(constructor)](./foundation-utils.numberparser._constructor_.md)
|
|
4
|
-
|
|
5
|
-
## NumberParser.(constructor)
|
|
6
|
-
|
|
7
|
-
Constructs a new instance of the `NumberParser` class
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
constructor(locale: string);
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
| Parameter | Type | Description |
|
|
18
|
-
| --- | --- | --- |
|
|
19
|
-
| locale | string | |
|
|
20
|
-
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [NumberParser](./foundation-utils.numberparser.md) > [hasSeparator](./foundation-utils.numberparser.hasseparator.md)
|
|
4
|
-
|
|
5
|
-
## NumberParser.hasSeparator() method
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
hasSeparator(localeNumber: string): boolean;
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Parameters
|
|
14
|
-
|
|
15
|
-
| Parameter | Type | Description |
|
|
16
|
-
| --- | --- | --- |
|
|
17
|
-
| localeNumber | string | |
|
|
18
|
-
|
|
19
|
-
**Returns:**
|
|
20
|
-
|
|
21
|
-
boolean
|
|
22
|
-
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [NumberParser](./foundation-utils.numberparser.md)
|
|
4
|
-
|
|
5
|
-
## NumberParser class
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Signature:**
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
export declare class NumberParser
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Constructors
|
|
15
|
-
|
|
16
|
-
| Constructor | Modifiers | Description |
|
|
17
|
-
| --- | --- | --- |
|
|
18
|
-
| [(constructor)(locale)](./foundation-utils.numberparser._constructor_.md) | | Constructs a new instance of the <code>NumberParser</code> class |
|
|
19
|
-
|
|
20
|
-
## Methods
|
|
21
|
-
|
|
22
|
-
| Method | Modifiers | Description |
|
|
23
|
-
| --- | --- | --- |
|
|
24
|
-
| [hasSeparator(localeNumber)](./foundation-utils.numberparser.hasseparator.md) | | |
|
|
25
|
-
| [parse(localeNumber)](./foundation-utils.numberparser.parse.md) | | |
|
|
26
|
-
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [NumberParser](./foundation-utils.numberparser.md) > [parse](./foundation-utils.numberparser.parse.md)
|
|
4
|
-
|
|
5
|
-
## NumberParser.parse() method
|
|
6
|
-
|
|
7
|
-
**Signature:**
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
parse(localeNumber: string): number;
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Parameters
|
|
14
|
-
|
|
15
|
-
| Parameter | Type | Description |
|
|
16
|
-
| --- | --- | --- |
|
|
17
|
-
| localeNumber | string | |
|
|
18
|
-
|
|
19
|
-
**Returns:**
|
|
20
|
-
|
|
21
|
-
number
|
|
22
|
-
|