import { identity } from "../utils/identity.js";
/**
 * @since 6.0.0
 * @internal
 */ export const defaultLocalStorageSerializer = (value)=>typeof value === "string" ? value : `${value}`;
/**
 * @since 6.0.0
 * @internal
 */ export function getStorageSerializers(options) {
    const { initialValue } = options;
    // this allows for strings to automatically be stored as-is instead of adding
    // additional quotes around then with JSON.stringify
    const raw = options.raw ?? typeof initialValue === "string";
    const serializer = options.serializer ?? (raw ? defaultLocalStorageSerializer : JSON.stringify);
    const deserializer = options.deserializer ?? (raw && typeof initialValue === "string" ? identity : JSON.parse);
    return {
        serializer,
        deserializer
    };
}

//# sourceMappingURL=internalUtils.js.map