Giter VIP home page Giter VIP logo

dayjs-source-code-analysis's Introduction

Dayjs 源码解析

插播一个新系列:时间库 dayjs 的源码解析。

用官方的描述 “Day.jsMoment.js 的 2kB 轻量化方案,拥有同样强大的 API”。优点是如下三个:

  • 简易:Day.js 是一个轻量的处理时间和日期的 JavaScript 库,和 Moment.jsAPI 设计保持完全一样。
  • 不可变:所有的 API 操作都将返回一个新的 Dayjs 实例。这种设计能避免 bug 产生,节约调试时间。
  • 国际化:Day.js 对国际化支持良好。但除非手动加载,多国语言默认是不会被打包到工程里的。

总的来说,dayjs 的优点就是 pluginlocale 手动按需加载,减少打包体积。

dayjs 是饿了么的大佬 iamkun 开发维护的,大佬同时也是 ElementUI 的开发者。解析之前先从dayjs 源代码仓库 fork 了一份:https://github.com/MageeLin/dayjs-source-code-analysis

时间是 2020 年 12 月 7 日,commitIDeb5fbc4c。解析时从 master 分支拉了一个新分支 analysis

可配合博客食用,分五章完成,目录如下:

  1. dayjs 源码解析(一):概念、locale、constant、utils
  2. dayjs 源码解析(二):Dayjs 类
  3. dayjs 源码解析(三):插件(上)
  4. dayjs 源码解析(四):插件(中)
  5. dayjs 源码解析(五):插件(下)

前端记事本,不定期更新,欢迎关注!


dayjs-source-code-analysis's People

Contributors

aalises avatar alik0211 avatar csvwolf avatar dyoshikawa avatar frankxuzy avatar frondor avatar g1eny0ung avatar guisturdy avatar huruji avatar hustcc avatar iamkun avatar mageelin avatar mahammedzkhan avatar mariomc avatar naulacambra avatar ohbarye avatar panjiachen avatar prantlf avatar revilationer avatar rn4n avatar saknarak avatar sameer-ahmed avatar schiem avatar semantic-release-bot avatar shadowpark avatar styfle avatar vilanz avatar waseemahmad31 avatar xx45 avatar zazzaz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.