From 888381a06c426d3967edf5e76ae8e43d6366a118 Mon Sep 17 00:00:00 2001 From: dudaodong Date: Fri, 10 Feb 2023 10:53:41 +0800 Subject: [PATCH] doc: add drop and sort related function doc --- README.md | 16 +++++++++++++++- README_zh-CN.md | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1abb9da..7baf088 100644 --- a/README.md +++ b/README.md @@ -832,9 +832,15 @@ import "github.com/duke-git/lancet/v2/slice" - **DeleteAt** : delete the element of slice from specific start index to end index - 1. [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#DeleteAt)] [[play](https://go.dev/play/p/pJ-d6MUWcvK)] -- **Drop** : creates a slice with `n` elements dropped from the beginning when n > 0, or `n` elements dropped from the ending when n < 0. +- **Drop** : drop n elements from the start of a slice. [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#Drop)] [[play](https://go.dev/play/p/pJ-d6MUWcvK)] +- **DropRight** : drop n elements from the end of a slice. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#DropRight)] +- **DropWhile** : drop n elements from the start of a slice while predicate function returns true. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#DropWhile)] +- **DropRightWhile** : drop n elements from the end of a slice while predicate function returns true. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#DropRightWhile)] - **Equal** : checks if two slices are equal: the same length and all elements' order and value are equal. [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#Equal)] [[play](https://go.dev/play/p/WcRQJ37ifPa)] @@ -910,6 +916,14 @@ import "github.com/duke-git/lancet/v2/slice" - **Shuffle** : shuffle the slice. [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#Shuffle)] [[play](https://go.dev/play/p/YHvhnWGU3Ge)] +- **IsAscending** : Checks if a slice is ascending order. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#IsAscending)] +- **IsDescending** : Checks if a slice is descending order. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#IsDescending)] +- **IsSorted** : Checks if a slice is sorted (ascending or descending). + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#IsSorted)] +- **IsSortedByKey** : Checks if a slice is sorted by iteratee function. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#IsSortedByKey)] - **Sort** : sorts a slice of any ordered type(number or string). [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice.md#Sort)] [[play](https://go.dev/play/p/V9AVjzf_4Fk)] diff --git a/README_zh-CN.md b/README_zh-CN.md index 3437c06..34371fc 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -839,9 +839,15 @@ import "github.com/duke-git/lancet/v2/slice" - **DeleteAt** : 删除切片中指定开始索引到结束索引的元素。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#DeleteAt)] [[play](https://go.dev/play/p/pJ-d6MUWcvK)] -- **Drop** : 创建一个切片,当n > 0时从开头删除n个元素,或者当n < 0时从结尾删除n个元素。 +- **Drop** : 从切片头部删除n个元素。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#Drop)] [[play](https://go.dev/play/p/pJ-d6MUWcvK)] +- **DropRight** : 从切片尾部删除n个元素。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#DropRight)] +- **DropWhile** : 从切片的头部删除n个元素,这个n个元素满足predicate函数返回true。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#DropWhile)] +- **DropRightWhile** : 从切片的尾部删除n个元素,这个n个元素满足predicate函数返回true。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#DropRightWhile)] - **Equal** : 检查两个切片是否相等,相等条件:切片长度相同,元素顺序和值都相同。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#Equal)] [[play](https://go.dev/play/p/WcRQJ37ifPa)] @@ -917,6 +923,14 @@ import "github.com/duke-git/lancet/v2/slice" - **Shuffle** : 随机打乱切片中的元素顺序。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#Shuffle)] [[play](https://go.dev/play/p/YHvhnWGU3Ge)] +- **IsAscending** : 检查切片元素是否按升序排列。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#IsAscending)] +- **IsDescending** : 检查切片元素是否按降序排列。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#IsDescending)] +- **IsSorted** : 检查切片元素是否是有序的(升序或降序)。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#IsSorted)] +- **IsSortedByKey** : 通过iteratee函数,检查切片元素是否是有序的。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#IsSortedByKey)] - **Sort** : 对任何有序类型(数字或字符串)的切片进行排序,使用快速排序算法。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/slice_zh-CN.md#Sort)] [[play](https://go.dev/play/p/V9AVjzf_4Fk)]