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

ts-jackson

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-jackson - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

9

dist/src/deserialize.d.ts
import 'reflect-metadata';
/**
* Function to deserialize json to Serializable class
*
* @param {Record<string, unknown>} json
* @param serializableClass Class to which json should be serialized
* @param args an arguments to be provided to constructor.
* For example Cat(readonly name, readonly color)
* deserialize({}, Cat, 'Moon', 'black')
*/
export default function deserialize<T, U extends Array<unknown>>(json: Record<string, unknown>, serializableClass: new (...params: [...U]) => T, ...args: U): T;

@@ -0,2 +1,22 @@

/**
* @author Ilias Gazdaliev <invimind@gmail.com>
*/
import 'reflect-metadata';
/**
* JsonProperty params
*
* @param {string} path -- path pattern for the property
* supports every pattern provided by lodash/get|set object
* @param {boolean} required throws an Error if json is missing required property
* @param {Function} type Optional. In most cases there is no need to specify
* type explicitly
* @param {Function} elementType due to reflect-metadata restriction one should
* explicitly set elementType property to correctly serialize/deserialize Array
* or Set values
* @param {Function} validate function for validating json values. Throws an error
* if property fails to pass validate check
* @param {Function} deserialize function for custom deserialization
* @param {Function} serialize function for custom serialization
* @param {Function} afterDeserialize takes deserialized instance and deserialized property. Should return new property value.
*/
declare type Params<P> = {

@@ -17,3 +37,7 @@ path?: string;

} & Params<P>;
/**
* Decorator. Collects annotated property metadata.
* @param {string | Params} arg
*/
export default function JsonProperty<P = unknown>(arg?: Params<P> | string): (object: Object, propertyName: string) => void;
export {};

@@ -0,1 +1,4 @@

/**
* @author Ilias Gazdaliev <invimind@gmail.com>
*/
import 'reflect-metadata';

@@ -6,3 +9,8 @@ declare type Params = {};

} & Params;
/**
* Decorator for marking serializable classes
*
* @returns {Record<string, unknown>} json
*/
export default function Serializable(): (target: new (...params: Array<unknown>) => unknown) => void;
export {};

@@ -0,1 +1,7 @@

/**
* Function to serialize Serializable class to json
*
* @param {Function} instance serializable instance
* @returns {Record<string, unknown>} json
*/
export default function serialize<T extends new (...args: any[]) => unknown>(instance: InstanceType<T>): Record<string, unknown>;

2

package.json
{
"name": "ts-jackson",
"version": "1.2.3",
"version": "1.2.4",
"author": "Ilias Gazdaliev",

@@ -5,0 +5,0 @@ "description": "",

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