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

m-vue-util

v0.0.11

Published

```JavaScript import { isUndefined } from 'm-vue-util';

Readme

Vue3 工具

使用

import { isUndefined } from 'm-vue-util';

console.log(isUndefined('test'));

方法

isUndefined(obj: any) //校验变量是否存在
isNull(obj: any) //校验变量是否是NULL
isString(obj: any) //校验变量是否是字符串
isNumber(obj: any) //校验变量是否是数字
isArray(obj: any) //校验变量是否是数组
isDate(obj: any) //校验变量是否是时间
isFunction(obj: any) //校验变量是否是方法
isObject(obj: any) //校验变量是否是对象
isBoolean(obj: any) //校验变量是否是布尔值
isSymbol(obj: any) //校验变量是否是Symbol
isRegExp(obj: any) //校验变量是否是正则
isError(obj: any) //校验变量是否是Error
isHTMLDocument(obj: any) //校验变量是否是HTMLDocument
isEmpty(obj: any) //校验变量是否是空(undefined、null、空字符串、NaN、空数组、空对象)
trim(obj: string, position = 'both') //去除字符串空格(position[both:前后空格,left:前空格,right:后空格,all:所有空格])
clone(obj: any) //深度克隆对象
mergeObject(target: { [key: string]: any }, ...sources: Array<{ [key: string]: any }>) //深度合并对象
getObject(obj: { [key: string]: any }, key: string | Array<string>, defaultValue?: any) //获取多级对象值
firstCase(str: string) //首字母大写
guid(rod = true) //生成UUID
debounce(fn: () => void, delay = 500, immdiate = false, name?: string, callBack: (value: any) => void) //防抖函数(delay时间间隔毫秒,immdiate是否立即执行,name唯一标识名称)
throttle(fn: () => void, delay = 500, immdiate = true, name?: string, callBack: (value: any) => void) //节流函数(delay时间间隔毫秒,immdiate是否立即执行,name唯一标识名称)
getUnit(value: string | number) //动态尺寸后缀
isUrl(str: string) //判断字符串是否是URL
download(content: string, name?: string) //浏览器下载(content下载地址或者bse64内容)
readFileText(file: File, callBack: (content: string) => void) //读取文件内容
readFileDataURL(file: File, callBack: (result: string) => void) //读取文件地址
toStr(obj: any) //数据转字符串(undefined、null、字符串、数字、数组、对象、方法)
strEval(str: string) //字符串转可执行方法
objToUrl(obj: { [key: string]: any }) //对象转URL地址
ajax(url: string, options?: { [key: string]: any }, success?: (value: any) => void, error?: (status: number, e: any) => void) //远程请求(options = { type: '', params:{}, headers: {}, mimeType: '', timeout: 500 })
loadJS(url: string) //加载JS文件,返回Promise加载完成执行then
listToTree(list: Array<{ [key: string]: any }>, idName = 'id', childrenName = 'children') //列表转树形
treeToList(tree: Array<{ [key: string]: any }>, childrenName = 'children') //树形转列表
filterTree(tree: Array<{ [key: string]: any }>, fields: Array<string>, value: string, childrenName = 'children') //树形过滤
findTree(tree: Array<{ [key: string]: any }>, where: (value: { [key: string]: any }) => {}, childrenName = 'children') //通过自定义条件查询树形节点
findTreeById(tree: Array<{ [key: string]: any }>, id: number | string, idName = 'id', childrenName = 'children') //通过唯一标识查询树形节点
eachTree(tree: Array<{ [key: string]: any }>, where: (value: { [key: string]: any }) => void, childrenName = 'children') //循环遍历树形
loadImage(url: string, callBack: (img: any) => void) //加载图片
local(key: string, value?: any) //长期缓存
session(key: string, value?: any) //临时缓存
removeLocal(key: string) //移除长期缓存
removeSession(key: string) //移除临时缓存