From b02ff75d7e056bc7e77de628055fc7015973ea1d Mon Sep 17 00:00:00 2001 From: Chau Tran Date: Mon, 10 Feb 2020 14:11:54 -0600 Subject: [PATCH] docs(readme.md): update docs regarding class-transformer removal --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2b9ff56a2..e3f6a6216 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,9 @@ npm install --save reflect-metadata yarn add reflect-metadata ``` -`@nartc/automapper` depends on `class-transformer` so `class-transformer` will also be installed automatically. I'll try to keep the dependency up-to-date so that when I update `@nartc/automapper`, all the dependencies are up-to-date as well. +~~`@nartc/automapper` depends on `class-transformer` so `class-transformer` will also be installed automatically. I'll try to keep the dependency up-to-date so that when I update `@nartc/automapper`, all the dependencies are up-to-date as well.~~ + +`@nartc/automapper` uses an internal solution for keeping track of `class metadata`. Hence, it is no longer dependant on `class-transformer` #### Lodash Note @@ -340,9 +342,11 @@ class FooVm { } ``` -Internally, `@nartc/automapper` uses `class-transformer's plainToClass` to initialize the models and do so recursively for nested models. However, `moment` doesn't have a constructor like any other model +~~Internally, `@nartc/automapper` uses `class-transformer's plainToClass` to initialize the models and do so recursively for nested models. However, `moment` doesn't have a constructor like any other model and I cannot intelligently tell an `Object` is a `Moment` object without pulling in the `moment` library. Passing in the `typeFn` does not do anything but by-pass initialization for those `moment` fields. -Again, apply mapping manually would be the best way to go about this. +Again, apply mapping manually would be the best way to go about this.~~ + +Although, `moment` object should be initialized properly now but for mapping `moment` to different type, you might want to add a mapping config manually. ```typescript Mapper.createMap(Foo, FooVm).forMember(