UNPKG

@talend/react-cmf

Version:

A framework built on top of best react libraries

14 lines 553 B
import Immutable from 'immutable'; import { get } from "lodash"; export default function getOneOfFunction(statePath) { return function includes({ context }, immutablePath, values) { if (!Array.isArray(values)) { throw new Error('You should pass an array of values to check if one of them is present'); } const arr = get(context.store.getState(), statePath, new Immutable.Map()).getIn(immutablePath.split('.'), new Immutable.List()); return values.some(value => arr.includes(value)); }; } //# sourceMappingURL=oneOf.js.map