question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to callback return rules

See original GitHub issue

hi, is not available to return as a rule in a callback.

how do I do that

export const rules = () => {
  return [
    check('firstname', i18n.t('characters.2', { field: 'Firstname' })).isLength({ min: 2 }),
    check('lastname', i18n.t('characters.2', { field: 'Lastname' })).isLength({ min: 2 })
  ]
}

...

router.put('/:id', rules, controller.update)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
gustavohenkecommented, Feb 13, 2018

Hello @mattandrews @carvalhoviniciusluiz this is now possible express-validator v5.0.0. Check this section of the docs for more information on how to do it.

0reactions
lock[bot]commented, May 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

array-callback-return - ESLint - Pluggable JavaScript Linter
Rule Details. This rule enforces usage of return statement in callbacks of array's methods. Additionally, it may also enforce the forEach array method...
Read more >
How to satisfy the lint rules 'array-callback-return'?
If I use forEach instead of map , it will not cause the array-callback-return lint error. Object.keys(planLimits).
Read more >
Rule array-callback-return - ESLint - Pluggable JavaScript linter
This rule enforces usage of return statement in callbacks of array's methods. Rule Details. This rule finds callback functions of the following methods,...
Read more >
Callbacks of array methods should have return statements
If there is no return, callback will implicitly return undefined , which will likely fail. This rule applies for the following methods of...
Read more >
Everything About Callback Functions in JavaScript
The callback is a function that's accepted as an argument and executed by another function (the higher-order function). There are 2 kinds of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found