@happyvertical/smrt-content 0.36.8 → 0.37.1
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/content-contribution.d.ts +14 -14
- package/dist/content-contributions.d.ts +20 -13
- package/dist/content-contributions.d.ts.map +1 -1
- package/dist/index.js +245 -5
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +106 -30
- package/dist/smrt-knowledge.json +9 -5
- package/package.json +18 -18
|
@@ -120,38 +120,38 @@ export declare class ContentContribution extends SmrtObject {
|
|
|
120
120
|
private createRevision;
|
|
121
121
|
private createHeldAttachments;
|
|
122
122
|
appendRevisionAction(options?: AppendContentContributionRevisionOptions): Promise<{
|
|
123
|
-
contribution:
|
|
124
|
-
revision:
|
|
125
|
-
attachments:
|
|
123
|
+
contribution: Record<string, unknown>;
|
|
124
|
+
revision: Record<string, unknown>;
|
|
125
|
+
attachments: Record<string, unknown>[];
|
|
126
126
|
}>;
|
|
127
|
-
requestChangesAction(options?: RequestChangesContentContributionOptions): Promise<
|
|
128
|
-
rejectAction(options?: RejectContentContributionOptions): Promise<
|
|
129
|
-
withdrawAction(options?: WithdrawContentContributionOptions): Promise<
|
|
127
|
+
requestChangesAction(options?: RequestChangesContentContributionOptions): Promise<Record<string, unknown>>;
|
|
128
|
+
rejectAction(options?: RejectContentContributionOptions): Promise<Record<string, unknown>>;
|
|
129
|
+
withdrawAction(options?: WithdrawContentContributionOptions): Promise<Record<string, unknown>>;
|
|
130
130
|
approveAction(options?: ApproveContentContributionOptions): Promise<{
|
|
131
|
-
contribution:
|
|
132
|
-
content:
|
|
131
|
+
contribution: Record<string, unknown>;
|
|
132
|
+
content: Record<string, unknown> | null;
|
|
133
133
|
assets: {
|
|
134
134
|
attachmentId: string | null | undefined;
|
|
135
135
|
assetId: string;
|
|
136
136
|
}[];
|
|
137
137
|
} | {
|
|
138
|
-
contribution:
|
|
139
|
-
content:
|
|
138
|
+
contribution: Record<string, unknown>;
|
|
139
|
+
content: Record<string, unknown>;
|
|
140
140
|
assets: {
|
|
141
141
|
attachmentId: string | null;
|
|
142
142
|
assetId: string | null;
|
|
143
143
|
}[];
|
|
144
144
|
}>;
|
|
145
145
|
promoteAction(options?: PromoteContentContributionOptions): Promise<{
|
|
146
|
-
contribution:
|
|
147
|
-
content:
|
|
146
|
+
contribution: Record<string, unknown>;
|
|
147
|
+
content: Record<string, unknown> | null;
|
|
148
148
|
assets: {
|
|
149
149
|
attachmentId: string | null | undefined;
|
|
150
150
|
assetId: string;
|
|
151
151
|
}[];
|
|
152
152
|
} | {
|
|
153
|
-
contribution:
|
|
154
|
-
content:
|
|
153
|
+
contribution: Record<string, unknown>;
|
|
154
|
+
content: Record<string, unknown>;
|
|
155
155
|
assets: {
|
|
156
156
|
attachmentId: string | null;
|
|
157
157
|
assetId: string | null;
|
|
@@ -31,45 +31,52 @@ export declare class ContentContributions extends SmrtCollection<ContentContribu
|
|
|
31
31
|
statuses?: string | string[];
|
|
32
32
|
}): Promise<ContentContribution[]>;
|
|
33
33
|
submitWebContribution(options: SubmitWebContentContributionOptions): Promise<{
|
|
34
|
-
contribution:
|
|
35
|
-
content:
|
|
34
|
+
contribution: Record<string, unknown>;
|
|
35
|
+
content: Record<string, unknown> | null;
|
|
36
36
|
assets: {
|
|
37
37
|
attachmentId: string | null | undefined;
|
|
38
38
|
assetId: string;
|
|
39
39
|
}[];
|
|
40
40
|
} | {
|
|
41
|
-
contribution:
|
|
42
|
-
content:
|
|
41
|
+
contribution: Record<string, unknown>;
|
|
42
|
+
content: Record<string, unknown>;
|
|
43
43
|
assets: {
|
|
44
44
|
attachmentId: string | null;
|
|
45
45
|
assetId: string | null;
|
|
46
46
|
}[];
|
|
47
47
|
} | {
|
|
48
|
-
contribution:
|
|
48
|
+
contribution: Record<string, unknown>;
|
|
49
49
|
intake: import('./content-contribution-config').EvaluateContributionIntakeResult;
|
|
50
50
|
}>;
|
|
51
51
|
ingestEmailContribution(options: IngestEmailContentContributionOptions): Promise<{
|
|
52
|
-
contribution:
|
|
53
|
-
content:
|
|
52
|
+
contribution: Record<string, unknown>;
|
|
53
|
+
content: Record<string, unknown> | null;
|
|
54
54
|
assets: {
|
|
55
55
|
attachmentId: string | null | undefined;
|
|
56
56
|
assetId: string;
|
|
57
57
|
}[];
|
|
58
58
|
} | {
|
|
59
|
-
contribution:
|
|
60
|
-
content:
|
|
59
|
+
contribution: Record<string, unknown>;
|
|
60
|
+
content: Record<string, unknown>;
|
|
61
61
|
assets: {
|
|
62
62
|
attachmentId: string | null;
|
|
63
63
|
assetId: string | null;
|
|
64
64
|
}[];
|
|
65
65
|
} | {
|
|
66
|
+
contribution: Record<string, unknown>;
|
|
66
67
|
intake: import('./content-contribution-config').EvaluateContributionIntakeResult;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
attachments: any[];
|
|
68
|
+
revision: null;
|
|
69
|
+
attachments: Record<string, unknown>[];
|
|
70
70
|
} | {
|
|
71
|
-
contribution: any;
|
|
72
71
|
intake: import('./content-contribution-config').EvaluateContributionIntakeResult;
|
|
72
|
+
contribution: Record<string, unknown>;
|
|
73
|
+
revision: Record<string, unknown>;
|
|
74
|
+
attachments: Record<string, unknown>[];
|
|
75
|
+
} | {
|
|
76
|
+
contribution: Record<string, unknown>;
|
|
77
|
+
intake: import('./content-contribution-config').EvaluateContributionIntakeResult;
|
|
78
|
+
revision?: undefined;
|
|
79
|
+
attachments?: undefined;
|
|
73
80
|
}>;
|
|
74
81
|
}
|
|
75
82
|
//# sourceMappingURL=content-contributions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-contributions.d.ts","sourceRoot":"","sources":["../src/content-contributions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAQ,MAAM,0BAA0B,CAAC;AAMhE,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAS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AO,EAAE,mCAAmC;;;;;;;;;;;;;;;;;;IAwElE,uBAAuB,CAC3B,OAAO,EAAE,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuKjD"}
|
package/dist/index.js
CHANGED
|
@@ -7017,7 +7017,6 @@ const CURRENCY = {
|
|
|
7017
7017
|
yen: "¥",
|
|
7018
7018
|
euro: "€",
|
|
7019
7019
|
dollar: "$",
|
|
7020
|
-
euro: "€",
|
|
7021
7020
|
fnof: "ƒ",
|
|
7022
7021
|
inr: "₹",
|
|
7023
7022
|
af: "؋",
|
|
@@ -7232,6 +7231,7 @@ class EntityDecoder {
|
|
|
7232
7231
|
*/
|
|
7233
7232
|
decode(str) {
|
|
7234
7233
|
if (typeof str !== "string" || str.length === 0) return str;
|
|
7234
|
+
if (str.indexOf("&") === -1) return str;
|
|
7235
7235
|
const original = str;
|
|
7236
7236
|
const chunks = [];
|
|
7237
7237
|
const len = str.length;
|
|
@@ -7862,17 +7862,244 @@ function validateEntityName(name) {
|
|
|
7862
7862
|
else
|
|
7863
7863
|
throw new Error(`Invalid entity name ${name}`);
|
|
7864
7864
|
}
|
|
7865
|
+
const SCRIPT_ZEROS = [
|
|
7866
|
+
// Basic Latin (ASCII) — included for completeness / pass-through
|
|
7867
|
+
48,
|
|
7868
|
+
// 0-9
|
|
7869
|
+
// Arabic scripts
|
|
7870
|
+
1632,
|
|
7871
|
+
// Arabic-Indic ٠١٢٣٤٥٦٧٨٩
|
|
7872
|
+
1776,
|
|
7873
|
+
// Extended Arabic-Indic (Urdu/Persian/Sindhi) ۰۱۲۳
|
|
7874
|
+
// Indic scripts
|
|
7875
|
+
2406,
|
|
7876
|
+
// Devanagari ०१२३४५६७८९
|
|
7877
|
+
2534,
|
|
7878
|
+
// Bengali ০১২৩৪৫৬৭৮৯
|
|
7879
|
+
2662,
|
|
7880
|
+
// Gurmukhi ੦੧੨੩੪੫੬੭੮੯
|
|
7881
|
+
2790,
|
|
7882
|
+
// Gujarati ૦૧૨૩૪૫૬૭૮૯
|
|
7883
|
+
2918,
|
|
7884
|
+
// Odia ୦୧୨୩୪୫୬୭୮୯
|
|
7885
|
+
3046,
|
|
7886
|
+
// Tamil ௦௧௨௩௪௫௬௭௮௯
|
|
7887
|
+
3174,
|
|
7888
|
+
// Telugu ౦౧౨౩౪౫౬౭౮౯
|
|
7889
|
+
3302,
|
|
7890
|
+
// Kannada ೦೧೨೩೪೫೬೭೮೯
|
|
7891
|
+
3430,
|
|
7892
|
+
// Malayalam ൦൧൨൩൪൫൬൭൮൯
|
|
7893
|
+
3558,
|
|
7894
|
+
// Sinhala Archaic ෦෧෨෩෪෫෬෭෮෯
|
|
7895
|
+
// Southeast Asian scripts
|
|
7896
|
+
3664,
|
|
7897
|
+
// Thai ๐๑๒๓๔๕๖๗๘๙
|
|
7898
|
+
3792,
|
|
7899
|
+
// Lao ໐໑໒໓໔໕໖໗໘໙
|
|
7900
|
+
3872,
|
|
7901
|
+
// Tibetan ༠༡༢༣༤༥༦༧༨༩
|
|
7902
|
+
4160,
|
|
7903
|
+
// Myanmar ၀၁၂၃၄၅၆၇၈၉
|
|
7904
|
+
4240,
|
|
7905
|
+
// Myanmar Shan ႐႑႒႓႔႕႖႗႘႙
|
|
7906
|
+
6112,
|
|
7907
|
+
// Khmer ០១២៣៤៥៦៧៨៩
|
|
7908
|
+
6160,
|
|
7909
|
+
// Mongolian ᠐᠑᠒᠓᠔᠕᠖᠗᠘᠙
|
|
7910
|
+
6470,
|
|
7911
|
+
// Limbu ᥆᥇᥈᥉᥊᥋᥌᥍᥎᥏
|
|
7912
|
+
6608,
|
|
7913
|
+
// New Tai Lue ᧐᧑᧒᧓᧔᧕᧖᧗᧘᧙
|
|
7914
|
+
6784,
|
|
7915
|
+
// Tai Tham Hora ᪀᪁᪂᪃᪄᪅᪆᪇᪈᪉
|
|
7916
|
+
6800,
|
|
7917
|
+
// Tai Tham Tham ᪐᪑᪒᪓᪔᪕᪖᪗᪘᪙
|
|
7918
|
+
6992,
|
|
7919
|
+
// Balinese ᭐᭑᭒᭓᭔᭕᭖᭗᭘᭙
|
|
7920
|
+
7088,
|
|
7921
|
+
// Sundanese ᮰᮱᮲᮳᮴᮵᮶᮷᮸᮹
|
|
7922
|
+
7232,
|
|
7923
|
+
// Lepcha ᱀᱁᱂᱃᱄᱅᱆᱇᱈᱉
|
|
7924
|
+
7248,
|
|
7925
|
+
// Ol Chiki ᱐᱑᱒᱓᱔᱕᱖᱗᱘᱙
|
|
7926
|
+
// Fullwidth (CJK context)
|
|
7927
|
+
65296,
|
|
7928
|
+
// Fullwidth 0123456789
|
|
7929
|
+
// Mathematical digit variants (Unicode math block)
|
|
7930
|
+
120782,
|
|
7931
|
+
// Mathematical Bold
|
|
7932
|
+
120792,
|
|
7933
|
+
// Mathematical Double-Struck
|
|
7934
|
+
120802,
|
|
7935
|
+
// Mathematical Sans-Serif
|
|
7936
|
+
120812,
|
|
7937
|
+
// Mathematical Sans-Serif Bold
|
|
7938
|
+
120822,
|
|
7939
|
+
// Mathematical Monospace
|
|
7940
|
+
// Other scripts
|
|
7941
|
+
66720,
|
|
7942
|
+
// Osmanya 𐒠𐒡𐒢𐒣𐒤𐒥𐒦𐒧𐒨𐒩
|
|
7943
|
+
68912,
|
|
7944
|
+
// Hanifi Rohingya 𐴰𐴱𐴲𐴳𐴴𐴵𐴶𐴷𐴸𐴹
|
|
7945
|
+
69734,
|
|
7946
|
+
// Brahmi 𑁦𑁧𑁨𑁩𑁪𑁫𑁬𑁭𑁮𑁯
|
|
7947
|
+
69872,
|
|
7948
|
+
// Sora Sompeng 𑃰𑃱𑃲𑃳𑃴𑃵𑃶𑃷𑃸𑃹
|
|
7949
|
+
69942,
|
|
7950
|
+
// Chakma 𑄶𑄷𑄸𑄹𑄺𑄻𑄼𑄽𑄾𑄿
|
|
7951
|
+
70096,
|
|
7952
|
+
// Sharada 𑇐𑇑𑇒𑇓𑇔𑇕𑇖𑇗𑇘𑇙
|
|
7953
|
+
70384,
|
|
7954
|
+
// Khudawadi 𑋰𑋱𑋲𑋳𑋴𑋵𑋶𑋷𑋸𑋹
|
|
7955
|
+
70736,
|
|
7956
|
+
// Newa 𑑐𑑑𑑒𑑓𑑔𑑕𑑖𑑗𑑘𑑙
|
|
7957
|
+
70864,
|
|
7958
|
+
// Tirhuta 𑓐𑓑𑓒𑓓𑓔𑓕𑓖𑓗𑓘𑓙
|
|
7959
|
+
71248,
|
|
7960
|
+
// Modi 𑙐𑙑𑙒𑙓𑙔𑙕𑙖𑙗𑙘𑙙
|
|
7961
|
+
71360,
|
|
7962
|
+
// Takri 𑛀𑛁𑛂𑛃𑛄𑛅𑛆𑛇𑛈𑛉
|
|
7963
|
+
71472,
|
|
7964
|
+
// Ahom 𑜰𑜱𑜲𑜳𑜴𑜵𑜶𑜷𑜸𑜹
|
|
7965
|
+
71904,
|
|
7966
|
+
// Warang Citi 𑣠𑣡𑣢𑣣𑣤𑣥𑣦𑣧𑣨𑣩
|
|
7967
|
+
72016,
|
|
7968
|
+
// Dives Akuru 𑥐𑥑𑥒𑥓𑥔𑥕𑥖𑥗𑥘𑥙
|
|
7969
|
+
72688,
|
|
7970
|
+
// Khitan Small Script
|
|
7971
|
+
72784,
|
|
7972
|
+
// Bhaiksuki 𑱐𑱑𑱒𑱓𑱔𑱕𑱖𑱗𑱘𑱙
|
|
7973
|
+
73040,
|
|
7974
|
+
// Masaram Gondi 𑵐𑵑𑵒𑵓𑵔𑵕𑵖𑵗𑵘𑵙
|
|
7975
|
+
73120,
|
|
7976
|
+
// Gunjala Gondi 𑶠𑶡𑶢𑶣𑶤𑶥𑶦𑶧𑶨𑶩
|
|
7977
|
+
73552,
|
|
7978
|
+
// Kawi 𑽐𑽑𑽒𑽓𑽔𑽕𑽖𑽗𑽘𑽙
|
|
7979
|
+
92768,
|
|
7980
|
+
// Mro 𖩠𖩡𖩢𖩣𖩤𖩥𖩦𖩧𖩨𖩩
|
|
7981
|
+
92864,
|
|
7982
|
+
// Tangsa 𖫀𖫁𖫂𖫃𖫄𖫅𖫆𖫇𖫈𖫉
|
|
7983
|
+
93008,
|
|
7984
|
+
// Pahawh Hmong 𖭐𖭑𖭒𖭓𖭔𖭕𖭖𖭗𖭘𖭙
|
|
7985
|
+
123200,
|
|
7986
|
+
// Nyiakeng Puachue Hmong 𞅀𞅁𞅂𞅃𞅄𞅅𞅆𞅇𞅈𞅉
|
|
7987
|
+
123632,
|
|
7988
|
+
// Wancho 𞋰𞋱𞋲𞋳𞋴𞋵𞋶𞋷𞋸𞋹
|
|
7989
|
+
124144,
|
|
7990
|
+
// Nag Mundari 𞓰𞓱𞓲𞓳𞓴𞓵𞓶𞓷𞓸𞓹
|
|
7991
|
+
125264,
|
|
7992
|
+
// Adlam 𞥐𞥑𞥒𞥓𞥔𞥕𞥖𞥗𞥘𞥙
|
|
7993
|
+
130032
|
|
7994
|
+
// Segmented digit symbols 🯰🯱🯲🯳🯴🯵🯶🯷🯸🯹
|
|
7995
|
+
];
|
|
7996
|
+
const NOT_DIGIT = 255;
|
|
7997
|
+
const HIGH_MAP = /* @__PURE__ */ new Map();
|
|
7998
|
+
const LOW_MAX = 65535;
|
|
7999
|
+
const LOW_MIN = 1632;
|
|
8000
|
+
const TABLE_OFFSET = LOW_MIN;
|
|
8001
|
+
const TABLE_SIZE = LOW_MAX - LOW_MIN + 1;
|
|
8002
|
+
const TABLE = new Uint8Array(TABLE_SIZE).fill(NOT_DIGIT);
|
|
8003
|
+
for (const zero of SCRIPT_ZEROS) {
|
|
8004
|
+
for (let d = 0; d < 10; d++) {
|
|
8005
|
+
const cp = zero + d;
|
|
8006
|
+
if (cp <= LOW_MAX) {
|
|
8007
|
+
TABLE[cp - TABLE_OFFSET] = d;
|
|
8008
|
+
} else {
|
|
8009
|
+
HIGH_MAP.set(cp, d);
|
|
8010
|
+
}
|
|
8011
|
+
}
|
|
8012
|
+
}
|
|
8013
|
+
const CHAR_0 = 48;
|
|
8014
|
+
const CHAR_9 = 57;
|
|
8015
|
+
const CHAR_MINUS = 45;
|
|
8016
|
+
const MINUS_SET = /* @__PURE__ */ new Set([8722, 65293, 65123]);
|
|
8017
|
+
function anynum(str) {
|
|
8018
|
+
if (typeof str !== "string") return str;
|
|
8019
|
+
const len = str.length;
|
|
8020
|
+
if (len === 0) return str;
|
|
8021
|
+
let firstHit = -1;
|
|
8022
|
+
for (let i = 0; i < len; i++) {
|
|
8023
|
+
const cc = str.charCodeAt(i);
|
|
8024
|
+
if (cc >= CHAR_0 && cc <= CHAR_9 || cc === CHAR_MINUS) continue;
|
|
8025
|
+
if (cc < TABLE_OFFSET) {
|
|
8026
|
+
if (MINUS_SET.has(cc)) {
|
|
8027
|
+
firstHit = i;
|
|
8028
|
+
break;
|
|
8029
|
+
}
|
|
8030
|
+
continue;
|
|
8031
|
+
}
|
|
8032
|
+
if (cc >= 55296 && cc <= 56319) {
|
|
8033
|
+
if (i + 1 < len) {
|
|
8034
|
+
const low = str.charCodeAt(i + 1);
|
|
8035
|
+
if (low >= 56320 && low <= 57343) {
|
|
8036
|
+
const cp = 65536 + (cc - 55296 << 10) + (low - 56320);
|
|
8037
|
+
if (HIGH_MAP.has(cp)) {
|
|
8038
|
+
firstHit = i;
|
|
8039
|
+
break;
|
|
8040
|
+
}
|
|
8041
|
+
}
|
|
8042
|
+
}
|
|
8043
|
+
continue;
|
|
8044
|
+
}
|
|
8045
|
+
if (TABLE[cc - TABLE_OFFSET] !== NOT_DIGIT || MINUS_SET.has(cc)) {
|
|
8046
|
+
firstHit = i;
|
|
8047
|
+
break;
|
|
8048
|
+
}
|
|
8049
|
+
}
|
|
8050
|
+
if (firstHit === -1) return str;
|
|
8051
|
+
const chars = [];
|
|
8052
|
+
if (firstHit > 0) chars.push(str.slice(0, firstHit));
|
|
8053
|
+
for (let i = firstHit; i < len; i++) {
|
|
8054
|
+
const cc = str.charCodeAt(i);
|
|
8055
|
+
if (cc >= CHAR_0 && cc <= CHAR_9 || cc === CHAR_MINUS) {
|
|
8056
|
+
chars.push(str[i]);
|
|
8057
|
+
continue;
|
|
8058
|
+
}
|
|
8059
|
+
if (cc < TABLE_OFFSET) {
|
|
8060
|
+
chars.push(MINUS_SET.has(cc) ? "-" : str[i]);
|
|
8061
|
+
continue;
|
|
8062
|
+
}
|
|
8063
|
+
if (cc >= 55296 && cc <= 56319) {
|
|
8064
|
+
if (i + 1 < len) {
|
|
8065
|
+
const low = str.charCodeAt(i + 1);
|
|
8066
|
+
if (low >= 56320 && low <= 57343) {
|
|
8067
|
+
const cp = 65536 + (cc - 55296 << 10) + (low - 56320);
|
|
8068
|
+
const d2 = HIGH_MAP.get(cp);
|
|
8069
|
+
if (d2 !== void 0) {
|
|
8070
|
+
chars.push(String.fromCharCode(d2 + 48));
|
|
8071
|
+
i++;
|
|
8072
|
+
continue;
|
|
8073
|
+
}
|
|
8074
|
+
}
|
|
8075
|
+
}
|
|
8076
|
+
chars.push(str[i]);
|
|
8077
|
+
continue;
|
|
8078
|
+
}
|
|
8079
|
+
if (MINUS_SET.has(cc)) {
|
|
8080
|
+
chars.push("-");
|
|
8081
|
+
continue;
|
|
8082
|
+
}
|
|
8083
|
+
const d = TABLE[cc - TABLE_OFFSET];
|
|
8084
|
+
chars.push(d !== NOT_DIGIT ? String.fromCharCode(d + 48) : str[i]);
|
|
8085
|
+
}
|
|
8086
|
+
return chars.join("");
|
|
8087
|
+
}
|
|
7865
8088
|
const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
8089
|
+
const binRegex = /^0b[01]+$/;
|
|
8090
|
+
const octRegex = /^0o[0-7]+$/;
|
|
7866
8091
|
const numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
|
|
7867
8092
|
const consider = {
|
|
7868
8093
|
hex: true,
|
|
7869
|
-
|
|
8094
|
+
binary: false,
|
|
8095
|
+
octal: false,
|
|
7870
8096
|
leadingZeros: true,
|
|
7871
8097
|
decimalPoint: ".",
|
|
7872
8098
|
eNotation: true,
|
|
7873
8099
|
//skipLike: /regex/,
|
|
7874
|
-
infinity: "original"
|
|
8100
|
+
infinity: "original",
|
|
7875
8101
|
// "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
|
|
8102
|
+
unicode: false
|
|
7876
8103
|
};
|
|
7877
8104
|
function toNumber(str, options = {}) {
|
|
7878
8105
|
options = Object.assign({}, consider, options);
|
|
@@ -7881,8 +8108,16 @@ function toNumber(str, options = {}) {
|
|
|
7881
8108
|
if (trimmedStr.length === 0) return str;
|
|
7882
8109
|
else if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str;
|
|
7883
8110
|
else if (trimmedStr === "0") return 0;
|
|
7884
|
-
|
|
8111
|
+
if (options.unicode) {
|
|
8112
|
+
trimmedStr = anynum(trimmedStr);
|
|
8113
|
+
if (trimmedStr === "0") return 0;
|
|
8114
|
+
}
|
|
8115
|
+
if (options.hex && hexRegex.test(trimmedStr)) {
|
|
7885
8116
|
return parse_int(trimmedStr, 16);
|
|
8117
|
+
} else if (options.binary && binRegex.test(trimmedStr)) {
|
|
8118
|
+
return parse_int(trimmedStr, 2);
|
|
8119
|
+
} else if (options.octal && octRegex.test(trimmedStr)) {
|
|
8120
|
+
return parse_int(trimmedStr, 8);
|
|
7886
8121
|
} else if (!isFinite(trimmedStr)) {
|
|
7887
8122
|
return handleInfinity(str, Number(trimmedStr), options);
|
|
7888
8123
|
} else if (trimmedStr.includes("e") || trimmedStr.includes("E")) {
|
|
@@ -7962,6 +8197,8 @@ function trimZeros(numStr) {
|
|
|
7962
8197
|
return numStr;
|
|
7963
8198
|
}
|
|
7964
8199
|
function parse_int(numStr, base) {
|
|
8200
|
+
const str = numStr.trim();
|
|
8201
|
+
if (base === 2 || base === 8) numStr = str.substring(2);
|
|
7965
8202
|
if (parseInt) return parseInt(numStr, base);
|
|
7966
8203
|
else if (Number.parseInt) return Number.parseInt(numStr, base);
|
|
7967
8204
|
else if (window && window.parseInt) return window.parseInt(numStr, base);
|
|
@@ -9294,7 +9531,7 @@ function readStopNodeData(xmlData, tagName, i) {
|
|
|
9294
9531
|
const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
|
|
9295
9532
|
i = closeIndex;
|
|
9296
9533
|
} else {
|
|
9297
|
-
const tagData = readTagExp(xmlData, i,
|
|
9534
|
+
const tagData = readTagExp(xmlData, i, false);
|
|
9298
9535
|
if (tagData) {
|
|
9299
9536
|
const openTagName = tagData && tagData.tagName;
|
|
9300
9537
|
if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") {
|
|
@@ -9378,6 +9615,9 @@ function compress(arr, options, matcher, readonlyMatcher) {
|
|
|
9378
9615
|
} else if (tagObj[property]) {
|
|
9379
9616
|
let val = compress(tagObj[property], options, matcher, readonlyMatcher);
|
|
9380
9617
|
const isLeaf = isLeafTag(val, options);
|
|
9618
|
+
if (Object.keys(val).length === 0 && options.alwaysCreateTextNode) {
|
|
9619
|
+
val[options.textNodeName] = "";
|
|
9620
|
+
}
|
|
9381
9621
|
if (tagObj[":@"]) {
|
|
9382
9622
|
assignAttributes(val, tagObj[":@"], readonlyMatcher, options);
|
|
9383
9623
|
} else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
|