Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update content README.md #114

Merged
merged 1 commit into from
Aug 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ There are some examples about go-dash. You can find all function about: array, c

<h3>godash.filter</h3>
The function returns the new filtered slice and an error if any occurs.
<br>

```go
filter([]int{1, 2, 3, 4}, func(n int) bool {
return n%2 == 0
Expand All @@ -63,7 +63,7 @@ filter([]*User{{Name: "Kakalot", Age: 26}, {Name: "Vegeta", Age: 27}, {Name: "Tr

<h3>godash.find</h3>
The function returns the found element and a boolean indicating whether a match was found, or an error if any occurs.
<br>

```go
find([]int{1, 2, 3, 4}, func(n int) bool {
return n%2 == 0
Expand All @@ -76,7 +76,7 @@ find([]*User{{Name: "Kakalot", Age: 26}, {Name: "Vegeta", Age: 27}, {Name: "Trun

<h3>godash.chunk</h3>
The function returns a slice of slices, where each inner slice contains elements from the original array.
<br>

```go
chunk([]int{1, 2, 3}, 1) // [][]int{{1}, {2}, {3}}
chunk([]string{"a", "b", "c", "d"}, 3) // [][]string{{"a", "b", "c"}, {"d"}}
Expand All @@ -85,23 +85,23 @@ chunk([]interface{}{1, "2", true}, 1) // [][]interface{}{{1}, {"2"}, {true}}

<h3>godash.intersection</h3>
The function accepts two arrays (slices) and returns a new array with the intersection of unique elements.
<br>

```go
intersection([]int{1, 2, 3}, []int{1}) // []int{1}
intersection([]string{"1.1", "2.2", "3.3"}, []string{"1.1", "3.3"}) // []string{"1.1", "3.3"}
```

<h3>godash.difference</h3>
It returns the index of the first occurrence of the value in the array. If the value is not found, the function returns -1.
<br>

```go
difference([]int{2, 1}, []int{2, 3}) // []int{1}
difference([]string{"2", "1", "2", "2", "5"}, []string{"2", "3"}) // []string{"1", "5"}
```

<h3>godash.indexOf</h3>
The function returns the new slice of different elements and an error if any occurs.
<br>

```go
indexOf([]string{"1", "2", "b", "3", "c", "b"}, "b", 2) // 2
indexOf([]interface{}{1.1, "2.2", 3.3}, 2.2, 0) // -1
Expand All @@ -110,7 +110,7 @@ indexOf([]float32{1.1, 2.2, 3.3}, float32(2.2), -6) // 1

<h3>godash.every</h3>
The function returns true if all elements satisfy the condition, false otherwise, or an error if any occurs.
<br>

```go
every([]int{1, 2, 3, 4}, func(n int) bool {
return n%2 == 0
Expand All @@ -127,7 +127,7 @@ every([]*User{{Name: "Kakalot", Age: 26}, {Name: "Vegeta", Age: 27}, {Name: "Tru

<h3>godash.partition</h3>
The function returns two new slices: one containing elements that satisfy the predicate, and the other containing elements that do not satisfy the predicate.
<br>

```go
partition([]int{1, 2, 3, 4}, func(n int) bool {
return n%2 == 0
Expand All @@ -140,7 +140,7 @@ partition([]string{"a", "b", "c"}, func(n string) bool {

<h3>godash.drop</h3>
The function returns a new array with the specified number of elements removed from the beginning.
<br>

```go
drop([]int{1, 2, 3}, 2) // []int{3}
drop([]string{"1", "2", "3"}, 2) // []string{"3"}
Expand All @@ -149,7 +149,7 @@ drop([]interface{}{1, "2", true}, 2) // []interface{}{true}

<h3>godash.initial</h3>
initial returns a new array (slice) containing all elements of the input array except the last one.
<br>

```go
initial([]int{1, 2, 3}) // []int{1, 2}
initial([]string{"a", "b", "c"}) // []string{"a", "b"}
Expand All @@ -158,7 +158,7 @@ initial([]interface{}{"true", 1, 1.1, true, int32(123), false, true}) // []inter

<h3>godash.tail</h3>
The function returns the new slice and an error if any occurs.
<br>

```go
tail([]int{1, 2, 3, 3, 2, 1}) // []int{2, 3, 3, 2, 1}
tail([]string{"1.1", "2.2", "3.3", "3.3", "2.2", "1.1"}) // []string{"2.2", "3.3", "3.3", "2.2", "1.1"}
Expand All @@ -167,7 +167,7 @@ tail([]interface{}{false, "true", true, 1, 2.2}) // []interface{}{"true", true,

<h3>godash.reverse</h3>
The function returns the modified array and an error if any occurs.
<br>

```go
reverse([]int{1, 2, 3}) // []int{3, 2, 1}
reverse([]string{"1.1", "2.2", "3.3"}) // []string{"3.3", "2.2", "1.1"}
Expand All @@ -176,7 +176,7 @@ reverse([]interface{}{"true", true, 1, 2.2, false}) // []interface{}{false, 2.2,

<h3>godash.findIndex</h3>
The function returns the index of the first occurrence of 'target' and a boolean indicating if the target was found.
<br>

```go
findIndex([]int64{1, 2, 3, 8, 7, 6, 5, 9}, int64(8)) // 3
findIndex([]string{"a", "b", "c"}, "b") // 1
Expand All @@ -201,7 +201,7 @@ findIndex([]*User{

<h3>godash.pullAt</h3>
pullAt removes elements from the input array at specified indexes and returns the modified array.
<br>

```go
pullAt([]float64{1.1, 2.2, 3.3}, []int{0, 1, 2}) // []float64{1.1, 2.2, 3.3}
pullAt([]bool{true, true, false, true, false}, []int{0, 1, 3, 4}) // []bool{true, true, true, false}
Expand All @@ -210,7 +210,7 @@ pullAt([]interface{}{"true", 1, false, true, 1.1, "false"}, []int{0, 1, 3, 4, 5}

<h3>godash.without</h3>
The function returns the new slice without the specified values and an error if any occurs.
<br>

```go
without([]int{2, 1, 2, 3}, 1, 2) // []int{3}
without([]string{"2", "1", "2", "3"}, "1", 2) // []string{"2", "2", "3"}
Expand All @@ -219,7 +219,7 @@ without([]interface{}{"true", true, false, 1, 2.2, 3.3}, 2.2, false) // []interf

<h3>godash.join</h3>
join takes an array (slice) of elements and a separator string, and returns a single string by joining the elements with the separator.
<br>

```go
join([]int{1, 2, 3}, "-") // "1-2-3"
join([]bool{true, false}, "-") // "true-false"
Expand All @@ -228,7 +228,7 @@ join([]interface{}{"1", false, 1.1, 2.2, 2}, "-") // "1-false-1.1-2.2-2"

<h3>godash.xor</h3>
xor returns a new slice that contains the elements that appear in an odd number of input arrays.
<br>

```go
xor([]int{4, 4, 2, 1}, []int{2, 3, 4}) // []int{1, 3}
xor([]float64{2, 1}, 3, []float64{2, 3}, []float64{2}) // []float64{1, 3}
Expand All @@ -238,7 +238,7 @@ xor([]string{"2", "1"}, 3, []string{"2", "3"}, []string{"2"}) // []string{"1", "

<h3>godash.camelCase</h3>
camelCase converts a string to camelCase format.
<br>

```go
camelCase("Foo Bar") // fooBar
camelCase("--foo-bar--") // fooBar
Expand All @@ -247,7 +247,7 @@ camelCase("@a98@#$,.23237@#$hello-world") // a9823237HelloWorld

<h3>godash.unescape</h3>
unescape a string that contains escape sequences and returns the unescaped string. If un-escaping fails, the original input string is returned.
<br>

```go
unescape("fred, barney, &amp; pebbles") // fred, barney, & pebbles
unescape("fred &lt; barney") // fred < barney
Expand All @@ -256,7 +256,7 @@ unescape("fred &gt; barney") // fred > barney

<h3>godash.lte</h3>
The function accepts two values of any comparable type (int, float, string, etc.) and returns true if the first value is less than or equal to the second value, false otherwise.
<br>

```go
lte(1, 2) // true
lte(int64(1), int64(2)) // true
Expand Down