@ygracs/xobj-lib-js 0.2.1 → 0.2.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 +7 -0
- package/lib/xObj-lib.js +15 -8
- package/package.json +5 -6
package/CHANGELOG.md
CHANGED
package/lib/xObj-lib.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.2.
|
|
1
|
+
// [v0.2.101-20250401]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -320,6 +320,7 @@ function insertXObjElement(...args) {
|
|
|
320
320
|
};
|
|
321
321
|
|
|
322
322
|
/**
|
|
323
|
+
* @since 0.2.0
|
|
323
324
|
* @function insertXObjElementEx
|
|
324
325
|
* @param {object} obj - some object
|
|
325
326
|
* @param {string} name - some child element
|
|
@@ -327,7 +328,6 @@ function insertXObjElement(...args) {
|
|
|
327
328
|
* @returns {RVAL_emodif}
|
|
328
329
|
* @throws {TypeError} if first param is not an object
|
|
329
330
|
* @throws {TypeError} if second param is empty string or not a string at all
|
|
330
|
-
* @since 0.2.0
|
|
331
331
|
* @description Inserts an element addressed by its key into a given object.
|
|
332
332
|
*/
|
|
333
333
|
function insertXObjElementEx(obj, name, opt) {
|
|
@@ -350,8 +350,12 @@ function insertXObjElementEx(obj, name, opt) {
|
|
|
350
350
|
obj[key] = prop = item;
|
|
351
351
|
isSucceed = true;
|
|
352
352
|
} else {
|
|
353
|
-
|
|
354
|
-
let {
|
|
353
|
+
/** @type {OPT_inselops_L} */
|
|
354
|
+
let {
|
|
355
|
+
force,
|
|
356
|
+
ripOldies,
|
|
357
|
+
acceptIfList,
|
|
358
|
+
} = isPlainObject(opt) ? opt : {};
|
|
355
359
|
if (typeof force !== 'boolean') force = false;
|
|
356
360
|
if (typeof ripOldies !== 'boolean') ripOldies = false;
|
|
357
361
|
if (typeof acceptIfList !== 'boolean') acceptIfList = false;
|
|
@@ -536,6 +540,7 @@ function deleteXObjAttribute(obj, attr = '', key) {
|
|
|
536
540
|
};
|
|
537
541
|
|
|
538
542
|
/**
|
|
543
|
+
* @since 0.2.0
|
|
539
544
|
* @function renameXObjAttribute
|
|
540
545
|
* @param {object} obj - some object
|
|
541
546
|
* @param {string} attr - some attribute ID
|
|
@@ -545,7 +550,6 @@ function deleteXObjAttribute(obj, attr = '', key) {
|
|
|
545
550
|
* @throws {TypeError} if first param is not an object
|
|
546
551
|
* @throws {TypeError} if second param is not an object
|
|
547
552
|
* @throws {TypeError} if third param is not an object
|
|
548
|
-
* @since 0.2.0
|
|
549
553
|
* @description Renames an attribute addressed by a given name.
|
|
550
554
|
*/
|
|
551
555
|
function renameXObjAttribute(obj, attr = '', value = '', key = XOBJ_DEF_ATTR_TNAME) {
|
|
@@ -1408,6 +1412,7 @@ function insertXObjEList(...args) {
|
|
|
1408
1412
|
};
|
|
1409
1413
|
|
|
1410
1414
|
/**
|
|
1415
|
+
* @since 0.2.0
|
|
1411
1416
|
* @function insertXObjEListEx
|
|
1412
1417
|
* @param {object} obj - some object
|
|
1413
1418
|
* @param {string} name - some child element
|
|
@@ -1415,7 +1420,6 @@ function insertXObjEList(...args) {
|
|
|
1415
1420
|
* @returns {RVAL_emodif}
|
|
1416
1421
|
* @throws {TypeError} if first param is not an object
|
|
1417
1422
|
* @throws {TypeError} if second param is empty string or not a string at all
|
|
1418
|
-
* @since 0.2.0
|
|
1419
1423
|
* @description Inserts a list elements into a given object.
|
|
1420
1424
|
*/
|
|
1421
1425
|
function insertXObjEListEx(obj, name, opt) {
|
|
@@ -1431,8 +1435,11 @@ function insertXObjEListEx(obj, name, opt) {
|
|
|
1431
1435
|
err.code = code;
|
|
1432
1436
|
throw err;
|
|
1433
1437
|
};
|
|
1434
|
-
|
|
1435
|
-
let {
|
|
1438
|
+
/** @type {OPT_inselops_S} */
|
|
1439
|
+
let {
|
|
1440
|
+
force,
|
|
1441
|
+
ripOldies,
|
|
1442
|
+
} = isPlainObject(opt) ? opt : {};
|
|
1436
1443
|
if (typeof force !== 'boolean') force = false;
|
|
1437
1444
|
if (typeof ripOldies !== 'boolean') ripOldies = false;
|
|
1438
1445
|
let prop = obj[key];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ygracs/xobj-lib-js",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "A helper library to work with xml-js module",
|
|
5
5
|
"author": "ygracs <cs70th-om@rambler.ru>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,10 +19,9 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"test": "jest",
|
|
21
21
|
"test-xobj": "jest xObj",
|
|
22
|
-
"test-xobj:c1": "jest
|
|
23
|
-
"test-xobj:c2": "jest
|
|
24
|
-
"test-xobj:c3": "jest
|
|
25
|
-
"test-xobj:c4": "jest xObj-lib.4",
|
|
22
|
+
"test-xobj:c1": "jest xobj-param",
|
|
23
|
+
"test-xobj:c2": "jest xobj-attr",
|
|
24
|
+
"test-xobj:c3": "jest xobj-elements",
|
|
26
25
|
"build-doc-md": "jsdoc2md",
|
|
27
26
|
"build-doc-html": "jsdoc"
|
|
28
27
|
},
|
|
@@ -31,7 +30,7 @@
|
|
|
31
30
|
"#test-dir/*": "./__test__/*"
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
|
-
"@ygracs/bsfoc-lib-js": "^0.2.
|
|
33
|
+
"@ygracs/bsfoc-lib-js": "^0.2.3"
|
|
35
34
|
},
|
|
36
35
|
"devDependencies": {
|
|
37
36
|
"jest": "^29.7.0",
|