mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-24 03:32:58 +03:00
docs: Update docs for get (#278)
* docs: Update chunk.md * Squashed commit of the following: commit 14c8b1108a3aa6d45955c7dcd94a74598c9b4737 Author: tanggd <tanggd11@foxmail.com> Date: Mon Jul 22 13:17:17 2024 +0800 docs: Update docs for get commit 9b7b7ac41f7484753723b32f4d624da4c8bfe4e6 Author: tanggd <tanggd11@qq.com> Date: Fri Jul 19 17:00:59 2024 +0800 docs: Update chunk.md --------- Co-authored-by: tanggd <tanggd11@foxmail.com>
This commit is contained in:
parent
3911ae8cfc
commit
b134df19da
@ -52,13 +52,16 @@ function get(object: unknown, path: PropertyKey | readonly PropertyKey[], defaul
|
||||
### 예시
|
||||
|
||||
```typescript
|
||||
import { get } from 'es-toolkit/compat';
|
||||
|
||||
const obj = {
|
||||
a: {
|
||||
b: 4
|
||||
}
|
||||
}
|
||||
console.log(obj, 'a.b') // 4
|
||||
console.log(obj, ['a', 'b']) // 4
|
||||
console.log(obj, ['a', 'c']) // undefined
|
||||
console.log(obj, ['a', 'c'], null) // null
|
||||
};
|
||||
|
||||
get(obj, 'a.b'); // 4
|
||||
get(obj, ['a', 'b']); // 4
|
||||
get(obj, ['a', 'c']); // undefined
|
||||
get(obj, ['a', 'c'], null); // null
|
||||
```
|
@ -52,13 +52,16 @@ function get(object: unknown, path: PropertyKey | readonly PropertyKey[], defaul
|
||||
### Examples
|
||||
|
||||
```typescript
|
||||
import { get } from 'es-toolkit/compat';
|
||||
|
||||
const obj = {
|
||||
a: {
|
||||
b: 4
|
||||
}
|
||||
}
|
||||
console.log(obj, 'a.b') // 4
|
||||
console.log(obj, ['a', 'b']) // 4
|
||||
console.log(obj, ['a', 'c']) // undefined
|
||||
console.log(obj, ['a', 'c'], null) // null
|
||||
};
|
||||
|
||||
get(obj, 'a.b'); // 4
|
||||
get(obj, ['a', 'b']); // 4
|
||||
get(obj, ['a', 'c']); // undefined
|
||||
get(obj, ['a', 'c'], null); // null
|
||||
```
|
@ -52,13 +52,16 @@ function get(object: unknown, path: PropertyKey | readonly PropertyKey[], defaul
|
||||
### 示例
|
||||
|
||||
```typescript
|
||||
import { get } from 'es-toolkit/compat';
|
||||
|
||||
const obj = {
|
||||
a: {
|
||||
b: 4
|
||||
}
|
||||
}
|
||||
console.log(obj, 'a.b') // 4
|
||||
console.log(obj, ['a', 'b']) // 4
|
||||
console.log(obj, ['a', 'c']) // undefined
|
||||
console.log(obj, ['a', 'c'], null) // null
|
||||
};
|
||||
|
||||
get(obj, 'a.b'); // 4
|
||||
get(obj, ['a', 'b']); // 4
|
||||
get(obj, ['a', 'c']); // undefined
|
||||
get(obj, ['a', 'c'], null); // null
|
||||
```
|
Loading…
Reference in New Issue
Block a user