1 line
4.1 KiB
JSON
1 line
4.1 KiB
JSON
{"ast":null,"code":"import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nvar _excluded = [\"show\"];\nimport * as React from 'react';\n/**\n * Cut `value` by the `count.max` prop.\n */\nexport function inCountRange(value, countConfig) {\n if (!countConfig.max) {\n return true;\n }\n var count = countConfig.strategy(value);\n return count <= countConfig.max;\n}\nexport default function useCount(count, showCount) {\n return React.useMemo(function () {\n var mergedConfig = {};\n if (showCount) {\n mergedConfig.show = _typeof(showCount) === 'object' && showCount.formatter ? showCount.formatter : !!showCount;\n }\n mergedConfig = _objectSpread(_objectSpread({}, mergedConfig), count);\n var _ref = mergedConfig,\n show = _ref.show,\n rest = _objectWithoutProperties(_ref, _excluded);\n return _objectSpread(_objectSpread({}, rest), {}, {\n show: !!show,\n showFormatter: typeof show === 'function' ? show : undefined,\n strategy: rest.strategy || function (value) {\n return value.length;\n }\n });\n }, [count, showCount]);\n}","map":{"version":3,"names":["_objectWithoutProperties","_objectSpread","_typeof","_excluded","React","inCountRange","value","countConfig","max","count","strategy","useCount","showCount","useMemo","mergedConfig","show","formatter","_ref","rest","showFormatter","undefined","length"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-input/es/hooks/useCount.js"],"sourcesContent":["import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nvar _excluded = [\"show\"];\nimport * as React from 'react';\n/**\n * Cut `value` by the `count.max` prop.\n */\nexport function inCountRange(value, countConfig) {\n if (!countConfig.max) {\n return true;\n }\n var count = countConfig.strategy(value);\n return count <= countConfig.max;\n}\nexport default function useCount(count, showCount) {\n return React.useMemo(function () {\n var mergedConfig = {};\n if (showCount) {\n mergedConfig.show = _typeof(showCount) === 'object' && showCount.formatter ? showCount.formatter : !!showCount;\n }\n mergedConfig = _objectSpread(_objectSpread({}, mergedConfig), count);\n var _ref = mergedConfig,\n show = _ref.show,\n rest = _objectWithoutProperties(_ref, _excluded);\n return _objectSpread(_objectSpread({}, rest), {}, {\n show: !!show,\n showFormatter: typeof show === 'function' ? show : undefined,\n strategy: rest.strategy || function (value) {\n return value.length;\n }\n });\n }, [count, showCount]);\n}"],"mappings":"AAAA,OAAOA,wBAAwB,MAAM,oDAAoD;AACzF,OAAOC,aAAa,MAAM,0CAA0C;AACpE,OAAOC,OAAO,MAAM,mCAAmC;AACvD,IAAIC,SAAS,GAAG,CAAC,MAAM,CAAC;AACxB,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,KAAK,EAAEC,WAAW,EAAE;EAC/C,IAAI,CAACA,WAAW,CAACC,GAAG,EAAE;IACpB,OAAO,IAAI;EACb;EACA,IAAIC,KAAK,GAAGF,WAAW,CAACG,QAAQ,CAACJ,KAAK,CAAC;EACvC,OAAOG,KAAK,IAAIF,WAAW,CAACC,GAAG;AACjC;AACA,eAAe,SAASG,QAAQA,CAACF,KAAK,EAAEG,SAAS,EAAE;EACjD,OAAOR,KAAK,CAACS,OAAO,CAAC,YAAY;IAC/B,IAAIC,YAAY,GAAG,CAAC,CAAC;IACrB,IAAIF,SAAS,EAAE;MACbE,YAAY,CAACC,IAAI,GAAGb,OAAO,CAACU,SAAS,CAAC,KAAK,QAAQ,IAAIA,SAAS,CAACI,SAAS,GAAGJ,SAAS,CAACI,SAAS,GAAG,CAAC,CAACJ,SAAS;IAChH;IACAE,YAAY,GAAGb,aAAa,CAACA,aAAa,CAAC,CAAC,CAAC,EAAEa,YAAY,CAAC,EAAEL,KAAK,CAAC;IACpE,IAAIQ,IAAI,GAAGH,YAAY;MACrBC,IAAI,GAAGE,IAAI,CAACF,IAAI;MAChBG,IAAI,GAAGlB,wB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