{"id":30058919,"url":"https://github.com/solnic/drops_inflector","last_synced_at":"2025-08-08T00:37:43.401Z","repository":{"id":305153632,"uuid":"1021913151","full_name":"solnic/drops_inflector","owner":"solnic","description":"Inflection utils for Elixir","archived":false,"fork":false,"pushed_at":"2025-07-30T07:32:15.000Z","size":53,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-03T15:15:48.826Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/solnic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"github":"solnic"}},"created_at":"2025-07-18T06:35:28.000Z","updated_at":"2025-07-30T07:32:11.000Z","dependencies_parsed_at":"2025-07-18T17:01:36.751Z","dependency_job_id":null,"html_url":"https://github.com/solnic/drops_inflector","commit_stats":null,"previous_names":["solnic/drops_inflector"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/solnic/drops_inflector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solnic%2Fdrops_inflector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solnic%2Fdrops_inflector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solnic%2Fdrops_inflector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solnic%2Fdrops_inflector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solnic","download_url":"https://codeload.github.com/solnic/drops_inflector/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solnic%2Fdrops_inflector/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269347823,"owners_count":24401863,"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-08-07T02:00:09.698Z","response_time":73,"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":[],"created_at":"2025-08-08T00:37:39.827Z","updated_at":"2025-08-08T00:37:43.381Z","avatar_url":"https://github.com/solnic.png","language":"Elixir","funding_links":["https://github.com/sponsors/solnic"],"categories":[],"sub_categories":[],"readme":"# Elixir Drops 💦\n\n## Inflector\n\n[![CI](https://github.com/solnic/drops/actions/workflows/ci.yml/badge.svg)](https://github.com/solnic/drops_inflector/actions/workflows/ci.yml) [![Hex pm](https://img.shields.io/hexpm/v/drops_inflector.svg?style=flat)](https://hex.pm/packages/drops_inflector) [![hex.pm downloads](https://img.shields.io/hexpm/dt/drops_inflector.svg?style=flat)](https://hex.pm/packages/drops_inflector)\n\n\nInflection utils for Elixir.\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:drops_inflector, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Links\n\n- [Documentation](https://hexdocs.pm/drops_inflector)\n\n## Basic Usage\n\nThe `Drops.Inflector` module provides a comprehensive set of string inflection functions:\n\n```elixir\n# Pluralization and singularization\nDrops.Inflector.pluralize(\"book\")        # =\u003e \"books\"\nDrops.Inflector.pluralize(\"person\")      # =\u003e \"people\"\nDrops.Inflector.singularize(\"books\")     # =\u003e \"book\"\nDrops.Inflector.singularize(\"children\")  # =\u003e \"child\"\n\n# Case transformations\nDrops.Inflector.camelize(\"data_mapper\")        # =\u003e \"DataMapper\"\nDrops.Inflector.camelize_lower(\"data_mapper\")  # =\u003e \"dataMapper\"\nDrops.Inflector.underscore(\"DataMapper\")       # =\u003e \"data_mapper\"\nDrops.Inflector.dasherize(\"drops_inflector\")   # =\u003e \"drops-inflector\"\n\n# Human-friendly transformations\nDrops.Inflector.humanize(\"drops_inflector\")  # =\u003e \"Drops inflector\"\nDrops.Inflector.humanize(\"author_id\")        # =\u003e \"Author\"\n\n# Database and class name transformations\nDrops.Inflector.tableize(\"User\")           # =\u003e \"users\"\nDrops.Inflector.classify(\"admin_users\")    # =\u003e \"AdminUser\"\nDrops.Inflector.foreign_key(\"Message\")     # =\u003e \"message_id\"\n\n# Module operations\nDrops.Inflector.demodulize(\"Drops.Inflector\")  # =\u003e \"Inflector\"\nDrops.Inflector.modulize(\"String\")             # =\u003e String\n\n# Number ordinalization\nDrops.Inflector.ordinalize(1)   # =\u003e \"1st\"\nDrops.Inflector.ordinalize(22)  # =\u003e \"22nd\"\nDrops.Inflector.ordinalize(103) # =\u003e \"103rd\"\n\n# Check if a word is uncountable\nDrops.Inflector.uncountable?(\"money\")       # =\u003e true\nDrops.Inflector.uncountable?(\"information\") # =\u003e true\nDrops.Inflector.uncountable?(\"book\")        # =\u003e false\n```\n\n## Custom Inflectors\n\nYou can create custom inflector modules with specific rules using the `use` macro. Custom rules take precedence over default rules:\n\n```elixir\ndefmodule MyInflector do\n  use Drops.Inflector,\n    plural: [\n      {\"virus\", \"viruses\"},\n      {\"octopus\", \"octopi\"}\n    ],\n    singular: [\n      {\"thieves\", \"thief\"},\n      {\"octopi\", \"octopus\"}\n    ],\n    uncountable: [\n      \"equipment\",\n      \"software\"\n    ],\n    acronyms: [\n      \"API\",\n      \"XML\",\n      \"HTML\"\n    ]\nend\n\n# Use your custom inflector\nMyInflector.pluralize(\"virus\")     # =\u003e \"viruses\"\nMyInflector.singularize(\"thieves\") # =\u003e \"thief\"\nMyInflector.uncountable?(\"equipment\") # =\u003e true\n\n# Acronyms are properly handled in camelization\nMyInflector.camelize(\"api_access\")     # =\u003e \"APIAccess\"\nMyInflector.camelize_lower(\"xml_data\") # =\u003e \"xmlData\"\n\n# All other functions work the same way\nMyInflector.camelize(\"data_mapper\")    # =\u003e \"DataMapper\"\nMyInflector.tableize(\"User\")           # =\u003e \"users\"\n```\n\n### Acronym Support\n\nDrops.Inflector includes built-in support for common acronyms like API, JSON, HTTP, etc. You can also define custom acronyms that will be properly handled during camelization:\n\n```elixir\ndefmodule APIInflector do\n  use Drops.Inflector,\n    acronyms: [\"API\", \"XML\", \"HTML\", \"CSS\"]\nend\n\nAPIInflector.camelize(\"api_access\")        # =\u003e \"APIAccess\"\nAPIInflector.camelize(\"xml_http_request\")  # =\u003e \"XMLHTTPRequest\"\nAPIInflector.camelize_lower(\"html_css\")    # =\u003e \"htmlCSS\"\n```\n\nThe default inflector already includes these acronyms: API, CSRF, CSV, DB, HMAC, HTTP, JSON, OpenSSL.\n\n### Multiple Custom Inflectors\n\nYou can create multiple inflectors with different rules:\n\n```elixir\ndefmodule MedicalInflector do\n  use Drops.Inflector,\n    plural: [\n      {\"virus\", \"viruses\"},\n      {\"bacterium\", \"bacteria\"}\n    ]\nend\n\ndefmodule TechInflector do\n  use Drops.Inflector,\n    plural: [\n      {\"server\", \"servers\"},\n      {\"database\", \"databases\"}\n    ],\n    uncountable: [\n      \"software\",\n      \"hardware\"\n    ]\nend\n\nMedicalInflector.pluralize(\"virus\")    # =\u003e \"viruses\"\nTechInflector.pluralize(\"server\")      # =\u003e \"servers\"\nTechInflector.uncountable?(\"software\") # =\u003e true\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolnic%2Fdrops_inflector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolnic%2Fdrops_inflector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolnic%2Fdrops_inflector/lists"}