{"id":16482625,"url":"https://github.com/mfix22/gnt","last_synced_at":"2025-07-04T19:38:08.651Z","repository":{"id":87401644,"uuid":"90557741","full_name":"mfix22/gnt","owner":"mfix22","description":":cocktail: GraphQL Normalized Types","archived":false,"fork":false,"pushed_at":"2018-12-04T22:14:12.000Z","size":290,"stargazers_count":32,"open_issues_count":7,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-03T18:23:25.343Z","etag":null,"topics":["credit-card","drivers-license","graphql","graphql-types","normalization","normalize","phonenumber","scalars","types","us-state","zipcode"],"latest_commit_sha":null,"homepage":"https://mfix22.github.io/gnt","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mfix22.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-05-07T19:51:45.000Z","updated_at":"2020-08-25T21:04:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2d81810-1e4f-4698-9280-05df1a5eaa38","html_url":"https://github.com/mfix22/gnt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mfix22/gnt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfix22%2Fgnt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfix22%2Fgnt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfix22%2Fgnt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfix22%2Fgnt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mfix22","download_url":"https://codeload.github.com/mfix22/gnt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfix22%2Fgnt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263608436,"owners_count":23488016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["credit-card","drivers-license","graphql","graphql-types","normalization","normalize","phonenumber","scalars","types","us-state","zipcode"],"created_at":"2024-10-11T13:11:28.076Z","updated_at":"2025-07-04T19:38:08.637Z","avatar_url":"https://github.com/mfix22.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# *G*raphQL *N*ormalized *T*ypes :cocktail:\nThe **g**in-**n**-**t**onic of GraphQL types: simple, final, clean. Normalize your common data with GraphQL Scalar types.\n\n[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lernajs.io/)\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#contributing)\n## Usage\n```bash\n$ npm install --save gnt\n```\n\nand then add to your schema:\n\n```javascript\nconst { Phone, UnixDate, CreditCard, State, ZipCode, DriversLicense } = require('gnt')\nconst { makeExecutableSchema } = require('graphql-tools');\n\nmakeExecutableSchema({ \n  typeDefs: schemaString, \n  resolvers: {\n    Phone,\n    UnixDate,\n    CreditCard,\n    USState: State,\n    ZipCode,\n    DriversLicense\n  }\n});\n```\n\n## Examples\nEach of these types can be installed individually using there 'Package Name' shown below\n\n| Type           | Package Name     | Input Example     | Output Example    |\n| :------------- | :-------------   | :-------------    | :-------------    |\n| Phone          | `graphql-types-phone`   | `'(817) 569-8900'` | `'+18175698900'` |\n| Zipcode        | `graphql-types-zipcode` | `'55902'`, `00000` | `'55902'`, `null` |\n| UnixDate       | `graphql-types-unix-timestamp` | `2017-05-07T14:47:59.438`, `Date` | `1494186489` |\n| CreditCard     | `graphql-types-credit-card` | `'4111111111111111'` | ```{ number: '4111111111111111', cardType: 'VISA', validCVV: false, validExpiryMonth: false, validExpiryYear: false, isExpired: true }``` |\n| NonEmptyString | `graphql-types-non-empty-string` | `''` | `null`         |\n| Drivers License| `graphql-types-drivers-license` | `{ state: 'CA', license: 'B2347354' }`| `{ state: 'CA', license: 'B2347354' }` OR `null` |\n#### Enum Types\n| Type           | Package Name     | Input Example     |\n| :------------- | :-------------   | :-------------    |\n| USState        | `graphql-types-us-state`    | `US`, `CA`, `DE` `...` |\n\n## Contributing\nContributions are more than welcome! This repo is not meant to be owned by me (and if there is a more suitable owner please [let me know](https://github.com/mfix22/gnt/issues)), but rather by the commuity.\n\n### Creating a new type\nFirst run:\n```shell\n$ npm run generate -- '\u003cyour type name\u003e'\n```\nto get started. A folder with `index.js`, `index.spec.js` (your test), and a `package.json` will be created for you!\nThen run `npm run link` and you should be on your way.\n\nIf you have any idea for new types, please submit an issue or PR!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfix22%2Fgnt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmfix22%2Fgnt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfix22%2Fgnt/lists"}