/**
 * @param {*} source
 * @param {boolean} shallowValues Should it return shallow values
 * @returns {(string|number|null)[]}
 */
function getDeepValues(source, shallowValues = false) {
  if (source && typeof source === 'object') {
    return Object.values(source).reduce((acc, value) => acc.concat(getDeepValues(value, true)), []);
  }

  if (!shallowValues) return [];

  return source;
}

module.exports = getDeepValues;
