mirror of https://github.com/Qortal/Q-Apps-Utils
Browse Source
QortalRequest.ts removed because its contents are split into multiple files printVar now checks if its parameter is null or undefined.pull/1/head
Qortal Dev
11 months ago
3 changed files with 16 additions and 1 deletions
@ -1,4 +1,20 @@ |
|||||||
|
export const objectIsNull = (variable: object) => { |
||||||
|
return Object.is(variable, null); |
||||||
|
}; |
||||||
|
export const objectIsUndefined = (variable: object) => { |
||||||
|
return Object.is(variable, undefined); |
||||||
|
}; |
||||||
|
|
||||||
export const printVar = (variable: object) => { |
export const printVar = (variable: object) => { |
||||||
|
if (objectIsNull(variable)) { |
||||||
|
console.log("variable is NULL"); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (objectIsUndefined(variable)) { |
||||||
|
console.log("variable is UNDEFINED"); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
const [key, value] = Object.entries(variable)[0]; |
const [key, value] = Object.entries(variable)[0]; |
||||||
console.log(key, " is: ", value); |
console.log(key, " is: ", value); |
||||||
}; |
}; |
||||||
|
Loading…
Reference in new issue