Skip to content
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.

kachkaev/graphql-type-regexp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphql-type-regexp

RegExp scalar type for GraphQL.js. Inspired by graphql-type-json.

Usage

In schema:

scalar RegExp

# ...

type Query {
    things(filter: RegExp): [Thing!]
    # ...
  }

In resolvers:

// when using babel
import GraphQLRegExp from 'graphql-type-regexp';

// otherwise
const GraphQLRegExp = require('graphql-type-regexp');

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:

Releases

No releases published

Packages

No packages published