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 🙏

© 2026 – Pkg Stats / Ryan Hefner

educiot-public

v0.0.8

Published

educiot-public

Readme

育联网web端常用方法合集

使用方法

import { a } from "educiot-public"

方法说明

1、saveUserInfo(k,i)设置本地缓存

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | ------------- | ---- | | k | String | 设置缓存的key | 是 | | i | Object | 缓存的数据 | 是 |

2、getUserInfo(k)获取本地缓存

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | ----------------- | ---- | | k | String | 需要获取缓存的key | 是 |

3、removeUserInfo(k)删除本地缓存

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | ----------------- | ---- | | k | String | 需要删除缓存的key | 是 |

4、clearCache(o)清除keep-alive

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | ------------ | ---- | | o | Object | 实例对象this | 是 |

5、jsonClearVoid(o)清除json中为空的key

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | -------- | ---- | | o | Object | json对象 | 是 |

6、mutualApp(o)与app通信

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | ------------------------------------------------------------ | ---- | | o | Object | {goNext: 与app协商的名称,data: 需要传递的数据,url: 单纯的链接跳转,此时不需要data} | 是 |

7、checkFormula(s,o)检查公式

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | -------------------------------- | ---- | | s | String | 公式字符串 | 是 | | o | Object | 将公式中动态值赋予随机数值的json | 是 |

8、setSize(n)设置尺寸大小,主要用于echarts图表柱状宽度或者字体大小

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | ----------------- | ---- | | n | Number | 375px宽度下的大小 | 是 |

9、getYMD(s,b)年月日格式化

| 参数 | 类型 | 说明 | 必传 | | ---- | ------- | ------------------------------ | ---- | | s | String | 需要转换的时间字符串或者时间戳 | 是 | | b | Boolead | 是否显示周 | 否 |

10、removeSpecial(s)删除上传文件名中的特殊字符

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | ------ | ---- | | s | String | 文件名 | 是 |

11、uniqueArray(a,k)json数组去重

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | ------------- | ---- | | a | Array | 数组 | 是 | | k | String | 唯一标识的key | 是 |

12、needs(n,o)对比条件返回一个布尔值

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | --------------------------- | ---- | | n | Object | 条件对象([表示或],{表示且}) | 是 | | o | Object | 参照条件 | 是 |

示例

let a = [

​ {name: '选择会议通知发布时间', type: 'time', key: 'issuetime', col: 4,need: { type: 0 }},

​ {name: '选择会议纪要发布时间', type: 'time', key: 'issuetime', col: 4,need: { type: 1 }},

​ {name: '选择会议时间', type: 'time', key: 'time', col: 4},

]

let type = 0;

reutrn a.filter(v => needs(v.need, { type: type}))

注:对象没有need条件则返回true,need可以是json也可以是数组,json表示为且,数组表示或

need: { type: [ 1,2 ],name: '张三' };need: [{type: [1,2,3],name: '张三'},{type: 4,name: '李四'}]

13、downloadFile(u,n)下载文件

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | ------- | ---- | | u | String | 文件url | 是 | | n | String | 文件名 | 是 |

14、checkFile(o, a, z)检查是否包含文件(用于pc端导出详情功能)

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | -------------------------- | ---- | | o | Object | 数据源,一般为接口返回数据 | 是 | | a | Array | 按钮列表 | 是 | | z | String | 文件合集字段名 | 否 |

示例

let o = {

​ imgs: [],

​ files: [],

​ contents: [

​ {

​ type: 3,

​ imgs: []

​ },{

​ type: 4,

​ imgs: []

​ }

​ ],

​ recordInfo: {

​ imgs: []

​ }

}

let a = [

​ {name: '导出详情', key: 'data'},

​ {name: '导出图片',key: 'imgs',need: ['imgs',{recordInfo: 'imgs'}]},

​ {name: '导出附件',key: 'files',need: ['files',{contents: {type: 3}}]}

]

15、findFile(a,c,k,z)返回文件合集(用于pc端导出详情功能)

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | -------------------------- | ---- | | a | Object | 数据源,一般为接口返回数据 | 是 | | c | Object | 导出文件类型的配置 | 是 | | k | String | 类型字段名 | 是 | | z | String | 文件合集字段名 | 否 |

示例

a 如同14中的o

let c = {

​ imgs: ['imgs',{recordInfo: 'imgs'}],

​ files: ['files',{contents: {type: 3}}]

}

k: 'imgs' || 'files'

16、getFileName(s,k,l)查找字符串中第几个某元素的下标

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | ---------------- | ---- | | s | String | 需要查找的字符串 | 是 | | k | String | 查找的元素 | 是 | | l | Number | 第几个 | 是 |

17、getStrId(str,sk,ek)查找字符串中俩个字符中间的内容

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | ------------------------ | ---- | | str | String | 需要查找的字符串 | 是 | | sk | String | 开始的字符 | 是 | | ek | String | 结束的字符,不传即到最后 | 否 |

18、shuffle(a,n)数组中随机选出n个元素

| 参数 | 类型 | 说明 | 必传 | | ---- | ------ | -------------------- | ---- | | a | Array | 基础数组 | 是 | | n | number | 需要选出的元素的个数 | 是 |