graphql-type-regexp2
RegExp scalar type for GraphQL.js.
Inspired by graphql-type-json
.
About
fork from graphql-type-regexp
- typescript
- breaking change to use
/g.*b/
notg.*b
, this will allow use flags
Install
yarn add graphql-type-regexp2
Usage
In schema:
scalar RegExp # ... type Query { things(filter: RegExp): [Thing!] # ... }
In resolvers:
;
In queries / mutations:
query { profiles(filter: "/g.*b/") { id }}
The resolver will receive new RegExp("g.*b")
, which is the same as /g.*b/
(will match github
and gitlab
).
Example: