fix(core): update

This commit is contained in:
Philipp Kunz 2024-04-17 20:10:59 +02:00
parent 777d7ae1b3
commit e44d014733
4 changed files with 427 additions and 1184 deletions

View File

@ -23,14 +23,13 @@
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^2.1.66", "@git.zone/tsbuild": "^2.1.66",
"@git.zone/tsrun": "^1.2.44", "@git.zone/tsrun": "^1.2.44",
"@git.zone/tstest": "^1.0.77", "@git.zone/tstest": "^1.0.88",
"@push.rocks/tapbundle": "^5.0.8", "@push.rocks/tapbundle": "^5.0.23",
"@types/node": "^20.11.24" "@types/node": "^20.12.7"
}, },
"dependencies": { "dependencies": {
"@push.rocks/smartbuffer": "^1.0.7",
"@push.rocks/smartenv": "^5.0.12", "@push.rocks/smartenv": "^5.0.12",
"@push.rocks/smartstring": "^4.0.14", "@push.rocks/smartstring": "^4.0.15",
"fast-json-stable-stringify": "^2.1.0", "fast-json-stable-stringify": "^2.1.0",
"lodash.clonedeep": "^4.5.0" "lodash.clonedeep": "^4.5.0"
}, },

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartjson', name: '@push.rocks/smartjson',
version: '5.0.16', version: '5.0.17',
description: 'typed json handlers' description: 'A library for handling typed JSON data, providing functionalities for parsing, stringifying, and working with JSON objects, including support for encoding and decoding buffers.'
} }

View File

@ -2,11 +2,26 @@ import * as plugins from './smartjson.plugins.js';
import * as bufferhandling from './bufferhandling.js'; import * as bufferhandling from './bufferhandling.js';
import { json } from 'stream/consumers'; import { json } from 'stream/consumers';
interface JsonObject {
[key: string]: any;
}
/** /**
* allows you to parse a json * allows you to parse a json
*/ */
export const parse = bufferhandling.parse; export const parse = bufferhandling.parse;
export const parseJsonL = (jsonlData: string): JsonObject[] => {
const lines = jsonlData.trim().split('\n');
const parsedData: JsonObject[] = lines.reduce((acc, line) => {
if (line.trim().length > 0) {
acc.push(JSON.parse(line));
}
return acc;
}, [] as JsonObject[]);
return parsedData;
}
/** /**
* *
* @param objArg * @param objArg