@cntwg/xml-lib-js 0.0.17 → 0.0.19

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
@@ -1,3 +1,15 @@
1
+ #### *v0.0.19*
2
+
3
+ Pre-release version.
4
+
5
+ > - updated dependency on `@ygracs/xobj-lib-js` module to v0.0.14rc1.
6
+
7
+ #### *v0.0.18*
8
+
9
+ Pre-release version.
10
+
11
+ > fixed error in `saveToFile` method of `TXmltvContentProvider` class.
12
+
1
13
  #### *v0.0.17*
2
14
 
3
15
  Pre-release version.
@@ -18,14 +30,14 @@ Pre-release version.
18
30
  Pre-release version.
19
31
 
20
32
  > - updated dependency on `@ygracs/bsfoc-lib-js` module to v0.1.2;
21
- > - updated dependency on `@ygracs/xobj-lib-js` module to v0.0.13;
33
+ > - updated dependency on `@ygracs/xobj-lib-js` module to v0.0.13.
22
34
 
23
35
  #### *v0.0.14*
24
36
 
25
37
  Pre-release version.
26
38
 
27
39
  > - updated dependency on `@ygracs/bsfoc-lib-js` module to v0.1.1;
28
- > - updated dependency on `@ygracs/xobj-lib-js` module to v0.0.12;
40
+ > - updated dependency on `@ygracs/xobj-lib-js` module to v0.0.12.
29
41
 
30
42
  #### *v0.0.13*
31
43
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019-2022 Yuri Grachev
3
+ Copyright (c) 2019-2023 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/lib/xmldoc-lib.js CHANGED
@@ -1,4 +1,4 @@
1
- // [v0.1.047-20220907]
1
+ // [v0.1.048-20220908]
2
2
 
3
3
  // === module init block ===
4
4
 
@@ -832,12 +832,18 @@ class TXmlContentContainer {
832
832
  return new Promise((resolve, reject) => {
833
833
  let data = {
834
834
  isSucceed: false,
835
- source: typeof source === 'string' ? source.trim : '',
835
+ source: typeof source === 'string' ? source.trim() : '',
836
836
  content: '',
837
837
  isERR: false,
838
838
  errEvent: '',
839
839
  };
840
- if (data.source !== '') {
840
+ if (data.source === '') {
841
+ data.isERR = true;
842
+ data.errEvent = (
843
+ typeof source === 'string' ? 'EMPTY_SRCLINK' : 'NO_SRCLINK'
844
+ );
845
+ resolve(data);
846
+ } else {
841
847
  data.content = this.saveToXMLString();
842
848
  fse.writeFile(data.source, data.content, 'utf8').then(result => {
843
849
  data.isSucceed = true;
@@ -848,16 +854,11 @@ class TXmlContentContainer {
848
854
  console.log('CHECK: TXmlContentContainer.saveToFile() => Error => '+err.code);
849
855
  reject(err);
850
856
  });
851
- } else {
852
- data.isERR = true;
853
- data.errEvent = 'EMPTY_SRCLINK';
854
- resolve(data);
855
857
  };
856
858
  });
857
859
  }
858
860
 
859
861
  saveToFileSync(source){
860
- //console.log('CHECK: TXmlContentContainer.saveToFileSync() => was called...');
861
862
  let data = {
862
863
  isSucceed: false,
863
864
  source: typeof source === 'string' ? source.trim() : '',
@@ -865,7 +866,12 @@ class TXmlContentContainer {
865
866
  isERR: false,
866
867
  errEvent: '',
867
868
  };
868
- if (data.source !== '') {
869
+ if (data.source === '') {
870
+ data.isERR = true;
871
+ data.errEvent = (
872
+ typeof source === 'string' ? 'EMPTY_SRCLINK' : 'NO_SRCLINK'
873
+ );
874
+ } else {
869
875
  try {
870
876
  data.content = this.saveToXMLString();
871
877
  fs.writeFileSync(data.source, data.content, 'utf8');
@@ -874,11 +880,7 @@ class TXmlContentContainer {
874
880
  console.log('CHECK: TXmlContentContainer.saveToFileSync() => Error => '+err.code);
875
881
  throw err;
876
882
  };
877
- } else {
878
- data.isERR = true;
879
- data.errEvent = 'EMPTY_SRCLINK';
880
883
  };
881
- //console.log('CHECK: TXmlContentContainer.saveToFileSync() => was left...');
882
884
  return data;
883
885
  }
884
886
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntwg/xml-lib-js",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "A library for handling an XML-documents",
5
5
  "author": "ygracs <cs70th-om@rambler.ru>",
6
6
  "license": "MIT",
@@ -8,11 +8,15 @@
8
8
  "type": "git",
9
9
  "url": "git+https://gitlab.com/cntwg/xml-lib-js.git"
10
10
  },
11
+ "keywords": [
12
+ "xml"
13
+ ],
11
14
  "main": "./index.js",
12
15
  "files": [
13
16
  "doc/xmldoc-lib.md",
14
17
  "lib/xmldoc-lib.js",
15
- "index.js"
18
+ "index.js",
19
+ "CHANGELOG.md"
16
20
  ],
17
21
  "scripts": {
18
22
  "test": "jest",
@@ -27,7 +31,7 @@
27
31
  "dependencies": {
28
32
  "@ygracs/bsfoc-lib-js": "^0.1.2",
29
33
  "@ygracs/xml-js6": "^0.0.3-b",
30
- "@ygracs/xobj-lib-js": "^0.0.13"
34
+ "@ygracs/xobj-lib-js": "^0.0.14-rc1"
31
35
  },
32
36
  "devDependencies": {
33
37
  "jest": "^27.5.1"