convert types (string, num) for seeding prisma, source data is inconsistent
Unanswered
Northeast Congo Lion posted this in #help-forum
Northeast Congo LionOP
This is just an example of my data I'm preparing for seeding through prisma. I have quite a large set of data, and I have inconsistent types across the fields, which I'm trying to convert before sending.
const products = [
{
title: 'product 1',
price: '$55.00',
sku: 45,
weight: 2.0
},
{
title: 'product 2',
price: '$55.00',
sku: 'bnst',
weight: '3'
}
]
const fixedProducts = products.map((p) => {
p.title.toString(),
p.price.toString(),
p.sku.toString(),
Number(p.weight)
})
return fixedProducts