Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
Express Validator: si existe para una matriz anidada de objetos
{ "orderId": "3", "storeId": "1", "products": [ "productId": "123", { "prescriptions" : [{ "eye": "1", "sph": "1", "cyl": "1", "add": "1", "axis": "1" }], "lensItems": { "lensId": "1", "lensType": "1", "lensCoating": "1", "index": "1", "price": "3000" }, "frameSize": { "a": "1", "b": "1", "ed": "1", "fh": "1", "d": "2" }, "counterSale": false } ] }

Quiero verificar las prescripciones solo si existe lensItems .

he probado esto,

 body('products.*.prescriptions') .if(body('products.*.lensItems').exists()) .exists() .withMessage('prescriptions not exists') .isArray() .withMessage('prescriptions is not an array') .notEmpty() .withMessage('prescriptions is empty'),

Está funcionando cuando verifico con string como la siguiente,

 body('products.*.prescriptions') .if(body('products.*.productId').exists()) .exists() .withMessage('prescriptions not exists') .isArray() .withMessage('prescriptions is not an array') .notEmpty() .withMessage('prescriptions is empty'),

Quiero comparar la matriz de objeto con objeto . Si tiene más información sobre esto, por favor comente, le compartiré mucha información que sea posible. Gracias por adelantado

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!