File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Editor configuration, see http://editorconfig.org
2
+ root = true
3
+
4
+ [* ]
5
+ charset = utf-8
6
+ indent_style = space
7
+ indent_size = 4
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
Original file line number Diff line number Diff line change
1
+ import "reflect-metadata" ;
2
+ import { defaultMetadataStorage } from "../../src/storage" ;
3
+ import { Transform } from "../../src/decorators" ;
4
+ import { classToPlain } from "../../src/index" ;
5
+ import moment = require( "moment" ) ;
6
+ import Moment = moment . Moment ;
7
+
8
+ describe ( "basic functionality" , ( ) => {
9
+
10
+ it ( "should not throw error" , ( ) => {
11
+ defaultMetadataStorage . clear ( ) ;
12
+
13
+ class User {
14
+ // As in https://github.com/gempain/class-transformer#additional-data-transformation
15
+ @Transform ( value => moment ( value ) , { toClassOnly : true } )
16
+ created : Moment ;
17
+ }
18
+
19
+ const user = new User ( ) ;
20
+ user . created = moment ( ) ;
21
+
22
+ const o = classToPlain ( user ) ;
23
+
24
+ o . should . not . be . undefined ;
25
+
26
+ } ) ;
27
+
28
+ } ) ;
You can’t perform that action at this time.
0 commit comments