npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

elgis-igu

v1.1.7

Published

Private tool class collection package of PatGp

Downloads

2

Readme

函数列表

| 函数名称 | 描述 | | ------------- | ------------------------------ | | isInt(num) | 验证是否是整数 | | toLowerCase(str) | 全部转小写 | | toUpperCase(str) | 全部转大写 | | isType(data,type) | 验证数据类型 | | isBasicData(data) | 判断数据是否为基础数据类型 | | getType(data) | 获取数据类型 | | initialstoLowerCase(str) | 设置首字母小写不改变之后的字符串 | | initialsCase(str) | 设置首字母大写不改变之后的字符串 | | initialsCaseLowercase(str) | 设置首字母大写其他全部转为小写 | | toLowerCamelCase(str) | 将字符串转为小驼峰 | | toCamelCase(str) | 将字符串转为大驼峰 | | isJSONStr(str) | 检查字符串是否为json格式 | | isEqual(data1,data2) | 判断两条数据是否相等 | | isBase64(str) | 检查是否为Base64字符串 | | isOdd(num) | 检查是否为奇数 | | isPicture(str) | 检查字符串是否为图片url | | isURL(url) | 检查URL是否有效 | | dateFmt(date,fmt) | 时间格式化 | | ConvertPinyin(l1,firstBoolen) | 汉字转拼音 | | fontSize(res,maxWidth) | 根据分辨率不同显示不同字体大小 | | hexToRgb(sColor,a) | 将hex表示方式转换为rgb表示方式 | | rgbToHex(rgb) | 将rgb表示方式转换为hex表示方式 | | getUrlQuery(url) | 从查询字符串中获取参数 | | getPathParams(path,pathMap,serializer) | 从查询字符串中获取参数 | | generatePathQuery(path,obj) | 使用查询字符串生成路径 | | generatePath(path,obj) | 使用参数生成路径 | | howLongAgo(date,type) | 距现在多少时间前 | | throttl(time) | 节流 | | lazyLoad(tags,node) | 图片懒加载 | | randomNum(min,max) | 生成区间随机数 | | setIcon(url) | 设置页面ICON | | setTitle(title) | 设置页面标题 | | cloneDeep(data) | 数据深拷贝 | | merge(data1,data2) | 数组/对象数据合并 | | each(data,iteratee) | 数组/对象数据遍历 | |new event.Scheduler(limit) | 并行调度器| |new event.Subscribe() | 发布订阅| |request(type: string, url: string, params: AnyObject, headers: AnyObject) | axios数据请求封装| |useRequest(callback: Function) | 数据请求前处理| |useResponse(callback: Function) | 数据请求后处理| |useConfig(config: AnyObject) | 数据请求基本配置处理| |isExistChild(data: any[] | AnyObject) | 验证对象/数组是否为空数据| |push(data: any[] | AnyObject, key: any, value: any) | 对象/数组添加数据| |flatter(arr: any[]) | 数组扁平化处理(多维数组变成一维数组)| |nextRegister(...fn) | 手动next| |currying(fn: Function, ...args: any) | 柯里化处理| |templateParser(template: string, data: AnyObject) | template 解析器| |listToTree(data: any[]) | 列表转成树形结构| |treeToList(data: any[]) | 树形结构转成列表| |setInterval | setInterval 重置优化| |copyjs | 复制当前节点内容到粘贴板 | |append | 添加dom节点 | |getChildNode | 获取dom子节点 | |setTransform | 设置dom节点transform样式 | |setStyle | 设置dom节点样式 | |setClass | 设置dom节点class | |removeClass | 删除dom节点class | |addListener | 添加节点事件 | |removeListener | 删除节点事件 | |remove | 删除节点 | |createTextNode | 创建文本节点 | |createDom | 创建虚拟dom节点 | |setAttr | 设置节点attrs | |getAttr | 获取节点attr | |htmlStringToVNode | HTMLString转虚拟dom节点 | |isDevice | 判断是android还是ios还是web还是WeChat | |filterTag | 过滤html代码(把<>转换) | |numberToChinese | 将阿拉伯数字翻译成中文的大写数字 | |h5Resize | H5软键盘缩回、弹起回调 | |setup | 设置localStorage Item | |removeSub | 删除localStorage Item | |getsub | 获取localStorage Item | |clearAll | 清除所有localStorage Item |

示例

isInt(num)

