mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-09 01:32:29 +08:00
30 lines
510 B
JavaScript
30 lines
510 B
JavaScript
![]() |
function isString(obj) {
|
||
|
if (typeof obj !== 'string') {
|
||
|
return `'${obj}' is not a string`;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function isStringOrNull(obj) {
|
||
|
if (obj) {
|
||
|
return isString(obj);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function isBoolean(obj) {
|
||
|
if (typeof obj !== 'boolean') {
|
||
|
return `'${obj}' is not a boolean`;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function isInteger(obj) {
|
||
|
if (!Number.isInteger(obj)) {
|
||
|
return `'${obj}' is not an integer`;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
isString,
|
||
|
isStringOrNull,
|
||
|
isBoolean,
|
||
|
isInteger
|
||
|
};
|