2.1.2 • Published 8 years ago

local-preferences v2.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Methods

localPreferences.set(key, value)

Sets value in localStorage. set key to null to clear the entry.

import {set} from "local-preferences"

set("isLoggedIn", true)
set("userId", 123)
set("email", "foo@bar.baz")
set("object", {
  foo: {
    bar: "baz"
  }
})

localPreferences.get(key, fallback)

Retrieves value from localStorage.

import {get} from "local-preferences"

get("isLoggedIn") // => true
get("userId")  // => 123
get("email")  // => "foo@bar.baz"
get("object")  // => {foo: {bar: "baz"}}

get("unset", "foo")  // => "foo"

localPreferences.clear()

Passthrough to the native localStorage.clear()

2.1.2

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.0.3

9 years ago