fix(core): update
This commit is contained in:
parent
777d7ae1b3
commit
e44d014733
@ -23,14 +23,13 @@
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.1.66",
|
||||
"@git.zone/tsrun": "^1.2.44",
|
||||
"@git.zone/tstest": "^1.0.77",
|
||||
"@push.rocks/tapbundle": "^5.0.8",
|
||||
"@types/node": "^20.11.24"
|
||||
"@git.zone/tstest": "^1.0.88",
|
||||
"@push.rocks/tapbundle": "^5.0.23",
|
||||
"@types/node": "^20.12.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"@push.rocks/smartbuffer": "^1.0.7",
|
||||
"@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",
|
||||
"lodash.clonedeep": "^4.5.0"
|
||||
},
|
||||
|
1583
pnpm-lock.yaml
generated
1583
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartjson',
|
||||
version: '5.0.16',
|
||||
description: 'typed json handlers'
|
||||
version: '5.0.17',
|
||||
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.'
|
||||
}
|
||||
|
15
ts/index.ts
15
ts/index.ts
@ -2,11 +2,26 @@ import * as plugins from './smartjson.plugins.js';
|
||||
import * as bufferhandling from './bufferhandling.js';
|
||||
import { json } from 'stream/consumers';
|
||||
|
||||
interface JsonObject {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* allows you to parse a json
|
||||
*/
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user