2025-06-22 00:21:09 +03:00

51 lines
1.1 KiB
JavaScript

function noop() {
}
function is_promise(value) {
return !!value && (typeof value === "object" || typeof value === "function") && typeof /** @type {any} */
value.then === "function";
}
function run(fn) {
return fn();
}
function blank_object() {
return /* @__PURE__ */ Object.create(null);
}
function run_all(fns) {
fns.forEach(run);
}
function is_function(thing) {
return typeof thing === "function";
}
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function";
}
function subscribe(store, ...callbacks) {
if (store == null) {
for (const callback of callbacks) {
callback(void 0);
}
return noop;
}
const unsub = store.subscribe(...callbacks);
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
function get_store_value(store) {
let value;
subscribe(store, (_) => value = _)();
return value;
}
function null_to_empty(value) {
return value == null ? "" : value;
}
export {
noop as a,
safe_not_equal as b,
is_function as c,
blank_object as d,
get_store_value as g,
is_promise as i,
null_to_empty as n,
run_all as r,
subscribe as s
};