New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

seroval

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seroval - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

16

dist/types/index.d.ts
import { Feature } from './compat';
import { Options } from './context';
import { SerovalNode } from './tree/types';
import { AsyncServerValue, PrimitiveValue, ServerValue, CommonServerValue, SemiPrimitiveValue, ErrorValue } from './types';

@@ -8,6 +9,13 @@ export { AsyncServerValue, ServerValue, PrimitiveValue, CommonServerValue, SemiPrimitiveValue, ErrorValue, Feature, };

export declare function deserialize<T extends AsyncServerValue>(source: string): T;
export declare function toJSON<T extends ServerValue>(source: T, options?: Partial<Options>): string;
export declare function toJSONAsync<T extends AsyncServerValue>(source: T, options?: Partial<Options>): Promise<string>;
export declare function compileJSON(source: string): string;
export declare function fromJSON<T extends AsyncServerValue>(source: string): T;
export interface SerovalJSON {
t: SerovalNode;
r: number;
i: boolean;
f: number;
m: number[];
}
export declare function toJSON<T extends ServerValue>(source: T, options?: Partial<Options>): SerovalJSON;
export declare function toJSONAsync<T extends AsyncServerValue>(source: T, options?: Partial<Options>): Promise<SerovalJSON>;
export declare function compileJSON(source: SerovalJSON): string;
export declare function fromJSON<T extends AsyncServerValue>(source: SerovalJSON): T;
export default serialize;
{
"name": "seroval",
"type": "module",
"version": "0.4.0",
"version": "0.4.1",
"files": [

@@ -67,3 +67,3 @@ "dist",

},
"gitHead": "4767da3b4b6397d6830978b6f4d0f014d2115479"
"gitHead": "a3cfb8eae6e1f9a2d2939b03c5ae88fa24c738f8"
}

@@ -142,3 +142,3 @@ # seroval

First example above outputs the following json
First example above outputs the following JSON

@@ -149,3 +149,3 @@ ```js

const result = toJSON(object);
console.log(result);
console.log(JSON.stringify(result));
```

@@ -152,0 +152,0 @@

@@ -96,3 +96,3 @@ /* eslint-disable no-await-in-loop */

interface SerovalJSON {
export interface SerovalJSON {
t: SerovalNode,

@@ -108,6 +108,6 @@ r: number,

options?: Partial<Options>,
) {
): SerovalJSON {
const ctx = createParserContext(options);
const [tree, root, isObject] = parseSync(ctx, source);
return JSON.stringify({
return {
t: tree,

@@ -118,3 +118,3 @@ r: root,

m: Array.from(ctx.markedRefs),
});
};
}

@@ -125,6 +125,6 @@

options?: Partial<Options>,
) {
): Promise<SerovalJSON> {
const ctx = createParserContext(options);
const [tree, root, isObject] = await parseAsync(ctx, source);
return JSON.stringify({
return {
t: tree,

@@ -135,16 +135,15 @@ r: root,

m: Array.from(ctx.markedRefs),
});
};
}
export function compileJSON(source: string): string {
const parsed = JSON.parse(source) as SerovalJSON;
export function compileJSON(source: SerovalJSON): string {
const serial = createSerializationContext({
features: parsed.f,
markedRefs: parsed.m,
features: source.f,
markedRefs: source.m,
});
const result = serializeTree(serial, parsed.t);
return finalize(serial, parsed.r, parsed.i, result);
const result = serializeTree(serial, source.t);
return finalize(serial, source.r, source.i, result);
}
export function fromJSON<T extends AsyncServerValue>(source: string): T {
export function fromJSON<T extends AsyncServerValue>(source: SerovalJSON): T {
return deserialize<T>(compileJSON(source));

@@ -151,0 +150,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc