
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
mk-methodjs
Advanced tools
作者:Kevin.W
npm安装 npm i mk-methodjs
import method from '文件地址';
console.log("方法库", method)
// 框架内使用时
const { libs } = getApp();
let newStr = method.dataFormat('需要转换的日期','当前分割字符','需要改变的分割字符');
// 返回对象的str字段为转换好的日期格式
let res = method.CheckRecords('每页加载条数','当前加载页数','总条数')
// 返回的是record对象 page表示需要增加的页数,isDone表示是否已加载完全部条数
// 请注意 接口返回的总条数字段,传入的当前加载页数将会与计算后的总页数做比较进行计算
// 使用该方法时应再次调用查询记录的接口,且传入要增加的字段
let res = method.addZero('需要补零的值','一共需要补零的个数')
// 返回加零或不需加零的值,任意长度
// 第二个参数最好不要传小于2的值(不然没有意义),不传时默认为2
let res = method.dayChange('需要转换的星期')
// 返回星期几这样的,传入的一定是数字
// 注意:星期日是0,其余为正常数
let res = method.getTime()
// 返回一个对象,格式为
{success:true,data:{'返回的时间数据'}}
let res = method.changeTimeStamp('传入时间戳')
// 返回一个对象,格式为
{success:true,data:{'返回的已转换的时间数据'}}
let res = method.removeDuplicate('传入需要去重的数组')
// 返回去重之后的数组
let res = method.cutdone('传入需要重组的json数组')
// 返回重组之后的json数组,格式为
[
{
itemId:xxx, // 商品id
skuId:xxx, // 商品skuid
num:xxx, // 数量
}
]
// 注意只适用于一键加购和一键下单
// 普通单次加购使用官方api sku选择器即可
let res = method.cutdone('传入结束时间戳','所需格式(可不传)')
// 格式:(不传值时默认将五个值分别返回)
'd-h-m-s-ms',
'd-h-m-s',
'h-m-s-ms',
'h-m-s',
'h-s',
's-ms'
// 返回一个对象,格式为
{success:true,data:{'返回的倒计时时间数据'}}
let res = await method.checkVip('传入商家sellerId')
// 返回一个对象,格式为
{success:true,data:{'isMember为是否会员的判断'}}
let res = await method.getSeverTime()
// 返回一个对象,格式为
{success:true,data:{'将获取的服务器时间戳进行转换后的数据'}}
let res = method.createUrl('传入一个对象,会将对象里path的值认为路径','传布尔值,是否进行url编码')
// 当对象里有path时会返回完整的url,没有时会返回纯参数parma
// 第二个参数为true时为编码
// 返回一个对象,格式为
{success:true,url:''}
// 或
{success:true,parma:''}
let res = method.changeUrl('传入url连接,需为字符类型','传布尔值,是否进行url解码')
// 当url里有识别到路径时会返回路径,没有时会返回纯参数parma
// 第二个参数为true时为解码
// 返回一个对象,格式为
{success:true,urlPath:'',urlParma:{}}
// 或
{success:true,parma:{}}
let res = method.copy(parma)
// parma可以是数组或对象
// 返回拷贝之后的数组或对象
handleTap:libs.method.debounce(funtion(e){
console.log(e[0]);
},300,funtion(e){
console.log(e[0]);
},3000,3)
handleTap:libs.method.throttle(funtion(e){
console.log(e[0]);
},2000)
libs.method.isTel(tel)
libs.method.isEmail(email)
libs.method.isNull(data)
| 版本 | 1.0.4 |
|---|---|
| 更新内容 | 优化方法,压缩代码,修复bug |
| 版本 | 1.0.5 |
| 更新内容 | 加入深拷贝方法,修复bug |
FAQs
一个js封装的库
We found that mk-methodjs 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.