elyongwj's js library
Here's elyongwj's js library.
Includes many functions and usecases about URL, DOM, asynchronous, array and XSS-input-defence.:blush:
Installation
You can install with npm:
$ npm install elyongwj_js_library --save-dev
Usage
$ import Base from 'elyongwj_js_library'
Functions
URL functions
query(name,querystring)
- Function for gets the value of the specified name in the specified querystring
Base.query('hello', '?hello=js') //return 'js'
serialize(data)
- Function for turn the object into a url string
Base.serialize({hello: 'js', hi: 'test'}) //return '?hello=js&hi=test'
getAbsoluteUrl(url)
- Function for get absolute url
Base.getAbsoluteUrl('/hhh') //return 'https://gitlab.com/hhh'
DOM functions
$(selector)
- Function for simulating jQuery
Base.$(selector) //return {DOM|undefined}
asynchronous functions
array functions
XSS-input-defence functions
注意:
npm run test
可以跑测试- code coverage 90% 以上
npm run coverage
跑测试并告知 coverage 的结果
加分项:
- 使用 ES6 ,并且编译出一份 ES5 的文件
- 遵从 ESLint 或者 standardjs 等代码规范
- 函数多多益善
- 发布到 npm ,发布后把链接贴到你的总结里
- 测试文件统一归到
test
目录下 - code coverage 不小于 95%
- 使用 git hook 来自动跑用例和代码覆盖率