Socket
Socket
Sign inDemoInstall

@peculiar/json-schema

Package Overview
Dependencies
1
Maintainers
5
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.4 to 1.1.5

18

build/index.js

@@ -467,8 +467,16 @@ 'use strict';

}
const schemaName = options.schema || DEFAULT_SCHEMA;
if (!schema.names[schemaName]) {
schema.names[schemaName] = {};
let schemaNames;
if (Array.isArray(options.schema)) {
schemaNames = options.schema;
}
const namedSchema = schema.names[schemaName];
namedSchema[propertyKey] = copyOptions;
else {
schemaNames = [options.schema || DEFAULT_SCHEMA];
}
for (const schemaName of schemaNames) {
if (!schema.names[schemaName]) {
schema.names[schemaName] = {};
}
const namedSchema = schema.names[schemaName];
namedSchema[propertyKey] = copyOptions;
}
};

@@ -475,0 +483,0 @@

@@ -32,3 +32,3 @@ declare namespace JsonSchema {

*/
schema?: string;
schema?: string | string[];
// string

@@ -35,0 +35,0 @@ /**

{
"name": "@peculiar/json-schema",
"version": "1.1.4",
"version": "1.1.5",
"description": "This package uses ES2015 decorators to simplify JSON schema creation and use",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -35,8 +35,8 @@ # JSON-SCHEMA

```js
import {JsonParser, JsonSerializer, JsonProp, JsonPropTypes} from ("@pv/json-schema");
import { JsonParser, JsonSerializer, JsonProp, JsonPropTypes, IJsonConverter } from "@peculiar/json-schema";
// custom data converter
const JsonBase64Urlonverter: IJsonConverter<Uint8Array, string> = {
parse: (value: string) => base64UrlToBuffer(value),
serialize: (value: Uint8Array) => bufferToBase64Url(value),
const JsonBase64UrlConverter: IJsonConverter<Uint8Array, string> = {
fromJSON: (value: string) => base64UrlToBuffer(value),
toJSON: (value: Uint8Array) => bufferToBase64Url(value),
};

@@ -72,3 +72,3 @@

const ecPubKey = JsonParser.parse(json, EcPublicKey);
const ecPubKey = JsonParser.parse(json, { targetSchema: EcPublicKey });
console.log(ecPubKey);

@@ -78,3 +78,3 @@

const jsonText = JsonSerializer.serialize(ecPubKey, undefined, 2);
const jsonText = JsonSerializer.serialize(ecPubKey, undefined, undefined, 2);
console.log(jsonText);

@@ -126,3 +126,3 @@

const person = JsonParser.parse(json, Person);
const person = JsonParser.parse(json, { targetSchema: Person });
console.log(person);

@@ -134,3 +134,3 @@

const jsonText = JsonSerializer.serialize(person, undefined, 2);
const jsonText = JsonSerializer.serialize(person, undefined, undefined, 2);
console.log(jsonText);

@@ -137,0 +137,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc