@naturalcycles/js-lib 15.17.0 → 15.19.0
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/array/index.d.ts +2 -0
- package/dist/array/index.js +2 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/json-schema/from-data/generateJsonSchemaFromData.js +1 -1
- package/dist/string/stringify.js +2 -1
- package/package.json +6 -4
- package/src/array/index.ts +2 -0
- package/src/index.ts +0 -2
- package/src/json-schema/from-data/generateJsonSchemaFromData.ts +1 -1
- package/src/string/stringify.ts +2 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/string/stringify.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _isBackendErrorResponseObject, _isErrorLike, _isErrorObject } from '../error/error.util.js';
|
|
2
2
|
import { _jsonParseIfPossible } from './json.util.js';
|
|
3
3
|
import { _safeJsonStringify } from './safeJsonStringify.js';
|
|
4
|
+
import { _truncateMiddle } from './string.util.js';
|
|
4
5
|
const supportsAggregateError = typeof globalThis.AggregateError === 'function';
|
|
5
6
|
let globalStringifyFunction = _safeJsonStringify;
|
|
6
7
|
/**
|
|
@@ -127,7 +128,7 @@ export function _stringify(obj, opt = {}) {
|
|
|
127
128
|
// Handle maxLen
|
|
128
129
|
const { maxLen = 10_000 } = opt;
|
|
129
130
|
if (maxLen && s.length > maxLen) {
|
|
130
|
-
|
|
131
|
+
return _truncateMiddle(s, maxLen, `\n... ${Math.ceil(s.length / 1024)} Kb message truncated ...\n`);
|
|
131
132
|
}
|
|
132
133
|
return s;
|
|
133
134
|
}
|
package/package.json
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/js-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.19.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"tslib": "^2",
|
|
7
7
|
"zod": "^4"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@naturalcycles/dev-lib": "*",
|
|
11
10
|
"@types/crypto-js": "^4",
|
|
12
11
|
"@types/node": "^24",
|
|
13
12
|
"@types/semver": "^7",
|
|
14
13
|
"crypto-js": "^4",
|
|
15
|
-
"dayjs": "^1"
|
|
14
|
+
"dayjs": "^1",
|
|
15
|
+
"@naturalcycles/dev-lib": "18.4.2"
|
|
16
16
|
},
|
|
17
17
|
"exports": {
|
|
18
|
-
"./cfg/frontend/tsconfig.json": "./cfg/frontend/tsconfig.json",
|
|
19
18
|
".": "./dist/index.js",
|
|
19
|
+
"./cfg/frontend/tsconfig.json": "./cfg/frontend/tsconfig.json",
|
|
20
|
+
"./array": "./dist/array/index.js",
|
|
21
|
+
"./array/*.js": "./dist/array/*.js",
|
|
20
22
|
"./browser": "./dist/browser/index.js",
|
|
21
23
|
"./browser/*.js": "./dist/browser/*.js",
|
|
22
24
|
"./datetime": "./dist/datetime/index.js",
|
package/src/index.ts
CHANGED
package/src/string/stringify.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { _isBackendErrorResponseObject, _isErrorLike, _isErrorObject } from '../
|
|
|
2
2
|
import type { Reviver } from '../types.js'
|
|
3
3
|
import { _jsonParseIfPossible } from './json.util.js'
|
|
4
4
|
import { _safeJsonStringify } from './safeJsonStringify.js'
|
|
5
|
+
import { _truncateMiddle } from './string.util.js'
|
|
5
6
|
|
|
6
7
|
const supportsAggregateError = typeof globalThis.AggregateError === 'function'
|
|
7
8
|
|
|
@@ -179,7 +180,7 @@ export function _stringify(obj: any, opt: StringifyOptions = {}): string {
|
|
|
179
180
|
// Handle maxLen
|
|
180
181
|
const { maxLen = 10_000 } = opt
|
|
181
182
|
if (maxLen && s.length > maxLen) {
|
|
182
|
-
|
|
183
|
+
return _truncateMiddle(s, maxLen, `\n... ${Math.ceil(s.length / 1024)} Kb message truncated ...\n`)
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
return s
|