refactor(storage): instantiate localStorage from a factory

Fixes #1921.

@ckarlof r?
I've added an `isNull` method. :ship: :it: