json-stream-lite 1.0.5 → 1.0.6

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/dist/stringify.js CHANGED
@@ -13,6 +13,9 @@ function* formatString(str, chunkSize = 1024) {
13
13
  i += chunkSize;
14
14
  }
15
15
  }
16
+ function shouldIgnore(value) {
17
+ return typeof value === 'function' || value === undefined;
18
+ }
16
19
  function* jsonStreamStringifyWithDepth(value, replacer, indent = 0, currentDepth = 0, options) {
17
20
  if (replacer) {
18
21
  value = replacer('', value);
@@ -41,7 +44,7 @@ function* jsonStreamStringifyWithDepth(value, replacer, indent = 0, currentDepth
41
44
  if (indent > 0) {
42
45
  yield '\n' + ' '.repeat(valueIndent);
43
46
  }
44
- if (next === undefined) {
47
+ if (shouldIgnore(next)) {
45
48
  yield 'null';
46
49
  continue;
47
50
  }
@@ -61,7 +64,7 @@ function* jsonStreamStringifyWithDepth(value, replacer, indent = 0, currentDepth
61
64
  for (let i = 0; i < len; i++) {
62
65
  const key = keys[i];
63
66
  const next = value[key];
64
- if (next === undefined) {
67
+ if (shouldIgnore(next)) {
65
68
  continue;
66
69
  }
67
70
  if (count > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-stream-lite",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "A lightweight, memory-efficient, zero-dependency streaming JSON parser and stringifier for JavaScript and TypeScript. It works in both Node.js and browser environments.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",