@sergdudko/objectstream 4.0.5 → 4.0.7

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.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Parser = void 0;
4
4
  const stream_1 = require("stream");
5
- const global_1 = require("../utils/global");
5
+ const global_js_1 = require("../utils/global.js");
6
6
  /**
7
7
  * @class Parser
8
8
  *
@@ -156,7 +156,7 @@ class Parser extends stream_1.Transform {
156
156
  const _buf = Buffer.concat(this.__buffers);
157
157
  const _str = _buf.toString("utf8");
158
158
  const _object = JSON.parse(_str);
159
- if ((0, global_1.validator)(_object, false)) {
159
+ if ((0, global_js_1.validator)(_object, false)) {
160
160
  this.__clear();
161
161
  this.push(_object);
162
162
  }
@@ -232,4 +232,3 @@ exports.Parser = Parser;
232
232
  * @private
233
233
  */
234
234
  Parser.__empty = Buffer.from("");
235
- //# sourceMappingURL=Parser.js.map
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Stringifer = void 0;
4
4
  const stream_1 = require("stream");
5
- const global_1 = require("../utils/global");
5
+ const global_js_1 = require("../utils/global.js");
6
6
  /**
7
7
  * @class Stringifer
8
8
  *
@@ -68,7 +68,7 @@ class Stringifer extends stream_1.Transform {
68
68
  switch (typeof object) {
69
69
  case "object":
70
70
  try {
71
- if ((0, global_1.validator)(object, false) !== true) {
71
+ if ((0, global_js_1.validator)(object, false) !== true) {
72
72
  callback([
73
73
  new Error("Validation failed, incoming data type is not pure Object!"),
74
74
  ]);
@@ -155,4 +155,3 @@ class Stringifer extends stream_1.Transform {
155
155
  }
156
156
  }
157
157
  exports.Stringifer = Stringifer;
158
- //# sourceMappingURL=Stringifer.js.map
package/dist/cjs/index.js CHANGED
@@ -10,20 +10,19 @@
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Stringifer = exports.Parser = void 0;
13
- const Parser_1 = require("./classes/Parser");
14
- Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return Parser_1.Parser; } });
15
- const Stringifer_1 = require("./classes/Stringifer");
16
- Object.defineProperty(exports, "Stringifer", { enumerable: true, get: function () { return Stringifer_1.Stringifer; } });
13
+ const Parser_js_1 = require("./classes/Parser.js");
14
+ Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return Parser_js_1.Parser; } });
15
+ const Stringifer_js_1 = require("./classes/Stringifer.js");
16
+ Object.defineProperty(exports, "Stringifer", { enumerable: true, get: function () { return Stringifer_js_1.Stringifer; } });
17
17
  // Default export for CommonJS compatibility
18
18
  const objectstream = {
19
19
  /**
20
20
  * Object to String stream
21
21
  */
22
- Stringifer: Stringifer_1.Stringifer,
22
+ Stringifer: Stringifer_js_1.Stringifer,
23
23
  /**
24
24
  * String to Object stream
25
25
  */
26
- Parser: Parser_1.Parser,
26
+ Parser: Parser_js_1.Parser,
27
27
  };
28
28
  exports.default = objectstream;
29
- //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=genericFunction.js.map
@@ -37,4 +37,3 @@ const validator = (obj, it = true) => {
37
37
  }
38
38
  };
39
39
  exports.validator = validator;
40
- //# sourceMappingURL=global.js.map
@@ -1,5 +1,5 @@
1
1
  import { Transform } from "stream";
2
- import { validator } from "../utils/global";
2
+ import { validator } from "../utils/global.js";
3
3
  /**
4
4
  * @class Parser
5
5
  *
@@ -43,6 +43,54 @@ export class Parser extends Transform {
43
43
  this.__rightBrace = 0;
44
44
  this.__openQuotes = false;
45
45
  }
46
+ /**
47
+ * separators
48
+ *
49
+ * @private
50
+ */
51
+ __separators;
52
+ /**
53
+ * empty buffer
54
+ *
55
+ * @private
56
+ */
57
+ static __empty = Buffer.from("");
58
+ /**
59
+ * stream byte counter
60
+ *
61
+ * @private
62
+ */
63
+ __bytesRead;
64
+ /**
65
+ * stream encoding
66
+ *
67
+ * @private
68
+ */
69
+ __encoding;
70
+ /**
71
+ * stream buffer
72
+ *
73
+ * @private
74
+ */
75
+ __buffers;
76
+ /**
77
+ * left brace counter
78
+ *
79
+ * @private
80
+ */
81
+ __leftBrace;
82
+ /**
83
+ * right brace counter
84
+ *
85
+ * @private
86
+ */
87
+ __rightBrace;
88
+ /**
89
+ * open quote flag
90
+ *
91
+ * @private
92
+ */
93
+ __openQuotes;
46
94
  /**
47
95
  * clear buffer and reset counters
48
96
  *
@@ -222,10 +270,3 @@ export class Parser extends Transform {
222
270
  return this;
223
271
  }
224
272
  }
225
- /**
226
- * empty buffer
227
- *
228
- * @private
229
- */
230
- Parser.__empty = Buffer.from("");
231
- //# sourceMappingURL=Parser.js.map
@@ -1,5 +1,5 @@
1
1
  import { Transform } from "stream";
