utils.js 473 B

12345678910111213141516171819
  1. export const domReady = () => {
  2. return new Promise(resolve => {
  3. if (document.readyState == "loading") {
  4. document.addEventListener("DOMContentLoaded", resolve)
  5. } else {
  6. resolve()
  7. }
  8. })
  9. }
  10. export const isNullOrUndefined = value => {
  11. return value === null || value === undefined
  12. }
  13. export const isObject = _ => {
  14. return Object.getPrototypeOf(_) === Object.prototype
  15. }
  16. export const isArray = _ => Array.isArray(_)