@ygracs/xobj-lib-js 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/index.d.ts +14 -8
- package/index.js +35 -33
- package/lib/xObj-attr.d.ts +97 -0
- package/lib/xObj-attr.js +591 -0
- package/lib/xObj-lib.d.ts +124 -245
- package/lib/xObj-lib.js +227 -1092
- package/lib/xObj-param.d.ts +69 -0
- package/lib/xObj-param.js +410 -0
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
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,
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.016-20260530]
|
|
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;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts an attributes from a given object by its key.
|
|
3
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
4
|
+
*/
|
|
5
|
+
export function getXObjAttributes(obj: object, key?: string): INode | null;
|
|
6
|
+
/**
|
|
7
|
+
* Checks whether an attribute is exists.
|
|
8
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
9
|
+
* @throws {EvalKeyNameError} if `attr` param is not valid identifier
|
|
10
|
+
*/
|
|
11
|
+
export function checkXObjAttribute(obj: object, attr?: string, key?: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Deletes an attribute addressed by a given name.
|
|
14
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
15
|
+
* @throws {EvalKeyNameError} if `attr` param is not valid identifier
|
|
16
|
+
*/
|
|
17
|
+
export function deleteXObjAttribute(obj: object, attr?: string, key?: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Renames an attribute addressed by a given name.
|
|
20
|
+
* @since 0.2.0
|
|
21
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
22
|
+
* @throws {EvalKeyNameError} if `attr` param is not valid identifier
|
|
23
|
+
* @throws {EvalKeyNameError} if `value` param is not valid identifier
|
|
24
|
+
* @throws {EvalKeyNameError} if `key` param is not valid identifier
|
|
25
|
+
*/
|
|
26
|
+
export function renameXObjAttribute(obj: object, attr?: string, value?: string, key?: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Extracts an attribute 'AS IS' from a given object.
|
|
29
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
30
|
+
* @throws {EvalKeyNameError} if `attr` param is not valid identifier
|
|
31
|
+
*/
|
|
32
|
+
export function readXObjAttrRaw(obj: object, attr?: string, key?: string): any;
|
|
33
|
+
/**
|
|
34
|
+
* Writes a parameter into a given object.
|
|
35
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
36
|
+
* @throws {EvalKeyNameError} if `attr` param is not valid identifier
|
|
37
|
+
*/
|
|
38
|
+
export function writeXObjAttrRaw(obj: object, attr: string, value: any, key?: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Extracts an attribute from a given object and returns it as a string.
|
|
41
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
42
|
+
*/
|
|
43
|
+
export function readXObjAttr(obj: object, attr: string, key?: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Extracts an attribute from a given object and returns it as a boolean.
|
|
46
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
47
|
+
*/
|
|
48
|
+
export function readXObjAttrAsBool(obj: object, attr: string, defValue?: boolean, key?: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Extracts an attribute from a given object and returns it as a number.
|
|
51
|
+
* @returns {number}
|
|
52
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
53
|
+
*/
|
|
54
|
+
export function readXObjAttrAsNum(obj: object, attr: string, defValue?: number, key?: string): number;
|
|
55
|
+
/**
|
|
56
|
+
* Extracts an attribute from a given object and returns it as 'index' value.
|
|
57
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
58
|
+
*/
|
|
59
|
+
export function readXObjAttrAsIndex(obj: object, attr: string, key?: string): number;
|
|
60
|
+
/**
|
|
61
|
+
* Extracts an attribute from a given object and returns it as a string.
|
|
62
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
63
|
+
* @todo [since `v0.2.1`] deprecate use of `opt` as `string`
|
|
64
|
+
*/
|
|
65
|
+
export function readXObjAttrEx(obj: object, attr: string, opt?: object, key?: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Tries to convert a given value to a string and writes it as an attribute
|
|
68
|
+
* into a given object.
|
|
69
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
70
|
+
*/
|
|
71
|
+
export function writeXObjAttr(obj: object, attr: string, value: any, key?: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Tries to convert a given value to a boolean and writes it as an attribute
|
|
74
|
+
* into a given object.
|
|
75
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
76
|
+
*/
|
|
77
|
+
export function writeXObjAttrAsBool(obj: object, attr: string, value: any, defValue?: boolean, key?: string): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Tries to convert a given value to a number and writes it as an attribute
|
|
80
|
+
* into a given object.
|
|
81
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
82
|
+
*/
|
|
83
|
+
export function writeXObjAttrAsNum(obj: object, attr: string, value: any, defValue?: number, key?: string): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Tries to convert a given value into an 'index' value and writes it
|
|
86
|
+
* as an attribute into a given object.
|
|
87
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
88
|
+
*/
|
|
89
|
+
export function writeXObjAttrAsIndex(obj: object, attr: string, value: any, key?: string): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Tries to convert a given value to a string and writes it as an attribute
|
|
92
|
+
* into a given object.
|
|
93
|
+
* @throws {TypeError} if `obj` param is not an object
|
|
94
|
+
* @todo [since `v0.2.1`] deprecate use of `opt` as `string`
|
|
95
|
+
*/
|
|
96
|
+
export function writeXObjAttrEx(obj: object, attr: string, value: any, opt?: object, key?: string): boolean;
|
|
97
|
+
import type { INode } from "./xObj-lib";
|