lsc-utils
Version:
一般常用的前端工具类
108 lines (101 loc) • 5.71 kB
JavaScript
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["lscUtils"] = factory();
else
root["lscUtils"] = factory();
})(self, () => {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/date/index.js":
/*!***************************!*\
!*** ./src/date/index.js ***!
\***************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"monthDayDiff\": () => (/* binding */ monthDayDiff)\n/* harmony export */ });\n/**\n * 计算两个时间差 x年x月x日\n * @param startTime 开始时间\n * @param endTime 结束时间\n */\nfunction monthDayDiff (startTime, endTime) {\n const flag = [1, 3, 5, 7, 8, 10, 12, 4, 6, 9, 11, 2]\n const start = new Date(startTime)\n const end = new Date(endTime)\n let year = end.getFullYear() - start.getFullYear()\n let month = end.getMonth() - start.getMonth()\n let day = end.getDate() - start.getDate()\n if (month < 0) {\n year--\n month = end.getMonth() + (12 - start.getMonth())\n }\n if (day < 0) {\n month--\n const index = flag.findIndex((temp) => {\n return temp === start.getMonth() + 1\n })\n let monthLength\n if (index <= 6) {\n monthLength = 31\n } else if (index > 6 && index <= 10) {\n monthLength = 30\n } else {\n monthLength = 28\n }\n day = end.getDate() + (monthLength - start.getDate())\n }\n return `${year}岁${month}月${day}天`\n}\n\n\n//# sourceURL=webpack://lscUtils/./src/date/index.js?");
/***/ }),
/***/ "./src/index.js":
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"monthDayDiff\": () => (/* reexport safe */ _date_index__WEBPACK_IMPORTED_MODULE_0__.monthDayDiff)\n/* harmony export */ });\n/* harmony import */ var _date_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./date/index */ \"./src/date/index.js\");\n\n\n\n//# sourceURL=webpack://lscUtils/./src/index.js?");
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = __webpack_require__("./src/index.js");
/******/
/******/ return __webpack_exports__;
/******/ })()
;
});