@cdklabs/cdk-ecs-codedeploy 0.0.442 → 0.0.444
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/.jsii +3 -3
- package/lib/api-canary/index.js +1 -1
- package/lib/ecs-appspec/index.js +1 -1
- package/lib/ecs-deployment/index.js +1 -1
- package/lib/ecs-patterns/application-load-balanced-codedeployed-fargate-service.js +1 -1
- package/node_modules/@aws-sdk/client-codedeploy/package.json +10 -10
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +47 -2291
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +12 -6
- package/node_modules/@aws-sdk/core/dist-es/index.js +3 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.js +1 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +11 -6
- package/node_modules/@aws-sdk/core/dist-types/index.d.ts +5 -5
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/index.d.ts +5 -5
- package/node_modules/@aws-sdk/core/package.json +12 -12
- package/node_modules/@aws-sdk/credential-provider-env/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-http/package.json +11 -10
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +15 -15
- package/node_modules/@aws-sdk/credential-provider-login/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-node/package.json +13 -13
- package/node_modules/@aws-sdk/credential-provider-process/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +4 -1
- package/node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js +4 -1
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +12 -10
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +8 -8
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +99 -106
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +62 -120
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +55 -86
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +73 -104
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +102 -185
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/auth/httpAuthSchemeProvider.js +4 -5
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/endpoint/bdd.js +21 -57
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.browser.js +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.js +2 -4
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/schemas/schemas_0.js +73 -41
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/auth/httpAuthSchemeProvider.js +4 -5
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/bdd.js +20 -52
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.browser.js +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.js +2 -4
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/schemas/schemas_0.js +36 -59
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/auth/httpAuthSchemeProvider.js +4 -5
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/endpoint/bdd.js +17 -45
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.browser.js +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.js +2 -4
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/schemas/schemas_0.js +32 -32
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/auth/httpAuthSchemeProvider.js +4 -5
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/endpoint/bdd.js +17 -45
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.browser.js +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.js +2 -4
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/schemas/schemas_0.js +50 -50
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/auth/httpAuthSchemeProvider.js +4 -5
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/defaultRoleAssumers.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/endpoint/bdd.js +34 -96
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.browser.js +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.js +3 -6
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/schemas/schemas_0.js +63 -80
- package/node_modules/@aws-sdk/nested-clients/package.json +11 -11
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +10 -9
- package/node_modules/@aws-sdk/token-providers/package.json +8 -8
- package/node_modules/@aws-sdk/types/package.json +4 -4
- package/node_modules/@aws-sdk/util-locate-window/package.json +3 -3
- package/node_modules/@aws-sdk/xml-builder/package.json +4 -4
- package/node_modules/@nodable/entities/package.json +4 -1
- package/node_modules/@nodable/entities/src/EntityDecoder.js +104 -3
- package/node_modules/@nodable/entities/src/index.d.ts +77 -0
- package/node_modules/@nodable/entities/src/index.js +1 -1
- package/node_modules/@smithy/core/dist-cjs/index.js +13 -15
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +29 -31
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.browser.js +2 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.js +7 -9
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.native.js +3 -5
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +22 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +10 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +38 -39
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +10 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +14 -17
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +20 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +9 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +11 -13
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +59 -60
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +26 -27
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +28 -29
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +5 -7
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +4 -6
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +23 -25
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +4 -6
- package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +2 -4
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-signing/httpSigningMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/endpointMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retry-pre-sra-deprecated/StandardRetryStrategy.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/retry/util-retry/DefaultRateLimiter.js +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +1 -1
- package/node_modules/@smithy/core/package.json +18 -17
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +23 -24
- package/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/httpRequest.js +2 -2
- package/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/node-http.js +2 -0
- package/node_modules/@smithy/credential-provider-imds/dist-types/remoteProvider/httpRequest.d.ts +1 -1
- package/node_modules/@smithy/credential-provider-imds/dist-types/remoteProvider/node-http.d.ts +2 -0
- package/node_modules/@smithy/credential-provider-imds/package.json +7 -7
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +6 -8
- package/node_modules/@smithy/fetch-http-handler/package.json +10 -10
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +15 -15
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +7 -6
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +2 -1
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2.js +2 -0
- package/node_modules/@smithy/node-http-handler/dist-es/node-https.js +2 -0
- package/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +2 -2
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2.d.ts +2 -0
- package/node_modules/@smithy/node-http-handler/dist-types/node-https.d.ts +2 -0
- package/node_modules/@smithy/node-http-handler/package.json +8 -8
- package/node_modules/@smithy/signature-v4/dist-cjs/index.js +27 -29
- package/node_modules/@smithy/signature-v4/package.json +7 -7
- package/node_modules/@smithy/types/dist-cjs/index.js +23 -18
- package/node_modules/@smithy/types/package.json +10 -10
- package/node_modules/anynum/LICENSE +21 -0
- package/node_modules/anynum/README.md +142 -0
- package/node_modules/anynum/anynum.js +135 -0
- package/node_modules/anynum/digitTable.js +116 -0
- package/node_modules/anynum/package.json +42 -0
- package/node_modules/strnum/CHANGELOG.md +8 -0
- package/node_modules/strnum/README.md +9 -0
- package/node_modules/strnum/package.json +4 -1
- package/node_modules/strnum/strnum.js +9 -1
- package/package.json +2 -2
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flat lookup table: maps Unicode code point → ASCII digit (0-9).
|
|
3
|
+
* Only decimal digit characters (Unicode category Nd) are included.
|
|
4
|
+
*
|
|
5
|
+
* Strategy: Int32Array of size (maxCodePoint - minCodePoint + 1).
|
|
6
|
+
* Value 0xFF means "not a digit". Value 0-9 is the ASCII digit value.
|
|
7
|
+
* This gives O(1) lookup with no branching, no bisect, no loop.
|
|
8
|
+
*
|
|
9
|
+
* Memory: range is 0x0660 to 0x1FBF0 → ~129,936 entries × 1 byte = ~127 KB.
|
|
10
|
+
* Acceptable for a one-time init; lookup is a single array index.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// All known Unicode Nd (decimal digit) script zero code points.
|
|
14
|
+
// Each script has exactly 10 consecutive digits: zero+0 .. zero+9.
|
|
15
|
+
const SCRIPT_ZEROS = [
|
|
16
|
+
// Basic Latin (ASCII) — included for completeness / pass-through
|
|
17
|
+
0x0030, // 0-9
|
|
18
|
+
|
|
19
|
+
// Arabic scripts
|
|
20
|
+
0x0660, // Arabic-Indic ٠١٢٣٤٥٦٧٨٩
|
|
21
|
+
0x06F0, // Extended Arabic-Indic (Urdu/Persian/Sindhi) ۰۱۲۳
|
|
22
|
+
|
|
23
|
+
// Indic scripts
|
|
24
|
+
0x0966, // Devanagari ०१२३४५६७८९
|
|
25
|
+
0x09E6, // Bengali ০১২৩৪৫৬৭৮৯
|
|
26
|
+
0x0A66, // Gurmukhi ੦੧੨੩੪੫੬੭੮੯
|
|
27
|
+
0x0AE6, // Gujarati ૦૧૨૩૪૫૬૭૮૯
|
|
28
|
+
0x0B66, // Odia ୦୧୨୩୪୫୬୭୮୯
|
|
29
|
+
0x0BE6, // Tamil ௦௧௨௩௪௫௬௭௮௯
|
|
30
|
+
0x0C66, // Telugu ౦౧౨౩౪౫౬౭౮౯
|
|
31
|
+
0x0CE6, // Kannada ೦೧೨೩೪೫೬೭೮೯
|
|
32
|
+
0x0D66, // Malayalam ൦൧൨൩൪൫൬൭൮൯
|
|
33
|
+
0x0DE6, // Sinhala Archaic ෦෧෨෩෪෫෬෭෮෯
|
|
34
|
+
|
|
35
|
+
// Southeast Asian scripts
|
|
36
|
+
0x0E50, // Thai ๐๑๒๓๔๕๖๗๘๙
|
|
37
|
+
0x0ED0, // Lao ໐໑໒໓໔໕໖໗໘໙
|
|
38
|
+
0x0F20, // Tibetan ༠༡༢༣༤༥༦༧༨༩
|
|
39
|
+
0x1040, // Myanmar ၀၁၂၃၄၅၆၇၈၉
|
|
40
|
+
0x1090, // Myanmar Shan ႐႑႒႓႔႕႖႗႘႙
|
|
41
|
+
0x17E0, // Khmer ០១២៣៤៥៦៧៨៩
|
|
42
|
+
0x1810, // Mongolian ᠐᠑᠒᠓᠔᠕᠖᠗᠘᠙
|
|
43
|
+
0x1946, // Limbu ᥆᥇᥈᥉᥊᥋᥌᥍᥎᥏
|
|
44
|
+
0x19D0, // New Tai Lue ᧐᧑᧒᧓᧔᧕᧖᧗᧘᧙
|
|
45
|
+
0x1A80, // Tai Tham Hora ᪀᪁᪂᪃᪄᪅᪆᪇᪈᪉
|
|
46
|
+
0x1A90, // Tai Tham Tham ᪐᪑᪒᪓᪔᪕᪖᪗᪘᪙
|
|
47
|
+
0x1B50, // Balinese ᭐᭑᭒᭓᭔᭕᭖᭗᭘᭙
|
|
48
|
+
0x1BB0, // Sundanese ᮰᮱᮲᮳᮴᮵᮶᮷᮸᮹
|
|
49
|
+
0x1C40, // Lepcha ᱀᱁᱂᱃᱄᱅᱆᱇᱈᱉
|
|
50
|
+
0x1C50, // Ol Chiki ᱐᱑᱒᱓᱔᱕᱖᱗᱘᱙
|
|
51
|
+
|
|
52
|
+
// Fullwidth (CJK context)
|
|
53
|
+
0xFF10, // Fullwidth 0123456789
|
|
54
|
+
|
|
55
|
+
// Mathematical digit variants (Unicode math block)
|
|
56
|
+
0x1D7CE, // Mathematical Bold
|
|
57
|
+
0x1D7D8, // Mathematical Double-Struck
|
|
58
|
+
0x1D7E2, // Mathematical Sans-Serif
|
|
59
|
+
0x1D7EC, // Mathematical Sans-Serif Bold
|
|
60
|
+
0x1D7F6, // Mathematical Monospace
|
|
61
|
+
|
|
62
|
+
// Other scripts
|
|
63
|
+
0x104A0, // Osmanya 𐒠𐒡𐒢𐒣𐒤𐒥𐒦𐒧𐒨𐒩
|
|
64
|
+
0x10D30, // Hanifi Rohingya 𐴰𐴱𐴲𐴳𐴴𐴵𐴶𐴷𐴸𐴹
|
|
65
|
+
0x11066, // Brahmi 𑁦𑁧𑁨𑁩𑁪𑁫𑁬𑁭𑁮𑁯
|
|
66
|
+
0x110F0, // Sora Sompeng 𑃰𑃱𑃲𑃳𑃴𑃵𑃶𑃷𑃸𑃹
|
|
67
|
+
0x11136, // Chakma 𑄶𑄷𑄸𑄹𑄺𑄻𑄼𑄽𑄾𑄿
|
|
68
|
+
0x111D0, // Sharada 𑇐𑇑𑇒𑇓𑇔𑇕𑇖𑇗𑇘𑇙
|
|
69
|
+
0x112F0, // Khudawadi 𑋰𑋱𑋲𑋳𑋴𑋵𑋶𑋷𑋸𑋹
|
|
70
|
+
0x11450, // Newa 𑑐𑑑𑑒𑑓𑑔𑑕𑑖𑑗𑑘𑑙
|
|
71
|
+
0x114D0, // Tirhuta 𑓐𑓑𑓒𑓓𑓔𑓕𑓖𑓗𑓘𑓙
|
|
72
|
+
0x11650, // Modi 𑙐𑙑𑙒𑙓𑙔𑙕𑙖𑙗𑙘𑙙
|
|
73
|
+
0x116C0, // Takri 𑛀𑛁𑛂𑛃𑛄𑛅𑛆𑛇𑛈𑛉
|
|
74
|
+
0x11730, // Ahom 𑜰𑜱𑜲𑜳𑜴𑜵𑜶𑜷𑜸𑜹
|
|
75
|
+
0x118E0, // Warang Citi 𑣠𑣡𑣢𑣣𑣤𑣥𑣦𑣧𑣨𑣩
|
|
76
|
+
0x11950, // Dives Akuru 𑥐𑥑𑥒𑥓𑥔𑥕𑥖𑥗𑥘𑥙
|
|
77
|
+
0x11BF0, // Khitan Small Script
|
|
78
|
+
0x11C50, // Bhaiksuki 𑱐𑱑𑱒𑱓𑱔𑱕𑱖𑱗𑱘𑱙
|
|
79
|
+
0x11D50, // Masaram Gondi 𑵐𑵑𑵒𑵓𑵔𑵕𑵖𑵗𑵘𑵙
|
|
80
|
+
0x11DA0, // Gunjala Gondi 𑶠𑶡𑶢𑶣𑶤𑶥𑶦𑶧𑶨𑶩
|
|
81
|
+
0x11F50, // Kawi 𑽐𑽑𑽒𑽓𑽔𑽕𑽖𑽗𑽘𑽙
|
|
82
|
+
0x16A60, // Mro 𖩠𖩡𖩢𖩣𖩤𖩥𖩦𖩧𖩨𖩩
|
|
83
|
+
0x16AC0, // Tangsa 𖫀𖫁𖫂𖫃𖫄𖫅𖫆𖫇𖫈𖫉
|
|
84
|
+
0x16B50, // Pahawh Hmong 𖭐𖭑𖭒𖭓𖭔𖭕𖭖𖭗𖭘𖭙
|
|
85
|
+
0x1E140, // Nyiakeng Puachue Hmong 𞅀𞅁𞅂𞅃𞅄𞅅𞅆𞅇𞅈𞅉
|
|
86
|
+
0x1E2F0, // Wancho 𞋰𞋱𞋲𞋳𞋴𞋵𞋶𞋷𞋸𞋹
|
|
87
|
+
0x1E4F0, // Nag Mundari 𞓰𞓱𞓲𞓳𞓴𞓵𞓶𞓷𞓸𞓹
|
|
88
|
+
0x1E950, // Adlam 𞥐𞥑𞥒𞥓𞥔𞥕𞥖𞥗𞥘𞥙
|
|
89
|
+
0x1FBF0, // Segmented digit symbols 🯰🯱🯲🯳🯴🯵🯶🯷🯸🯹
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
// Build a sparse Map for scripts above 0xFFFF (surrogate-pair range).
|
|
93
|
+
// These can't go into a flat Uint8Array indexed by code point efficiently.
|
|
94
|
+
const NOT_DIGIT = 0xFF;
|
|
95
|
+
const HIGH_MAP = new Map(); // codePoint → digit value (0-9)
|
|
96
|
+
|
|
97
|
+
const LOW_MAX = 0xFFFF;
|
|
98
|
+
const LOW_MIN = 0x0660; // first non-ASCII digit script
|
|
99
|
+
|
|
100
|
+
// Flat Uint8Array covering 0x0660 .. 0xFFFF
|
|
101
|
+
const TABLE_OFFSET = LOW_MIN;
|
|
102
|
+
const TABLE_SIZE = LOW_MAX - LOW_MIN + 1;
|
|
103
|
+
const TABLE = new Uint8Array(TABLE_SIZE).fill(NOT_DIGIT);
|
|
104
|
+
|
|
105
|
+
for (const zero of SCRIPT_ZEROS) {
|
|
106
|
+
for (let d = 0; d < 10; d++) {
|
|
107
|
+
const cp = zero + d;
|
|
108
|
+
if (cp <= LOW_MAX) {
|
|
109
|
+
TABLE[cp - TABLE_OFFSET] = d;
|
|
110
|
+
} else {
|
|
111
|
+
HIGH_MAP.set(cp, d);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export { TABLE, TABLE_OFFSET, HIGH_MAP, NOT_DIGIT };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "anynum",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Normalize all Unicode decimal digits (Devanagari, Arabic, Thai, etc.) to ASCII numerals. Zero dependencies, performance-first.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./anynum.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"anynum.js",
|
|
9
|
+
"digitTable.js",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "jasmine tests/anynum.test.js",
|
|
14
|
+
"bench": "node test/bench.js"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"unicode",
|
|
18
|
+
"digits",
|
|
19
|
+
"normalize",
|
|
20
|
+
"devanagari",
|
|
21
|
+
"arabic",
|
|
22
|
+
"hindi",
|
|
23
|
+
"japanese",
|
|
24
|
+
"indic",
|
|
25
|
+
"asian",
|
|
26
|
+
"math",
|
|
27
|
+
"numerals",
|
|
28
|
+
"strnum"
|
|
29
|
+
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/NaturalIntelligence/anynum"
|
|
33
|
+
},
|
|
34
|
+
"author": "Amit Gupta (https://solothought.work/)",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"funding": [
|
|
37
|
+
{
|
|
38
|
+
"type": "github",
|
|
39
|
+
"url": "https://github.com/sponsors/NaturalIntelligence"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
**2.4.0 / 2026-06-09**
|
|
3
|
+
- support unicode numerals using 'anynum'
|
|
4
|
+
|
|
5
|
+
**2.3.0 / 2026-05-07**
|
|
6
|
+
- support octal and binary, test with @byspec/numbers
|
|
7
|
+
- test with @byspec/numbers
|
|
8
|
+
|
|
9
|
+
|
|
2
10
|
**2.2.3 / 2026-04-07**
|
|
3
11
|
- remove unnecessary files from npm package
|
|
4
12
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# strnum
|
|
2
2
|
Parse string into Number based on configuration
|
|
3
3
|
|
|
4
|
+
[](https://npm-compare.com/strnum)
|
|
5
|
+
[](https://www.npmjs.com/package/strnum)
|
|
6
|
+
[](https://github.com/NaturalIntelligence/strnum)
|
|
7
|
+
|
|
4
8
|
## Users
|
|
5
9
|
|
|
6
10
|
<a href="https://github.com/aws-amplify" target="_blank"><img src="https://avatars.githubusercontent.com/u/41077760?s=100&v=4"></a>
|
|
@@ -86,6 +90,10 @@ toNumber("1.0e-2"); //0.01)
|
|
|
86
90
|
|
|
87
91
|
toNumber("+1212121212"); // 1212121212
|
|
88
92
|
toNumber("+1212121212", { skipLike: /\+[0-9]{10}/} )); //"+1212121212"
|
|
93
|
+
|
|
94
|
+
toNumber("1e1000", { unicode: true, infinity: "original" }); //"1e1000"
|
|
95
|
+
toNumber("1000", { unicode: true }); //1000
|
|
96
|
+
toNumber("1000", { unicode: false }); //"1000"
|
|
89
97
|
```
|
|
90
98
|
|
|
91
99
|
Supported Options
|
|
@@ -95,6 +103,7 @@ leadingZeros: true, //when number with leading zeros like 08 should be parsed. 0
|
|
|
95
103
|
eNotation: true, //when number with eNotation or number parsed in eNotation should be considered
|
|
96
104
|
skipLike: /regex/ //when string should not be parsed when it matches the specified regular expression
|
|
97
105
|
infinity: "original", // "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
|
|
106
|
+
unicode: false, //when number with unicode numerals should be parsed
|
|
98
107
|
```
|
|
99
108
|
|
|
100
109
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strnum",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Parse String to Number based on configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "strnum.js",
|
|
@@ -28,5 +28,8 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@byspec/numbers": "^0.1.1",
|
|
30
30
|
"jasmine": "^5.6.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"anynum": "^1.0.0"
|
|
31
34
|
}
|
|
32
35
|
}
|
|
@@ -3,6 +3,8 @@ const binRegex = /^0b[01]+$/;
|
|
|
3
3
|
const octRegex = /^0o[0-7]+$/;
|
|
4
4
|
const numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
|
|
5
5
|
|
|
6
|
+
import anynum from "anynum";
|
|
7
|
+
|
|
6
8
|
const consider = {
|
|
7
9
|
hex: true,
|
|
8
10
|
binary: false,
|
|
@@ -12,6 +14,7 @@ const consider = {
|
|
|
12
14
|
eNotation: true,
|
|
13
15
|
//skipLike: /regex/,
|
|
14
16
|
infinity: "original", // "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
|
|
17
|
+
unicode: false,
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
export default function toNumber(str, options = {}) {
|
|
@@ -23,7 +26,12 @@ export default function toNumber(str, options = {}) {
|
|
|
23
26
|
if (trimmedStr.length === 0) return str;
|
|
24
27
|
else if (options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str;
|
|
25
28
|
else if (trimmedStr === "0") return 0;
|
|
26
|
-
|
|
29
|
+
|
|
30
|
+
if (options.unicode) {
|
|
31
|
+
trimmedStr = anynum(trimmedStr);
|
|
32
|
+
if (trimmedStr === "0") return 0; // re-check after normalization
|
|
33
|
+
}
|
|
34
|
+
if (options.hex && hexRegex.test(trimmedStr)) {
|
|
27
35
|
return parse_int(trimmedStr, 16);
|
|
28
36
|
} else if (options.binary && binRegex.test(trimmedStr)) {
|
|
29
37
|
return parse_int(trimmedStr, 2);
|
package/package.json
CHANGED
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"constructs": "^10.0.5"
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
|
-
"@aws-sdk/client-codedeploy": "^3.
|
|
113
|
+
"@aws-sdk/client-codedeploy": "^3.1068.0",
|
|
114
114
|
"jmespath": "^0.16.0"
|
|
115
115
|
},
|
|
116
116
|
"bundledDependencies": [
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"publishConfig": {
|
|
129
129
|
"access": "public"
|
|
130
130
|
},
|
|
131
|
-
"version": "0.0.
|
|
131
|
+
"version": "0.0.444",
|
|
132
132
|
"jest": {
|
|
133
133
|
"coverageProvider": "v8",
|
|
134
134
|
"testMatch": [
|