Skip to content

Commit 9319444

Browse files
author
°¬Â×
committed
Release 1.1.2
1 parent ae111eb commit 9319444

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

Diff for: index.d.ts

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'reflect-metadata';
2-
import { IDecoratorMetaData } from './';
32
/**
43
* provide interface to indicate the object is allowed to be traversed
54
*
@@ -8,17 +7,30 @@ import { IDecoratorMetaData } from './';
87
export interface IGenericObject {
98
[key: string]: any;
109
}
10+
/**
11+
* When custom mapping of a property is required.
12+
*
13+
* @interface
14+
*/
15+
export interface ICustomConverter {
16+
fromJson(data: any): any;
17+
toJson(data: any): any;
18+
}
1119
/**
1220
* IDecoratorMetaData<T>
1321
* DecoratorConstraint
1422
*
1523
* @interface
24+
* @property {ICustomConverter} customConverter, will be used for mapping the property, if specified
25+
* @property {boolean} excludeToJson, will exclude the property for serialization, if true
1626
*/
1727
export interface IDecoratorMetaData<T> {
1828
name?: string;
1929
clazz?: {
2030
new (): T;
2131
};
32+
customConverter?: ICustomConverter;
33+
excludeToJson?: boolean;
2234
}
2335
/**
2436
* JsonProperty
@@ -40,3 +52,11 @@ export declare function JsonProperty<T>(metadata?: IDecoratorMetaData<T> | strin
4052
export declare function deserialize<T extends IGenericObject>(Clazz: {
4153
new (): T;
4254
}, json: IGenericObject): T;
55+
/**
56+
* Serialize: Creates a ready-for-json-serialization object from the provided model instance.
57+
* Only @JsonProperty decorated properties in the model instance are processed.
58+
*
59+
* @param instance an instance of a model class
60+
* @returns {any} an object ready to be serialized to JSON
61+
*/
62+
export declare function serialize(instance: any): any;

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-typescript-mapper",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"typescript": {
55
"definition": "index.d.ts"
66
},

0 commit comments

Comments
 (0)