PromoCursed/node_modules/.cache/babel-loader/0cbecc49a796343ffc86fb56400c837c8a1b0d67f496b929baf70f52ffe292da.json
2024-08-20 23:25:37 +04:00

1 line
5.1 KiB
JSON

{"ast":null,"code":"// Countdown\nconst timeUnits = [['Y', 1000 * 60 * 60 * 24 * 365],\n// years\n['M', 1000 * 60 * 60 * 24 * 30],\n// months\n['D', 1000 * 60 * 60 * 24],\n// days\n['H', 1000 * 60 * 60],\n// hours\n['m', 1000 * 60],\n// minutes\n['s', 1000],\n// seconds\n['S', 1] // million seconds\n];\nexport function formatTimeStr(duration, format) {\n let leftDuration = duration;\n const escapeRegex = /\\[[^\\]]*]/g;\n const keepList = (format.match(escapeRegex) || []).map(str => str.slice(1, -1));\n const templateText = format.replace(escapeRegex, '[]');\n const replacedText = timeUnits.reduce((current, _ref) => {\n let [name, unit] = _ref;\n if (current.includes(name)) {\n const value = Math.floor(leftDuration / unit);\n leftDuration -= value * unit;\n return current.replace(new RegExp(`${name}+`, 'g'), match => {\n const len = match.length;\n return value.toString().padStart(len, '0');\n });\n }\n return current;\n }, templateText);\n let index = 0;\n return replacedText.replace(escapeRegex, () => {\n const match = keepList[index];\n index += 1;\n return match;\n });\n}\nexport function formatCountdown(value, config) {\n const {\n format = ''\n } = config;\n const target = new Date(value).getTime();\n const current = Date.now();\n const diff = Math.max(target - current, 0);\n return formatTimeStr(diff, format);\n}","map":{"version":3,"names":["timeUnits","formatTimeStr","duration","format","leftDuration","escapeRegex","keepList","match","map","str","slice","templateText","replace","replacedText","reduce","current","_ref","name","unit","includes","value","Math","floor","RegExp","len","length","toString","padStart","index","formatCountdown","config","target","Date","getTime","now","diff","max"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/statistic/utils.js"],"sourcesContent":["// Countdown\nconst timeUnits = [['Y', 1000 * 60 * 60 * 24 * 365],\n// years\n['M', 1000 * 60 * 60 * 24 * 30],\n// months\n['D', 1000 * 60 * 60 * 24],\n// days\n['H', 1000 * 60 * 60],\n// hours\n['m', 1000 * 60],\n// minutes\n['s', 1000],\n// seconds\n['S', 1] // million seconds\n];\nexport function formatTimeStr(duration, format) {\n let leftDuration = duration;\n const escapeRegex = /\\[[^\\]]*]/g;\n const keepList = (format.match(escapeRegex) || []).map(str => str.slice(1, -1));\n const templateText = format.replace(escapeRegex, '[]');\n const replacedText = timeUnits.reduce((current, _ref) => {\n let [name, unit] = _ref;\n if (current.includes(name)) {\n const value = Math.floor(leftDuration / unit);\n leftDuration -= value * unit;\n return current.replace(new RegExp(`${name}+`, 'g'), match => {\n const len = match.length;\n return value.toString().padStart(len, '0');\n });\n }\n return current;\n }, templateText);\n let index = 0;\n return replacedText.replace(escapeRegex, () => {\n const match = keepList[index];\n index += 1;\n return match;\n });\n}\nexport function formatCountdown(value, config) {\n const {\n format = ''\n } = config;\n const target = new Date(value).getTime();\n const current = Date.now();\n const diff = Math.max(target - current, 0);\n return formatTimeStr(diff, format);\n}"],"mappings":"AAAA;AACA,MAAMA,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;AACnD;AACA,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAC/B;AACA,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAC1B;AACA,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;AACrB;AACA,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,CAAC;AAChB;AACA,CAAC,GAAG,EAAE,IAAI,CAAC;AACX;AACA,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAAA,CACR;AACD,OAAO,SAASC,aAAaA,CAACC,QAAQ,EAAEC,MAAM,EAAE;EAC9C,IAAIC,YAAY,GAAGF,QAAQ;EAC3B,MAAMG,WAAW,GAAG,YAAY;EAChC,MAAMC,QAAQ,GAA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