format docs

This commit is contained in:
Ruidy 2024-09-08 19:11:52 +02:00
parent bfac048fb4
commit eda818c6e0
No known key found for this signature in database
GPG key ID: E00F51288CB857CC
22 changed files with 143 additions and 137 deletions

View file

@ -9,9 +9,11 @@ title: _Underscore
![underscore](https://socialify.git.ci/rjNemo/underscore/image?description=1&font=KoHo&language=1&logo=https%3A%2F%2Fraw.githubusercontent.com%2FrjNemo%2Funderscore%2Fmain%2Fdocs%2Fstatic%2Flogo.png&owner=1&pattern=Floating%20Cogs&stargazers=1&theme=Dark) ![underscore](https://socialify.git.ci/rjNemo/underscore/image?description=1&font=KoHo&language=1&logo=https%3A%2F%2Fraw.githubusercontent.com%2FrjNemo%2Funderscore%2Fmain%2Fdocs%2Fstatic%2Flogo.png&owner=1&pattern=Floating%20Cogs&stargazers=1&theme=Dark)
`underscore` is a `Go` library providing useful functional programming helpers without extending any built-in objects. `underscore` is a `Go` library providing useful functional programming helpers without
extending any built-in objects.
It is mostly a port from the `underscore.js` library based on generics available from `go1.18`. It is mostly a port from the `underscore.js` library based on generics available
from `go1.18`.
## Quick Start ## Quick Start
@ -21,7 +23,8 @@ Install the library using
go get github.com/rjNemo/underscore go get github.com/rjNemo/underscore
``` ```
Please check out the [examples](https://github.com/rjNemo/underscore/tree/main/examples) to see how to use the library. Please check out the [examples](https://github.com/rjNemo/underscore/tree/main/examples)
to see how to use the library.
```go ```go
package main package main

View file

@ -3,7 +3,6 @@ title: "All"
date: 2021-12-30T13:24:39-04:00 date: 2021-12-30T13:24:39-04:00
--- ---
`All` returns true if all the values in the slice pass the predicate truth test.\ `All` returns true if all the values in the slice pass the predicate truth test.\
Short-circuits and stops traversing the slice if a false element is found. Short-circuits and stops traversing the slice if a false element is found.

View file

@ -22,3 +22,4 @@ func main(){
fmt.Println(u.Intersection(a, b)) // {3, 5} fmt.Println(u.Intersection(a, b)) // {3, 5}
} }
``` ```

View file

@ -3,11 +3,11 @@ title: "NewPipe"
date: 2021-12-31T13:11:41-04:00 date: 2021-12-31T13:11:41-04:00
--- ---
Calling `NewPipe` will cause all future method calls to return wrapped objects.
When you've finished the computation, call `Value` to retrieve the final value.
Calling `NewPipe` will cause all future method calls to return wrapped objects. When you've finished the computation, Methods not returning a collection such as `Reduce`, `All`, `Any`, will break the
call `Value` to retrieve the final value. chain and return `Value` instantly.
Methods not returning a collection such as `Reduce`, `All`, `Any`, will break the chain and return `Value` instantly.
```go ```go
package main package main
@ -29,3 +29,4 @@ func main() {
fmt.Println(sum) // 120 fmt.Println(sum) // 120
} }
``` ```

View file

@ -11,7 +11,8 @@ Install the library using
go get github.com/rjNemo/underscore go get github.com/rjNemo/underscore
``` ```
Please check out the [examples](https://github.com/rjNemo/underscore/tree/main/examples) to see how to use the library. Please check out the [examples](https://github.com/rjNemo/underscore/tree/main/examples)
to see how to use the library.
```go ```go
package main package main
@ -36,13 +37,14 @@ func main() {
## Installation ## Installation
These instructions will get you a copy of the project up and running on your local machine for development and testing These instructions will get you a copy of the project up and running on your local
purposes. machine for development and testing purposes.
### Prerequisites ### Prerequisites
You need at least `go1.18` for development. The project is shipped with You need at least `go1.18` for development. The project is shipped with
a [Dockerfile](https://github.com/rjNemo/underscore/tree/main/Dockerfile) based on `go1.18`. a [Dockerfile](https://github.com/rjNemo/underscore/tree/main/Dockerfile) based
on `go1.18`.
If you prefer local development, navigate to the [official If you prefer local development, navigate to the [official
download page](https://go.dev/dl/) and install version `1.18` or beyond. download page](https://go.dev/dl/) and install version `1.18` or beyond.