验证是否是整数 | 参数 | 描述 | | ------------- | ------------------------------ | | num | 需要验证的数据 |

let a = 1.23123,b = 12312;
console.log(isInt(a)); // false
console.log(isInt(b)); // true

toLowerCase(str)

全部转小写 | 参数 | 描述 | | ------------- | ------------------------------ | | str | 需要转换为小写的字符串 |

let a = "ADASDASD";
console.log(toLowerCase(a)); // adasdasd

toUpperCase(str)

全部转大写 | 参数 | 描述 | | ------------- | ------------------------------ | | str | 需要转换为大写的字符串 |

let a = "ADASDASD";
console.log(toUpperCase(a)); // adasdasd

isType(data,typeStr)

判断数据类型是否为指定数据类型 | 参数 | 描述 | | ------------- | ------------------------------ | | data | 数据源 | | typeStr | 指定数据类型字符串或者数据类型数组 |

let a = "ADASDASD";
console.log(isType(a,"string")); // true
console.log(isType(a,["string",'symbol'])); // true
console.log(isType(a,['symbol'])); // false

isBasicData(data)

判断数据是否为基础数据类型 | 参数 | 描述 | | ------------- | ------------------------------ | | data | 数据源 |

let a = "ADASDASD",b = {};
console.log(isType(a)); // true
console.log(isType(b)); // false

getType(data)

获取数据类型 | 参数 | 描述 | | ------------- | ------------------------------ | | data | 数据源 |

let a = "ADASDASD";
console.log(getType(a)); // string

initialsCase(str)

设置首字母大写不改变之后的字符串 | 参数 | 描述 | | ------------- | ------------------------------ | | str | 指定字符串 |

let a = "adaSDasd";
console.log(initialsCase(a)); // AdaSDasd

initialstoLowerCase(str)

设置首字母小写不改变之后的字符串 | 参数 | 描述 | | ------------- | ------------------------------ | | str | 指定字符串 |

let a = "AdaSDasd";
console.log(initialstoLowerCase(a)); // adaSDasd

toLowerCamelCase(str)

将字符串转为小驼峰 | 参数 | 描述 | | ------------- | ------------------------------ | | str | 指定字符串 |

let a = "Ada_sDasd";
console.log(toLowerCamelCase(a)); // adaSDasd

toCamelCase(str)

将字符串转为大驼峰 | 参数 | 描述 | | ------------- | ------------------------------ | | str | 指定字符串 |

let a = "ada_s_dasd";
console.log(toCamelCase(a)); // AdaSDasd

isJSONStr(str)

检查字符串是否为json格式 | 参数 | 描述 | | ------------- | ------------------------------ | | str | 指定字符串 |

let a = "{a:1,b:2}";
console.log(isJSONStr(a)); // true

isEqual(data1,data2)

判断两条数据是否相等 | 参数 | 描述 | | ------------- | ------------------------------ | | data1 | 数据源 | | data2 | 数据源 |

let a = {a:1,b:2},b={a:1,b:2},c=1;
console.log(isEqual(a,b)); // true
console.log(isEqual(a,c)); // false

isOdd(num)

检查是否为奇数 | 参数 | 描述 | | ------------- | ------------------------------ | | num | 需要检查的数字 |

let a = 1,b=2;
console.log(isOdd(a)); // true
console.log(isOdd(b)); // false

isBase64(str)

检查是否为Base64字符串 | 参数 | 描述 | | ------------- | ------------------------------ | | str | 需要验证的字符串 |

let a = "data:image/jpg;base64,/……";
console.log(isOdd(a)); // true

isNumber(data)

判断是否为数字 | 参数 | 描述 | | ------------- | ------------------------------ | | data | 数据源 |

let a = "12312.312";
console.log(isNumber(a)); // true
let b = "12312.312a";
console.log(isNumber(b)); // false

isPicture(picture)

判断是否为图片url | 参数 | 描述 | | ------------- | ------------------------------ | | picture | 数据源 |

let a = "xxx.jpng";
console.log(isPicture(a)); // true

isURL(url)

检查URL是否有效 | 参数 | 描述 | | ------------- | ------------------------------ | | picture | 数据源 |

console.log(isURL("https://baidu.com")); // true

dateFmt(date,fmt)

时间格式化 | 参数 | 描述 | | ------------- | ------------------------------ | | date | 需要转换格式的时间数据 | | fmt | 转换的格式 YYYY/mm/dd HH:MM:SS Y+:年、m+:月、d+:日、H+:时、M+:分、S+:秒、W+:周 |

