hapijs / hapijs/joi

add characters to alphanum

Open
#2,810 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
21.2k
Forks
1.5k
Avg merge
4h 57m
Merged PRs (30d)
14

Description

#### Context

```
Yarn Plugin Envinfo

System:
OS: macOS 11.6.6
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 36.38 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.2 - ~/.asdf/installs/nodejs/16.14.2/bin/node
npm: 8.5.0 - ~/.asdf/plugins/nodejs/shims/npm
Monorepos:
Yarn Workspaces: 3.2.1
npmGlobalPackages:
yarn: 1.22.19

└─ @cof/e1-fake-chamber-of-secrets@workspace:packages/fake-chamber-of-secrets
└─ joi@npm:17.6.0 (via npm:^17)
```

#### What problem are you trying to solve?

a simpler replacement for this regular expression. To quote myself? I have a problem, I wrote a regular expression, now I have two problems.

```ts
const paramValidator = Joi.string()
.lowercase()
.regex(/^[a-z0-9_-]+$/)
.required()
```

#### Do you have a new or modified API suggestion to solve the problem?

```ts
const paramValidator = Joi.string()
.lowercase()
.alphaNumPlus('_', '-')
.required()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.