From 470adbe45b68024593035159d7b6dde4e7d1f3ac Mon Sep 17 00:00:00 2001 From: Samuel Berthe Date: Fri, 9 Dec 2022 15:59:20 +0100 Subject: [PATCH] doc: add PartialX to readme --- CHANGELOG.md | 5 +++++ README.md | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1cf93c7..ce203060 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ @samber: I sometimes forget to update this file. Ping me on [Twitter](https://twitter.com/samuelberthe) or open an issue in case of error. We need to keep a clear changelog for easier lib upgrade. +## 1.37.0 (2022-12-xx) + +Adding: +- lo.PartialX + ## 1.36.0 (2022-11-28) Adding: diff --git a/README.md b/README.md index 775211c0..a35fc496 100644 --- a/README.md +++ b/README.md @@ -226,6 +226,7 @@ Type manipulation helpers: Function helpers: - [Partial](#partial) +- [Partial2 -> Partial5](#partial2---partial5) Concurrency helpers: @@ -2274,6 +2275,21 @@ f(42) // 47 ``` +### Partial2 -> Partial5 + +Returns new function that, when called, has its first argument set to the provided value. + +```go +add := func(x, y, z int) int { return x + y + z } +f := lo.Partial2(add, 42) + +f(10, 5) +// 57 + +f(42, -4) +// 80 +``` + ### Attempt Invokes a function N times until it returns valid output. Returning either the caught error or nil. When first argument is less than `1`, the function runs until a successful response is returned.