Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
#uke-base 基础核心库
###amountHelper
@description 数量除以100
@param {number} amount 数量
@param {number} decimals 小数位数
@returns {string}
@example
AmountHelper.centiAmount(100) 返回值 1.00
###encryption
charCodeAt 简单加密 非md5
字符串解密
deEncryption(String)
字符串加密
encryption(String)
###numberFormat 数字处理
格式化手机号码: xxx-xxxx-xxxx
formatMobilePhone(number)
格式化显示IMEI号码 xxxx-xxxx-xxxx-xxx
formatIMEI(number)
分隔字符串
@param {string|number} str 字符串
@param {number} separateLength 分隔长度
@param {string} separator 分隔符
@returns {string}
separateString(str, separateLength, separator)
###store
localStorage和sessionStorage简单封装
存储对象
localSave(key, value)
获取对象
localGet(key)
获取本地存储的长度
localSize()
根据键删除本地存储
localDelete(key)
清空本地存储
localClear()
存储session对象
sessionSave(key, value)
获取session对象
sessionGet(key)
获取session存储的长度
sessionSize()
根据键删除session存储
sessionDelete(key)
清空session存储
sessionClear()
设置cookie值
@param name 名称
@param value 名称对应值
@param Hours 过期时间
setCookie(name, value, Hours)
获取cookie值
@param name cookie名
@returns {*}
getCookie(name)
删除cookie
@param name cookie name
delCookie(name)
###timeFormat
获取当前浏览器的时区
getBrowserGMT()
获取当前浏览器时区的修正
getDateZoneOffset()
转换时间long格式到yyyy-mm-dd hh-MM-ss
d long格式数据
ks 时区
getFormatTime(d, ks)
转换时间yyyy-mm-dd hh-MM-ss格式到long
formatTimeTolong(datetime, ks)
今天的时间戳
getToday()
今天的时间格式 yyyy-mm-dd hh-MM-ss
getTodayFormat()
今天的时间格式 yyyy-mm-dd
getTodayFormatShort()
今天加减n天的时间戳
getDayNearToday(day)
今天加减n天的时间格式 yyyy-mm-dd hh-MM-ss
getDayNearTodayFormat(day)
今天加减n天的时间格式 yyyy-mm-dd
getDayNearTodayFormatShort(day)
转化日期字符串为时间戳
parseDateStr(dtStr)
转换时间到其他时区的时间
convertDatetime(1495238400000, 8, 'yyyy-MM-dd HH:mm:ss', true) 返回值 "2017-05-20 08:00:00 GMT+0800"
withGMT 返回值是否带时区标识 默认为false, 时区标识 Chrome/Edge 支持, Firefox不支持
new Date("017-05-20 08:00:00 GMT+0800")
convertDatetime(dt, targetTimezone = 0, format = 'yyyy-MM-dd HH:mm:ss', withGMT = false)
浏览器时间和UTC时间的偏移量(毫秒数)
getTimezoneOffset()
@description 通用格式化时间方法
@param {string} format 'yyyy-MM-dd HH:mm:ss.uuu' 时间格式
yyyy年 MM月 dd日 HH时 mm分 ss秒 uuu毫秒
@param {number|Date|undefined|string|mixed} dt dateTime
可以为 时间戳|Date对象|undefined|表示日期时间的字符串
@returns {string}
@throws {string}
@example
timeFormat.formatDateTime('yyyy-MM-dd', '2017-05-20 00:00:00')
返回值 "2017-05-20"
timeFormat.formatDateTime('yyyy-MM-dd HH:mm:ss.uuu', 1495209600000)
返回值 "2017-05-20 00:00:00.000"
timeFormat.formatDateTime('yyyyMMdd', 'Sat May 20 2017')
返回值 "20170520"
formatDateTime(format, dt)
###util
数组根据其中某个值进行冒泡排序
@param {object} dataList 数组
@param {object} k 排序基准值
@param {object} desc 升序还是降序排序
@return {undefined || array} 数组的值或者为空
arraySortByTag(dataList, k, desc)
根据值移除数组中的某个元素(仅仅真的非复杂对象的数组)
@param {array} dataList 数组
@param {string} value 值
@return {array} 数组的值
arrRemoveByValue(dataList, value)
异步等待功能,主要解决一下数据同步的问题,后续有可能的话可能需要对此方法进行改进
@param {function} fn 需要重置的对象
@return {Promise} Promise 对象
wait(fn)
判断是否是数字
IsNumeric(txt)
数组去重
@param thisArr 需要去重的数组
@retrun {array}去重后的新数组
unique(thisArr)
通过key获取url中的参数值
@param key
@returns {string}
getQueryString(key)
判断非空
@param obj
@returns {boolean}
isEmpty(obj)
区间随机数
@param low 开始
@param high 结束
@return {number} 随机数
randInt(low, high)
判断变量的数据类型
@param obj 变量
@return{string}
map = {
'[object Boolean]': 'boolean',
'[object Number]': 'number',
'[object String]': 'string',
'[object Function]': 'function',
'[object Array]': 'array',
'[object Date]': 'date',
'[object RegExp]': 'regExp',
'[object Undefined]': 'undefined',
'[object Null]': 'null',
'[object Object]': 'object'
};
typeOf(obj)
深度克隆
@param obj 需要克隆的对象
@retrun _obj 克隆后对象
deepCopy(obj)
判断对象是否为空
@param obj
@return {boolean}
isEmptyObject(obj)
页面跳转工具,加当前时间戳参数
使用方式 url(‘url地址’,{ 参数1:参数值1,参数2:参数值2 })
会直接跳转
RedirectUrl(url,{key:111,key1:222})
FAQs
uke base.js
The npm package uke-base receives a total of 2 weekly downloads. As such, uke-base popularity was classified as not popular.
We found that uke-base 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.