@ygracs/xobj-lib-js 0.2.5-b → 0.2.7-b

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/CHANGELOG.md CHANGED
@@ -3,6 +3,7 @@
3
3
  Release version.
4
4
 
5
5
  > - update `xObj.md`;
6
+ > - add a new `EvalKeyNameError` class;
6
7
  > - some fixes.
7
8
 
8
9
  #### *v0.2.4*
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019-2025 Yuri Grachev
3
+ Copyright (c) 2019-2026 Yuri Grachev
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/index.d.ts CHANGED
@@ -1,53 +1,76 @@
1
- declare const _exports: {
2
- readXObjParamRaw: typeof import("./lib/xObj-lib").readXObjParamRaw;
3
- readXObjParam: typeof import("./lib/xObj-lib").readXObjParam;
4
- readXObjParamAsBool: typeof import("./lib/xObj-lib").readXObjParamAsBool;
5
- readXObjParamAsNum: typeof import("./lib/xObj-lib").readXObjParamAsNum;
6
- readXObjParamEx: typeof import("./lib/xObj-lib").readXObjParamEx;
7
- readXObjParamAsIndex: typeof import("./lib/xObj-lib").readXObjParamAsIndex;
8
- writeXObjParamRaw: typeof import("./lib/xObj-lib").writeXObjParamRaw;
9
- writeXObjParam: typeof import("./lib/xObj-lib").writeXObjParam;
10
- writeXObjParamAsBool: typeof import("./lib/xObj-lib").writeXObjParamAsBool;
11
- writeXObjParamAsNum: typeof import("./lib/xObj-lib").writeXObjParamAsNum;
12
- writeXObjParamAsIndex: typeof import("./lib/xObj-lib").writeXObjParamAsIndex;
13
- writeXObjParamEx: typeof import("./lib/xObj-lib").writeXObjParamEx;
14
- readXObjAttrRaw: typeof import("./lib/xObj-lib").readXObjAttrRaw;
15
- readXObjAttr: typeof import("./lib/xObj-lib").readXObjAttr;
16
- readXObjAttrAsBool: typeof import("./lib/xObj-lib").readXObjAttrAsBool;
17
- readXObjAttrAsNum: typeof import("./lib/xObj-lib").readXObjAttrAsNum;
18
- readXObjAttrEx: typeof import("./lib/xObj-lib").readXObjAttrEx;
19
- readXObjAttrAsIndex: typeof import("./lib/xObj-lib").readXObjAttrAsIndex;
20
- writeXObjAttrRaw: typeof import("./lib/xObj-lib").writeXObjAttrRaw;
21
- writeXObjAttr: typeof import("./lib/xObj-lib").writeXObjAttr;
22
- writeXObjAttrAsBool: typeof import("./lib/xObj-lib").writeXObjAttrAsBool;
23
- writeXObjAttrAsNum: typeof import("./lib/xObj-lib").writeXObjAttrAsNum;
24
- writeXObjAttrAsIndex: typeof import("./lib/xObj-lib").writeXObjAttrAsIndex;
25
- writeXObjAttrEx: typeof import("./lib/xObj-lib").writeXObjAttrEx;
26
- getXObjAttributes: typeof import("./lib/xObj-lib").getXObjAttributes;
27
- checkXObjAttribute: typeof import("./lib/xObj-lib").checkXObjAttribute;
28
- deleteXObjAttribute: typeof import("./lib/xObj-lib").deleteXObjAttribute;
29
- renameXObjAttribute: typeof import("./lib/xObj-lib").renameXObjAttribute;
30
- getXObjElement: typeof import("./lib/xObj-lib").getXObjElement;
31
- addXObjElement: typeof import("./lib/xObj-lib").addXObjElement;
32
- insertXObjElement: typeof import("./lib/xObj-lib").insertXObjElement;
33
- insertXObjElementEx: typeof import("./lib/xObj-lib").insertXObjElementEx;
34
- deleteXObjElement: typeof import("./lib/xObj-lib").deleteXObjElement;
35
- deleteXObjElementEx: typeof import("./lib/xObj-lib").deleteXObjElementEx;
36
- renameXObjElement: typeof import("./lib/xObj-lib").renameXObjElement;
37
- evalXObjEName: typeof import("./lib/xObj-lib").evalXObjEName;
38
- insertXObjEList: typeof import("./lib/xObj-lib").insertXObjEList;
39
- insertXObjEListEx: typeof import("./lib/xObj-lib").insertXObjEListEx;
40
- evalKeyName: typeof import("./lib/xObj-lib").evalKeyName;
41
- genXObjENameDescr: typeof import("./lib/xObj-lib").genXObjENameDescr;
42
- insertXObjElements: typeof import("./lib/xObj-lib").insertXObjElements;
43
- insertXObjEChain: typeof import("./lib/xObj-lib").insertXObjEChain;
44
- readonly XOBJ_DEF_PARAM_TNAME: string;
45
- readonly XOBJ_DEF_ATTR_TNAME: string;
46
- TXmlContentParseOptions: typeof TXmlContentParseOptions;
47
- DEF_XML_PARSE_OPTIONS: typeof DEF_XML_PARSE_OPTIONS;
48
- XOBJ_DEF_TNAMES: typeof XOBJ_DEF_TNAMES;
49
- };
50
- export = _exports;
51
- import { TXmlContentParseOptions } from "./lib/xObj-defs";
52
- import { DEF_XML_PARSE_OPTIONS } from "./lib/xObj-defs";
53
- import { XOBJ_DEF_TNAMES } from "./lib/xObj-defs";
1
+ declare const _exports: {
2
+ readXObjParamRaw: typeof import("./lib/xObj-lib").readXObjParamRaw;
3
+ readXObjParam: typeof import("./lib/xObj-lib").readXObjParam;
4
+ readXObjParamAsBool: typeof import("./lib/xObj-lib").readXObjParamAsBool;
5
+ readXObjParamAsNum: typeof import("./lib/xObj-lib").readXObjParamAsNum;
6
+ readXObjParamEx: typeof import("./lib/xObj-lib").readXObjParamEx;
7
+ readXObjParamAsIndex: typeof import("./lib/xObj-lib").readXObjParamAsIndex;
8
+ writeXObjParamRaw: typeof import("./lib/xObj-lib").writeXObjParamRaw;
9
+ writeXObjParam: typeof import("./lib/xObj-lib").writeXObjParam;
10
+ writeXObjParamAsBool: typeof import("./lib/xObj-lib").writeXObjParamAsBool;
11
+ writeXObjParamAsNum: typeof import("./lib/xObj-lib").writeXObjParamAsNum;
12
+ writeXObjParamAsIndex: typeof import("./lib/xObj-lib").writeXObjParamAsIndex;
13
+ writeXObjParamEx: typeof import("./lib/xObj-lib").writeXObjParamEx;
14
+ readXObjAttrRaw: typeof import("./lib/xObj-lib").readXObjAttrRaw;
15
+ readXObjAttr: typeof import("./lib/xObj-lib").readXObjAttr;
16
+ readXObjAttrAsBool: typeof import("./lib/xObj-lib").readXObjAttrAsBool;
17
+ readXObjAttrAsNum: typeof import("./lib/xObj-lib").readXObjAttrAsNum;
18
+ readXObjAttrEx: typeof import("./lib/xObj-lib").readXObjAttrEx;
19
+ readXObjAttrAsIndex: typeof import("./lib/xObj-lib").readXObjAttrAsIndex;
20
+ writeXObjAttrRaw: typeof import("./lib/xObj-lib").writeXObjAttrRaw;
21
+ writeXObjAttr: typeof import("./lib/xObj-lib").writeXObjAttr;
22
+ writeXObjAttrAsBool: typeof import("./lib/xObj-lib").writeXObjAttrAsBool;
23
+ writeXObjAttrAsNum: typeof import("./lib/xObj-lib").writeXObjAttrAsNum;
24
+ writeXObjAttrAsIndex: typeof import("./lib/xObj-lib").writeXObjAttrAsIndex;
25
+ writeXObjAttrEx: typeof import("./lib/xObj-lib").writeXObjAttrEx;
26
+ getXObjAttributes: typeof import("./lib/xObj-lib").getXObjAttributes;
27
+ checkXObjAttribute: typeof import("./lib/xObj-lib").checkXObjAttribute;
28
+ deleteXObjAttribute: typeof import("./lib/xObj-lib").deleteXObjAttribute;
29
+ renameXObjAttribute: typeof import("./lib/xObj-lib").renameXObjAttribute;
30
+ getXObjElement: typeof import("./lib/xObj-lib").getXObjElement;
31
+ addXObjElement: typeof import("./lib/xObj-lib").addXObjElement;
32
+ insertXObjElement: typeof import("./lib/xObj-lib").insertXObjElement;
33
+ insertXObjElementEx: typeof import("./lib/xObj-lib").insertXObjElementEx;
34
+ deleteXObjElement: typeof import("./lib/xObj-lib").deleteXObjElement;
35
+ deleteXObjElementEx: typeof import("./lib/xObj-lib").deleteXObjElementEx;
36
+ renameXObjElement: typeof import("./lib/xObj-lib").renameXObjElement;
37
+ evalXObjEName: typeof import("./lib/xObj-lib").evalXObjEName;
38
+ insertXObjEList: typeof import("./lib/xObj-lib").insertXObjEList;
39
+ insertXObjEListEx: typeof import("./lib/xObj-lib").insertXObjEListEx;
40
+ evalKeyName: typeof import("./lib/xObj-lib").evalKeyName;
41
+ genXObjENameDescr: typeof import("./lib/xObj-lib").genXObjENameDescr;
42
+ insertXObjElements: typeof import("./lib/xObj-lib").insertXObjElements;
43
+ insertXObjEChain: typeof import("./lib/xObj-lib").insertXObjEChain;
44
+ TXmlContentParseOptions: typeof TXmlContentParseOptions;
45
+ DEF_XML_PARSE_OPTIONS: typeof DEF_XML_PARSE_OPTIONS;
46
+ XOBJ_DEF_TNAMES: typeof XOBJ_DEF_TNAMES;
47
+ EvalKeyNameError: typeof EvalKeyNameError;
48
+
49
+ xml2jsParseOptions: xml2jsParseOptions;
50
+ js2xmlParseOptions: js2xmlParseOptions;
51
+ OPT_parserOptions: OPT_parserOptions;
52
+
53
+ XObjENameDescr: XObjENameDescr;
54
+ OPT_inselops_L: OPT_inselops_L;
55
+ OPT_inselops_S: OPT_inselops_S;
56
+ RVAL_reason: RVAL_reason;
57
+ RVAL_emodif: RVAL_emodif;
58
+ VCOR_evalkname: VCOR_evalkname;
59
+ };
60
+ export = _exports;
61
+ import { TXmlContentParseOptions } from "./lib/xObj-defs";
62
+ import { DEF_XML_PARSE_OPTIONS } from "./lib/xObj-defs";
63
+ import { XOBJ_DEF_TNAMES } from "./lib/xObj-defs";
64
+ import { EvalKeyNameError } from "./lib/xObj-errors";
65
+
66
+ import type {
67
+ xml2jsParseOptions, js2xmlParseOptions,
68
+ OPT_parserOptions,
69
+ } from "./lib/xObj-defs";
70
+
71
+ import type {
72
+ XObjENameDescr,
73
+ OPT_inselops_L, OPT_inselops_S,
74
+ RVAL_reason, RVAL_emodif,
75
+ VCOR_evalkname,
76
+ } from "./lib/xObj-lib";
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // [v0.1.013-20251213]
1
+ // [v0.1.014-20251228]
2
2
 
