0.1.26 • Published 3 years ago

wind-library v0.1.26

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

wind-library


Installation

yarn add wind-library

npm install wind-library --save-dev

Tools API

  • 本地/会话存储
import { storage } from 'wind-library';
// 设置
storage.session.set(key,value);
// 获取
storage.session.get(key);
// 移除
storage.session.remove(key);
// 清除
storage.session.clear();
// 获取所有
storage.session.getAll();
// 遍历
storage.session.forEach(cb);
// localStorage 同样API
storage.local.set(...)
...

  • 生日转化星座
import { constellation } from 'wind-library';
const birthday = '2000-01-03';

constellation(birthday); // 摩羯

  • 根据 URL 判断是否是视频/图片
import { isPicture, isVideo } from 'wind-library';
isPicture('http://hycoding.com'); // false
isVideo('http://hycoding.com/1cabidesa.mp4'); // true

使用正则匹配后缀判断,对于非正常 URL 请不要使用这个方法。



  • 读取 JSON 文件内容(File 对象),返回读取变量
import { fileToJson } from 'wind-library';
fileToJson(File);

0.1.26

3 years ago

0.1.25

3 years ago

0.1.24

3 years ago

0.1.23

3 years ago

0.1.22

3 years ago

0.1.21

3 years ago

0.1.1

3 years ago