Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
chain-able-chain / src / plugins / getterOnSet.ts
Size: Mime:
const isUndefined = require('../deps/is/undefined')

function copySetIntoFunction(name, parent) {
  const auto = arg => {
    if (isUndefined(arg)) {
      parent.get(name)
    }
    else {
      parent.set(name, arg)
      Object.assign(parent[name], arg)
    }
  }

  // so we know if we defaulted them
  auto.getterOnSet = true
  return this.onSet(auto).onGet(auto).onCall(auto)
}

module.exports = copySetIntoFunction