Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小刘28
xz-uniapp
提交
a5db3092
xz-uniapp
项目概览
小刘28
/
xz-uniapp
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
xz-uniapp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a5db3092
编写于
7月 19, 2022
作者:
小刘28
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:调整部分类型校验代码;
Signed-off-by:
xiaozuo28
<
1032584581@qq.com
>
上级
bdec63f3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
223 addition
and
0 deletion
+223
-0
utils/help/xzFile.js
utils/help/xzFile.js
+0
-0
utils/help/xzImage.js
utils/help/xzImage.js
+0
-0
utils/other/xzCopy.js
utils/other/xzCopy.js
+0
-0
utils/other/xzType.js
utils/other/xzType.js
+223
-0
未找到文件。
utils/
validate
/xzFile.js
→
utils/
help
/xzFile.js
浏览文件 @
a5db3092
文件已移动
utils/
validate
/xzImage.js
→
utils/
help
/xzImage.js
浏览文件 @
a5db3092
文件已移动
utils/xzCopy.js
→
utils/
other/
xzCopy.js
浏览文件 @
a5db3092
文件已移动
utils/other/xzType.js
0 → 100644
浏览文件 @
a5db3092
/**
* @Author: xiaozuo28
* @Date: 2022年5月13日08:05:20
* @LastEditors: xiaozuo28
* @LastEditTime: 2022年7月19日23:47:40
* @Description: 数据类型处理
**/
export
default
{
/**
* @Description 校验是否是字符串
* @Date 2022年7月19日23:51:27
* @Param {Object} obejct 待校验对象
* @Return {Boolean} true:是,false:不是
**/
isString
(
obejct
)
{
return
Object
.
prototype
.
toString
.
call
(
obejct
).
slice
(
8
,
-
1
)
===
'
String
'
;
},
/**
* @Description 校验是否是数字
* @Date 2022年7月19日23:51:27
* @Param {Object} obejct 待校验对象
* @Return {Boolean} true:是,false:不是
**/
isNumber
(
obejct
)
{
return
Object
.
prototype
.
toString
.
call
(
obejct
).
slice
(
8
,
-
1
)
===
'
Number
'
;
},
/**
* @Description 校验是否是Boolean
* @Date 2022年7月19日23:51:27
* @Param {Object} obejct 待校验对象
* @Return {Boolean} true:是,false:不是
**/
isBoolean
(
obejct
)
{
return
Object
.
prototype
.
toString
.
call
(
obejct
).
slice
(
8
,
-
1
)
===
'
Boolean
'
;
},
/**
* @Description 校验是否是函数
* @Date 2022年7月19日23:51:27
* @Param {Object} obejct 待校验对象
* @Return {Boolean} true:是,false:不是
**/
isFunction
(
obejct
)
{
return
Object
.
prototype
.
toString
.
call
(
obejct
).
slice
(
8
,
-
1
)
===
'
Function
'
;
}
}
/**
* @description 是否是Null
* @param {Object} obj 待判断对象
* @example
* obj.ubIsNull(null);<br/>
* true
*/
function
ubIsNull
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
Null
'
;
}
/**
* @description 是否是undefined
* @param {Object} obj 待判断对象
* @example
* obj.ubIsUndefined(undefined);<br/>
* true
*/
function
ubIsUndefined
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
Undefined
'
;
}
/**
* @description 是否是对象
* @param {Object} obj 待判断对象
* @example
* obj.ubIsObject(new Object());<br/>
* true
*/
function
ubIsObject
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
Object
'
;
}
/**
* @description 是否是数组
* @param {Object} obj 待判断对象
* @example
* obj.ubIsArray([1,2,3]);<br/>
* true
*/
function
ubIsArray
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
Array
'
;
}
/**
* @description 是否是时间
* @param {Object} obj 待判断对象
* @example
* obj.ubIsDate(new Date());<br/>
* true
*/
function
ubIsDate
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
Date
'
;
}
/**
* @description 是否是正则表达式
* @param {Object} obj 待判断对象
* @example
* obj.ubIsRegExp(/,/g);<br/>
* true
*/
function
ubIsRegExp
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
RegExp
'
;
}
/**
* @description 是否是错误对象
* @param {Object} obj 待判断对象
* @example
* obj.ubIsError(new Error());<br/>
* true
*/
function
ubIsError
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
Error
'
;
}
/**
* @description 是否是Symbol函数
* @param {Object} obj 待判断对象
* @example
* obj.ubIsSymbol(Symbol());<br/>
*/
function
ubIsSymbol
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
Symbol
'
;
}
/**
* @description 是否是Promise对象
* @param {Object} obj 待判断对象
* @example
* obj.ubIsPromise(new Promise(function(resolve, reject) {}));<br/>
* true
*/
function
ubIsPromise
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
Promise
'
;
}
/**
* @description 是否是Set
* @param {Object} obj 待判断对象
* @example
* obj.ubIsSet(new Set());<br/>
* true
*/
function
ubIsSet
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
Set
'
;
}
/**
* @description 是否是Map
* @param {Object} obj 待判断对象
* @example
* obj.ubIsMap(new Map());
* true
*/
function
ubIsMap
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
Map
'
;
}
/**
* @description 是否是Math
* @param {Object} obj 待判断对象
* @example
* obj.ubIsMath(Math);<br/>
* true
*/
function
ubIsMath
(
obj
)
{
return
Object
.
prototype
.
toString
.
call
(
obj
).
slice
(
8
,
-
1
)
===
'
Math
'
;
}
/**
* @description 是否是False
* @param {Object} obj
* @example
* obj.ubIsFalse(false);<br/>
* true
*/
function
ubIsFalse
(
obj
)
{
if
(
!
obj
||
obj
===
'
null
'
||
obj
===
'
undefined
'
||
obj
===
'
false
'
||
obj
===
'
NaN
'
){
return
true
}
return
false
;
}
/**
* @description 是否是True
* @param {Object} obj 待判断对象
* @example
* obj.ubIsTrue(true);<br/>
* true
*/
function
ubIsTrue
(
obj
)
{
return
!
this
.
ubIsFalse
(
obj
);
}
export
default
{
ubIsString
,
ubIsNumber
,
ubIsBoolean
,
ubIsFunction
,
ubIsNull
,
ubIsUndefined
,
ubIsObject
,
ubIsArray
,
ubIsDate
,
ubIsRegExp
,
ubIsError
,
ubIsSymbol
,
ubIsPromise
,
ubIsSet
,
ubIsMap
,
ubIsMath
,
ubIsFalse
,
ubIsTrue
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录