Code Monkey home page Code Monkey logo

js-func-lib's Introduction

js-func-lib

To record some useful functions.

对于利用Vue脚手架生成的项目(vue init webpack projectname),提交代码之后,让运维人员上线,如何快速确定已经上线成功了呢?

对于前端,当然可以通过查看本次修改的界面或功能进行验证,但是这样未免太慢,所以写了个函数,放在构建跑的脚本中。

构建默认跑的命令是npm run build,在package.json中找到build命令所跑的脚本,即build/build.js文件,放到合适的位置,搞定。

函数的功能是读取构建生成的index.html文件,在body结束标签之前插入如下代码,后面的时间是每一次构建时间。

<script>console.log("Build Time: Thu Jun 08 2017 15:05:40 GMT+0800 (**标准时间)");</script>

函数的功能是将日期格式化成型如"yyyy-mm-dd HH:mm:ss"类型数据,可以传递Date类型数据或者时间戳。

对于一般的对象可以采用Object.assign({}, originObj)这个函数进行复制,但是数组无法这个函数,所以参考网上资料写了一个deepCopy

获取今天的某个时间,返回一个Date对象

在不同JavaScript环境中,如浏览器和Node中,获取顶层对象(来自阮一峰《ES6入门》- 2.let和const命令 -最后一部分)

测试一个字符由两个字节还是由四个字节组成的方法(来自阮一峰《ES6入门》- 4.字符串拓展 2.codePointAt)

利用标签模板过滤html代码(来自阮一峰《ES6入门》- 4.字符串拓展 12.标签模板)

js-func-lib's People

Contributors

kerita avatar

Watchers

 avatar  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.