mirror of
https://github.com/toss/es-toolkit.git
synced 2024-12-01 02:33:54 +03:00
docs(zh-hans): add missing link (#366)
* docs(zh-hans): add missing link * fix: bind
This commit is contained in:
parent
7ca9ffcd72
commit
233682acf6
@ -68,6 +68,7 @@ function sidebar(): DefaultTheme.Sidebar {
|
|||||||
{ text: 'intersection', link: '/zh_hans/reference/array/intersection' },
|
{ text: 'intersection', link: '/zh_hans/reference/array/intersection' },
|
||||||
{ text: 'intersectionBy', link: '/zh_hans/reference/array/intersectionBy' },
|
{ text: 'intersectionBy', link: '/zh_hans/reference/array/intersectionBy' },
|
||||||
{ text: 'intersectionWith', link: '/zh_hans/reference/array/intersectionWith' },
|
{ text: 'intersectionWith', link: '/zh_hans/reference/array/intersectionWith' },
|
||||||
|
{ text: 'isSubset', link: '/zh_hans/reference/array/isSubset' },
|
||||||
{ text: 'keyBy', link: '/zh_hans/reference/array/keyBy' },
|
{ text: 'keyBy', link: '/zh_hans/reference/array/keyBy' },
|
||||||
{ text: 'minBy', link: '/zh_hans/reference/array/minBy' },
|
{ text: 'minBy', link: '/zh_hans/reference/array/minBy' },
|
||||||
{ text: 'maxBy', link: '/zh_hans/reference/array/maxBy' },
|
{ text: 'maxBy', link: '/zh_hans/reference/array/maxBy' },
|
||||||
@ -117,7 +118,7 @@ function sidebar(): DefaultTheme.Sidebar {
|
|||||||
{ text: 'noop', link: '/zh_hans/reference/function/noop' },
|
{ text: 'noop', link: '/zh_hans/reference/function/noop' },
|
||||||
{ text: 'ary', link: '/zh_hans/reference/function/ary' },
|
{ text: 'ary', link: '/zh_hans/reference/function/ary' },
|
||||||
{ text: 'unary', link: '/zh_hans/reference/function/unary' },
|
{ text: 'unary', link: '/zh_hans/reference/function/unary' },
|
||||||
{ text: 'bind (兼容性)', link: '/zh_hans/reference/function/bind' },
|
{ text: 'bind (兼容性)', link: '/zh_hans/reference/compat/function/bind' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
此函数与 lodash 完全兼容。您可以在我们的[兼容性库](../../../compatibility.md)中找到它,`es-toolkit/compat`。
|
此函数与 lodash 完全兼容。您可以在我们的[兼容性库](../../../compatibility.md)中找到它,`es-toolkit/compat`。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
创建一个调用 `func` 的函数,`thisObj` 绑定 `func` 函数中的 `this`,并且 `func` 函数会接收 `partialArgs` 附加参数。
|
||||||
创建一个调用 `func` 的函数,`thisArg` 绑定 `func` 函数中的 `this`,并且 `func` 函数会接收 `partials` 附加参数。
|
|
||||||
|
|
||||||
`bind.placeholder` 的值默认是一个 `symbol`,可以用作附加的部分参数的占位符。
|
`bind.placeholder` 的值默认是一个 `symbol`,可以用作附加的部分参数的占位符。
|
||||||
|
|
||||||
@ -14,7 +13,8 @@
|
|||||||
## 签名
|
## 签名
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
function bind(func: (...args: any[]) => any, thisArg?: any, ...partials: any[]): (...args: any[]) => any;
|
function bind<F extends Function>(func: F, thisObj?: unknown, ...partialArgs: any[]): F;
|
||||||
|
|
||||||
namespace bind {
|
namespace bind {
|
||||||
placeholder: symbol;
|
placeholder: symbol;
|
||||||
}
|
}
|
||||||
@ -22,13 +22,13 @@ namespace bind {
|
|||||||
|
|
||||||
### 参数
|
### 参数
|
||||||
|
|
||||||
- `fn` (`(...args: any[]) => any`): 绑定的函数。
|
- `fn` (`F`): 绑定的函数。
|
||||||
- `thisArg` (`any`, optional): `func` 绑定的 `this` 对象。
|
- `thisObj` (`any`, optional): `func` 绑定的 `this` 对象。
|
||||||
- `partials` (`any[]`): 附加的部分参数。
|
- `partialArgs` (`any[]`): 附加的部分参数。
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
(`(...args: any[]) => any`): 返回新的绑定函数。
|
(`F`): 返回新的绑定函数。
|
||||||
|
|
||||||
## 示例
|
## 示例
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user