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.

Custom attribute replacements for custom rules

See original GitHub issue

It would be nice to have custom replacements for a custom rule using the Validator.register() function.

Ex.:

Validator.register(
    'dateBetween',  
    function (value, requirement) {
        // custom validation using dates
    },
    function (parameters) {
        return {
            min: parameters[0],
            max: parameters[1],
        });
    },
    'Custom message for attribute :attribute with replacements :min and :max.',
);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:11
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mikeericksoncommented, Aug 24, 2020

This feature was added in v3.19

1reaction
rennerDacommented, May 31, 2019

https://github.com/anwr-group/validatorjs/blob/master/spec/register.js In this fork you can add custom replacements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Example of Defining Set Attribute Value Rules for Custom ...
This topic explains how to define a survivorship rule of the type Set Attribute Value to select the smallest value for a specific...
Read more >
Custom rule attributes
A custom rule attribute represents a specific piece of information that you can attach to a rule that doesn't fit into existing rule...
Read more >
Custom attributes in Exchange Server
Summary: Learn to use the custom attributes in Exchange Server 2016 or Exchange Server 2019 to add information about a mail recipient.
Read more >
Using Business Rules to update custom attributes
Business Rules make it easier than ever to update a custom attribute based upon a trigger, like a keyword on an incoming email....
Read more >
How to set up office 365 custom attributes & use them in ...
How to set up custom attributes in Office 365 · Log in to your Office 365 tenant and click the Admin app. ·...
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