0.0.3 • Published 6 years ago

ammunition-storage v0.0.3

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

Ammunition Storage

各种公共工具

JavaScript API

用法:

...
<script src="./dist/ammunition-0.0.1.min.js"></script>

<script>
var ammunition = new Ammunition();
ammunition.init();
</script>
...

说明:

  1. md5: md5 加密;

    var ammunition = new Ammunition();
    var date = new Date();
    var dateString = date.valueOf().toString();
    
    console.log(ammunition.md5(dateString));
  2. cookieUtil: cookie 操作。

    var ammunition = new Ammunition();
    var cookieUtil = ammunition.cookieUtil;
    
    cookieUtil.set('name', 'WJT20', 1);
    console.log(cookieUtil.get('name'));

Node.js API

用法:

npm i -D ammunition-storage

说明:

  1. init: 初始化。

    const ammunition = require('./index.js');
    
    ammunition.init();
    console.log((new Date()).format('yyyy-MM-dd hh:mm'));
  2. copyDir: 拷贝目录。

    const path = require('path');
    const ammunition = require('./index.js');
    
    ammunition.copyDir({
        srcPath: path.resolve(__dirname, './src'),
        tgtPath: path.resolve(__dirname, './dist')    
    });

DATE: 2018-07-30