Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robstoll committed Jul 13, 2023
1 parent 9bdf74a commit 3c338ac
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
<!-- for main -->

[![Download](https://img.shields.io/badge/Download-0.16.0-%23007ec6)](https://search.maven.org/artifact/ch.tutteli.kbox/kbox/0.16.0/jar)
<!--
[![Download](https://img.shields.io/badge/Download-1.0.0-%23007ec6)](https://search.maven.org/artifact/ch.tutteli.kbox/kbox/1.0.0/jar)
[![Apache license](https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg)](http://opensource.org/licenses/Apache2.0)
[![Build Status Ubuntu](https://github.com/robstoll/kbox/workflows/Ubuntu/badge.svg?event=push)](https://github.com/robstoll/kbox/actions?query=workflow%3AUbuntu+branch%3Amain)
[![Build Status Windows](https://github.com/robstoll/kbox/workflows/Windows/badge.svg?event=push)](https://github.com/robstoll/kbox/actions?query=workflow%3AWindows+branch%3Amain)
[![SonarCloud Status](https://sonarcloud.io/api/project_badges/measure?project=robstoll_kbox&metric=alert_status)](https://sonarcloud.io/dashboard?id=robstoll_kbox)

-->

<!-- for a specific release -->
<!--
[![Download](https://img.shields.io/badge/Download-0.15.1-%23007ec6)](https://search.maven.org/artifact/ch.tutteli.kbox/kbox/0.15.1/jar)

[![Download](https://img.shields.io/badge/Download-1.0.0-%23007ec6)](https://search.maven.org/artifact/ch.tutteli.kbox/kbox/1.0.0/jar)
[![Apache license](https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg)](http://opensource.org/licenses/Apache2.0)
-->


# KBox
KBox is a very small but useful utility library for Kotlin (JVM, Android and JS).

Current extension functions:
- [`Array/List/Iterable/Sequence.appendtoStringBuilder`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/appendToString.kt#L37)
- [`Array/List/Iterable/Sequence.appendtoStringBuilder`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/appendToString.kt#L37)
with the ability to define a different separator for the last separation
=> handy if you want to form sentences like `a, b and c`

- [`CharSequence.blankToNull`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/blanktoNull.kt#L7)
- [`CharSequence.blankToNull`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/blanktoNull.kt#L7)
returns the same `CharSequence` if not blank, `null` otherwise

- [`forEachIn(Array/Iterable/Sequence<E>, Array/Iterable/Sequence<E>, ..., action: (E) -> Unit)`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/forEachIn.kt#L6)
- [`forEachIn(Array/Iterable/Sequence<E>, Array/Iterable/Sequence<E>, ..., action: (E) -> Unit)`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/forEachIn.kt#L6)
applies the given action to each entry in the given `Iterable`s.

- [`<E> forElementAndEachIn(E, Array/Iterable/Sequence<E>, action: (E) -> Unit)`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/forThisAndForEach.kt#L6)
- [`<E> forElementAndEachIn(E, Array/Iterable/Sequence<E>, action: (E) -> Unit)`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/forThisAndForEach.kt#L6)
applies the given action to `this` and each entry in Iterable

- [`Iterable<T>.forEachRemaining()`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/forEachRemaining.kt#L9)
- [`Iterable<T>.forEachRemaining()`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/forEachRemaining.kt#L9)
shortcut for `while(hasNext()) yourLambda(next())`

- [`Array/List.ifWithinBound`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/ifWithinBound.kt#L13)
- [`Array/List.ifWithinBound`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/ifWithinBound.kt#L13)
shortcut for `if(index < size){ thenBlock() } else { elseBlock() }`

- [`CharSequence?.isNotNullAndNotEmpty/isNotNullAndNotBlank`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/isNotNullAndNot.kt#L6)
- [`CharSequence?.isNotNullAndNotEmpty/isNotNullAndNotBlank`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/isNotNullAndNot.kt#L6)

- [`Array/List/Iterable/Sequence.joinToString`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/joinToString.kt#L31)
- [`Array/List/Iterable/Sequence.joinToString`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/joinToString.kt#L31)
with the ability to define a different separator for the last separation
=> handy if you want to form sentences like `a, b and c`

- [`Map<T, T>.mapParents`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/mapParents.kt#L13)
- [`Map<T, T>.mapParents`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/mapParents.kt#L13)
maps child-parent relations.

- [`Iterator<T>.mapRemaining/mapRemainingWithCounter`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/mapRemaining.kt#L9)
- [`Iterator<T>.mapRemaining/mapRemainingWithCounter`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/mapRemaining.kt#L9)
maps remaining entries with the help of a transform function (where `mapRemainingWithCounter` passes a counter variable to the transform function).

- [`Array/Iterable/Sequence.mapWithIndex`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/mapWithIndex.kt#L11)
- [`Array/Iterable/Sequence.mapWithIndex`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/mapWithIndex.kt#L11)

- [`Iterator.toPeekingIterator()`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/PeekingIteratorUnsynchronized.kt)
- [`Iterator.toPeekingIterator()`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/PeekingIteratorUnsynchronized.kt)
which allows to have a look what the next element is without consuming it.

- [`varargsToList/glue`](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/varargToList.kt#L11)
- [`varargsToList/glue`](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/varargToList.kt#L11)
creates a `List` out of a single `E` and an `Array<E>`.

Moreover, the following function might come in handy for you as well:
- [identity](https://github.com/robstoll/kbox/tree/main/src/commonMain/kotlin/ch/tutteli/kbox/identity.kt)
- [identity](https://github.com/robstoll/kbox/tree/v1.0.0/src/commonMain/kotlin/ch/tutteli/kbox/identity.kt)

# Installation

Expand All @@ -66,7 +66,7 @@ KBox is published to maven central.
```
repositories { mavenCentral() }
dependencies {
implementation("ch.tutteli.kbox:kbox-jvm:0.16.0")
implementation("ch.tutteli.kbox:kbox-jvm:1.0.0")
}
```

Expand Down
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ Release & deploy a commit
1. search for X.Y.Z-SNAPSHOT and replace with X.Y.Z
2. update main:
a) point to the tag, search for `tree/main` and replace it with `tree/vX.Y.Z` (README.md)
b) commit (modified .travis.yml, build.gradle, README.md)
b) update badges
c) commit (modified docs/index.md, build.gradle.kts, README.md)
c) git tag vX.Y.Z
d) git push origin vX.Y.Z
4. deploy to bintray:
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Download](https://img.shields.io/badge/Download-0.15.1-%23007ec6)](https://search.maven.org/artifact/ch.tutteli.kbox/kbox/0.15.1/jar)
[![Download](https://img.shields.io/badge/Download-1.0.0-%23007ec6)](https://search.maven.org/artifact/ch.tutteli.kbox/kbox/1.0.0/jar)
[![Apache license](https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg)](http://opensource.org/licenses/Apache2.0)

# KBox
Expand Down

0 comments on commit 3c338ac

Please sign in to comment.