console.log(dateFmt("2021年4月19日 14:16:28","YYYY/mm/dd HH:MM:SS")); // 2021/4/19 14:16:28

ConvertPinyin(l1,firstBoolen)

汉字转拼音 | 参数 | 描述 | | ------------- | ------------------------------ | | l1 | 指定中文字符串 | | firstBoolen | 首字母是否大写 |

console.log(ConvertPinyin("张三")); // Zhangsan

fontSize(res,maxWidth)

根据分辨率不同显示不同大小 | 参数 | 描述 | | ------------- | ------------------------------ | | res | 初始大小 | | maxWidth | 最大分辨率宽 |

console.log(fontSize(12)); // 12

hexToRgb(sColor,a)

将hex表示方式转换为rgb表示方式 | 参数 | 描述 | | ------------- | ------------------------------ | | sColor | hex 色值 | | a | 转换结束的透明度,默认1 |

console.log(hexToRgb("#fff")); // rgba(255,255,255,1)

rgbToHex(rgb)

将rgb表示方式转换为hex表示方式 | 参数 | 描述 | | ------------- | ------------------------------ | | rgb | rgb 色值 |

console.log(rgbToHex("rgba(255,255,255,0.8)")); // #FFFFFFCC

getUrlQuery(url)

从查询字符串中获取参数 | 参数 | 描述 | | ------------- | ------------------------------ | | url | url 地址 |

console.log(getQueryParams("/user?name=Orkhan&age=30")); // { name: 'Orkhan', age: '30' }

getPathParams(path: string, pathMap: string, serializer: AnyObject | null | undefined = null)

从路径中获取参数 | 参数 | 描述 | | ------------- | ------------------------------ | | path | url路径符串 | | pathMap | 需要获取参数字符串 | | serializer | 序列对象 |

console.log(getPathParams("/items/2/id/8583212", "/items/:category/id/:id", {category: v => ['Car', 'Mobile', 'Home'][v],id: v => +v})); // { category: 'Home', id: 8583212 }

generatePathQuery(path: string, pathMap: string, serializer: AnyObject | null | undefined = null)

从路径中获取参数 | 参数 | 描述 | | ------------- | ------------------------------ | | path | url路径符串 | | pathMap | 需要获取参数字符串 | | serializer | 序列对象 |

console.log(generatePathQuery("/user", { name: "Orkhan", age: 30 })); // "/user?name=Orkhan&age=30"

generatePath(path: string, obj: AnyObject): string

使用参数生成路径 | 参数 | 描述 | | ------------- | ------------------------------ | | path | url路径符串 | | obj | 参数对象 |

console.log(generatePath("/app/:page/:id", { page: "products", id: 85, })); // "/app/products/85"

howLongAgo(date: Date|number|string, type: string = "cn"): string

距现在多少时间前 | 参数 | 描述 | | ------------- | ------------------------------ | | date | 时间 new Date(2021, 0, 5) | | type | 语言类型 cn|en |

console.log(howLongAgo('2021-4-19 14:2:33')); // 1 小时前

throttl(time: number = 500)

节流 | 参数 | 描述 | | ------------- | ------------------------------ | | time | 时间长度 |

let t = throttl();
t(()=>{
    console.log(111)
})
// 500毫秒之后打印111

lazyLoad(tags: string[], node: any = null)

图片懒加载 | 参数 | 描述 | | ------------- | ------------------------------ | | tags | 图片链接地址集合 | | node | 节点 |

lazyLoad(['xxx.png','xxx.png'],document.documentElement)

randomNum(min: number, max: number)

生成区间随机数 | 参数 | 描述 | | ------------- | ------------------------------ | | tags | 图片链接地址集合 | | node | 节点 |

console.log(randomNum(0,1)) // 0.234234

setIcon(url: string)

设置页面ICON | 参数 | 描述 | | ------------- | ------------------------------ | | url | 图片地址 |

setIcon("xxx.png")

setTitle(title: string)

设置页面标题 | 参数 | 描述 | | ------------- | ------------------------------ | | title | 页面标题 |

setTitle("png")

cloneDeep(data: any)merge

数据深拷贝 | 参数 | 描述 | | ------------- | ------------------------------ | | data | 数据源 |

let a = {a:1,b:{a:1}}
console.log(cloneDeep(a)) // {a:1,b:{a:1}}

