{"id":36596515,"url":"https://github.com/opengood-aio/kotlin-commons","last_synced_at":"2026-01-12T08:30:04.181Z","repository":{"id":43493162,"uuid":"321470437","full_name":"opengood-aio/kotlin-commons","owner":"opengood-aio","description":"Commons library containing reusable functions, extensions, and objects for Kotlin","archived":false,"fork":false,"pushed_at":"2025-05-27T22:40:03.000Z","size":302,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-22T07:51:34.001Z","etag":null,"topics":["library","protected-branches-true","update-copyright-current-year"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opengood-aio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-14T20:54:34.000Z","updated_at":"2025-05-27T22:40:04.000Z","dependencies_parsed_at":"2023-11-23T02:31:40.858Z","dependency_job_id":"faf20ba7-1d02-4b96-9f21-15eb9e7585fc","html_url":"https://github.com/opengood-aio/kotlin-commons","commit_stats":null,"previous_names":["opengood-aio/kotlin-commons","opengoodio/kotlin-commons"],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/opengood-aio/kotlin-commons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengood-aio%2Fkotlin-commons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengood-aio%2Fkotlin-commons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengood-aio%2Fkotlin-commons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengood-aio%2Fkotlin-commons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opengood-aio","download_url":"https://codeload.github.com/opengood-aio/kotlin-commons/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengood-aio%2Fkotlin-commons/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28337595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["library","protected-branches-true","update-copyright-current-year"],"created_at":"2026-01-12T08:30:04.078Z","updated_at":"2026-01-12T08:30:04.168Z","avatar_url":"https://github.com/opengood-aio.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kotlin Commons Library\n\n[![Build](https://github.com/opengood-aio/kotlin-commons/workflows/build/badge.svg)](https://github.com/opengood-aio/kotlin-commons/actions?query=workflow%3Abuild)\n[![Release](https://github.com/opengood-aio/kotlin-commons/workflows/release/badge.svg)](https://github.com/opengood-aio/kotlin-commons/actions?query=workflow%3Arelease)\n[![CodeQL](https://github.com/opengood-aio/kotlin-commons/actions/workflows/codeql.yml/badge.svg)](https://github.com/opengood-aio/kotlin-commons/actions/workflows/codeql.yml)\n[![Codecov](https://codecov.io/gh/opengood-aio/kotlin-commons/branch/main/graph/badge.svg?token=AEEYTGK87F)](https://codecov.io/gh/opengood-aio/kotlin-commons)\n[![Release Version](https://img.shields.io/github/release/opengood-aio/kotlin-commons.svg)](https://github.com/opengood-aio/kotlin-commons/releases/latest)\n[![Maven Central](https://img.shields.io/maven-central/v/io.opengood.commons/kotlin-commons.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22io.opengood.commons%22%20AND%20a:%22kotlin-commons%22)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/opengood-aio/kotlin-commons/master/LICENSE)\n\nCommons library containing reusable functions, extensions, and objects\nfor Kotlin\n\n## Compatibility\n\n* Java 21\n* Spring Boot 3\n\n## Setup\n\n### Add Dependency\n\n#### Gradle\n\n```groovy\nimplementation(\"io.opengood.commons:kotlin-commons:VERSION\")\n```\n\n#### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.opengood.commons\u003c/groupId\u003e\n    \u003cartifactId\u003ekotlin-commons\u003c/artifactId\u003e\n    \u003cversion\u003eVERSION\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n**Note:** See *Release* version badge above for latest version.\n\n## Features\n\n### Annotations\n\n#### NoArg\n\n* Automatically generate no argument constructor on data class:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.annotation.NoArg\n    \n    @NoArg\n    data class Greeting(\n        val name: String\n    )\n    ```\n\n    Add configuration to `build.gradle.kts`:\n\n    ```kotlin\n    noArg {\n        annotation(\"io.opengood.commons.kotlin.annotation.NoArg\")\n        invokeInitializers = true\n    }\n    ```\n  \n---\n\n### Extensions\n\n#### Methods\n\n##### Array\n\n###### printAll\n\n* Print all arguments in an array:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.printAll\n    \n    arrayOf(\"foo\", \"bar\").printAll()\n    ```\n\n---\n\n##### BigDecimal\n\n###### roundUp\n\n* Rounds decimal value half up to specified scale:\n\n  Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.roundUp\n    \n    BigDecimal(12.346).roundUp(2)\n    ```\n\n---\n\n##### List\n\n###### containsIgnoreCase\n\n* Case-insensitive string contained in list:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.containsIgnoreCase\n    \n    listOf(\"foo\", \"bar\").containsIgnoreCase(\"foo\")\n    ```\n\n###### sortAscending\n\n* Sorts list of map keys in ascending order:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.sortAscending\n    \n    val list = listOf(\n        mapOf(\n            \"foo\" to \"bar\",\n            \"baz\" to \"pas\"\n        ),\n        mapOf(\n            \"foo\" to \"par\",\n            \"baz\" to \"taz\"\n        )\n    )\n\n    list.sortAscending(\"baz\")\n    ```\n\n###### sortDescending\n\n* Sorts list of map keys in descending order:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.sortDescending\n    \n    val list = listOf(\n        mapOf(\n            \"baz\" to \"pas\",\n            \"foo\" to \"bar\"\n        ),\n        mapOf(\n            \"baz\" to \"taz\",\n            \"foo\" to \"par\"\n        )\n    )\n\n    list.sortDescending(\"baz\")\n    ```\n\n---\n\n##### Map\n\n###### containsMultipleListItems\n\n* Map entry contains more than one value in list:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.containsMultipleListItems\n    \n    mapOf(\"foo\" to listOf(\"bar\", \"baz\")).containsMultipleListItems(\"foo\")\n    ```\n\n###### keyByIndex\n\n* Gets map key by index\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.keyByIndex\n    \n    val map = mapOf(\"foo\" to \"bar\")\n    map.keyByIndex(0)\n    ```\n\n###### notContainsKey\n\n* Key not contained in map:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.notContainsKey\n    \n    emptyMap\u003cString, String\u003e().notContainsKey(\"foo\")\n    ```\n\n###### notContainsValue\n\n* Value not contained in map:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.notContainsValue\n    \n    emptyMap\u003cString, String\u003e().notContainsValue(\"foo\")\n    ```\n\n###### putIfNotAbsent\n\n* Puts an entry into a map if it does not exist:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.putIfNotAbsent\n    import io.opengood.commons.kotlin.function.makeEntry\n    \n    val map = mutableMapOf\u003cString, String\u003e()\n    val entry = makeEntry(\"foo\", \"bar\")\n    map.putIfNotAbsent(entry)\n    ```\n\n###### valueByIndex\n\n* Gets map value by index\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.valueByIndex\n    \n    val map = mapOf(\"foo\" to \"bar\")\n    map.valueByIndex(0)\n    ```\n\n---\n\n##### Pair\n\n###### toEntry\n\n* Convert `Pair` to map entry:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.toEntry\n    \n    Pair(\"foo\", \"bar\").toEntry()\n    ```\n\n---\n\n##### String\n\n###### capitalizeWord\n\n* Capitalize word in a string:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.capitalizeWord\n    \n    \"hello\".capitalizeWord()\n    ```\n\n###### capitalizeWords\n\n* Capitalize all words in a string:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.capitalizeWords\n    \n    \"hello world!\".capitalizeWords()\n    ```\n\n###### containsIgnoreCase\n\n* Case-insensitive substring contained in string:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.containsIgnoreCase\n    \n    \"Hello World!\".containsIgnoreCase(\"HELLO\")\n    ```\n\n###### equalsIgnoreCase\n\n* Case-insensitive string equals substring:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.equalsIgnoreCase\n    \n    \"Hello World!\".equalsIgnoreCase(\"HELLO WORLD!\")\n    ```\n\n###### isBoolean\n\n* Value indicating if string is boolean:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.isBoolean\n    \n    \"true\".isBoolean()\n    ```\n\n###### isInt\n\n* Value indicating if string is integer:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.isInt\n    \n    \"12345\".isInt()\n    ```\n\n###### isUuid\n\n* Value indicating if string is UUIS:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.isUuid\n    \n    \"12102e90-2918-4578-a9a1-bb16ac81d8f8\".isUuid()\n    ```\n\n###### toIntOrZero\n\n* Value indicating if string is integer, if so then value as integer,\nand if not, then value is zero:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.extension.method.toIntOrZero\n    \n    \"12345\".toIntOrZero()\n    ```\n\n---\n\n#### Properties\n\n##### Decimal\n\n| Property | Description           | Value         |\n|----------|-----------------------|---------------|\n| `zero`   | BigDecimal zero value | BigDecimal(0) |\n\nExample:\n\n```kotlin\nimport io.opengood.commons.kotlin.extension.property.*\n\nDecimal.zero\n```\n\n---\n\n##### String\n\n| Property          | Description               | Value  |\n|-------------------|---------------------------|--------|\n| `carriageReturn`  | Carrier return            | `\\r`   |\n| `comma`           | Comma                     | `,`    |\n| `crlf`            | Carriage return/line feed | `\\n\\r` |\n| `empty`           | Empty string              |        |\n| `equalsSign`      | Equals sign               | `=`    |\n| `greaterThanSign` | Greater than sign         | `\u003e`    |\n| `lessThanSign`    | Less than sign            | `\u003c`    |\n| `newline`         | Newline                   | `\\n`   |\n| `pipe`            | Pipe                      | `\\     |\n| `tab`             | Tab                       | `\\t`   |\n| `whitespace`      | Whitespace                |        |\n\nExample:\n\n```kotlin\nimport io.opengood.commons.kotlin.extension.property.*\n\nString.carriageReturn\nString.comma\nString.crlf\nString.empty\nString.equalsSign\nString.greaterThanSign\nString.lessThanSign\nString.newline\nString.pipe\nString.tab\nString.whitespace\n```\n\n---\n\n##### UUID\n\n| Property | Description | Value        |\n|----------|-------------|--------------|\n| `empty`  | Empty UUID  | UUID(0L, 0L) |\n\nExample:\n\n```kotlin\nimport io.opengood.commons.kotlin.extension.property.*\n\nUuid.empty\n```\n\n---\n\n### Functions\n\n#### I/O\n\n##### captureStdOut\n\n* Captures standard output of specified function:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.function.captureStdOut\n    \n    val output = captureStdOut { print(\"foo\") }\n    ```\n\n---\n\n#### Map\n\n##### makeEntry\n\n* Creates a map entry using specified key and value:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.function.makeEntry\n    \n    makeEntry(\"foo\", \"bar\")\n    ```\n  \n---\n\n### Infix Functions\n\n#### Boolean\n\n##### then\n\n* Shorthand ternary function for evaluating simple conditions then\nreturning simple results:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.infix.then\n    \n    val condition = 1\n    val result = (condition == 1) then { true } ?: false\n    ```\n\n---\n\n#### Generic Type\n\n##### firstOrDefault\n\n* Gets value of specified object, if not null, otherwise, gets specified\ndefault value:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.infix.firstOrDefault\n    \n    \"foo\" firstOrDefault \"bar\"\n    ```\n\n---\n\n#### Integer\n\n##### isDivFactorOf\n\n* Gets value indicating if specified integer is divisible by a factor\nof specified value:\n\n    Example:\n\n    ```kotlin\n    import io.opengood.commons.kotlin.infix.isDivFactorOf\n    \n    10 isDivFactorOf 5\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopengood-aio%2Fkotlin-commons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopengood-aio%2Fkotlin-commons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopengood-aio%2Fkotlin-commons/lists"}