This is just a common toolkit for the Front End

Install and use

  • Install
$ npm install yanjs
Copy the code
  • Example
var yanjs = require('yanjs');
Copy the code
  • Documentation usage

The original intention of the wheel

We’re in the era of front-end development, with frameworks, libraries, and plugins cropping up all over the place, so why repeat the wheel?

  1. Reduce dependency on tripartite plug-ins for internal use
  2. In order to be lightweight and speed up page loading, current popular libraries (such as Lodash.js) are not used very much by existing businesses, and not all features are used
  3. At present, the technical stack of the business is mainly Vue. It is necessary to further remove the dependence of jQuery and make a transition to replace some tool functions in jQuery
  4. To familiarize yourself with hands-on front-end development processes, learn how to build wheels (hats off to VCZH), and improve yourself
  5. Contributing to the development of big front end, ^_^

The development process

  • The development requirements are summarized as follows
  1. The ajax module
  2. Time format conversion module
  3. String format conversion module
  4. Cookie module
  5. Url parsing module
  6. Browser module
  • Development dependence In view of the common Ajax library in development is AXIos, so we do not repeat the wheel, simple encapsulation, cookies directly use docCookies encapsulated by MDN
  1. axios
  2. docCookies
  • Development environment language: Typescript 3.x transformation: Babel 7.x Packaging: webpack 4.x testing: Mocha + Chai + Phantomjs
  • Publishing environment integration: Travis- CI Publishing: NPM hosting: Github

Develop insight

  • The first time I wrote business code in typescript the first time I released an NPM package the first time I did code testing with Mocha the first time I did integration with Travis

  • Results A complete experience of front-end engineering development, basic familiar with the whole development process, the company has two projects in the use of this library, has been basically stable

twitter

I am still in the process of growing up, there may be a lot of inconsiderate, welcome to exchange and study, welcome to issue

Contact me: Github:github.com/Yangfan2016 Blog: yangfan2016. Making. IO/Segmentfault:segmentfault.com/u/yangfan20…

Big guy, click star and then go, ^_^