mazey
    Preparing search index...

    Function getLocalJSON

    • Read a value from localStorage, parsing JSON when possible.

      Usage:

      import { setLocalJSON, getLocalJSON } from "mazey";

      setLocalJSON("preferences", { theme: "dark" });
      const preferences = getLocalJSON("preferences");
      console.log(JSON.stringify(preferences));

      Output:

      {"theme":"dark"}
      

      Type Parameters

      • T

      Parameters

      • key: string

        Storage key.

      Returns T | null

      The parsed value, raw stored value, or null when no value exists.