UNPKG

@talend/react-cmf

Version:

A framework built on top of best react libraries

21 lines (20 loc) 802 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getOneOfFunction; var _immutable = _interopRequireDefault(require("immutable")); var _lodash = require("lodash"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } 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 = (0, _lodash.get)(context.store.getState(), statePath, new _immutable.default.Map()).getIn(immutablePath.split('.'), new _immutable.default.List()); return values.some(value => arr.includes(value)); }; } //# sourceMappingURL=oneOf.js.map