{"id":21765985,"url":"https://github.com/narazaka/miyojs-filter-conditions","last_synced_at":"2026-07-11T11:32:20.260Z","repository":{"id":21773933,"uuid":"25096224","full_name":"Narazaka/miyojs-filter-conditions","owner":"Narazaka","description":"conditions - easy conditions filter for Miyo","archived":false,"fork":false,"pushed_at":"2014-10-14T15:39:42.000Z","size":132,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-19T10:04:50.646Z","etag":null,"topics":["miyojs","ukagaka"],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","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/Narazaka.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":"2014-10-11T21:36:23.000Z","updated_at":"2023-10-16T15:44:32.000Z","dependencies_parsed_at":"2022-08-19T16:50:44.747Z","dependency_job_id":null,"html_url":"https://github.com/Narazaka/miyojs-filter-conditions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Narazaka/miyojs-filter-conditions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narazaka%2Fmiyojs-filter-conditions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narazaka%2Fmiyojs-filter-conditions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narazaka%2Fmiyojs-filter-conditions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narazaka%2Fmiyojs-filter-conditions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Narazaka","download_url":"https://codeload.github.com/Narazaka/miyojs-filter-conditions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narazaka%2Fmiyojs-filter-conditions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267613438,"owners_count":24115626,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["miyojs","ukagaka"],"created_at":"2024-11-26T13:14:38.993Z","updated_at":"2025-10-28T05:32:57.935Z","avatar_url":"https://github.com/Narazaka.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"conditions - 条件分岐\r\n========================================\r\n\r\nこれはなにか\r\n----------------------------------------\r\n\r\nこれは伺か用SHIORIサブシステムである美代(Miyo)の辞書フィルタプラグインです。\r\n\r\nいわゆるswitch文を提供します。\r\n\r\nインストール\r\n----------------------------------------\r\n\r\n### 一般\r\n\r\n    npm install miyojs-filter-conditions\r\n\r\n### ゴーストに追加する場合\r\n\r\nghost/masterをカレントディレクトリとして同様に\r\n\r\n    npm install miyojs-filter-conditions\r\n\r\n含まれるフィルタ\r\n----------------------------------------\r\n\r\n### conditions\r\n\r\nいわゆるswitch文を提供します。\r\n\r\n依存\r\n----------------------------------------\r\n\r\nこのフィルタは以下に依存します。\r\n\r\n- [miyojs-filter-property](https://github.com/Narazaka/miyojs-filter-property.git)\r\n\r\npropertyを読み込んだ上でproperty_initializeを一回実行した後で利用できます。\r\n\r\n    _load:\r\n    \tfilters: [..., property_initialize, ...]\r\n\r\n使用方法\r\n----------------------------------------\r\n\r\nMiyoのYAML辞書ファイルのエントリにフィルタを追加します。\r\n\r\n    OnTest:\r\n    \tfilters: [conditions]\r\n    \targument:\r\n    \t\tconditions:\r\n    \t\t\t-\r\n    \t\t\t\twhen.jse: this.variables.hoge == 1\r\n    \t\t\t\tdo:\r\n    \t\t\t\t\t- \\h\\s[0]hoge = 1\\e\r\n    \t\t\t\t\t- \\h\\s[0]hoge = 1!\\e\r\n    \t\t\t-\r\n    \t\t\t\twhen.coffee: @variables.hoge == 2\r\n    \t\t\t\tdo:\r\n    \t\t\t\t\tfilters: [conditions]\r\n    \t\t\t\t\targument:\r\n    \t\t\t\t\t\t...\r\n\r\nargument.conditionsを使います。\r\n\r\nconditionsは配列で、それぞれの要素のwhenを評価し、真ならdoをエントリ内容として実行します。\r\n\r\nwhenはpropertyフィルタによる効果でwhen.[handler]という名前にするとコードとして評価することが出来ます。\r\n\r\nbreakのいらないswitch文のように、要素は順番どおりに評価され、最初に真となった要素のみが使われます。\r\n\r\nwhenのない要素は常に真と評価されるので、switch文のdefaultのように使うことが出来ます。\r\n\r\ndo内はエントリのトップレベル(たとえばOnTest:の直下)と同じように実行されます。\r\nなので通常の発話等をおいたり、さらにfilterをかけることも可能です。\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarazaka%2Fmiyojs-filter-conditions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnarazaka%2Fmiyojs-filter-conditions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarazaka%2Fmiyojs-filter-conditions/lists"}