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    
exotic-core / src / coerce / CoerceChain.ts
Size: Mime:
// import { isUndefinedLike, not, isFixed } from 'chain/exports'
import { isUndefinedLike, not, isFixed } from '../../deps'

function CoerceChain(fn) {
  let $this = this
  if (isUndefinedLike(typeof $this)) {
    $this = Object.prototype.apply($this, arguments)
  }
  $this.fn = fn
  return $this
}
// .from, .schema, .fn, .obj
CoerceChain.prototype.coercer = function(x) {
  return this
}
CoerceChain.prototype.type = function(x) {
  return this
}
// or .when
CoerceChain.prototype.coerceIf = CoerceChain.prototype.type
CoerceChain.prototype.coerceUnless = function(x) {
  return this.coerceIf(not(x))
}

CoerceChain.prototype.default = function(x) {
  return this
}
CoerceChain.prototype.end = function() {
  return this.wrapped
}

// function wrap(fn) {
//   return coerce()
// }
// function coerce() {
//   args = arguments
// }

class CoerceArgs {
  // ---
  fn() {}
  coercions() {}
  defaultAll(should = true) {}
  defaultArgsPassedIn(should = true) {}

  // ---
  nthArg() {}
  singleObjArg() {
    // return fn.call(this, coercedObj)
  }
}

export { CoerceChain }
export default CoerceChain