{"id":21314985,"url":"https://github.com/elbow-jason/izz-ts","last_synced_at":"2025-03-15T21:24:32.697Z","repository":{"id":57278912,"uuid":"94504350","full_name":"elbow-jason/izz-ts","owner":"elbow-jason","description":"An easy-to-use TypeScript type guard utility library.","archived":false,"fork":false,"pushed_at":"2017-06-22T00:58:55.000Z","size":296,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T15:06:35.430Z","etag":null,"topics":["io","typeguard","types","typescript","validation"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elbow-jason.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-16T04:13:47.000Z","updated_at":"2017-06-21T21:07:30.000Z","dependencies_parsed_at":"2022-09-11T18:12:18.007Z","dependency_job_id":null,"html_url":"https://github.com/elbow-jason/izz-ts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elbow-jason%2Fizz-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elbow-jason%2Fizz-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elbow-jason%2Fizz-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elbow-jason%2Fizz-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elbow-jason","download_url":"https://codeload.github.com/elbow-jason/izz-ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243791136,"owners_count":20348423,"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":["io","typeguard","types","typescript","validation"],"created_at":"2024-11-21T18:17:00.977Z","updated_at":"2025-03-15T21:24:32.665Z","avatar_url":"https://github.com/elbow-jason.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/elbow-jason/izz-ts.svg?branch=master)](https://travis-ci.org/elbow-jason/izz-ts)\n\n# izz-ts \nA TypeScript Guard Type Checker\n\n## Install\n\n`npm install --save izz-ts`\n\n## Example\n\n### Code\n\n```typescript\nimport * as izz from 'izz-ts'\n\nexport class Sale {\n  key:                       string = ''\n  completing_party_name:     string = ''\n  completing_party_address:  string = ''\n  completing_party_phone:    string = ''\n  down_payment:     (null | number) = null\n  sale_price:       (null | number) = null\n\n  static paramsValidator = izz.object({\n    key:                       izz.string,\n    completing_party_name:     izz.string,\n    completing_party_address:  izz.string,\n    completing_party_phone:    izz.string,\n    sale_price:                izz.number,\n    down_payment:              izz.number,\n  })\n\n  static isValidJSON(data: any): data is Sale {\n    return Sale.paramsValidator.isValid(data)\n  }\n\n  static fromJSON(data: any): (Sale | never) {\n    if (Sale.isValidJSON(data)) {\n      return new Sale(data)\n    } else {\n      let val = new izz.DataValidator('SaleJSON', Sale.paramsValidator, data)\n      console.groupCollapsed('Invalid Sale JSON')\n      console.log('data', data)\n      console.log('errors', val.errors)\n      console.groupEnd()\n      throw new Error(`Invalid Sale JSON`)\n    }\n  }\n\n  constructor(params: (Sale | null) = null) {\n    if (params) {\n      this.key                      = params.key\n      this.completing_party_name    = params.completing_party_name\n      this.completing_party_address = params.completing_party_address\n      this.completing_party_phone   = params.completing_party_phone\n      this.sale_price               = params.sale_price\n      this.down_payment             = params.down_payment\n    }\n  }\n}\n```\n\n### Logged Invalid Data\n\n![sale_errors.png](images/sale_errors.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felbow-jason%2Fizz-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felbow-jason%2Fizz-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felbow-jason%2Fizz-ts/lists"}