Skip to content

Commit

Permalink
feat(type): 新增isFalsy, isTruthy
Browse files Browse the repository at this point in the history
  • Loading branch information
vfiee committed Apr 2, 2022
1 parent a58d3db commit d97d81c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/type/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author: vyron
* @Date: 2022-01-10 17:38:09
* @LastEditTime: 2022-04-01 14:44:04
* @LastEditTime: 2022-04-01 15:02:15
* @LastEditors: vyron
* @Description: 判断数据类型
* @FilePath: /v-utils/packages/type/src/index.ts
Expand Down Expand Up @@ -84,6 +84,12 @@ export const isNaN = (value: unknown): boolean => value !== value
export const isNil = (value: unknown): boolean =>
value === null || value === undefined

// 是否为假值
export const isFalsy = (value: unknown): boolean => !!value === false

// 是否为真值
export const isTruthy = (value: unknown): boolean => !isFalsy(value)

// 判断是否为有效的数组长度
const MAX_SAFE_INTEGER = 9007199254740991
export const isLength = (value: unknown): boolean =>
Expand Down

0 comments on commit d97d81c

Please sign in to comment.