merge(data1: any,data1: 2)

数组/对象数据合并 | 参数 | 描述 | | ------------- | ------------------------------ | | data1 | 数据源 | | data2 | 数据源 |

let a = {a:1,b:{a:1}},b = {a:1,b:{a:1}}
console.log(merge(a,b)) // {a:1,b:{a:1}}
let c = [1,2,3],c = [1,2,3]
console.log(merge(c,d)) // [1,2,3]

each(data: AnyObject | any[], iteratee: Function)

数组/对象数据遍历 | 参数 | 描述 | | ------------- | ------------------------------ | | data | 数据源 | | iteratee | 回调函数 (item,key/index,data) |

let a = {a:1,b:{a:1}},b = [1,2,3]
each(a,(item,key,data)=>console.log(item,key,data)) 
//  1 a  {a:1,b:{a:1}}
//  {a:1} b  {a:1,b:{a:1}}
each(b,(item,index,data)=>console.log(item,index,data)) 
//  1 0  [1,2,3]
//  2 1  [1,2,3]
//  3 2  [1,2,3]

new event.Scheduler(limit)

并行调度器 | 参数 | 描述 | | ------------- | ------------------------------ | | limit | 并行大小 |

import {event} from "igu";
const iScheduler = new event.Scheduler(2);
iScheduler.add(1000,(add)=>{
    console.log(1111);
    add('aaaa').then(res => { console.log(res)})
},).next();

new event.Subscribe()

发布订阅 | 参数 | 描述 | | ------------- | ------------------------------ |

import {event} from "igu";
const eventSubscribe = new event.Subscribe();
eventSubscribe.on("click", (...rest) => {
  console.log(rest);
});
eventSubscribe.emit("click", 1, 2, 3, 4);

eventSubscribe.once("dbClick", () => {
  console.log(123456);
});
eventSubscribe.emit("dbClick");

request(type: string, url: string, params: AnyObject, headers: AnyObject)

