UNPKG

react-dropdown-select

Version:
1 lines 1.41 kB
"use strict";exports.__esModule=!0,exports.valueExistInSelected=exports.isomorphicWindow=exports.isEqual=exports.hexToRGBA=exports.getProp=exports.getByPath=exports.debounce=void 0;var valueExistInSelected=function(a,b,c){return!!b.find(function(b){return getByPath(b,c.valueField)===a||getByPath(b,c.labelField)===a})};exports.valueExistInSelected=valueExistInSelected;var hexToRGBA=function(a,b){4===a.length&&(a=""+a[1]+a[1]+a[2]+a[2]+a[3]+a[3]+"}");var c=parseInt(a.slice(1,3),16),d=parseInt(a.slice(3,5),16),e=parseInt(a.slice(5,7),16);return"rgba("+c+", "+d+", "+e+(b&&", "+b)+")"};exports.hexToRGBA=hexToRGBA;var debounce=function(a,b){void 0===b&&(b=0);var c;return function(){for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];c&&clearTimeout(c),c=setTimeout(function(){a.apply(void 0,e),c=null},b)}};exports.debounce=debounce;var isEqual=function(c,a){return JSON.stringify(c)===JSON.stringify(a)};exports.isEqual=isEqual;var getByPath=function(a,b){return b?b.split(".").reduce(function(a,b){return a[b]},a):void 0};exports.getByPath=getByPath;var getProp=function(a,b,c){if(!b)return a;var d=Array.isArray(b)?b:b.split(".").filter(function(a){return a.length});return d.length?getProp(a[d.shift()],d,c):void 0===a?c:a};exports.getProp=getProp;var isomorphicWindow=function(){return"undefined"==typeof window&&(global.window={}),window};exports.isomorphicWindow=isomorphicWindow;