{"id":15111284,"url":"https://github.com/ouattararomuald/numbering-plan","last_synced_at":"2025-10-30T15:03:24.522Z","repository":{"id":55396472,"uuid":"283610213","full_name":"ouattararomuald/numbering-plan","owner":"ouattararomuald","description":"numbering plan","archived":false,"fork":false,"pushed_at":"2021-01-03T07:58:58.000Z","size":144,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-30T23:40:26.581Z","etag":null,"topics":["android","digits","kotlin","numbering-plan","phone-number"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ouattararomuald.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-29T21:56:42.000Z","updated_at":"2021-05-30T15:40:41.000Z","dependencies_parsed_at":"2022-08-14T23:20:37.784Z","dependency_job_id":null,"html_url":"https://github.com/ouattararomuald/numbering-plan","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouattararomuald%2Fnumbering-plan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouattararomuald%2Fnumbering-plan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouattararomuald%2Fnumbering-plan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouattararomuald%2Fnumbering-plan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ouattararomuald","download_url":"https://codeload.github.com/ouattararomuald/numbering-plan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239816513,"owners_count":19701753,"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":["android","digits","kotlin","numbering-plan","phone-number"],"created_at":"2024-09-26T00:03:02.502Z","updated_at":"2025-10-30T15:03:19.484Z","avatar_url":"https://github.com/ouattararomuald.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/ouattararomuald/numbering-plan/tree/master.svg?style=shield)](https://circleci.com/gh/ouattararomuald/numbering-plan/tree/master)\n[![](https://img.shields.io/badge/code--style-square-green.svg)](https://github.com/square/java-code-styles)\n[![](https://img.shields.io/maven-central/v/com.ouattararomuald/numbering.svg)](https://search.maven.org/search?q=g:com.ouattararomuald%20a:numbering)\n[![](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.ouattararomuald/numbering.svg)](https://oss.sonatype.org/content/repositories/snapshots/)\n\n# numbering-plan\n\nThis library helps you migrate exiting phone numbers format to new phone number formats.\n\n## Usage\n\nFirst you start by defining the migration rules for you country\n\n```kotlin\nval ivoryCoastPlanFactory: CountryPlan = CountryPlan.Builder()\n    .setOldPhoneNumberSize(8)\n    .setInternationalCallingCode(\"225\")\n    .setDigitMapperPosition(Position.START) // Position.END\n    .setMigrationType(MigrationType.PREFIX) // MigrationType.POSTFIX\n    .setPrefixesMapper(\n      mapOf(\n        \"07\" to \"07\", // Orange\n        \"08\" to \"07\", // eg: 08 XX XX XX =\u003e 07 08 XX XX XX (if MigrationType.prefix is used) =\u003e 08 XX XX XX 07 (if MigrationType.postfix is used)\n        \"09\" to \"07\",\n        \"04\" to \"05\", // MTN\n        \"05\" to \"05\",\n        \"06\" to \"05\",\n        \"01\" to \"01\", // MOOV\n        \"02\" to \"01\",\n        \"03\" to \"01\"\n      )\n    ).build()\n```\n\nThen you pass those rules to `NumberingPlan` and you can start the migration:\n\n```kotlin\nval ivoryCoastPlanFactory: CountryPlan = ...\nval numberingPlan = NumberingPlan(ivoryCoastPlanFactory)\nval newPhoneNumbers = numberingPlan.migrate(mapOf(\n  \"userId-1\" to listOf(\"08060709\"),\n  \"userId-2\" to listOf(\"06060709\"),\n  \"userId-6\" to listOf(\"zezae/03-060-701\", \"01020304\"),\n  \"userId-3\" to listOf(\"03060701\"),\n  \"userId-4\" to listOf(\" 03 060 701 \"),\n  \"userId-5\" to listOf(\" 03-060-701\"),\n  \"userId-7\" to listOf(\")'.03-060-701\")\n))\n```\n\nAfter the migration `newPhoneNumbers` will be equal to:\n\n```kotlin\nmapOf(\n  \"userId-1\" to listOf(\"002250708060709\"),\n  \"userId-2\" to listOf(\"002250506060709\"),\n  \"userId-6\" to listOf(\"\", \"002250101020304\"),\n  \"userId-3\" to listOf(\"002250103060701\"),\n  \"userId-4\" to listOf(\"002250103060701\"),\n  \"userId-5\" to listOf(\"002250103060701\"),\n  \"userId-7\" to listOf(\"\")\n)\n```\n\nInvalid phone numbers are replaced by empty string.\n\n## Download\n\nDownload the [latest JAR](https://search.maven.org/search?q=g:com.ouattararomuald%20AND%20a:numbering) or grab via Gradle:\n\n```groovy\nimplementation 'com.ouattararomuald:numbering:2.0.1'\n```\n\nor Maven:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.ouattararomuald\u003c/groupId\u003e\n  \u003cartifactId\u003enumbering\u003c/artifactId\u003e\n  \u003cversion\u003e2.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nSnapshots of the development version are available in [Sonatype's snapshots repository](https://oss.sonatype.org/content/repositories/snapshots/).\n\n## Known limitations\n\n- [x] Migrates only valid phone numbers.\n- [x] Can add new digits before or after the old phone number. We decided to not handle in between insertions.\n- [x] Can only look for digits to replace at the start, or the end of old phone numbers. We think this shouldn’t be a problem (generally) but as of now we decided to not handle such cases.\n- [x] It is synchronous. This is a choice that will let you pick the any library you want to handle async tasks.\n\n## Contributing\n\nContributions you say? Yes please!\n\n**Bug report?**\n\nIf at all possible, please attach a minimal sample project or code which reproduces the bug.\nScreenshots are also a huge help if the problem is visual.\n\n**Send a pull request!**\n\nIf you're fixing a bug, please add a failing test or code that can reproduce the issue.\n\n## License\n\n```\nCopyright 2020 Ouattara Gninlikpoho Romuald\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouattararomuald%2Fnumbering-plan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fouattararomuald%2Fnumbering-plan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouattararomuald%2Fnumbering-plan/lists"}