+ "html": "<h1><em>G</em>raphQL <em>N</em>ormalized <em>T</em>ypes :cocktail:</h1>\n<p>The <strong>g</strong>in-<strong>n</strong>-<strong>t</strong>onic of GraphQL types: simple, final, clean. Normalize your common data with GraphQL Scalar types.</p>\n<p><a href=\"https://github.com/facebook/jest\"><img src=\"https://img.shields.io/badge/tested_with-jest-99424f.svg\"></a>\n<a href=\"https://lernajs.io/\"><img src=\"https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg\"></a>\n<a href=\"#contributing\"><img src=\"https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat\"></a></p>\n<h2>Usage</h2>\n<pre>$ npm install --save gnt</pre><p>and then add to your schema:</p>\n<pre><span class=\"hljs-keyword\">const</span> { Phone, UnixDate, CreditCard, State, ZipCode, DriversLicense } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'gnt'</span>)\n<span class=\"hljs-keyword\">const</span> { makeExecutableSchema } = <span class=\"hljs-built_in\">require</span>(<span class=\"hljs-string\">'graphql-tools'</span>);\n\nmakeExecutableSchema({ \n <span class=\"hljs-attr\">typeDefs</span>: schemaString, \n <span class=\"hljs-attr\">resolvers</span>: {\n Phone,\n UnixDate,\n CreditCard,\n <span class=\"hljs-attr\">USState</span>: State,\n ZipCode,\n DriversLicense\n }\n});</pre><h2>Examples</h2>\n<p>Each of these types can be installed individually using there 'Package Name' shown below</p>\n<table>\n<thead>\n<tr>\n<th>Type</th>\n<th>Package Name</th>\n<th>Input Example</th>\n<th>Output Example</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Phone</td>\n<td><code>graphql-types-phone</code></td>\n<td><code>'(817) 569-8900'</code></td>\n<td><code>'+18175698900'</code></td>\n</tr>\n<tr>\n<td>Zipcode</td>\n<td><code>graphql-types-zipcode</code></td>\n<td><code>'55902'</code>, <code>00000</code></td>\n<td><code>'55902'</code>, <code>null</code></td>\n</tr>\n<tr>\n<td>UnixDate</td>\n<td><code>graphql-types-unix-timestamp</code></td>\n<td><code>2017-05-07T14:47:59.438</code>, <code>Date</code></td>\n<td><code>1494186489</code></td>\n</tr>\n<tr>\n<td>CreditCard</td>\n<td><code>graphql-types-credit-card</code></td>\n<td><code>'4111111111111111'</code></td>\n<td><code>{ number: '4111111111111111', cardType: 'VISA', validCVV: false, validExpiryMonth: false, validExpiryYear: false, isExpired: true }</code></td>\n</tr>\n<tr>\n<td>NonEmptyString</td>\n<td><code>graphql-types-non-empty-string</code></td>\n<td><code>''</code></td>\n<td><code>null</code></td>\n</tr>\n<tr>\n<td>Drivers License</td>\n<td><code>graphql-types-drivers-license</code></td>\n<td><code>{ state: 'CA', license: 'B2347354' }</code></td>\n<td><code>{ state: 'CA', license: 'B2347354' }</code> OR <code>null</code></td>\n</tr>\n</tbody>\n</table>\n<h4>Enum Types</h4>\n<table>\n<thead>\n<tr>\n<th>Type</th>\n<th>Package Name</th>\n<th>Input Example</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>USState</td>\n<td><code>graphql-types-us-state</code></td>\n<td><code>US</code>, <code>CA</code>, <code>DE</code> <code>...</code></td>\n</tr>\n</tbody>\n</table>\n<h2>Contributing</h2>\n<p>Contributions are more than welcome! This repo is not meant to be owned by me (and if there is a more suitable owner please <a href=\"https://github.com/mfix22/gnt/issues\">let me know</a>), but rather by the commuity.</p>\n<h3>Creating a new type</h3>\n<p>First run:</p>\n<pre>$ npm run generate -- '<your type name>'</pre><p>to get started. A folder with <code>index.js</code>, <code>index.spec.js</code> (your test), and a <code>package.json</code> will be created for you!\nThen run <code>npm run link</code> and you should be on your way.</p>\n<p>If you have any idea for new types, please submit an issue or PR!</p>\n"
0 commit comments