/
githubmirror
/
immutable-js
Обзор
Документация
Войти
/
githubmirror
/
immutable-js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v4.3.4
src/functional/getIn.js
15 строк
430 B
Lee Byron
Relicence and copyright (#1814)
18 июн 2021, 01:53
Не верифицирован
18 июн 2021, 01:53
5155a7f
Код
Авторство
О чём код?
import coerceKeyPath from '../utils/coerceKeyPath'; import { NOT_SET } from '../TrieUtils'; import { get } from './get'; export function getIn(collection, searchKeyPath, notSetValue) { const keyPath = coerceKeyPath(searchKeyPath); let i = 0; while (i !== keyPath.length) { collection = get(collection, keyPath[i++], NOT_SET); if (collection === NOT_SET) { return notSetValue; } } return collection; }