{"id":16307560,"url":"https://github.com/kfly8/type-equal","last_synced_at":"2025-10-19T23:11:38.555Z","repository":{"id":188143838,"uuid":"678052526","full_name":"kfly8/Type-Equal","owner":"kfly8","description":"type constraints for single value equality","archived":false,"fork":false,"pushed_at":"2024-06-17T14:14:25.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-12T04:16:20.204Z","etag":null,"topics":["perl"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kfly8.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2023-08-13T14:29:34.000Z","updated_at":"2024-06-17T14:14:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"889456ba-2701-485e-8fdb-9a0cb8e2a020","html_url":"https://github.com/kfly8/Type-Equal","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"584a085878cc3814da6e3a6f523767fbf0821867"},"previous_names":["kfly8/type-equal"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfly8%2FType-Equal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfly8%2FType-Equal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfly8%2FType-Equal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfly8%2FType-Equal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kfly8","download_url":"https://codeload.github.com/kfly8/Type-Equal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247410842,"owners_count":20934648,"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":["perl"],"created_at":"2024-10-10T21:14:35.398Z","updated_at":"2025-10-19T23:11:38.441Z","avatar_url":"https://github.com/kfly8.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/kfly8/Type-Equal/actions/workflows/test.yml/badge.svg)](https://github.com/kfly8/Type-Equal/actions) [![Coverage Status](https://img.shields.io/coveralls/kfly8/Type-Equal/main.svg?style=flat)](https://coveralls.io/r/kfly8/Type-Equal?branch=main) [![MetaCPAN Release](https://badge.fury.io/pl/Types-Equal.svg)](https://metacpan.org/release/Types-Equal)\n# NAME\n\nTypes::Equal - type constraints for single value equality\n\n# SYNOPSIS\n\n```perl\nuse Types::Equal qw( Eq Equ );\nuse Types::Standard -types;\nuse Type::Utils qw( match_on_type );\n\n# Check single string equality\nmy $Foo = Eq['foo'];\n$Foo-\u003echeck('foo'); # true\n$Foo-\u003echeck('bar'); # false\n\neval { Eq[undef]; };\nok $@; # dies\n\n\n# Check single string equality with undefined\nmy $Bar = Equ['bar'];\n$Bar-\u003echeck('bar'); # true\n\nmy $Undef = Equ[undef];\n$Undef-\u003echeck(undef);\n\n\n# Can combine with other types\nmy $Baz = Eq['baz'];\nmy $ListBaz = ArrayRef[$Baz];\nmy $Type = $ListBaz | $Baz;\n\n$Type-\u003echeck(['baz']); # true\n$Type-\u003echeck('baz'); # true\n\n# Easily use pattern matching\nmy $Publish = Eq['publish'];\nmy $Draft = Eq['draft'];\n\nmy $post = {\n    status =\u003e 'publish',\n    title =\u003e 'Hello World',\n};\n\nmatch_on_type($post-\u003e{status},\n    $Publish =\u003e sub { \"Publish!\" },\n    $Draft =\u003e sub { \"Draft...\" },\n) # =\u003e Publish!;\n\n\n# Create simple Algebraic Data Types(ADT)\nmy $LoginUser = Dict[\n    _type =\u003e Eq['LoginUser'],\n    id =\u003e Int,\n    name =\u003e Str,\n];\n\nmy $Guest = Dict[\n    _type =\u003e Eq['Guest'],\n    name =\u003e Str,\n];\n\nmy $User = $LoginUser | $Guest;\n\nmy $user = { _type =\u003e 'Guest', name =\u003e 'ken' };\n$User-\u003eassert_valid($user);\n\nmatch_on_type($user,\n    $LoginUser =\u003e sub { \"You are LoginUser!\" },\n    $Guest =\u003e sub { \"You are Guest!\" },\n) # =\u003e 'You are Guest!';\n```\n\n# DESCRIPTION\n\nTypes::Equal provides type constraints for single string equality like TypeScript's string literal types.\n\n## Eq\n\n`Eq` is function of a type constraint [Type::Tiny::Eq](https://metacpan.org/pod/Type%3A%3ATiny%3A%3AEq) which is for single string equality.\n\n## Equ\n\n`Equ` is function of a type constraint [Type::Tiny::Equ](https://metacpan.org/pod/Type%3A%3ATiny%3A%3AEqu) which is for single string equality with undefined.\n\n## NumEq\n\n`NumEq` is function of a type constraint [Type::Tiny::NumEq](https://metacpan.org/pod/Type%3A%3ATiny%3A%3ANumEq) which is for single number equality.\n\n## NumEqu\n\n`NumEqu` is function of a type constraint [Type::Tiny::NumEqu](https://metacpan.org/pod/Type%3A%3ATiny%3A%3ANumEqu) which is for single number equality with undefined.\n\n# LICENSE\n\nCopyright (C) kobaken.\n\nThis library is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself.\n\n# AUTHOR\n\nkobaken \u003ckfly@cpan.org\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfly8%2Ftype-equal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkfly8%2Ftype-equal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfly8%2Ftype-equal/lists"}