2
- import { validator } from "../utils/global";
2
+ import { validator } from "../utils/global.js";
3
3
  /**
4
4
  * @class Stringifer
5
5
  *
@@ -39,6 +39,30 @@ export class Stringifer extends Transform {
39
39
  this.__encoding = "utf8";
40
40
  this.setDefaultEncoding(this.__encoding);
41
41
  }
42
+ /**
43
+ * separators
44
+ *
45
+ * @private
46
+ */
47
+ __separators;
48
+ /**
49
+ * pass string data to the stream
50
+ *
51
+ * @private
52
+ */
53
+ __isString;
54
+ /**
55
+ * stream byte counter
56
+ *
57
+ * @private
58
+ */
59
+ __bytesWrite;
60
+ /**
61
+ * stream encoding
62
+ *
63
+ * @private
64
+ */
65
+ __encoding;
42
66
  /**
43
67
  * Data event handler
44
68
  *
@@ -151,4 +175,3 @@ export class Stringifer extends Transform {
151
175
  return this;
152
176
  }
153
177
  }
154
- //# sourceMappingURL=Stringifer.js.map
package/dist/esm/index.js CHANGED
@@ -7,8 +7,8 @@
7
7
  * @version 2.0.0
8
8
  * @requires stream
9
9
  */
10
- import { Parser } from "./classes/Parser";
11
- import { Stringifer } from "./classes/Stringifer";
10
+ import { Parser } from "./classes/Parser.js";
11
+ import { Stringifer } from "./classes/Stringifer.js";
12
12
  // Named exports
13
13
  export { Parser, Stringifer };
14
14
  // Default export for CommonJS compatibility
@@ -23,4 +23,3 @@ const objectstream = {
23
23
  Parser,
24
24
  };
25
25
  export default objectstream;
26
- //# sourceMappingURL=index.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=genericFunction.js.map
@@ -33,4 +33,3 @@ export const validator = (obj, it = true) => {
33
33
  return false;
34
34
  }
35
35
  };
36
- //# sourceMappingURL=global.js.map
@@ -1,5 +1,5 @@
1
1
  import { Transform } from "stream";
2
- import { UniversalGenericFunction } from "../utils/genericFunction";
2
+ import { UniversalGenericFunction } from "../utils/genericFunction.js";
3
3
  /**
4
4
  * @class Parser
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import { Transform } from "stream";
2
- import { UniversalGenericFunction } from "../utils/genericFunction";
2
+ import { UniversalGenericFunction } from "../utils/genericFunction.js";
3
3
  /**
4
4
  * @class Stringifer
5
5
  *
@@ -7,8 +7,8 @@
7
7
  * @version 2.0.0
8
8
  * @requires stream
9
9
  */
10
- import { Parser } from "./classes/Parser";
11
- import { Stringifer } from "./classes/Stringifer";
10
+ import { Parser } from "./classes/Parser.js";
11
+ import { Stringifer } from "./classes/Stringifer.js";
12
12
  export { Parser, Stringifer };
13
13
  declare const objectstream: {
14
14
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sergdudko/objectstream",
3
- "version": "4.0.5",
3
+ "version": "4.0.7",
4
4
  "description": "Creates a stream to convert json from string or convert json to string.",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -33,8 +33,8 @@
33
33
  "testv20": "docker run --name=objectstream-node20 --rm -v $PWD:/app node20:1.0.0 nyc npm run test"
34
34
  },
35
35
  "files": [
36
- "dist/esm/**/*.js",
37
- "dist/cjs/**/*.js",
36
+ "dist/esm/**/*.js{,on}",
37
+ "dist/cjs/**/*.js{,on}",
38
38
  "dist/types/**/*",
39
39
  "README.md",
40
40
  "LICENSE"
@@ -91,7 +91,7 @@
91
91
  "typescript-eslint": "^8.46.1"
92
92
  },
93
93
  "engines": {
94
- "node": ">=10"
94
+ "node": ">=16"
95
95
  },
96
96
  "directories": {
97
97
  "test": "./test/"