/
githubmirror
/
immutable-js
Обзор
Документация
Войти
/
githubmirror
/
immutable-js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
website/docs/get().mdx
16 строк
633 B
Julien Deniau
Doc as mdx instead of export from .d.ts file (#2104)
24 май 2025, 00:47
Не верифицирован
24 май 2025, 00:47
21de701
Код
Авторство
О чём код?
import Repl from '@/repl/Repl.tsx'; import CodeLink from '@/mdx-components/CodeLink.tsx'; # get() Returns the value within the provided collection associated with the provided key, or notSetValue if the key is not defined in the collection. <Signature code={`get(collection, key, notSetValue?): any;`} /> A functional alternative to `collection.get(key)` which will also work on plain Objects and Arrays as an alternative for `collection[key]`. <Repl defaultValue={`get([ 'dog', 'frog', 'cat' ], 2)`} /> <Repl defaultValue={`get({ x: 123, y: 456 }, 'x')`} /> <Repl defaultValue={`get({ x: 123, y: 456 }, 'z', 'ifNotSet')`} />