index.js 1.0 KB

123456789101112131415161718
  1. function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
  2. export default (function (option, Dayjs, dayjs) {
  3. dayjs.updateLocale = function (locale, customConfig) {
  4. var localeList = dayjs.Ls;
  5. var localeConfig = localeList[locale];
  6. if (!localeConfig) return;
  7. var customConfigKeys = customConfig ? Object.keys(customConfig) : [];
  8. customConfigKeys.forEach(function (c) {
  9. if (localeConfig[c] && customConfig[c] && typeof localeConfig[c] === 'object' && typeof customConfig[c] === 'object' && !Array.isArray(localeConfig[c])) {
  10. localeConfig[c] = _extends({}, localeConfig[c], customConfig[c]);
  11. } else {
  12. localeConfig[c] = customConfig[c];
  13. }
  14. });
  15. return localeConfig; // eslint-disable-line consistent-return
  16. };
  17. });