@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
14 lines (13 loc) • 351 B
JavaScript
;
function serializeValue(value) {
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);
}
module.exports = serializeValue;