src/index.js
function _convertToWishObjectFromNullOrId(wish, magicWord) {
  let wishObject = wish
  // Check if it may be a wish object
  if (!_isObject(wishObject)) {
    wishObject = getWish(wish)
  }
  if (_isNullOrUndefined(wishObject)) {
    const matchingWishes = getMatchingWishes(magicWord)
    if (matchingWishes.length > 0) {
      wishObject = matchingWishes[0]
    }
  }
  return wishObject
}
function _convertToWishObjectFromNullOrId(wish, magicWord) {
  let wishObject = wish
  // Check if it may be a wish object
  if (!_isObject(wishObject)) {
    wishObject = getWish(wish)
  }
  if (_isNullOrUndefined(wishObject)) {
    const matchingWishes = getMatchingWishes(magicWord)
    if (matchingWishes.length > 0) {
      wishObject = matchingWishes[0]
    }
  }
  return wishObject
}
function _convertToWishObjectFromNullOrId ( wish , magicWord ) { let wishObject = wish // Check if it may be a wish object if ( ! _isObject ( wishObject ) ) { wishObject = getWish ( wish ) } if ( _isNullOrUndefined ( wishObject ) ) { const matchingWishes = getMatchingWishes ( magicWord ) if ( matchingWishes . length > 0 ) { wishObject = matchingWishes [ 0 ] } } return wishObject }
Convert the given wish argument to a valid wish object.
It could be an ID, or null.
@param {wish|string} [wish] An id, wish object, or null.
@param {string} magicWord Used if wish is null to lookup
the nearest matching wish to be used.
@returns {wish} The wish object
@private
Convert the given wish argument to a valid wish object . It could be an ID or null .