     encodeURIComponent JSON.stringify data
 
   # Clear all keys from `localStorage`.
-  clear: ->
-    delete localStorage[key] for own key of localStorage
+  clear: -> delete localStorage[key] for own key of localStorage
 
   # Determine whether or not the specified `keys` exist in `localStorage`.
   exists: (keys...) ->


  # Search `localStorage` for all keys that match the specified regular
  # expression.
  search: (regex) ->
    key for own key of localStorage when regex.test key

  # Set the value of the specified key(s) in `localStorage`.  
  # `keys` can either be a string for a single key (in which case `value`
  # should also be specified) or a map of key/value pairs.  
  # If the specified value is `undefined`, assign that value directly to the
  # key; otherwise transform it to a JSON string beforehand.
  set: (keys, value) ->
    switch typeof keys
      when 'object' then @set key, value for own key, value of keys
      when 'string'
        oldValue = @get keys
        localStorage[keys] = tryStringify value
        oldValue

# Public classes
# --------------

# Inlcuding, but not limited to, data transformations and migration.
class store.Updater extends utils.Class

  # Create a new instance of `Updater` for `namespace`.  
  # Also indicate whether or not `namespace` existed initially.
  constructor: (@namespace) -> @isNew = not @exists()

  # Determine whether or not this namespace exists.
  exists: -> store.get("updates.#{@namespace}")?

  # Remove this namespace.
  remove: -> store.modify 'updates', (updates) => delete updates[@namespace]

  # Rename this namespace to `namespace`.
  rename: (namespace) -> store.modify 'updates', (updates) =>
    updates[namespace] = updates[@namespace] if updates[@namespace]?
    delete updates[@namespace]
    @namespace = namespace

  # Update this namespace to `version` using the `processor` provided when
  # `version` is newer.
  update: (version, processor) -> store.modify 'updates', (updates) =>
    updates[@namespace] ?= ''
    if updates[@namespace] < version
      processor?()
      updates[@namespace] = version

# Configuration
# -------------