axios数据请求封装 | 参数 | 描述 | | ------------- | ------------------------------ | | type | 请求类型 ('put', 'post', 'get', 'delete', 'head', 'patch','formData','upload','getBlob' | | url | 请求地址 | | params | 请求条件 | | headers | 请求头 | | other | 其他请求配置 |

import request from "igu";
request.post(
	`http://192.168.238.145:8077/bq/web/region`,
	{ region: "巴青县" },
	{
		"Content-Type": "applicationx-www-form-urlencoded",
	}
).then((res) => {
	console.log(res);
});

useRequest(callback: Function)

数据请求前处理 | 参数 | 描述 | | ------------- | ------------------------------ | | callback | 回调函数必须输出 config |

import {useRequest} from "igu";
useRequest((config) => {
	console.log(config);
	return config;
});

useResponse(callback: Function)

数据请求后处理 | 参数 | 描述 | | ------------- | ------------------------------ | | callback | 回调函数必须输出 res |

import {useResponse} from "igu";
useRequest((res) => {
	return res.data||res;
});

useConfig(config: AnyObject)

数据请求基本配置处理 | 参数 | 描述 | | ------------- | ------------------------------ | | config | 配置信息 |

import {useConfig} from "igu";
useConfig({
	defaults: {
		timeout: 0,
		withCredentials: false,
	},
});

isExistChild(data: any[] | AnyObject)

验证对象/数组是否为空数据 | 参数 | 描述 | | ------------- | ------------------------------ | | data | 数组/对象数据源 |

import {isExistChild} from "igu";
console.log(isExistChild([])) // false
console.log(isExistChild({})) // false

push(data: any[] | AnyObject, key: any, value: any)

对象/数组添加数据 | 参数 | 描述 | | ------------- | ------------------------------ | | data | 数组/对象数据源 | | key | 数组: 需要添加的参数。对象:需要添加的Key | | value | 对象:需要添加的参数 |

import {push} from "igu";
let a = {},b=[]
console.log(push(a,"key1",1)) // {key1:2}
console.log(push(b,"key1")) // ['key1']

flatter(arr: any[])

数组扁平化处理(多维数组变成一维数组) | 参数 | 描述 | | ------------- | ------------------------------ | | arr | 数组数据源 |

import {flatter} from "igu";
console.log(flatter([1,[1,[2]]])) // [1,2]

nextRegister(...fn)

手动next | 参数 | 描述 | | ------------- | ------------------------------ | | fn | 需要next的函数 |

import {nextRegister} from "igu";
function a(next){ next() }
function b(next){ next() }
function c(next){console.log(111) }
nextRegister(a,b,c) // 111

currying(fn: Function, ...args: any)

手动next | 参数 | 描述 | | ------------- | ------------------------------ | | fn | 函数 |

import {currying} from "igu";
const add = (a, b, c) => a + b + c;
const a = currying(add, 1);
console.log(a(2,3))

templateParser(template: string, data: AnyObject)

template 解析器 | 参数 | 描述 | | ------------- | ------------------------------ | | template | 模板字符串 | | data | 转换数据源 |

import {templateParser} from "igu";
console.log(templateParser('{{aa}} Word',{aa:'Hallo'}))

listToTree(data: any[])

列表转成树形结构 | 参数 | 描述 | | ------------- | ------------------------------ | | data | 数据源 |

import {listToTree} from "igu";
console.log(listToTree([
    {
        id: 1,
        text: '节点1',
        parentId: 0 //这里用0表示为顶级节点
    },
    {
        id: 2,
        text: '节点1_1',
        parentId: 1 //通过这个字段来确定子父级
    }
]))
// [
//     {
//         id: 1,
//         text: '节点1',
//         parentId: 0,
//         children: [
//             {
//                 id:2,
//                 text: '节点1_1',
//                 parentId:1
//             }
//         ]
//     }
// ]

treeToList(data: any[])

树形结构转成列表 | 参数 | 描述 | | ------------- | ------------------------------ | | data | 数据源 |

import {treeToList} from "igu";
console.log(treeToList([
    {
        id: 1,
        text: '节点1',
        parentId: 0,
        children: [
            {
                id:2,
                text: '节点1_1',
                parentId:1
            }
        ]
    }
]))
// [
//     {
//         id: 1,
//         text: '节点1',
//         parentId: 0 //这里用0表示为顶级节点
//     },
//     {
//         id: 2,
//         text: '节点1_1',
//         parentId: 1 //通过这个字段来确定子父级
//     }
// ]

setInterval(fn: Function, t: number)

setInterval 重置优化 | 参数 | 描述 | | ------------- | ------------------------------ | | fn | 回调执行方法 | | t | 时间值 |

import {setInterval} from "igu";
let iTime = setInterval(()=>{
    console.log(111111)
},1000);
iTime();

copyjs(dom:Element)

copyjs 复制当前节点内容到粘贴板 | 参数 | 描述 | | ------------- | ------------------------------ | | dom | 需要复制的节点 |

import {copyjs} from "igu";
copyjs(document.body)

append(dom: AnyObject | HTMLElement | Node, child: any[] | VNode[]): HTMLElement | Node | AnyObject

向dom节点添加子节点 | 参数 | 描述 | | ------------- | ------------------------------ | | dom | 主节点 | | child | 需要添加的节点 |

import {append} from "igu";
append(document.body,{
    tag:'div',
    attrs:{
        style:'color:red',
        innerHTML:'child'
    }
})

getChildNode(dom: AnyObject | HTMLElement | Node, child?: string | string[] | null): Node[] | HTMLElement[] | any[]

获取节点下的所有子节点 | 参数 | 描述 | | ------------- | ------------------------------ | | dom | 主节点 | | child | 子节点 |

import {getChildNode} from "igu";
getChildNode(document.body)

setTransform(el: HTMLElement, value: string): void

设置dom节点transform样式 | 参数 | 描述 | | ------------- | ------------------------------ | | el | 主节点 | | value | 样式 |

import {setTransform} from "igu";
setTransform(document.body,"")

setStyle(dom: HTMLElement | Node | any, style: string | AnyObject | any): HTMLElement | Node

设置dom节点样式 | 参数 | 描述 | | ------------- | ------------------------------ | | dom | 主节点 | | style | 样式 |

import {setStyle} from "igu";
setStyle(document.body,"color:red")

setClass(dom: AnyObject, clas: string | AnyObject | string[]): HTMLElement | Node | AnyObject

设置dom节点class | 参数 | 描述 | | ------------- | ------------------------------ | | dom | 主节点 | | clas | 样式 |

import {setClass} from "igu";
setClass(document.body,{
    color:true
})

removeClass(dom: AnyObject | HTMLElement | Node | any, clas: string | AnyObject | string[]): HTMLElement | Node | AnyObject

删除dom节点class | 参数 | 描述 | | ------------- | ------------------------------ | | dom | 主节点 | | clas | 样式 |

import {removeClass} from "igu";
removeClass(document.body,{
    color:false
})

addListener(target: any, type: string, callback: Function, options?: { passive?: boolean; capture?: boolean; }): void

添加节点事件 | 参数 | 描述 | | ------------- | ------------------------------ | | target | 节点 | | type | 事件类型 | | callback | 执行函数 | | options | 参数 |

import {addListener} from "igu";
addListener(document.body,'click',()=>{console.log('yes')})

removeListener(target: any, type: string, callback: Function, options?: { passive?: boolean; capture?: boolean; }): void

删除节点事件 | 参数 | 描述 | | ------------- | ------------------------------ | | target | 节点 | | type | 事件类型 | | callback | 执行函数 | | options | 参数 |

import {removeListener} from "igu";
removeListener(document.body,'click',()=>{console.log('yes')})

remove(node: HTMLElement): void

删除节点 | 参数 | 描述 | | ------------- | ------------------------------ | | node | 节点 |

import {remove} from "igu";
remove(document.body)

createTextNode(text: string): Text

创建文本节点 | 参数 | 描述 | | ------------- | ------------------------------ | | node | 节点 |

import {createTextNode} from "igu";
createTextNode('document.body')

createDom(vnode: VNode | any, container?: AnyObject | HTMLElement | Node): HTMLElement | Node

创建虚拟dom节点 | 参数 | 描述 | | ------------- | ------------------------------ | | vnode | 节点 | | container | 添加到父节点 |

import {createDom} from "igu";
createDom({
    tag:'div',
    attrs:{
        style:{
            color:'red',
            border:'1px solid #333'
        },
        innerHTML:'createDom document.body'
    }
},document.body)

setAttr(node: HTMLElement, attrs?: AnyObject): void

设置节点attrs | 参数 | 描述 | | ------------- | ------------------------------ | | node | 节点 | | attrs | attrs |

import {setAttr} from "igu";
setAttr(document.body,{
    style:{
        color:'red',
        border:'1px solid #333'
    },
    innerHTML:'createDom document.body'
})

getAttr(node: HTMLElement, attrName: string[] | string | any): any

获取节点attr | 参数 | 描述 | | ------------- | ------------------------------ | | node | 节点 | | attrName | attrs名称 |

import {getAttr} from "igu";
getAttr(document.body,['style','innerHTML'])

htmlStringToVNode(html: string | any): VNode

HTMLString转虚拟dom节点 | 参数 | 描述 | | ------------- | ------------------------------ | | html | HTML片段 |

import {htmlStringToVNode} from "igu";
htmlStringToVNode('<div class="test">test</div>')

isDevice(): string

判断是android还是ios还是web还是WeChat

import {isDevice} from "igu";
isDevice()

filterTag(str: string): string

过滤html代码(把<>转换) | 参数 | 描述 | | ------------- | ------------------------------ | | html | HTML片段 |

import {filterTag} from "igu";
filterTag('<div class="test">test</div>')

numberToChinese(num: number): string

将阿拉伯数字翻译成中文的大写数字 | 参数 | 描述 | | ------------- | ------------------------------ | | html | HTML片段 |

import {numberToChinese} from "igu";
numberToChinese(123456)

h5Resize(downCallback?: Function, upCallback?: Function): void

H5软键盘缩回、弹起回调 | 参数 | 描述 | | ------------- | ------------------------------ | | downCallback | 键盘缩回 | | upCallback | 弹起回调 |

import {h5Resize} from "igu";
h5Resize()

setup(name: string, params: any, expires?: string | number): any

设置localStorage Item | 参数 | 描述 | | ------------- | ------------------------------ | | name | 存储的名称 | | params | 存储的内容 | | expires | 存储的时间,不填默认永久 |

import {setup} from "igu";
setup('token','setupsetupsetupsetup',1000)

removeSub(name: string | string[]): any

删除localStorage Item | 参数 | 描述 | | ------------- | ------------------------------ | | name | 存储的名称 |

import {removeSub} from "igu";
removeSub('token')

getsub(name: string | string[]): any

获取localStorage Item | 参数 | 描述 | | ------------- | ------------------------------ | | name | 存储的名称 |

import {getsub} from "igu";
getsub('token')

clearAll(): any

清除所有localStorage Item

import {clearAll} from "igu";
clearAll()