purs-pkg-deps
Version:
Query package dependencies in PureScript package-sets
23 lines (21 loc) • 551 B
JavaScript
;
exports._unsafeReadProtoTagged = function (nothing, just, name, value) {
if (typeof window !== "undefined") {
var ty = window[name];
if (ty != null && value instanceof ty) {
return just(value);
}
}
var obj = value;
while (obj != null) {
var proto = Object.getPrototypeOf(obj);
var constructorName = proto.constructor.name;
if (constructorName === name) {
return just(value);
} else if (constructorName === "Object") {
return nothing;
}
obj = proto;
}
return nothing;
};