Attribute Adapter
Overview
When you work with a typed language like typescript, some times you can need to make some data cast over the result set that comes from a connection or a store. This library implements something like the JPA AttributeConverter solution, using all power given by typescript.
Using
First thing you'll need to implement an AttributeConverter, like this:
; // I don't want to instantiate a Date object each time I receive an attribute with a date value.
Then, now, you need a classe that represents something that comes from anywhere, like a JSON that comes from a server or sessionStorage, any external place where typescript can't garantee the class signature.
;; // This is just a piece of JPA, implemented with vague similarity, so, this is not an @Entity, but just a resultset of wherever that comes from wherever
Instalation
´´´sh npm install attr-adapter ´´´
License
MIT
Free Software, Hell Yeah!