Local scope manager

Use this function to assign private properties related to your objects / class instances.

@param   {WeakMap} map     The WeakMap to which the private scope objects should be saved.
You should not provide this parameter - it is bound automatically for
you. Just use the key below.
@param   {Object}  key     The key with which to associate this scope
@return  {Object}          Object which can be used to assign properties to
function manager(map, key) {
  if (!(key instanceof Object)) {
    throw new TypeError('Key must be an object')
  }

  let contents = map.get(key)

  if (!contents) {
    map.set(key, contents = {})
  }

  return contents
}