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.

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I’m always frustrated when […] About @marblejs/middleware-io, I want validate with regex

Now, I validate which using requestValidator (type), But I have to validate with other pipe function (regexp)

Describe the solution you’d like A clear and concise description of what you want to happen. Add option to validate body parameter with regex

Describe alternatives you’ve considered A clear and concise description of any alternative solutions or features you’ve considered.

import { requestValidator$, t } from '@marblejs/middleware-io'

const registerVaildater$ = requestValidator$({
  body: t.type({
    email: t.regex(new Regexp(something)),
    name:  t.regex(new Regexp(something)),
    password:  t.regex(new Regexp(something)),
    rPassword:  t.regex(new Regexp(something))
  })
});

Additional context Add any other context or screenshots about the feature request here.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
krzysztof-miemieccommented, Apr 27, 2019

As stated in the docs for middleware-io, the middleware is based on io-ts library. You can use https://gcanti.github.io/io-ts-types/modules/regexp.ts.html from io-ts-types which should allow you to do something like:

import { requestValidator$, t } from '@marblejs/middleware-io';
import { regexp } from 'io-ts-types';

const registerVaildator$ = requestValidator$({
  body: t.type({
    email: regexp(new Regexp(something)),
    name:  regexp(new Regexp(something)),
    password:  regexp(new Regexp(something)),
    rPassword:  regexp(new Regexp(something))
  })
});
0reactions
JozefFlakuscommented, Apr 28, 2019

Closing this issue because it is not related to @marblejs/middleware-io package.

Read more comments on GitHub >

github_iconTop Results From Across the Web

regex101: build, test, and debug regex
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
Read more >
RegExr: Learn, Build, & Test RegEx
Regular expression tester with syntax highlighting, PHP / PCRE & JS Support, contextual help, cheat sheet, reference, and searchable community patterns.
Read more >
Regex Tester and Debugger Online - Javascript, PCRE, PHP
Regular Expression Tester with highlighting for Javascript and PCRE. Quickly test and debug your regex.
Read more >
Free Online Regular Expression Tester - FreeFormatter.com
This free regular expression tester lets you test your regular expressions against any entry of your choice and clearly highlights all matches.
Read more >
Debuggex: Online visual regex tester. JavaScript, Python, and ...
Test your regex by visualizing it with a live editor. JavaScript, Python, and PCRE.
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