1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2024-11-22 07:49:38 +01:00
deka-dom-el/src/helpers.js
Jan Andrle 5436e50a95
🐛 Try to make undefined more inuitive…
…(as it is ‘template lang’ not only `assign`)
2023-09-13 13:06:25 +02:00

18 lines
483 B
JavaScript

export function isUndef(value){ return typeof value==="undefined"; }
export function typeOf(v){
const t= typeof v;
if(t!=="object") return t;
if(v===null) return "null";
return Object.prototype.toString.call(v);
}
export function onAbort(signal, listener){
if(!signal || !(signal instanceof AbortSignal))
return true;
if(signal.aborted)
return;
signal.addEventListener("abort", listener);
return function cleanUp(){
signal.removeEventListener("abort", listener);
};
}