graphql-type-regexp2
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

graphql-type-regexp2

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

About

fork from graphql-type-regexp

  1. typescript
  2. breaking change to use /g.*b/ not g.*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:

import GraphQLRegExp from 'graphql-type-regexp2';

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:

Package Sidebar

Install

npm i graphql-type-regexp2

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

12.9 kB

Total Files

12

Last publish

Collaborators

  • bluelovers