1.0.2 • Published 9 months ago
data-transfer-object-ts v1.0.2
DTO TS
This package provides Data Transfer Object functions. With this package, you can easily convert your data to DTO.
Installation
Using NPM
npm install data-transfer-object-ts
Usage
- Import the components into your project
import NativeDTO from 'data-transfer-object-ts'
- Use functions in your project
const data = { name: 'John', surname: 'Doe', age: 25, address: { city: 'New York', country: 'USA', }, } const encodedData = NativeDTO.encode(data) console.log(encodedData) const decodedData = NativeDTO.decode(encodedData) console.log(decodedData)
Type
Option | Type |
---|---|
payload | { type: string, data?: any} |
API
Option | Type |
---|---|
encode | ( payload: payload ) => string |
decode | ( data: string) => payload |
Contributing
All contributions are welcome. If you would like to contribute to this project, feel free to submit pull requests. Prior to making significant changes, I recommend opening an issue to discuss the changes.
License
This project is licensed under the MIT license. For more information, refer to the LICENSE
file.