Skip to content

Commit 5e55a05

Browse files
authored
Merge branch 'develop' into polymorph
2 parents bdf9423 + b829396 commit 5e55a05

14 files changed

+2939
-1478
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ language: node_js
22
node_js:
33
- stable
44
- 8
5-
- 6
65

76
after_success:
87
- bash <(curl -s https://codecov.io/bash)

CHANGELOG.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Changelog and release notes
2+
3+
### 0.1.10
4+
5+
#### Fixed
6+
7+
- improve MetadataStorage perf by changing from Arrays to ES6 Maps by @sheiidan
8+
- fixed getAncestor issue with unknown nested properties by @247GradLabs
9+
10+
### 0.1.9
11+
12+
#### Fixed
13+
14+
- objects with `null` prototype are converted properly now
15+
- objects with unknown non primitive properties are converted properly now
16+
- corrected a typo in the README.md
17+
- fixed the deserialize example in the README.md
18+
19+
### 0.1.4
20+
21+
#### Added
22+
23+
- added `TransformClassToPlain` and `TransformClassToClass` decorators
24+
25+
### 0.1.0
26+
27+
#### Added
28+
29+
- renamed library from `constructor-utils` to `class-transformer`
30+
- completely renamed most of names
31+
- renamed all main methods: `plainToConstructor` now is `plainToClass` and `constructorToPlain` is `classToPlain`, etc.
32+
- `plainToConstructorArray` method removed - now `plainToClass` handles it
33+
- `@Skip()` decorator renamed to `@Exclude()`
34+
- added `@Expose` decorator
35+
- added lot of new options: groups, versioning, custom names, etc.
36+
- methods and getters that should be exposed must be decorated with `@Expose` decorator
37+
- added `excludedPrefix` to class transform options that allows exclude properties that start with one of the given prefix
38+
39+
### 0.0.22
40+
41+
#### Fixed
42+
43+
- fixed array with primitive types being converted
44+
45+
### 0.0.18-0.0.21
46+
47+
#### Fixed
48+
49+
- fixed bugs when getters are not converted with es6 target
50+
51+
### 0.0.17
52+
53+
#### Fixed
54+
55+
- fixed issue #4
56+
- added type guessing during transformation from constructor to plain object
57+
- added sample with generics
58+
59+
### 0.0.16
60+
61+
#### Changed
62+
63+
- renamed `constructor-utils/constructor-utils` to `constructor-utils` package namespace
64+
65+
### 0.0.15
66+
67+
#### Removed
68+
69+
- removed code mappings from package
70+
71+
### 0.0.14
72+
73+
#### Removed
74+
75+
- removed `import "reflect-metadata"` from source code. Now reflect metadata should be included like any other shims.
76+
77+
### 0.0.13
78+
79+
#### Changed
80+
81+
- Library has changed its name from `serializer.ts` to `constructor-utils`.
82+
- Added `constructor-utils` namespace.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2015-2016 Umed Khudoiberdiev
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,29 @@ export class Photo {
637637

638638
Library will handle proper transformation automatically.
639639

640+
ES6 collections `Set` and `Map` also require the `@Type` decorator:
641+
642+
```typescript
643+
export class Skill {
644+
name: string;
645+
}
646+
647+
export class Weapon {
648+
name: string;
649+
range: number;
650+
}
651+
652+
export class Player {
653+
name: string;
654+
655+
@Type(() => Skill)
656+
skills: Set<Skill>;
657+
658+
@Type(() => Weapon)
659+
weapons: Map<string, Weapon>;
660+
}
661+
```
662+
640663
## Additional data transformation
641664

642665
### Basic usage
@@ -683,6 +706,7 @@ The `@Transform` decorator is given more arguments to let you configure how you
683706
|--------------------|------------------------------------------|---------------------------------------------|
684707
| `@TransformClassToPlain` | `@TransformClassToPlain({ groups: ["user"] })` | Transform the method return with classToPlain and expose the properties on the class.
685708
| `@TransformClassToClass` | `@TransformClassToClass({ groups: ["user"] })` | Transform the method return with classToClass and expose the properties on the class.
709+
| `@TransformPlainToClass` | `@TransformPlainToClass(User, { groups: ["user"] })` | Transform the method return with plainToClass and expose the properties on the class.
686710

687711
The above decorators accept one optional argument:
688712
ClassTransformOptions - The transform options like groups, version, name
@@ -730,7 +754,7 @@ the exposed variables. email property is also exposed becuase we metioned the gr
730754
## Working with generics
731755

732756
Generics are not supported because TypeScript does not have good reflection abilities yet.
733-
Once TypeScript team provide us better runtime type reelection tools, generics will be implemented.
757+
Once TypeScript team provide us better runtime type reflection tools, generics will be implemented.
734758
There are some tweaks however you can use, that maybe can solve your problem.
735759
[Checkout this example.](https://github.com/pleerock/class-transformer/tree/master/sample/sample4-generics)
736760

doc/release-notes.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)