3
3
  // === module init block ===
4
4
 
@@ -8,6 +8,10 @@ const {
8
8
  XOBJ_DEF_TNAMES,
9
9
  } = require('./lib/xObj-defs');
10
10
 
11
+ const {
12
+ EvalKeyNameError,
13
+ } = require('./lib/xObj-errors');
14
+
11
15
  // === module inner block ===
12
16
 
13
17
  // === module main block ===
@@ -15,6 +19,9 @@ const {
15
19
  // === module exports block ===
16
20
 
17
21
  module.exports = require('./lib/xObj-lib');
22
+
18
23
  module.exports.TXmlContentParseOptions = TXmlContentParseOptions;
19
24
  module.exports.DEF_XML_PARSE_OPTIONS = DEF_XML_PARSE_OPTIONS;
20
25
  module.exports.XOBJ_DEF_TNAMES = XOBJ_DEF_TNAMES;
26
+
27
+ module.exports.EvalKeyNameError = EvalKeyNameError;
@@ -1,166 +1,118 @@
1
- /**
2
- * A parser options settings
3
- */
4
- export type OPT_parserOptions = {
5
- compact?: boolean | undefined;
6
- declarationKey?: string | undefined;
7
- attributesKey?: string | undefined;
8
- textKey?: string | undefined;
9
- commentKey?: string | undefined;
10
- cdataKey?: string | undefined;
11
- nameKey?: string | undefined;
12
- typeKey?: string | undefined;
13
- parentKey?: string | undefined;
14
- elementsKey?: string | undefined;
15
- ignoreDeclaration?: boolean | undefined;
16
- ignoreDocType?: boolean | undefined;
17
- ignoreInstraction?: boolean | undefined;
18
- ignoreText?: boolean | undefined;
19
- ignoreComment?: boolean | undefined;
20
- ignoreCData?: boolean | undefined;
21
- fullTagEmptyElement?: boolean | undefined;
22
- addParent?: boolean | undefined;
23
- trim?: boolean | undefined;
24
- spaces?: any;
25
- };
26
- /**
27
- * A parser options to convert an 'XML'-string into a 'JS'-object
28
- */
29
- export type xml2jsParseOptions = {
30
- compact?: boolean | undefined;
31
- declarationKey?: string | undefined;
32
- attributesKey?: string | undefined;
33
- textKey?: string | undefined;
34
- commentKey?: string | undefined;
35
- cdataKey?: string | undefined;
36
- nameKey?: string | undefined;
37
- typeKey?: string | undefined;
38
- parentKey?: string | undefined;
39
- elementsKey?: string | undefined;
40
- ignoreDeclaration?: boolean | undefined;
41
- ignoreDocType?: boolean | undefined;
42
- ignoreInstraction?: boolean | undefined;
43
- ignoreText?: boolean | undefined;
44
- ignoreComment?: boolean | undefined;
45
- ignoreCData?: boolean | undefined;
46
- addParent?: boolean | undefined;
47
- trim?: boolean | undefined;
48
- };
49
- /**
50
- * A parser options to convert a 'JS'-object into an 'XML'-string
51
- */
52
- export type js2xmlParseOptions = {
53
- compact?: boolean | undefined;
54
- declarationKey?: string | undefined;
55
- attributesKey?: string | undefined;
56
- textKey?: string | undefined;
57
- commentKey?: string | undefined;
58
- cdataKey?: string | undefined;
59
- nameKey?: string | undefined;
60
- typeKey?: string | undefined;
61
- parentKey?: string | undefined;
62
- elementsKey?: string | undefined;
63
- ignoreDeclaration?: boolean | undefined;
64
- ignoreDocType?: boolean | undefined;
65
- ignoreInstraction?: boolean | undefined;
66
- ignoreText?: boolean | undefined;
67
- ignoreComment?: boolean | undefined;
68
- ignoreCData?: boolean | undefined;
69
- fullTagEmptyElement?: boolean | undefined;
70
- spaces?: any;
71
- };
72
- export const XOBJ_DEF_PARAM_TNAME: "__text";
73
- export const XOBJ_DEF_ATTR_TNAME: "__attr";
74
- export namespace XOBJ_DEF_TNAMES {
75
- export { XOBJ_DEF_PARAM_TNAME };
76
- export { XOBJ_DEF_ATTR_TNAME };
77
- export { XOBJ_DEF_DECL_TNAME };
78
- export { XOBJ_DEF_CDATA_TNAME };
79
- }
80
- export namespace XOBJ_ECODE_TABLE {
81
- export { XOBJ_TE_NOBJ_EMSG };
82
- export { XOBJ_TE_NOBJ_ECODE };
83
- export { XOBJ_TE_NARR_EMSG };
84
- export { XOBJ_TE_NARR_ECODE };
85
- export { XOBJ_TE_NSTR_EMSG };
86
- export { XOBJ_TE_NSTR_ECODE };
87
- export { XOBJ_TE_NPOBJ_EMSG };
88
- export { XOBJ_TE_NPOBJ_ECODE };
89
- export { XOBJ_TE_ANES_EMSG };
90
- export { XOBJ_TE_ANES_ECODE };
91
- export { XOBJ_TE_KNES_EMSG };
92
- export { XOBJ_TE_KNES_ECODE };
93
- }
94
- export namespace DEF_XML_PARSE_OPTIONS {
95
- export let compact: boolean;
96
- export { XOBJ_DEF_DECL_TNAME as declarationKey };
97
- export { XOBJ_DEF_ATTR_TNAME as attributesKey };
98
- export { XOBJ_DEF_PARAM_TNAME as textKey };
99
- export let commentKey: string;
100
- export { XOBJ_DEF_CDATA_TNAME as cdataKey };
101
- export let nameKey: string;
102
- export let typeKey: string;
103
- export let parentKey: string;
104
- export let elementsKey: string;
105
- export let ignoreDeclaration: boolean;
106
- export let ignoreDocType: boolean;
107
- /** @deprecated */
108
- export let ignoreInstractions: boolean;
109
- export let ignoreInstraction: boolean;
110
- export let ignoreText: boolean;
111
- /** @deprecated */
112
- export let ignoreComments: boolean;
113
- export let ignoreComment: boolean;
114
- export let ignoreCData: boolean;
115
- export let fullTagEmptyElement: boolean;
116
- export let addParent: boolean;
117
- export let trim: boolean;
118
- export let spaces: number;
119
- }
120
-
121
- /**
122
- * @classdesc Implements a container that provide a functionality to work
123
- * with options for an XML-parser
124
- */
125
- export class TXmlContentParseOptions {
126
- /**
127
- * Creates a container instance
128
- */
129
- static createNewOptionsSet(opt?: any): OPT_parserOptions;
130
- /**
131
- * Creates a container instance
132
- */
133
- constructor(param?: any);
134
- /**
135
- * Contains a set of a current settings
136
- */
137
- get settings(): OPT_parserOptions;
138
- /**
139
- * Contains a set of a settings for converting an 'XML' to 'JS'-object
140
- */
141
- get xml2js(): xml2jsParseOptions;
142
- /**
143
- * Contains a set of a settings for converting an 'JS'-object to 'XML'
144
- */
145
- get js2xml(): js2xmlParseOptions;
146
- /**
147
- * Contains a set of a reserved key words
148
- */
149
- get reservedKeys(): Set<string>;
150
- #private;
151
- }
152
- declare const XOBJ_DEF_DECL_TNAME: "__decl";
153
- declare const XOBJ_DEF_CDATA_TNAME: "__cdata";
154
- declare const XOBJ_TE_NOBJ_EMSG: "invalid argument (an object expected)";
155
- declare const XOBJ_TE_NOBJ_ECODE: "ERR_XOBJ_NOBJ";
156
- declare const XOBJ_TE_NARR_EMSG: "invalid argument (an array expected)";
157
- declare const XOBJ_TE_NARR_ECODE: "ERR_XOBJ_NARR";
158
- declare const XOBJ_TE_NSTR_EMSG: "invalid argument (a string expected)";
159
- declare const XOBJ_TE_NSTR_ECODE: "ERR_XOBJ_NSTR";
160
- declare const XOBJ_TE_NPOBJ_EMSG: "invalid argument (a plain object expected)";
161
- declare const XOBJ_TE_NPOBJ_ECODE: "ERR_XOBJ_NPOBJ";
162
- declare const XOBJ_TE_ANES_EMSG: "<attr_name> must be a non-empty string";
163
- declare const XOBJ_TE_ANES_ECODE: "ERR_XOBJ_INVARG_ATTR";
164
- declare const XOBJ_TE_KNES_EMSG: "<key_name> must be a non-empty string";
165
- declare const XOBJ_TE_KNES_ECODE: "ERR_XOBJ_INVARG_KEY";
166
- export {};
1
+ /**
2
+ * A parser options settings
3
+ */
4
+ export type OPT_parserOptions = {
5
+ compact?: boolean;
6
+ declarationKey?: string;
7
+ attributesKey?: string;
8
+ textKey?: string;
9
+ commentKey?: string;
10
+ cdataKey?: string;
11
+ nameKey?: string;
12
+ typeKey?: string;
13
+ parentKey?: string;
14
+ elementsKey?: string;
15
+ ignoreDeclaration?: boolean;
16
+ ignoreDocType?: boolean;
17
+ ignoreInstraction?: boolean;
18
+ ignoreText?: boolean;
19
+ ignoreComment?: boolean;
20
+ ignoreCData?: boolean;
21
+ fullTagEmptyElement?: boolean;
22
+ addParent?: boolean;
23
+ trim?: boolean;
24
+ spaces?: any;
25
+ };
26
+ /**
27
+ * A parser options to convert an 'XML'-string into a 'JS'-object
28
+ */
29
+ export type xml2jsParseOptions = {
30
+ compact?: boolean;
31
+ declarationKey?: string;
32
+ attributesKey?: string;
33
+ textKey?: string;
34
+ commentKey?: string;
35
+ cdataKey?: string;
36
+ nameKey?: string;
37
+ typeKey?: string;
38
+ parentKey?: string;
39
+ elementsKey?: string;
40
+ ignoreDeclaration?: boolean;
41
+ ignoreDocType?: boolean;
42
+ ignoreInstraction?: boolean;
43
+ ignoreText?: boolean;
44
+ ignoreComment?: boolean;
45
+ ignoreCData?: boolean;
46
+ addParent?: boolean;
47
+ trim?: boolean;
48
+ };
49
+ /**
50
+ * A parser options to convert a 'JS'-object into an 'XML'-string
51
+ */
52
+ export type js2xmlParseOptions = {
53
+ compact?: boolean;
54
+ declarationKey?: string;
55
+ attributesKey?: string;
56
+ textKey?: string;
57
+ commentKey?: string;
58
+ cdataKey?: string;
59
+ nameKey?: string;
60
+ typeKey?: string;
61
+ parentKey?: string;
62
+ elementsKey?: string;
63
+ ignoreDeclaration?: boolean;
64
+ ignoreDocType?: boolean;
65
+ ignoreInstraction?: boolean;
66
+ ignoreText?: boolean;
67
+ ignoreComment?: boolean;
68
+ ignoreCData?: boolean;
69
+ fullTagEmptyElement?: boolean;
70
+ spaces?: any;
71
+ };
72
+
73
+ export namespace XOBJ_DEF_TNAMES {
74
+ export { XOBJ_DEF_PARAM_TNAME };
75
+ export { XOBJ_DEF_ATTR_TNAME };
76
+ export { XOBJ_DEF_DECL_TNAME };
77
+ export { XOBJ_DEF_CDATA_TNAME };
78
+ }
79
+
80
+ export const DEF_XML_PARSE_OPTIONS: OPT_parserOptions;
81
+
82
+ /**
83
+ * @classdesc Implements a container that provide a functionality to work
84
+ * with options for an XML-parser
85
+ */
86
+ export class TXmlContentParseOptions {
87
+ /**
88
+ * Creates a container instance
89
+ */
90
+ static createNewOptionsSet(opt?: any): OPT_parserOptions;
91
+ /**
92
+ * Creates a container instance
93
+ */
94
+ constructor(param?: any);
95
+ /**
96
+ * Contains a set of a current settings
97
+ */
98
+ get settings(): OPT_parserOptions;
99
+ /**
100
+ * Contains a set of a settings for converting an 'XML' to 'JS'-object
101
+ */
102
+ get xml2js(): xml2jsParseOptions;
103
+ /**
104
+ * Contains a set of a settings for converting an 'JS'-object to 'XML'
105
+ */
106
+ get js2xml(): js2xmlParseOptions;
107
+ /**
108
+ * Contains a set of a reserved key words
109
+ */
110
+ get reservedKeys(): Set<string>;
111
+ #private;
112
+ }
113
+
114
+ declare const XOBJ_DEF_PARAM_TNAME: "__text";
115
+ declare const XOBJ_DEF_ATTR_TNAME: "__attr";
116
+ declare const XOBJ_DEF_DECL_TNAME: "__decl";
117
+ declare const XOBJ_DEF_CDATA_TNAME: "__cdata";
118
+ export {};
package/lib/xObj-defs.js CHANGED
@@ -1,4 +1,4 @@
1
- // [v0.1.067-20251214]
1
+ // [v0.1.067-20260101]
2
2
 
3
3
  // === module init block ===
4
4
 
@@ -25,35 +25,9 @@ const XOBJ_DEF_TNAMES = {
25
25
  XOBJ_DEF_DECL_TNAME,
26
26
  XOBJ_DEF_CDATA_TNAME,
27
27
  };
28
-
29
- const XOBJ_TE_INVARG_EMSG = 'invalid argument';
30
- const XOBJ_TE_NOBJ_EMSG = `${XOBJ_TE_INVARG_EMSG} (an object expected)`;
31
- const XOBJ_TE_NOBJ_ECODE = 'ERR_XOBJ_NOBJ';
32
- const XOBJ_TE_NARR_EMSG = `${XOBJ_TE_INVARG_EMSG} (an array expected)`;
33
- const XOBJ_TE_NARR_ECODE = 'ERR_XOBJ_NARR';
34
- const XOBJ_TE_NSTR_EMSG = `${XOBJ_TE_INVARG_EMSG} (a string expected)`;
35
- const XOBJ_TE_NSTR_ECODE = 'ERR_XOBJ_NSTR';
36
- const XOBJ_TE_NPOBJ_EMSG = `${XOBJ_TE_INVARG_EMSG} (a plain object expected)`;
37
- const XOBJ_TE_NPOBJ_ECODE = 'ERR_XOBJ_NPOBJ';
38
- const XOBJ_TE_ANES_EMSG = '<attr_name> must be a non-empty string';
39
- const XOBJ_TE_ANES_ECODE = 'ERR_XOBJ_INVARG_ATTR';
40
- const XOBJ_TE_KNES_EMSG = '<key_name> must be a non-empty string';
41
- const XOBJ_TE_KNES_ECODE = 'ERR_XOBJ_INVARG_KEY';
42
-
43
- const XOBJ_ECODE_TABLE = {
44
- XOBJ_TE_NOBJ_EMSG,
45
- XOBJ_TE_NOBJ_ECODE,
46
- XOBJ_TE_NARR_EMSG,
47
- XOBJ_TE_NARR_ECODE,
48
- XOBJ_TE_NSTR_EMSG,
49
- XOBJ_TE_NSTR_ECODE,
50
- XOBJ_TE_NPOBJ_EMSG,
51
- XOBJ_TE_NPOBJ_ECODE,
52
- XOBJ_TE_ANES_EMSG,
53
- XOBJ_TE_ANES_ECODE,
54
- XOBJ_TE_KNES_EMSG,
55
- XOBJ_TE_KNES_ECODE,
56
- };
28
+ //module.exports.XOBJ_DEF_PARAM_TNAME = XOBJ_DEF_PARAM_TNAME;
29
+ //module.exports.XOBJ_DEF_ATTR_TNAME = XOBJ_DEF_ATTR_TNAME;
30
+ module.exports.XOBJ_DEF_TNAMES = XOBJ_DEF_TNAMES;
57
31
 
58
32
  /**
59
33
  * A parser options settings
@@ -107,6 +81,7 @@ const DEF_XML_PARSE_OPTIONS = {
107
81
  trim: true,
108
82
  spaces: 2,
109
83
  };
84
+ module.exports.DEF_XML_PARSE_OPTIONS = DEF_XML_PARSE_OPTIONS;
110
85
 
111
86
  /***
112
87
  * (* function definitions *)
@@ -310,13 +285,4 @@ class TXmlContentParseOptions {
310
285
  }
311
286
 
312
287
  }
313
-
314
- // === module exports block ===
315
-
316
- module.exports.XOBJ_DEF_PARAM_TNAME = XOBJ_DEF_PARAM_TNAME;
317
- module.exports.XOBJ_DEF_ATTR_TNAME = XOBJ_DEF_ATTR_TNAME;
318
- module.exports.XOBJ_DEF_TNAMES = XOBJ_DEF_TNAMES;
319
- module.exports.XOBJ_ECODE_TABLE = XOBJ_ECODE_TABLE;
320
- module.exports.DEF_XML_PARSE_OPTIONS = DEF_XML_PARSE_OPTIONS;
321
-
322
288
  module.exports.TXmlContentParseOptions = TXmlContentParseOptions;
@@ -0,0 +1,41 @@
1
+ export namespace XOBJ_ECODE_TABLE {
2
+ export { XOBJ_TE_NOBJ_EMSG };
3
+ export { XOBJ_TE_NOBJ_ECODE };
4
+ export { XOBJ_TE_NARR_EMSG };
5
+ export { XOBJ_TE_NARR_ECODE };
6
+ export { XOBJ_TE_NSTR_EMSG };
7
+ export { XOBJ_TE_NSTR_ECODE };
8
+ export { XOBJ_TE_NPOBJ_EMSG };
9
+ export { XOBJ_TE_NPOBJ_ECODE };
10
+ export { XOBJ_TE_ANES_EMSG };
11
+ export { XOBJ_TE_ANES_ECODE };
12
+ export { XOBJ_TE_KNES_EMSG };
13
+ export { XOBJ_TE_KNES_ECODE };
14
+ }
15
+ /**
16
+ * @classdesc Extends a base `TypeError` object to provide some information
17
+ * on the errors thrown when a key name evaluation failed
18
+ */
19
+ export class EvalKeyNameError extends TypeError {
20
+ /**
21
+ * Creates a new instance
22
+ */
23
+ constructor(msg: string, options?: any);
24
+ /**
25
+ * Represents an error code
26
+ */
27
+ code: string;
28
+ }
29
+ declare const XOBJ_TE_NOBJ_EMSG: "invalid argument (an object expected)";
30
+ declare const XOBJ_TE_NOBJ_ECODE: "ERR_XOBJ_NOBJ";
31
+ declare const XOBJ_TE_NARR_EMSG: "invalid argument (an array expected)";
32
+ declare const XOBJ_TE_NARR_ECODE: "ERR_XOBJ_NARR";
33
+ declare const XOBJ_TE_NSTR_EMSG: "invalid argument (a string expected)";
34
+ declare const XOBJ_TE_NSTR_ECODE: "ERR_XOBJ_NSTR";
35
+ declare const XOBJ_TE_NPOBJ_EMSG: "invalid argument (a plain object expected)";
36
+ declare const XOBJ_TE_NPOBJ_ECODE: "ERR_XOBJ_NPOBJ";
37
+ declare const XOBJ_TE_ANES_EMSG: "<attr_name> must be a non-empty string";
38
+ declare const XOBJ_TE_ANES_ECODE: "ERR_XOBJ_INVARG_ATTR";
39
+ declare const XOBJ_TE_KNES_EMSG: "<key_name> must be a non-empty string";
40
+ declare const XOBJ_TE_KNES_ECODE: "ERR_XOBJ_INVARG_KEY";
41
+ export {};
@@ -0,0 +1,71 @@
1
+ // [v0.1.003-20251229]
2
+
3
+ // === module init block ===
4
+
5
+ const {
6
+ isPlainObject,
7
+ } = require('@ygracs/bsfoc-lib-js');
8
+
9
+ // === module inner block ===
10
+
11
+ // === module main block ===
12
+
13
+ const XOBJ_TE_INVARG_EMSG = 'invalid argument';
14
+ const XOBJ_TE_NOBJ_EMSG = `${XOBJ_TE_INVARG_EMSG} (an object expected)`;
15
+ const XOBJ_TE_NOBJ_ECODE = 'ERR_XOBJ_NOBJ';
16
+ const XOBJ_TE_NARR_EMSG = `${XOBJ_TE_INVARG_EMSG} (an array expected)`;
17
+ const XOBJ_TE_NARR_ECODE = 'ERR_XOBJ_NARR';
18
+ const XOBJ_TE_NSTR_EMSG = `${XOBJ_TE_INVARG_EMSG} (a string expected)`;
19
+ const XOBJ_TE_NSTR_ECODE = 'ERR_XOBJ_NSTR';
20
+ const XOBJ_TE_NPOBJ_EMSG = `${XOBJ_TE_INVARG_EMSG} (a plain object expected)`;
21
+ const XOBJ_TE_NPOBJ_ECODE = 'ERR_XOBJ_NPOBJ';
22
+ const XOBJ_TE_ANES_EMSG = '<attr_name> must be a non-empty string';
23
+ const XOBJ_TE_ANES_ECODE = 'ERR_XOBJ_INVARG_ATTR';
24
+ const XOBJ_TE_KNES_EMSG = '<key_name> must be a non-empty string';
25
+ const XOBJ_TE_KNES_ECODE = 'ERR_XOBJ_INVARG_KEY';
26
+
27
+ const XOBJ_ECODE_TABLE = {
28
+ XOBJ_TE_NOBJ_EMSG,
29
+ XOBJ_TE_NOBJ_ECODE,
30
+ XOBJ_TE_NARR_EMSG,
31
+ XOBJ_TE_NARR_ECODE,
32
+ XOBJ_TE_NSTR_EMSG,
33
+ XOBJ_TE_NSTR_ECODE,
34
+ XOBJ_TE_NPOBJ_EMSG,
35
+ XOBJ_TE_NPOBJ_ECODE,
36
+ XOBJ_TE_ANES_EMSG,
37
+ XOBJ_TE_ANES_ECODE,
38
+ XOBJ_TE_KNES_EMSG,
39
+ XOBJ_TE_KNES_ECODE,
40
+ };
41
+ module.exports.XOBJ_ECODE_TABLE = XOBJ_ECODE_TABLE;
42
+
43
+ /**
44
+ * @augments TypeError
45
+ * @classdesc Extends a base `TypeError` object to provide some information
46
+ * on the errors thrown when a key name evaluation failed
47
+ */
48
+ class EvalKeyNameError extends TypeError {
49
+ /**
50
+ * Creates a new instance
51
+ * @param {string} msg - some user error message
52
+ * @param {*} [options] - user options
53
+ */
54
+ constructor(msg, options) {
55
+ super(msg, options);
56
+ /** @type {string} */
57
+ this.name = 'EvalKeyNameError';
58
+ const code = (
59
+ isPlainObject(options) && typeof options.code === 'string'
60
+ ? options.code
61
+ : ''
62
+ );
63
+ /**
64
+ * Represents an error code
65
+ * @type {string}
66
+ */
67
+ this.code = code;
68
+ }
69
+
70
+ };
71
+ module.exports.EvalKeyNameError = EvalKeyNameError;