Skip to content

Commit 1133e00

Browse files
committed
Rename combineErrors to combineErr
1 parent a7c66c0 commit 1133e00

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

  • kotlin-result/src

kotlin-result/src/commonMain/kotlin/com/github/michaelbull/result/Iterable.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ public fun <V, E> Iterable<Result<V, E>>.combine(): Result<List<V>, E> {
417417
* Combines the specified [results] into a single [Result] (holding a [List] of errors). Elements
418418
* in the returned list are in the same order as the specified [results].
419419
*/
420-
public fun <V, E, R : Result<V, E>> combineErrors(vararg results: R): Result<V, List<E>> {
421-
return results.asIterable().combineErrors()
420+
public fun <V, E, R : Result<V, E>> combineErr(vararg results: R): Result<V, List<E>> {
421+
return results.asIterable().combineErr()
422422
}
423423

424424
/**
@@ -429,7 +429,7 @@ public fun <V, E, R : Result<V, E>> combineErrors(vararg results: R): Result<V,
429429
* - If any result [is ok][Result.isOk], returns the first [Ok] encountered.
430430
* - If the iterable is empty, returns [Err] with an empty list.
431431
*/
432-
public fun <V, E> Iterable<Result<V, E>>.combineErrors(): Result<V, List<E>> {
432+
public fun <V, E> Iterable<Result<V, E>>.combineErr(): Result<V, List<E>> {
433433
val errors = map { result ->
434434
when {
435435
result.isErr -> result.error

kotlin-result/src/commonTest/kotlin/com/github/michaelbull/result/IterableTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ class IterableTest {
538538

539539
@Test
540540
fun returnsErrorsIfAllErr() {
541-
val result = combineErrors(
541+
val result = combineErr(
542542
Err(IterableError.IterableError1),
543543
Err(IterableError.IterableError2),
544544
)
@@ -551,7 +551,7 @@ class IterableTest {
551551

552552
@Test
553553
fun returnsFirstOkIfAnyOk() {
554-
val result = combineErrors(
554+
val result = combineErr(
555555
Err(IterableError.IterableError1),
556556
Ok(1),
557557
Err(IterableError.IterableError2),
@@ -567,7 +567,7 @@ class IterableTest {
567567
@Test
568568
fun returnsErrEmptyListIfEmpty() {
569569
val result = emptyList<Result<Int, IterableError>>()
570-
.combineErrors()
570+
.combineErr()
571571

572572
assertEquals(
573573
expected = Err(emptyList()),

0 commit comments

Comments
 (0)