{"id":19513029,"url":"https://github.com/invrs/industry-pattern","last_synced_at":"2026-07-03T05:34:21.873Z","repository":{"id":57273538,"uuid":"56955652","full_name":"invrs/industry-pattern","owner":"invrs","description":null,"archived":false,"fork":false,"pushed_at":"2016-07-03T19:57:10.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-09T04:04:41.889Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/invrs.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":"2016-04-24T05:27:02.000Z","updated_at":"2016-04-24T05:46:07.000Z","dependencies_parsed_at":"2022-09-17T02:23:04.128Z","dependency_job_id":null,"html_url":"https://github.com/invrs/industry-pattern","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/invrs%2Findustry-pattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invrs%2Findustry-pattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invrs%2Findustry-pattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invrs%2Findustry-pattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/invrs","download_url":"https://codeload.github.com/invrs/industry-pattern/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240762308,"owners_count":19853457,"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":[],"created_at":"2024-11-10T23:28:31.961Z","updated_at":"2026-07-03T05:34:16.836Z","avatar_url":"https://github.com/invrs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IndustryPattern [![Build Status](https://travis-ci.org/invrs/industry-pattern.svg?branch=master)](https://travis-ci.org/invrs/industry-pattern)\n\nPattern matching on factory class and instance methods.\n\n## Usage\n\n```js\nimport { factory } from \"industry\"\nimport { functions } from \"industry-functions\"\nimport { instance } from \"industry-instance\"\nimport { pattern } from \"industry-pattern\"\nimport { standard_io } from \"industry-standard-io\"\n\nclass Test {\n  init() {\n    this.pattern({\n      and: { a: Number, b: String, c: \"c\" },\n      or: [\n        { a: Number },\n        { b: 0 },\n        { c: c =\u003e !!c }\n      ]\n    })\n  }\n\n  and({ a, b, c }) { return true }\n  or({ a, b, c }) { return true }\n}\n\nlet test = factory(Test)\n  .set(\"functions\", functions)\n  .set(\"instance\", instance)\n  .set(\"pattern\", pattern)\n  .set(\"standard_io\", standard_io)\n\ntest().and() // { value: undefined }\ntest().and({ a: 0, b: \"b\" }) // { value: undefined }\ntest().and({ a: 0, b: \"b\", c: \"c\" }) // { value: true }\n\ntest().or() // { value: undefined }\ntest().or({ a: 0, b: \"b\" }) // { value: undefined }\ntest().or({ a: 0, b: 0 }) // { value: true }\ntest().and({ c: true }) // { value: true }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvrs%2Findustry-pattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finvrs%2Findustry-pattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvrs%2Findustry-pattern/lists"}