Compare commits

...

6 Commits

Author SHA1 Message Date
606ff73f58 5.0.2 2022-09-13 21:37:42 +02:00
7ea17c792d fix(core): update 2022-09-13 21:37:42 +02:00
4478b7588a 5.0.1 2022-06-26 11:20:39 +02:00
9bac6e5809 fix(core): update 2022-06-26 11:20:39 +02:00
cbc7e4ebce 5.0.0 2022-06-09 19:55:12 +02:00
097f54a74c BREAKING CHANGE(core): update 2022-06-09 19:55:12 +02:00
9 changed files with 4451 additions and 1832 deletions

4
.snyk
View File

@ -1,4 +0,0 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.3
ignore: {}
patch: {}

6210
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartjson",
"version": "4.0.7",
"version": "5.0.2",
"private": false,
"description": "typed json handlers",
"main": "dist_ts/index.js",
@ -21,17 +21,17 @@
},
"homepage": "https://gitlab.com/pushrocks/smartjson#README",
"devDependencies": {
"@gitzone/tsbuild": "^2.1.63",
"@gitzone/tsrun": "^1.2.35",
"@gitzone/tstest": "^1.0.71",
"@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^17.0.41",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
"@gitzone/tsbuild": "^2.1.65",
"@gitzone/tsrun": "^1.2.37",
"@gitzone/tstest": "^1.0.73",
"@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^18.7.17"
},
"dependencies": {
"@pushrocks/smartstring": "^4.0.5",
"@types/buffer-json": "^2.0.1",
"@types/fast-json-stable-stringify": "^2.1.0",
"@types/lodash.clonedeep": "^4.5.7",
"buffer-json": "^2.0.0",
"fast-json-stable-stringify": "^2.1.0",
"lodash.clonedeep": "^4.5.0"

View File

@ -40,4 +40,16 @@ tap.test('should products stable jsons', async () => {
console.log(jsonString);
});
tap.test('should work with base64', async() => {
const someObject = {
hi: 'there',
thisIs: 'awesome',
};
const base64Json = smartjson.stringifyBase64(someObject);
console.log(base64Json);
const decodedObject = smartjson.parseBase64(base64Json);
expect(decodedObject).toEqual(someObject);
})
tap.start();

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartjson',
version: '4.0.7',
version: '5.0.2',
description: 'typed json handlers'
}

View File

@ -21,6 +21,18 @@ export const stringify = (
return returnJson;
};
export const stringifyBase64 = (...args: Parameters<typeof stringify>): string => {
const stringifiedResult = stringify(...args);
return plugins.smartstring.base64.encodeUri(stringifiedResult);
}
export const parseBase64 = (base64JsonStringArg: string) => {
const simpleStringified = plugins.smartstring.base64.decode(base64JsonStringArg);
return parse(simpleStringified);
}
parse
export class Smartjson {
/**
* enfolds data from an object

View File

@ -1,3 +1,10 @@
// @pushrocks scope
import * as smartstring from '@pushrocks/smartstring';
export {
smartstring
}
// third party scope
import lodashCloneDeep from 'lodash.clonedeep';
import stableJson2 from 'fast-json-stable-stringify';

View File

@ -4,6 +4,7 @@
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext"
"moduleResolution": "nodenext",
"esModuleInterop": true
}
}

View File

@ -1,17 +0,0 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}