first commit
This commit is contained in:
29
resources/js/@core/utils/helpers.js
Normal file
29
resources/js/@core/utils/helpers.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// 👉 IsEmpty
|
||||
export const isEmpty = value => {
|
||||
if (value === null || value === undefined || value === '')
|
||||
return true
|
||||
|
||||
return !!(Array.isArray(value) && value.length === 0)
|
||||
}
|
||||
|
||||
// 👉 IsNullOrUndefined
|
||||
export const isNullOrUndefined = value => {
|
||||
return value === null || value === undefined
|
||||
}
|
||||
|
||||
// 👉 IsEmptyArray
|
||||
export const isEmptyArray = arr => {
|
||||
return Array.isArray(arr) && arr.length === 0
|
||||
}
|
||||
|
||||
// 👉 IsObject
|
||||
export const isObject = obj => obj !== null && !!obj && typeof obj === 'object' && !Array.isArray(obj)
|
||||
|
||||
// 👉 IsToday
|
||||
export const isToday = date => {
|
||||
const today = new Date()
|
||||
|
||||
return (date.getDate() === today.getDate()
|
||||
&& date.getMonth() === today.getMonth()
|
||||
&& date.getFullYear() === today.getFullYear())
|
||||
}
|
Reference in New Issue
Block a user