es2015/createNamespaceProxy.js
function createProxy(instance, symbols, enumerable) {
  return new Proxy(instance, {
    set: (target, propertyName, value) => {
      let { symbol, isNew } = getSymbol(symbols, propertyName)
      instance[symbol] = value
      if (!enumerable && isNew) {
        Object.defineProperty(instance, symbol, {
          enumerable: false
        })
      }
      return true
    },

    get: (target, propertyName) => {
      if (!symbols.has(propertyName)) {
        return undefined // the property has not been defined (set) yet
      }

      let { symbol } = getSymbol(symbols, propertyName)
      return instance[symbol]
    }
  })
}
function createProxy(instance, symbols, enumerable) {
  return new Proxy(instance, {
    set: (target, propertyName, value) => {
      let { symbol, isNew } = getSymbol(symbols, propertyName)
      instance[symbol] = value
      if (!enumerable && isNew) {
        Object.defineProperty(instance, symbol, {
          enumerable: false
        })
      }
      return true
    },

    get: (target, propertyName) => {
      if (!symbols.has(propertyName)) {
        return undefined // the property has not been defined (set) yet
      }

      let { symbol } = getSymbol(symbols, propertyName)
      return instance[symbol]
    }
  })
}
function createProxy ( instance , symbols , enumerable ) { return new Proxy ( instance , { set : ( target , propertyName , value ) => { let { symbol , isNew } = getSymbol ( symbols , propertyName ) instance [ symbol ] = value if ( ! enumerable && isNew ) { Object . defineProperty ( instance , symbol , { enumerable : false } ) } return true } , get : ( target , propertyName ) => { if ( ! symbols . has ( propertyName ) ) { return undefined // the property has not been defined (set) yet } let { symbol } = getSymbol ( symbols , propertyName ) return instance [ symbol ] } } ) }
Creates a proxy for retrieving and setting the values of the private
properties of the provided instance.

@param {Object} instance The instance for which the proxy should be created.
@param {Map<string, symbol>} symbols Cache of private property symbols.
@param {boolean} enumerable The flag specifying whether or not the
properties created by the returned proxy should be enumerable or not.
@return {Proxy} The proxy for convenient setting and retrieving of private
properties of the specified instance.
Creates a proxy for retrieving and setting the values of the private properties of the provided instance .