1.0.1 • Published 2 years ago

react-native-wenkingtools v1.0.1

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

react-native-wenkingtools

描述

该库主要收集通用项目中常用的方法

安装

npm install react-native-wenkingtools --save

or

yarn add react-native-wenkingtools

需要安装第三方库

npm install moment --save

or

yarn add moment

引入

import {WenKingTools} from 'react-native-wenkingtools';

// TODO: What to do with the module?
WenKingTools;

方法

方法默认值描述
log控制是否打印-用于设置是否打印输出
deepClone深度拷贝
multiClickcallback:回调函数 count:点击次数 默认4次 duration:有效时间,默认2s 单位秒多次点击事件
repetitionCallcallBack:回调函数 duration:运行重复调用时间间隔,默认2s,单位秒防止重复调用
priceToStringprice:价格normal:null/undefined/无法转换价格返回的缺省值价格转换为x.xx
dateToStringdate:时间format:默认为YYYY-MM-DD HH:mm:ss时间格式转换
phoneSeparatedphoneno:手机号手机号码格式转化为 344 格式 (188 3886 9199)
encryptPhonenophoneno:手机号手机号码加密(188****9199)
encryptIdNoidNo:身份证号身份证号加密
validatorIdNoidNo:身份证号验证身份证号是否正确
changeToStringvalue:价格normal:缺省值默认为''转换为string-避免nullundefined字段显示报错
removeAllSpacetext:字符串string去除空格
randomAroundmin:最小值max:最大值生成随机数
stringPaddinglabelNumber:总长度 type:不缺位置left/right scale:scale根据不同的值设置” “,4倍为一个中文字体大小,“-” 2倍为一个中文字体大小,“a” 2倍为一个中文字体大小,默认为1string补充长度
numberPaddingvalue:值minLength:最小程度数字转string前缀补0
sortAsciiobject按ascii字母排序,返回string
sleeptime:等待时间(单位秒)睡眠-等待
compareDated1:第一个时间d2:第二个时间比较两个日期大小