js-common-toolkit
v1.0.3
Published
Make the modal component of bootstrap easier to use
Downloads
10
Readme
js常用方法工具
检测目标是否是空,是否是对象,是否是数组,获取地址栏指定参数值,检测是否是手机号,复制内容到剪切板,获取图片真实宽高等等
调用方式
安装
npm i js-common-toolkit
引入
import jsUtils from 'js-common-toolkit'
示例:
// 检测目标是否为空
jsUtils.isEmpty('')
// 检测内容是否为邮箱
jsUtils.isEmail('[email protected]')
// 获取url链接上userName的值
jsUtils.getUrlParam('userName')
创建js工具项目
npm init -y 快速生成一个node.js项目,-y 参数表示自动接受默认设置,无需手动输入 修改package.json配置项: name属性是插件的名称,不允许重复; 添加 type:"module",就可以在js里面使用import和export; version不允许重复,每次发布都得改一下
js工具发布到npm
需要设置npm源
npm config set registry https://registry.npmjs.org/
登录npm账号(输入账号、密码、邮箱)
npm login
发布到npm上,可以npm i 安装使用
npm publish
** version版本不允许重复