Detecting the framework from a signal factory function signature?
I'm trying to figure out an approach for detecting what framework a signal function is coming from.
Something like this.
detectFrameworkForSignalFactory(factory) {
if (isAngular(factory) {
return "ITS ANGULAR!!"
}
if (isVue(factory) {
return "ITS VUE!!"
}
if (isPreact(factory) {
return "ITS Preact!!"
}
if (isLit(factory) {
return "ITS Lit!!"
}
}
Gemini is suggesting various approaches to this. For example:
function detectSignal(sig) {
if (sig && sig.__v_isRef === true) {
return 'vue-ref';
}
if (typeof sig === 'function') {
// SolidJS getter functions are plain functions
return 'solid-signal';
}
return 'unknown';
}
Just wanted to see if perhaps there is a more generic approach?