kotools / libraries

Multiplatform libraries for expressive programming with Kotlin.
https://kotools.github.io/libraries
MIT License
0 stars 0 forks source link
assert assertion-library assertions csv kotlin kotlin-js kotlin-jvm kotlin-jvm-utilities kotlin-library kotlin-multiplatform kotlin-multiplatform-library kotlin-native types

> This project is not maintained anymore.

Please find the libraries in their respective repository.

Kotools

[![Kotlin](https://img.shields.io/badge/kotlin-1.5.31-blue.svg?logo=kotlin)][kotlin] [![Kotools Assert](https://img.shields.io/maven-central/v/io.github.kotools/assert?color=CD6B54&label=assert)](https://search.maven.org/artifact/io.github.kotools/assert) [![Kotools CSV](https://img.shields.io/maven-central/v/io.github.kotools/csv?color=CD6B54&label=csv)](https://search.maven.org/artifact/io.github.kotools/csv) [![Kotools Types](https://img.shields.io/maven-central/v/io.github.kotools/types?color=CD6B54&label=types)](https://search.maven.org/artifact/io.github.kotools/types)

This project contains a set of libraries providing tools for expressive programming in Kotlin.

Libraries

Kotools Types

Versions 1, 2 and 3 are not maintained anymore. Please find the new one in this repository.

Kotools Types provides explicit types like NonZeroInt or NotBlankString for the following platforms: JVM, JS, Linux x64, macOS x64 and Windows x64.

import kotools.types.number.StrictlyPositiveInt
import kotools.types.number.toStrictlyPositiveInt
import kotools.types.text.NotBlankString
import kotools.types.text.toNotBlankString

data class Person(val name: NotBlankString, val age: StrictlyPositiveInt)

fun main() {
    val name: NotBlankString = "Somebody".toNotBlankString()
        .getOrThrow()
    val age: StrictlyPositiveInt = 42.toStrictlyPositiveInt()
        .getOrThrow()
    val somebody = Person(name, age)
    println(somebody) // Person(name=Somebody, age=42)
}

Kotools CSV

Kotools CSV is a JVM library for managing CSV files an expressive DSL.

data class Person(val name: String, val age: Int, val isAdmin: Boolean = false)

suspend fun main() {
    csvWriter<Person> {
        file = "people"
        records { +Person("Nobody", 25) }
    }
    val people: List<Person> = csvReader { file = "people" }
    println(people)
}

Kotools Assert

Kotools Assert provides additional assertions for the following platforms: JVM, JS, Linux x64, macOS x64 and Windows x64.

1 assertEquals 1
2 assertNotEquals 0

assertNull { null }
null.assertNull()

assertNotNull { 3 }
3.assertNotNull()

assertPass { println("Hello") }
assertFails { throw Exception() }
assertFailsWith<RuntimeException> { throw RuntimeException() }

Installation

Gradle

Kotlin DSL

implementation("io.github.kotools:csv:2.2.1")
implementation("io.github.kotools:types:3.2.0")
testImplementation("io.github.kotools:assert:3.0.2")

Groovy DSL

implementation "io.github.kotools:csv:2.2.1"
implementation "io.github.kotools:types:3.2.0"
testImplementation "io.github.kotools:assert:3.0.2"

Maven

<dependencies>
    <dependency>
        <groupId>io.github.kotools</groupId>
        <artifactId>csv</artifactId>
        <version>2.2.1</version>
    </dependency>
    <dependency>
        <groupId>io.github.kotools</groupId>
        <artifactId>types</artifactId>
        <version>3.2.0</version>
    </dependency>
    <dependency>
        <groupId>io.github.kotools</groupId>
        <artifactId>assert</artifactId>
        <version>3.0.2</version>
        <scope>test</scope>
    </dependency>
</dependencies>

Documentation

Latest documentation of those libraries is available here.

Contributing

Feel free to contribute to this project with issues and pull requests.

This project follows the Conventional Commits guidelines for committing with Git. Please read the specifications before committing to this project.

License

All libraries are licensed under the MIT License.