mirror of
https://github.com/rjNemo/underscore
synced 2026-06-12 13:36:40 +00:00
format docs
This commit is contained in:
parent
bfac048fb4
commit
eda818c6e0
22 changed files with 143 additions and 137 deletions
|
|
@ -9,9 +9,11 @@ title: _Underscore
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
`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
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,3 +22,4 @@ func main(){
|
||||||
fmt.Println(u.Intersection(a, b)) // {3, 5}
|
fmt.Println(u.Intersection(a, b)) // {3, 5}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue