"use strict";

var utils = require('./../../utils');

function define(name, prop, priv) {
  var descriptor = {enumerable: true};

  var getter = prop.get;
  var setter = prop.set;

  if (getter !== false) {
    if (!utils.is.fun(getter) && getter !== false) {
      getter = function() {
        return this[priv.symbl][name];
      };
    }

    descriptor.get = getter;
  }

  if (setter !== false) {
    if (!utils.is.fun(setter)) {
      setter = function(value) {
        if (value) {
          this[priv.symbl][name] = value;
        }

        return this;
      };
    }

    descriptor.set = setter;
  }

  return descriptor;
}

module.exports = function(priv) {
  return function(name, prop) {
    return define(name, prop, priv);
  };
};
"use strict";

var utils = require('./../../utils');

function define(name, prop, priv) {
  var descriptor = {enumerable: true};

  var getter = prop.get;
  var setter = prop.set;

  if (getter !== false) {
    if (!utils.is.fun(getter) && getter !== false) {
      getter = function() {
        return this[priv.symbl][name];
      };
    }

    descriptor.get = getter;
  }

  if (setter !== false) {
    if (!utils.is.fun(setter)) {
      setter = function(value) {
        if (value) {
          this[priv.symbl][name] = value;
          this[priv.flags][name] = this[priv.shado][name] !== value;
        }

        return this;
      };
    }

    descriptor.set = setter;
  }

  return descriptor;
}

module.exports = function(priv) {
  return function(name, prop) {
    return define(name, prop, priv);
  };
};
Add updated flags for default setter