Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
zoedylan-tool
Advanced tools
zoeDylan 私人工具包
收集前端开发中的各种小技巧和小工具,例如随机字符串、数字什么的,各种验证什么的。
npm zoedylan-tool
cosnt tool = require('zoedylan-tool');
or const { } = require('zoedylan-tool');
_randomColor();
随机 16 进制颜色值
@return String
_randomColor(); // #000000
_randomNum(min[,max[,decimal]]);
随机数字
*
min:Number
最小值
max:Number
最大值
decimal:Number
小数位数 (Max:10
anddefault:0
)
@return Number
_randomNum(5); // 0 - 5
_randomNum(1, 5); // 1 - 5
_randomNum(10, 5); // 5 - 10
_randomNum(0, 5, 1); // 0.0 - 5.0
_randomNum(0, 5, 2); // 0.00 - 5.00
_randomString([length[, chars]])
随机字符串
length:Number
字符串长度 (default:32
)
chars:String
自定义字符串 (default:ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678
)
@return String
_randomString(); //32位字符串
_randomString(5); //5位字符串
_randomString(3, "abcdef"); //3位字随机`abcdef`字符串
_randomStringBySymbol([length]) 包含符号的随机字符串
length:Number
字符串长度 (default:32
)
@return String
_randomStringBySymbol(); //32位字符串
_cookie
cookie 操作 * 仅用于浏览器
_cookie.set(name,val,day)
设置 cookie
*
name:String
cookie 名称
*
val:String
cookie 值
*
day:Number
cookie 保存天数 (default:0
)
@return undefined
_cookie.set("zoeDylan", "_cookie.set"); //保存0天cookie
_cookie.set("zoeDylan", "_cookie.set", 2); //保存2天cookie
_cookie.get(name)
获取 cookie
name:String
cookie 名称
@return String
_cookie.set("zoeDylan"); // '_cookie.set'
_cookie.getAll()
获取全部 cookie
@return Object
_cookie.getAll(); // {'name1':'val1','name2':'value2'}
_cookie.clear(name)
清除 cookie
name:String
cookie 名称
@return undefined
_cookie.clear("zoeDylan"); //清除 zoeDylan
_cookie.clearAll()
清除全部 cookie
@return undefined
_cookie.clearAll(); //清除全部cookie
_isEmail(val)
是否是邮箱格式
val:String
邮箱
@return Boolean
_isEmail("627213037@qq.com"); //true
_isEmail(`123`); //false
_isPhone(val)
是否是手机格式
val:String
手机号
@return Boolean
_isPhone("13511221122"); //true
_isPhone(`123`); //false
_isIDcard(val)
是否是中国身份证
val:String
身份证号
@return Boolean
_isIDcard("312334958722348857"); //true
_isIDcard(`123`); //false
_wx
微信开发
_wx.init(config,shareConfig)
模块初始化,必须调用次方法才能其它操作
config:Object
微信权限配置shareConfig:Object
微信分享配置@return undefined
_wx.init(
{
//debug模式 默认:false
debug: Boolean,
appId: String,
timestamp: String,
nonceStr: String,
signature: String,
//微信api列表 默认:['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','onMenuShareQZone']
jsApiList: Array
},
{
title: String, //标题
desc: String, //描述
link: String, //地址
imgUrl: String, //图片
success: Function, //分享成功回调
cancel: Function //分享取消回调
}
);
_wx.setShareConfig(shareConfig)
微信分享配置
shareConfig:Object
微信分享配置@return undefined
_wx.setShareConfig({
title: String, //标题
desc: String, //描述
link: String, //地址
imgUrl: String, //图片
success: Function, //分享成功回调
cancel: Function //分享取消回调
});
_wx.setShareCancel(fn)
设置分享取消的事件
fn:Function
>>@return undefined
_wx.setShareCancel(function() {
//you code
});
_wx.setShareSuccess(fn)
设置分享完成的事件
fn:Function
>>@return undefined
_wx.setShareSuccess(function() {
//you code
});
_queryURL(url)
解析 URL 参数
url:String
@return Object
cosnt url = _queryURL('http://www.a.com?a1=123&num=100');
console.log(url.a1);//123
console.log(url['num']);//100
_element.hasClass(elements,cName)
查询元素是否存在某个class
elements:element Object
>>cName:String
>>@return Boolean
_element.hasClass(document.querySelector("body"), "phoen"); //false
_element.addClass(elements,cName)
给元素添加class
elements:element Object
>>cName:String
>>@return undefined
_element.addClass(document.querySelector("body"), "phoen");
_element.removeClas(elements,cName)
移除某个元素的class
elements:element Object
>>cName:String
>>@return undefined
_element.removeClas(document.querySelector("body"), "phoen");
2018-04-19
添加random
中的_randomStringBySymbol
函数,用于生成包含特殊字符的字符串
修复random
中_randomString
函数判断toString
报错BUG
2017-12-01
is
的isIDcard
中国身份证验证2017-11-28
element
的class
处理2017-11-22
url
参数解析方法:queryURL(string)
2017-08-17
2017-08-09
2017-07-28
FAQs
zoeDylan私人工具包
We found that zoedylan-tool demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.