express-java-monetary-amount-deserializer
v1.0.6
Published
A express middleware module for deserializing Javas MonetaryAmount object
Downloads
3
Readme
express-java-monetary-amount-deserializer
A express middleware module for deserializing Javas MonetaryAmount object
Usage
import deserializeMonetary from 'express-java-monetary-amount-deserializer'
let app = express()
app.use(deserializeMonetary)
Example flat
Input
{
sum: "GBP 100.00"
}
Output:
{
sum: {
amount: 100
currency: "GBP"
}
}
Example nested
Input
{
goods_list: [
{
title: "item 1",
price: "EUR 10.50",
},
{
title: "item 2",
price: "EUR 25.99",
}
]
}
Output:
{
goods_list: [
{
title: "item 1",
price: {
amount: 10.5,
currency: "EUR"
}
},
{
title: "item 2",
price: {
amount: 25.99,
currency: "EUR"
}
}
]
}