Skip to content

Commit

Permalink
1.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Jun 2, 2017
1 parent b91ca75 commit 9c59eb7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-express-decorators",
"version": "1.4.5",
"version": "1.4.6",
"description": "Use TypeScript decorators to create your Express application and Rest API",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
3 changes: 1 addition & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from "./utils";
export * from "./class";
export * from "./utils";
24 changes: 23 additions & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
import {getClassName} from "./class";
/**
* Get the class name.
* @param targetClass
*/
export const getClassName = (targetClass: any) => {

if (typeof targetClass === "symbol") {
return targetClass.toString();
}

return typeof targetClass === "function"
? targetClass.name
: targetClass.constructor.name;
};

/**
* Get the class constructor.
* @param targetClass
*/
export const getContructor = (targetClass: any): Function =>
typeof targetClass === "function"
? targetClass
: targetClass.constructor;
/**
* Get the class constructor if target is an instance.
* @param target
Expand Down
10 changes: 5 additions & 5 deletions test/helper/models/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

import {JsonProperty} from '../../../src/decorators/method/json-property';

export class Task {
public name: string = void 0;
public percent: number;
}

export class EventModel {

@JsonProperty()
Expand All @@ -17,8 +22,3 @@ export class EventModel {
public tasks: Task[];

}

export class Task {
public name: string = void 0;
public percent: number;
}

0 comments on commit 9c59eb7

Please sign in to comment.