1.1.5 • Published 4 years ago

izk-util v1.1.5

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

##izk-util

包下载: npm install izk-util@latest

api说明文档:

###getUrlParameter

获取URL中的参数 method: getUrlParameter params: String: 参数名, 例如: key String: 地址, 默认: 当前页面地址, 例如: http://www.izhikang.com/ return: String

... ###serializerToJson

将序列化字符串转为json

let izkUtil = require('izk-util');

let queryString = 'name=liujintao&age=28&address=beijing';

let queryObj = izkUtil.serializerToJson(queryString);

console.log(queryObj);

output

{ name: 'liujintao', age: '28', address: 'beijing' }

###jsonToSerializer

将json对象转为序列化字符串

let izkUtil = require('izk-util');

let queryObj = {name: 'liujintao', age: '28', address: 'beijing'};

let queryString = izkUtil.jsonToSerializer(queryObj);



console.log(queryString);

output

name=liujintao&age=28&address=beijing

###checkMobile

获取设备信息

var device = izkUtil.checkMobile();

console.log(device);

output

iphone

###cookie cookie相关操作

cookie.set 设置cookie

  izkUtil.cookie.set('cookie_name','cookie value here','domain.com','/path/to/set/cookie','hours')

cookie.get 读取cookie

  izkUtil.cookie.get('cookie_name')

cookie.del 删除cookie

  izkUtil.cookie.del('cookie_name')

###formatDate

日期格式化, 返回格式化的字符串

let izkUtil = require('izk-util');

let now = new Date();

let dateString = izkUtil.formatDate(now,'yyyy年MM月dd日 hh:mm');

console.log(dateString);

###isSupportWebp

设备webp图片支持检测

let izkUtil = require('izk-util');

izkUtil.isSupportWebp(type=>{console.log(type)});

###imageMogr2

图片裁剪(适用于腾讯云)

let izkUtil = require('izk-util');

let imgurl = izkUtil.imageMogr2(imageOriginUrl,{w:180,h:160});

ES Module支持

import izkutil from  'izkutil/dist/izkutil.esm.min';

let queryObj = {name: 'liujintao', age: '28', address: 'beijing'};

let queryString = izkUtil.jsonToSerializer(queryObj);

console.log(queryString);
1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago