Skip to content
Merged

Npm #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/
coverage/
3 changes: 3 additions & 0 deletions dist/examples/json/data.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Zoo } from '../models/zoo';
export declare const data: any;
export declare const deserializedData: Zoo;
9 changes: 9 additions & 0 deletions dist/examples/models/animal.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export declare class Animal {
id: number;
name: string;
birthdate: Date;
numberOfPaws: number;
gender: string;
childrenIds: Array<number>;
constructor();
}
8 changes: 8 additions & 0 deletions dist/examples/models/employee.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export declare class Employee {
id: number;
name: string;
birthdate: Date;
email: string;
gender: string;
constructor();
}
5 changes: 5 additions & 0 deletions dist/examples/models/gender.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare enum Gender {
female = 0,
male = 1,
other = 2,
}
6 changes: 6 additions & 0 deletions dist/examples/models/panther.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Animal } from './animal';
export declare class Panther extends Animal {
color: string;
isSpeckled: boolean;
constructor();
}
5 changes: 5 additions & 0 deletions dist/examples/models/snake.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Animal } from './animal';
export declare class Snake extends Animal {
isPoisonous: boolean;
constructor();
}
13 changes: 13 additions & 0 deletions dist/examples/models/zoo.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Employee } from './employee';
import { Panther } from './panther';
export declare class Zoo {
boss: Employee;
city: string;
country: string;
employees: Array<Employee>;
id: number;
name: string;
panthers: Array<Panther>;
isOpen: boolean;
constructor();
}
1 change: 1 addition & 0 deletions dist/spec/index.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'reflect-metadata';
20 changes: 20 additions & 0 deletions dist/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'reflect-metadata';
/**
* Decorator JsonProperty
*/
export declare function JsonProperty(args?: string | {
name?: string;
type: Function;
}): Function;
/**
* Decorator Serializable
*/
export declare function Serializable(parentType?: string): Function;
/**
* Function to deserialize json into a class
*/
export declare function deserialize(json: any, type: any): any;
/**
* Function to serialize a class into json
*/
export declare function serialize(instance: any, removeUndefined?: boolean): any;
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "typescript-json-serializer",
"version": "1.0.0",
"version": "1.0.1",
"description": "Typescript library to serialize classes into json and deserialize json into classes.",
"main": "src/index.ts",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"scripts": {
"build": "tsc",
"test": "npm run build && mocha -r ts-node/register dist/spec/**/*.spec.js",
Expand All @@ -18,6 +19,14 @@
"url": "https://github.com/GillianPerard/typescript-json-serializer/issues"
},
"homepage": "https://github.com/GillianPerard/typescript-json-serializer#readme",
"keywords": [
"json",
"typescript",
"serializer",
"deserializer",
"decorator",
"metadata"
],
"dependencies": {
"lodash": "^4.17.5",
"reflect-metadata": "^0.1.12"
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "./dist",
"sourceMap": false,
"declaration": false,
"declaration": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
Expand Down