@ygracs/xobj-lib-js 0.3.1 → 0.3.3
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 +13 -0
- package/doc/xObj.md +44 -38
- package/index.d.ts +16 -8
- package/index.js +37 -33
- package/lib/xObj-attr.d.ts +109 -0
- package/lib/xObj-attr.js +614 -0
- package/lib/xObj-lib.d.ts +126 -247
- package/lib/xObj-lib.js +231 -1107
- package/lib/xObj-param.d.ts +83 -0
- package/lib/xObj-param.js +435 -0
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
package/doc/xObj.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
>|***rev.*:**|0.1.
|
|
1
|
+
>|***rev.*:**|0.1.53|
|
|
2
2
|
>|:---|---:|
|
|
3
|
-
>|date:|2026-
|
|
3
|
+
>|date:|2026-06-08|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -13,6 +13,7 @@ This paper describes a functions provided by `xObj.js` module.
|
|
|
13
13
|
- Base types
|
|
14
14
|
- <a href="#typedef+xml2jsParseOptions">xml2jsParseOptions</a>
|
|
15
15
|
- <a href="#typedef+js2xmlParseOptions">js2xmlParseOptions</a>
|
|
16
|
+
- <a href="#typedef+INode">INode</a>
|
|
16
17
|
|
|
17
18
|
- Classes
|
|
18
19
|
- <a href="#TXmlContentParseOptions">TXmlContentParseOptions</a>
|
|
@@ -28,6 +29,11 @@ This paper describes a functions provided by `xObj.js` module.
|
|
|
28
29
|
|
|
29
30
|
This section contains some definitions for a general types of the objects (e.g. options set) that frequently used in a function descriptions.
|
|
30
31
|
|
|
32
|
+
<a name="typedef+INode"></a>
|
|
33
|
+
#### `INode` - object type
|
|
34
|
+
|
|
35
|
+
This type is an `object` which represents a base element (so called an `XObj-node`). Its child elements addressed by a `key`. Each `key` is defined by a used parser options and must be a `string`.
|
|
36
|
+
|
|
31
37
|
<a name="typedef+OPT_valtostr"></a>
|
|
32
38
|
#### `OPT_valtostr` - options set
|
|
33
39
|
|
|
@@ -154,7 +160,7 @@ This function returns a value of an object parameter as a string.
|
|
|
154
160
|
|
|
155
161
|
| parameter name | value type | default value | description |
|
|
156
162
|
|:---|---|---:|:---|
|
|
157
|
-
| `object` | `
|
|
163
|
+
| `object` | `INode` | --- | some object |
|
|
158
164
|
| `key` | `string` | --- | some key |
|
|
159
165
|
|
|
160
166
|
##### ***exceptions***
|
|
@@ -173,7 +179,7 @@ This function reads a value of an object parameter and returns it as a `boolean`
|
|
|
173
179
|
|
|
174
180
|
| parameter name | value type | default value | description |
|
|
175
181
|
|:---|---|---:|:---|
|
|
176
|
-
| `object` | `
|
|
182
|
+
| `object` | `INode` | --- | some object |
|
|
177
183
|
| `defValue` | `boolean` | `false` | default value |
|
|
178
184
|
| `key` | `string` | --- | some key |
|
|
179
185
|
|
|
@@ -193,7 +199,7 @@ This function reads a value of an object parameter and returns it as a `number`.
|
|
|
193
199
|
|
|
194
200
|
| parameter name | value type | default value | description |
|
|
195
201
|
|:---|---|---:|:---|
|
|
196
|
-
| `object` | `
|
|
202
|
+
| `object` | `INode` | --- | some object |
|
|
197
203
|
| `defValue` | `number` | `0` | default value |
|
|
198
204
|
| `key` | `string` | --- | some key |
|
|
199
205
|
|
|
@@ -215,7 +221,7 @@ This function reads a value of an object parameter and try to convert it to a va
|
|
|
215
221
|
|
|
216
222
|
| parameter name | value type | default value | description |
|
|
217
223
|
|:---|---|---:|:---|
|
|
218
|
-
| `object` | `
|
|
224
|
+
| `object` | `INode` | --- | some object |
|
|
219
225
|
| `key` | `string` | --- | some key |
|
|
220
226
|
|
|
221
227
|
##### ***exceptions***
|
|
@@ -236,7 +242,7 @@ This function reads a value of an object parameter and returns it as a `string`.
|
|
|
236
242
|
|
|
237
243
|
| parameter name | value type | default value | description |
|
|
238
244
|
|:---|---|---:|:---|
|
|
239
|
-
| `object` | `
|
|
245
|
+
| `object` | `INode` | --- | some object |
|
|
240
246
|
| `options` | `string`, `object` | --- | options that defines how a value must be transformed |
|
|
241
247
|
| `key` | `string` | --- | some key |
|
|
242
248
|
|
|
@@ -279,7 +285,7 @@ This function sets object parameter to a given value and if succeed returns `tru
|
|
|
279
285
|
|
|
280
286
|
| parameter name | value type | default value | description |
|
|
281
287
|
|:---|---|---:|:---|
|
|
282
|
-
| `object` | `
|
|
288
|
+
| `object` | `INode` | --- | some object |
|
|
283
289
|
| `value` | `any` | --- | some value to write |
|
|
284
290
|
| `key` | `string` | --- | some key |
|
|
285
291
|
|
|
@@ -299,7 +305,7 @@ This function writes a given `boolean` value of an object parameter.
|
|
|
299
305
|
|
|
300
306
|
| parameter name | value type | default value | description |
|
|
301
307
|
|:---|---|---:|:---|
|
|
302
|
-
| `object` | `
|
|
308
|
+
| `object` | `INode` | --- | some object |
|
|
303
309
|
| `value` | `any` | --- | some value to write |
|
|
304
310
|
| `defValue` | `boolean` | `false` | default value |
|
|
305
311
|
| `key` | `string` | --- | some key |
|
|
@@ -320,7 +326,7 @@ This function writes a given `number` value of an object parameter.
|
|
|
320
326
|
|
|
321
327
|
| parameter name | value type | default value | description |
|
|
322
328
|
|:---|---|---:|:---|
|
|
323
|
-
| `object` | `
|
|
329
|
+
| `object` | `INode` | --- | some object |
|
|
324
330
|
| `value` | `any` | --- | some value to write |
|
|
325
331
|
| `defValue` | `number` | `0` | default value |
|
|
326
332
|
| `key` | `string` | --- | some key |
|
|
@@ -341,7 +347,7 @@ This function try to interpret a given value as a valid index value and, if succ
|
|
|
341
347
|
|
|
342
348
|
| parameter name | value type | default value | description |
|
|
343
349
|
|:---|---|---:|:---|
|
|
344
|
-
| `object` | `
|
|
350
|
+
| `object` | `INode` | --- | some object |
|
|
345
351
|
| `value` | `any` | --- | some value to write |
|
|
346
352
|
| `key` | `string` | --- | some key |
|
|
347
353
|
|
|
@@ -361,7 +367,7 @@ This function sets object parameter to a given value and if succeed returns `tru
|
|
|
361
367
|
|
|
362
368
|
| parameter name | value type | default value | description |
|
|
363
369
|
|:---|---|---:|:---|
|
|
364
|
-
| `object` | `
|
|
370
|
+
| `object` | `INode` | --- | some object |
|
|
365
371
|
| `value` | `any` | --- | some value to write |
|
|
366
372
|
| `options` | `string`, `object` | --- | options that defines how a value must be transformed |
|
|
367
373
|
| `key` | `string` | --- | some key |
|
|
@@ -405,7 +411,7 @@ This function returns a value of an object attribute. The value is of a `string`
|
|
|
405
411
|
|
|
406
412
|
| parameter name | value type | default value | description |
|
|
407
413
|
|:---|---|---:|:---|
|
|
408
|
-
| `object` | `
|
|
414
|
+
| `object` | `INode` | --- | some object |
|
|
409
415
|
| `attr` | `string` | --- | some attribute |
|
|
410
416
|
| `key` | `string` | --- | some key |
|
|
411
417
|
|
|
@@ -425,7 +431,7 @@ This function reads a value of an object attribute and returns it as a `boolean`
|
|
|
425
431
|
|
|
426
432
|
| parameter name | value type | default value | description |
|
|
427
433
|
|:---|---|---:|:---|
|
|
428
|
-
| `object` | `
|
|
434
|
+
| `object` | `INode` | --- | some object |
|
|
429
435
|
| `attr` | `string` | --- | some attribute |
|
|
430
436
|
| `defValue` | `boolean` | `false` | default value |
|
|
431
437
|
| `key` | `string` | --- | some key |
|
|
@@ -446,7 +452,7 @@ This function reads a value of an object attribute and returns it as a `number`.
|
|
|
446
452
|
|
|
447
453
|
| parameter name | value type | default value | description |
|
|
448
454
|
|:---|---|---:|:---|
|
|
449
|
-
| `object` | `
|
|
455
|
+
| `object` | `INode` | --- | some object |
|
|
450
456
|
| `attr` | `string` | --- | some attribute |
|
|
451
457
|
| `defValue` | `number` | `0` | default value |
|
|
452
458
|
| `key` | `string` | --- | some key |
|
|
@@ -469,7 +475,7 @@ This function reads a value of an object attribute and try to convert it to a va
|
|
|
469
475
|
|
|
470
476
|
| parameter name | value type | default value | description |
|
|
471
477
|
|:---|---|---:|:---|
|
|
472
|
-
| `object` | `
|
|
478
|
+
| `object` | `INode` | --- | some object |
|
|
473
479
|
| `attr` | `string` | --- | some attribute |
|
|
474
480
|
| `key` | `string` | --- | some key |
|
|
475
481
|
|
|
@@ -491,7 +497,7 @@ This function returns a value of an object attribute. The value is of a `string`
|
|
|
491
497
|
|
|
492
498
|
| parameter name | value type | default value | description |
|
|
493
499
|
|:---|---|---:|:---|
|
|
494
|
-
| `object` | `
|
|
500
|
+
| `object` | `INode` | --- | some object |
|
|
495
501
|
| `attr` | `string` | --- | some attribute |
|
|
496
502
|
| `options` | `string`, `object` | --- | options that defines how a value must be transformed |
|
|
497
503
|
| `key` | `string` | --- | some key |
|
|
@@ -535,7 +541,7 @@ This function sets object attribute to a given value and if succeed returns `tru
|
|
|
535
541
|
|
|
536
542
|
| parameter name | value type | default value | description |
|
|
537
543
|
|:---|---|---:|:---|
|
|
538
|
-
| `object` | `
|
|
544
|
+
| `object` | `INode` | --- | some object |
|
|
539
545
|
| `attr` | `string` | --- | some attribute |
|
|
540
546
|
| `value` | `any` | --- | some value |
|
|
541
547
|
| `key` | `string` | --- | some key |
|
|
@@ -558,7 +564,7 @@ This function writes a given `boolean` value of an object attribute.
|
|
|
558
564
|
|
|
559
565
|
| parameter name | value type | default value | description |
|
|
560
566
|
|:---|---|---:|:---|
|
|
561
|
-
| `object` | `
|
|
567
|
+
| `object` | `INode` | --- | some object |
|
|
562
568
|
| `attr` | `string` | --- | some attribute |
|
|
563
569
|
| `value` | `any` | --- | some value |
|
|
564
570
|
| `defValue` | `boolean` | `false` | default value |
|
|
@@ -580,7 +586,7 @@ This function writes a given `number` value of an object attribute.
|
|
|
580
586
|
|
|
581
587
|
| parameter name | value type | default value | description |
|
|
582
588
|
|:---|---|---:|:---|
|
|
583
|
-
| `object` | `
|
|
589
|
+
| `object` | `INode` | --- | some object |
|
|
584
590
|
| `attr` | `string` | --- | some attribute |
|
|
585
591
|
| `value` | `any` | --- | some value |
|
|
586
592
|
| `defValue` | `number` | `0` | default value |
|
|
@@ -602,7 +608,7 @@ This function try to interpret a given value as a valid index value and, if succ
|
|
|
602
608
|
|
|
603
609
|
| parameter name | value type | default value | description |
|
|
604
610
|
|:---|---|---:|:---|
|
|
605
|
-
| `object` | `
|
|
611
|
+
| `object` | `INode` | --- | some object |
|
|
606
612
|
| `attr` | `string` | --- | some attribute |
|
|
607
613
|
| `value` | `any` | --- | some value |
|
|
608
614
|
| `key` | `string` | --- | some key |
|
|
@@ -623,7 +629,7 @@ This function sets object attribute to a given value and if succeed returns `tru
|
|
|
623
629
|
|
|
624
630
|
| parameter name | value type | default value | description |
|
|
625
631
|
|:---|---|---:|:---|
|
|
626
|
-
| `object` | `
|
|
632
|
+
| `object` | `INode` | --- | some object |
|
|
627
633
|
| `attr` | `string` | --- | some attribute |
|
|
628
634
|
| `value` | `any` | --- | some value |
|
|
629
635
|
| `options` | `string`, `object` | --- | options that defines how a value must be transformed |
|
|
@@ -664,7 +670,7 @@ This is a special function that returns a value of an object parameter as "IT IS
|
|
|
664
670
|
|
|
665
671
|
| parameter name | value type | default value | description |
|
|
666
672
|
|:---|---|---:|:---|
|
|
667
|
-
| `object` | `
|
|
673
|
+
| `object` | `INode` | --- | some object |
|
|
668
674
|
| `key` | `string` | --- | some key |
|
|
669
675
|
|
|
670
676
|
> NOTE:
|
|
@@ -691,7 +697,7 @@ This is a special function that writes a given value of an object parameter as "
|
|
|
691
697
|
|
|
692
698
|
| parameter name | value type | default value | description |
|
|
693
699
|
|:---|---|---:|:---|
|
|
694
|
-
| `object` | `
|
|
700
|
+
| `object` | `INode` | --- | some object |
|
|
695
701
|
| `value` | `any` | --- | some value |
|
|
696
702
|
| `key` | `string` | --- | some key |
|
|
697
703
|
|
|
@@ -722,7 +728,7 @@ This is a special function that returns a value of an object attribute as "IT IS
|
|
|
722
728
|
|
|
723
729
|
| parameter name | value type | default value | description |
|
|
724
730
|
|:---|---|---:|:---|
|
|
725
|
-
| `object` | `
|
|
731
|
+
| `object` | `INode` | --- | some object |
|
|
726
732
|
| `attr` | `string` | --- | some attribute |
|
|
727
733
|
| `key` | `string` | --- | some key |
|
|
728
734
|
|
|
@@ -751,7 +757,7 @@ This is a special function that writes a given value of an object attribute as "
|
|
|
751
757
|
|
|
752
758
|
| parameter name | value type | default value | description |
|
|
753
759
|
|:---|---|---:|:---|
|
|
754
|
-
| `object` | `
|
|
760
|
+
| `object` | `INode` | --- | some object |
|
|
755
761
|
| `attr` | `string` | --- | some attribute |
|
|
756
762
|
| `value` | `any` | --- | some value |
|
|
757
763
|
| `key` | `string` | --- | some key |
|
|
@@ -779,7 +785,7 @@ The function throws a `EvalKeyNameError` exception in case:
|
|
|
779
785
|
> If a `key` parameter given not given, the function will use a default value defined by `XOBJ_DEF_ATTR_TNAME`.
|
|
780
786
|
|
|
781
787
|
<a name="getXObjAttributes"></a>
|
|
782
|
-
#### **getXObjAttributes(object\[, key])** => `?
|
|
788
|
+
#### **getXObjAttributes(object\[, key])** => `?INode`
|
|
783
789
|
|
|
784
790
|
This function returns an object which represents a set of the element attributes for a given object or `null` if failed.
|
|
785
791
|
|
|
@@ -787,7 +793,7 @@ This function returns an object which represents a set of the element attributes
|
|
|
787
793
|
|
|
788
794
|
| parameter name | value type | default value | description |
|
|
789
795
|
|:---|---|---:|:---|
|
|
790
|
-
| `object` | `
|
|
796
|
+
| `object` | `INode` | --- | some object |
|
|
791
797
|
| `key` | `string` | --- | some key |
|
|
792
798
|
|
|
793
799
|
##### ***exceptions***
|
|
@@ -806,7 +812,7 @@ This function tries to check whether or not an attribute with a name given by `a
|
|
|
806
812
|
|
|
807
813
|
| parameter name | value type | default value | description |
|
|
808
814
|
|:---|---|---:|:---|
|
|
809
|
-
| `object` | `
|
|
815
|
+
| `object` | `INode` | --- | some object |
|
|
810
816
|
| `attr` | `string` | --- | some attribute |
|
|
811
817
|
| `key` | `string` | --- | some key |
|
|
812
818
|
|
|
@@ -832,7 +838,7 @@ This function tries to delete an attribute with a name given by `attr` paramete
|
|
|
832
838
|
|
|
833
839
|
| parameter name | value type | default value | description |
|
|
834
840
|
|:---|---|---:|:---|
|
|
835
|
-
| `object` | `
|
|
841
|
+
| `object` | `INode` | --- | some object |
|
|
836
842
|
| `attr` | `string` | --- | some attribute |
|
|
837
843
|
| `key` | `string` | --- | some key |
|
|
838
844
|
|
|
@@ -860,7 +866,7 @@ This function tries to rename an attribute with a name given by `attr` parameter
|
|
|
860
866
|
|
|
861
867
|
| parameter name | value type | default value | description |
|
|
862
868
|
|:---|---|---:|:---|
|
|
863
|
-
| `object` | `
|
|
869
|
+
| `object` | `INode` | --- | some object |
|
|
864
870
|
| `attr` | `string` | --- | some attribute |
|
|
865
871
|
| `value` | `string` | --- | new attribute ID |
|
|
866
872
|
| `key` | `string` | --- | some key |
|
|
@@ -890,7 +896,7 @@ This function returns an element from a given object by its name or `null` if th
|
|
|
890
896
|
|
|
891
897
|
| parameter name | value type | default value | description |
|
|
892
898
|
|:---|---|---:|:---|
|
|
893
|
-
| `object` | `
|
|
899
|
+
| `object` | `INode` | --- | some object |
|
|
894
900
|
| `name` | `string` | --- | some child element ID |
|
|
895
901
|
|
|
896
902
|
##### ***exceptions***
|
|
@@ -937,7 +943,7 @@ This function adds an element given by `name` parameter to a members of the give
|
|
|
937
943
|
|
|
938
944
|
| parameter name | value type | default value | description |
|
|
939
945
|
|:---|---|---:|:---|
|
|
940
|
-
| `object` | `
|
|
946
|
+
| `object` | `INode` | --- | some object |
|
|
941
947
|
| `name` | `string` | --- | some child element ID |
|
|
942
948
|
|
|
943
949
|
##### ***result***
|
|
@@ -996,7 +1002,7 @@ This function inserts an empty element named by a `name` parameter into a given
|
|
|
996
1002
|
|
|
997
1003
|
| parameter name | value type | default value | description |
|
|
998
1004
|
|:---|---|---:|:---|
|
|
999
|
-
| `object` | `
|
|
1005
|
+
| `object` | `INode` | --- | some object |
|
|
1000
1006
|
| `name` | `string` | --- | some child element ID |
|
|
1001
1007
|
| `options` | `object` | --- | options |
|
|
1002
1008
|
|
|
@@ -1063,7 +1069,7 @@ This function deletes an element addressed by `name` parameter from a given obje
|
|
|
1063
1069
|
|
|
1064
1070
|
| parameter name | value type | default value | description |
|
|
1065
1071
|
|:---|---|---:|:---|
|
|
1066
|
-
| `object` | `
|
|
1072
|
+
| `object` | `INode` | --- | some object |
|
|
1067
1073
|
| `name` | `string` | --- | some child element ID |
|
|
1068
1074
|
|
|
1069
1075
|
##### ***result***
|
|
@@ -1096,7 +1102,7 @@ This function renames an element addressed by `name` for the given object. If su
|
|
|
1096
1102
|
|
|
1097
1103
|
| parameter name | value type | default value | description |
|
|
1098
1104
|
|:---|---|---:|:---|
|
|
1099
|
-
| `object` | `
|
|
1105
|
+
| `object` | `INode` | --- | some object |
|
|
1100
1106
|
| `name` | `string` | --- | some child element ID |
|
|
1101
1107
|
| `value` | `string` | --- | new element ID |
|
|
1102
1108
|
|
|
@@ -1124,7 +1130,7 @@ This function tries to clean a given node.
|
|
|
1124
1130
|
|
|
1125
1131
|
| parameter name | value type | default value | description |
|
|
1126
1132
|
|:---|---|---:|:---|
|
|
1127
|
-
| `node` | `
|
|
1133
|
+
| `node` | `INode` or `INode[]` | --- | some node or nodes list |
|
|
1128
1134
|
|
|
1129
1135
|
##### ***exceptions***
|
|
1130
1136
|
|
|
@@ -1189,7 +1195,7 @@ This function inserts an elements list named by a `name` parameter into a given
|
|
|
1189
1195
|
|
|
1190
1196
|
| parameter name | value type | default value | description |
|
|
1191
1197
|
|:---|---|---:|:---|
|
|
1192
|
-
| `object` | `
|
|
1198
|
+
| `object` | `INode` | --- | some object |
|
|
1193
1199
|
| `name` | `string` | --- | some child element ID |
|
|
1194
1200
|
| `options` | `object` | --- | options |
|
|
1195
1201
|
|
package/index.d.ts
CHANGED
|
@@ -23,14 +23,6 @@ import { EvalKeyNameError } from "./lib/xObj-errors";
|
|
|
23
23
|
export { EvalKeyNameError };
|
|
24
24
|
|
|
25
25
|
import {
|
|
26
|
-
readXObjParamRaw,
|
|
27
|
-
readXObjParam,
|
|
28
|
-
readXObjParamEx,
|
|
29
|
-
readXObjParamAsBool, readXObjParamAsNum, readXObjParamAsIndex,
|
|
30
|
-
writeXObjParamRaw,
|
|
31
|
-
writeXObjParam,
|
|
32
|
-
writeXObjParamEx,
|
|
33
|
-
writeXObjParamAsBool, writeXObjParamAsNum, writeXObjParamAsIndex,
|
|
34
26
|
readXObjAttrRaw,
|
|
35
27
|
readXObjAttr,
|
|
36
28
|
readXObjAttrEx,
|
|
@@ -43,6 +35,20 @@ import {
|
|
|
43
35
|
checkXObjAttribute,
|
|
44
36
|
deleteXObjAttribute,
|
|
45
37
|
renameXObjAttribute,
|
|
38
|
+
} from "./lib/xObj-attr";
|
|
39
|
+
|
|
40
|
+
import {
|
|
41
|
+
readXObjParamRaw,
|
|
42
|
+
readXObjParam,
|
|
43
|
+
readXObjParamEx,
|
|
44
|
+
readXObjParamAsBool, readXObjParamAsNum, readXObjParamAsIndex,
|
|
45
|
+
writeXObjParamRaw,
|
|
46
|
+
writeXObjParam,
|
|
47
|
+
writeXObjParamEx,
|
|
48
|
+
writeXObjParamAsBool, writeXObjParamAsNum, writeXObjParamAsIndex,
|
|
49
|
+
} from "./lib/xObj-param";
|
|
50
|
+
|
|
51
|
+
import {
|
|
46
52
|
getXObjElement,
|
|
47
53
|
addXObjElement, addXObjElementEx,
|
|
48
54
|
insertXObjElement, insertXObjElementEx,
|
|
@@ -98,6 +104,7 @@ import type {
|
|
|
98
104
|
RVAL_emodif,
|
|
99
105
|
VCOR_evalkname, RVAL_reason,
|
|
100
106
|
IEvalKeyNameResult,
|
|
107
|
+
INode,
|
|
101
108
|
} from "./lib/xObj-lib";
|
|
102
109
|
|
|
103
110
|
export type {
|
|
@@ -106,4 +113,5 @@ export type {
|
|
|
106
113
|
RVAL_emodif,
|
|
107
114
|
VCOR_evalkname, RVAL_reason,
|
|
108
115
|
IEvalKeyNameResult,
|
|
116
|
+
INode,
|
|
109
117
|
};
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.017-20260606]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -12,6 +12,10 @@ const {
|
|
|
12
12
|
EvalKeyNameError,
|
|
13
13
|
} = require('./lib/xObj-errors');
|
|
14
14
|
|
|
15
|
+
const xObjAttr = require('./lib/xObj-attr');
|
|
16
|
+
|
|
17
|
+
const xObjParam = require('./lib/xObj-param');
|
|
18
|
+
|
|
15
19
|
const xObj = require('./lib/xObj-lib');
|
|
16
20
|
|
|
17
21
|
// === module inner block ===
|
|
@@ -20,44 +24,42 @@ const xObj = require('./lib/xObj-lib');
|
|
|
20
24
|
|
|
21
25
|
// === module exports block ===
|
|
22
26
|
|
|
23
|
-
//module.exports = require('./lib/xObj-lib');
|
|
24
|
-
|
|
25
27
|
module.exports.TXmlContentParseOptions = TXmlContentParseOptions;
|
|
26
28
|
module.exports.DEF_XML_PARSE_OPTIONS = DEF_XML_PARSE_OPTIONS;
|
|
27
29
|
module.exports.XOBJ_DEF_TNAMES = XOBJ_DEF_TNAMES;
|
|
28
30
|
|
|
29
31
|
module.exports.EvalKeyNameError = EvalKeyNameError;
|
|
30
32
|
|
|
31
|
-
module.exports.readXObjParamRaw =
|
|
32
|
-
module.exports.readXObjParam =
|
|
33
|
-
module.exports.readXObjParamAsBool =
|
|
34
|
-
module.exports.readXObjParamAsNum =
|
|
35
|
-
module.exports.readXObjParamEx =
|
|
36
|
-
module.exports.readXObjParamAsIndex =
|
|
37
|
-
module.exports.writeXObjParamRaw =
|
|
38
|
-
module.exports.writeXObjParam =
|
|
39
|
-
module.exports.writeXObjParamAsBool =
|
|
40
|
-
module.exports.writeXObjParamAsNum =
|
|
41
|
-
module.exports.writeXObjParamAsIndex =
|
|
42
|
-
module.exports.writeXObjParamEx =
|
|
43
|
-
|
|
44
|
-
module.exports.readXObjAttrRaw =
|
|
45
|
-
module.exports.readXObjAttr =
|
|
46
|
-
module.exports.readXObjAttrAsBool =
|
|
47
|
-
module.exports.readXObjAttrAsNum =
|
|
48
|
-
module.exports.readXObjAttrEx =
|
|
49
|
-
module.exports.readXObjAttrAsIndex =
|
|
50
|
-
module.exports.writeXObjAttrRaw =
|
|
51
|
-
module.exports.writeXObjAttr =
|
|
52
|
-
module.exports.writeXObjAttrAsBool =
|
|
53
|
-
module.exports.writeXObjAttrAsNum =
|
|
54
|
-
module.exports.writeXObjAttrAsIndex =
|
|
55
|
-
module.exports.writeXObjAttrEx =
|
|
56
|
-
|
|
57
|
-
module.exports.getXObjAttributes =
|
|
58
|
-
module.exports.checkXObjAttribute =
|
|
59
|
-
module.exports.deleteXObjAttribute =
|
|
60
|
-
module.exports.renameXObjAttribute =
|
|
33
|
+
module.exports.readXObjParamRaw = xObjParam.readXObjParamRaw;
|
|
34
|
+
module.exports.readXObjParam = xObjParam.readXObjParam;
|
|
35
|
+
module.exports.readXObjParamAsBool = xObjParam.readXObjParamAsBool;
|
|
36
|
+
module.exports.readXObjParamAsNum = xObjParam.readXObjParamAsNum;
|
|
37
|
+
module.exports.readXObjParamEx = xObjParam.readXObjParamEx;
|
|
38
|
+
module.exports.readXObjParamAsIndex = xObjParam.readXObjParamAsIndex;
|
|
39
|
+
module.exports.writeXObjParamRaw = xObjParam.writeXObjParamRaw;
|
|
40
|
+
module.exports.writeXObjParam = xObjParam.writeXObjParam;
|
|
41
|
+
module.exports.writeXObjParamAsBool = xObjParam.writeXObjParamAsBool;
|
|
42
|
+
module.exports.writeXObjParamAsNum = xObjParam.writeXObjParamAsNum;
|
|
43
|
+
module.exports.writeXObjParamAsIndex = xObjParam.writeXObjParamAsIndex;
|
|
44
|
+
module.exports.writeXObjParamEx = xObjParam.writeXObjParamEx;
|
|
45
|
+
|
|
46
|
+
module.exports.readXObjAttrRaw = xObjAttr.readXObjAttrRaw;
|
|
47
|
+
module.exports.readXObjAttr = xObjAttr.readXObjAttr;
|
|
48
|
+
module.exports.readXObjAttrAsBool = xObjAttr.readXObjAttrAsBool;
|
|
49
|
+
module.exports.readXObjAttrAsNum = xObjAttr.readXObjAttrAsNum;
|
|
50
|
+
module.exports.readXObjAttrEx = xObjAttr.readXObjAttrEx;
|
|
51
|
+
module.exports.readXObjAttrAsIndex = xObjAttr.readXObjAttrAsIndex;
|
|
52
|
+
module.exports.writeXObjAttrRaw = xObjAttr.writeXObjAttrRaw;
|
|
53
|
+
module.exports.writeXObjAttr = xObjAttr.writeXObjAttr;
|
|
54
|
+
module.exports.writeXObjAttrAsBool = xObjAttr.writeXObjAttrAsBool;
|
|
55
|
+
module.exports.writeXObjAttrAsNum = xObjAttr.writeXObjAttrAsNum;
|
|
56
|
+
module.exports.writeXObjAttrAsIndex = xObjAttr.writeXObjAttrAsIndex;
|
|
57
|
+
module.exports.writeXObjAttrEx = xObjAttr.writeXObjAttrEx;
|
|
58
|
+
|
|
59
|
+
module.exports.getXObjAttributes = xObjAttr.getXObjAttributes;
|
|
60
|
+
module.exports.checkXObjAttribute = xObjAttr.checkXObjAttribute;
|
|
61
|
+
module.exports.deleteXObjAttribute = xObjAttr.deleteXObjAttribute;
|
|
62
|
+
module.exports.renameXObjAttribute = xObjAttr.renameXObjAttribute;
|
|
61
63
|
|
|
62
64
|
module.exports.getXObjElement = xObj.getXObjElement;
|
|
63
65
|
module.exports.addXObjElement = xObj.addXObjElement;
|
|
@@ -75,3 +77,5 @@ module.exports.insertXObjEListEx = xObj.insertXObjEListEx;
|
|
|
75
77
|
module.exports.genXObjENameDescr = xObj.genXObjENameDescr;
|
|
76
78
|
module.exports.insertXObjElements = xObj.insertXObjElements;
|
|
77
79
|
module.exports.insertXObjEChain = xObj.insertXObjEChain;
|
|
80
|
+
|
|
81
|
+
module.exports.INode = xObj.INode;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated
|
|
3
|
+
* @todo \[since `v0.2.1`] deprecated and will be removed
|
|
4
|
+
*/
|
|
5
|
+
export type readXObjAttrOptionAsStr = string;
|
|
6
|
+
export const readXObjAttrOptionAsStr: readXObjAttrOptionAsStr;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
* @todo \[since `v0.2.1`] deprecated and will be removed
|
|
10
|
+
*/
|
|
11
|
+
export type writeXObjAttrOptionAsStr = string;
|
|
12
|
+
export const writeXObjAttrOptionAsStr: writeXObjAttrOptionAsStr;
|
|
13
|
+
/**
|
|
14
|
+
* Extracts an attributes from a given object by its key.
|
|
15
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
16
|
+
*/
|
|
17
|
+
export function getXObjAttributes(obj: INode, key?: string): INode | null;
|
|
18
|
+
/**
|
|
19
|
+
* Checks whether an attribute is exists.
|
|
20
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
21
|
+
* @throws {EvalKeyNameError} if `attr` param is not valid identifier
|
|
22
|
+
*/
|
|
23
|
+
export function checkXObjAttribute(obj: INode, attr?: string, key?: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Deletes an attribute addressed by a given name.
|
|
26
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
27
|
+
* @throws {EvalKeyNameError} if `attr` param is not valid identifier
|
|
28
|
+
*/
|
|
29
|
+
export function deleteXObjAttribute(obj: INode, attr?: string, key?: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Renames an attribute addressed by a given name.
|
|
32
|
+
* @since 0.2.0
|
|
33
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
34
|
+
* @throws {EvalKeyNameError} if `attr` param is not valid identifier
|
|
35
|
+
* @throws {EvalKeyNameError} if `value` param is not valid identifier
|
|
36
|
+
* @throws {EvalKeyNameError} if `key` param is not valid identifier
|
|
37
|
+
*/
|
|
38
|
+
export function renameXObjAttribute(obj: INode, attr?: string, value?: string, key?: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Extracts an attribute 'AS IS' from a given object.
|
|
41
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
42
|
+
* @throws {EvalKeyNameError} if `attr` param is not valid identifier
|
|
43
|
+
*/
|
|
44
|
+
export function readXObjAttrRaw(obj: INode, attr?: string, key?: string): any;
|
|
45
|
+
/**
|
|
46
|
+
* Writes a parameter into a given object.
|
|
47
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
48
|
+
* @throws {EvalKeyNameError} if `attr` param is not valid identifier
|
|
49
|
+
*/
|
|
50
|
+
export function writeXObjAttrRaw(obj: INode, attr: string, value: any, key?: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Extracts an attribute from a given object and returns it as a string.
|
|
53
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
54
|
+
*/
|
|
55
|
+
export function readXObjAttr(obj: INode, attr: string, key?: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Extracts an attribute from a given object and returns it as a boolean.
|
|
58
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
59
|
+
*/
|
|
60
|
+
export function readXObjAttrAsBool(obj: INode, attr: string, defValue?: boolean, key?: string): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Extracts an attribute from a given object and returns it as a number.
|
|
63
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
64
|
+
*/
|
|
65
|
+
export function readXObjAttrAsNum(obj: INode, attr: string, defValue?: number, key?: string): number;
|
|
66
|
+
/**
|
|
67
|
+
* Extracts an attribute from a given object and returns it as 'index' value.
|
|
68
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
69
|
+
*/
|
|
70
|
+
export function readXObjAttrAsIndex(obj: INode, attr: string, key?: string): number;
|
|
71
|
+
/**
|
|
72
|
+
* Extracts an attribute from a given object and returns it as a string.
|
|
73
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
74
|
+
* @todo [since `v0.2.1`] deprecate use of `opt` as `string`
|
|
75
|
+
*/
|
|
76
|
+
export function readXObjAttrEx(obj: INode, attr: string, opt?: readXObjAttrOptionAsStr | IValueToStringTransformOptions, key?: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Tries to convert a given value to a string and writes it as an attribute
|
|
79
|
+
* into a given object.
|
|
80
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
81
|
+
*/
|
|
82
|
+
export function writeXObjAttr(obj: INode, attr: string, value: any, key?: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Tries to convert a given value to a boolean and writes it as an attribute
|
|
85
|
+
* into a given object.
|
|
86
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
87
|
+
*/
|
|
88
|
+
export function writeXObjAttrAsBool(obj: INode, attr: string, value: any, defValue?: boolean, key?: string): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Tries to convert a given value to a number and writes it as an attribute
|
|
91
|
+
* into a given object.
|
|
92
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
93
|
+
*/
|
|
94
|
+
export function writeXObjAttrAsNum(obj: INode, attr: string, value: any, defValue?: number, key?: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Tries to convert a given value into an 'index' value and writes it
|
|
97
|
+
* as an attribute into a given object.
|
|
98
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
99
|
+
*/
|
|
100
|
+
export function writeXObjAttrAsIndex(obj: INode, attr: string, value: any, key?: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Tries to convert a given value to a string and writes it as an attribute
|
|
103
|
+
* into a given object.
|
|
104
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
105
|
+
* @todo [since `v0.2.1`] deprecate use of `opt` as `string`
|
|
106
|
+
*/
|
|
107
|
+
export function writeXObjAttrEx(obj: INode, attr: string, value: any, opt?: writeXObjAttrOptionAsStr | IValueToStringTransformOptions, key?: string): boolean;
|
|
108
|
+
import type { INode } from "./xObj-lib";
|
|
109
|
+
import type { IValueToStringTransformOptions } from "@ygracs/bsfoc-lib-js";
|