lib/helpers.js
function setInflectType (inflect, types) {
  // use inflections if set as object else start fresh
  const out = typeof inflect === 'boolean' ? {} : inflect

  // if inflect is boolean use it for all types,
  // else use default for unset types
  const setInflect = typeof inflect === 'boolean' ? inflect : inflectTypeDef

  // For each Type set inflection, if not set
  for (const t of types) {
    const plural = inflection.transform(t, typeInflections[1])
    if (!(t in out))
      out[t] = setInflect

    // allow checking on pluralized too
    if (!(plural in out))
      out[plural] = out[t]
  }

  return out
}
function setInflectType (inflect, types) {
  // use inflections if set as object else start fresh
  const out = typeof inflect === 'boolean' ? {} : inflect

  // if inflect is boolean use it for all types,
  // else use default for unset types
  const setInflect = typeof inflect === 'boolean' ? inflect : inflectTypeDef

  // For each Type set inflection, if not set
  for (const t of types) {
    const plural = inflection.transform(t, typeInflections[1])
    if (!(t in out))
      out[t] = setInflect

    // allow checking on pluralized too
    if (!(plural in out))
      out[plural] = out[t]
  }

  return out
}
function setInflectType ( inflect , types ) { // use inflections if set as object else start fresh const out = typeof inflect === 'boolean' ? { } : inflect // if inflect is boolean use it for all types, // else use default for unset types const setInflect = typeof inflect === 'boolean' ? inflect : inflectTypeDef // For each Type set inflection, if not set for ( const t of types ) { const plural = inflection . transform ( t , typeInflections [ 1 ] ) if ( ! ( t in out ) ) out [ t ] = setInflect // allow checking on pluralized too if ( ! ( plural in out ) ) out [ plural ] = out [ t ] } return out }
Generate a list of which types are inflected.
@param {Boolean|Object} inflect setting from defaults or user override
@param {String[]} types array of declared types
@return {Object}
Generate a list of which types are inflected .