@signaldb/core
Version:
SignalDB is a client-side database that provides a simple MongoDB-like interface to the data with first-class typescript support to achieve an optimistic UI. Data persistence can be achieved by using storage providers that store the data through a JSON in
17 lines (16 loc) • 382 B
JavaScript
function serializeValue(value) {
if (value == null)
return null;
if (typeof value === "string")
return value;
if (typeof value === "number")
return value.toString();
if (typeof value === "boolean")
return value.toString();
if (value instanceof Date)
return value.toISOString();
return JSON.stringify(value);
}
export {
serializeValue as default
};