mirror of
https://github.com/rjNemo/underscore
synced 2026-06-07 19:16:47 +00:00
update docs
This commit is contained in:
parent
89da3c715a
commit
593e90dbfb
2 changed files with 25 additions and 3 deletions
|
|
@ -9,9 +9,9 @@ import (
|
|||
)
|
||||
|
||||
func TestDifference(t *testing.T) {
|
||||
a := []int{1, 3, 5, 6, 7, 9}
|
||||
b := []int{9, 7, 5, 4}
|
||||
nums := []int{1, 3, 5, 6, 7, 9}
|
||||
reject := []int{9, 7, 5, 4}
|
||||
want := []int{1, 3, 6}
|
||||
|
||||
assert.Equal(t, want, u.Difference(a, b))
|
||||
assert.Equal(t, want, u.Difference(nums, reject))
|
||||
}
|
||||
|
|
|
|||
22
docs/content/collections/difference.md
Normal file
22
docs/content/collections/difference.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
title: "Difference"
|
||||
date: 2022-03-21T13:48:21-04:00
|
||||
---
|
||||
|
||||
Returns a copy of the array with all instances of the values that are not present in the other arrays.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
u "github.com/rjNemo/underscore"
|
||||
)
|
||||
|
||||
func main() {
|
||||
nums := []int{1, 3, 5, 6, 7, 9}
|
||||
reject := []int{9, 7, 5, 4}
|
||||
|
||||
fmt.Println(u.Difference(nums, reject)) // {1, 3, 6}
|
||||
}
|
||||
```
|
||||
Loading…
Reference in a new issue