Skip to content

Instantly share code, notes, and snippets.

@dormd
Last active August 18, 2019 15:16
Show Gist options
  • Save dormd/ee175936124867d4a4c83c7315afff44 to your computer and use it in GitHub Desktop.
Save dormd/ee175936124867d4a4c83c7315afff44 to your computer and use it in GitHub Desktop.
function getSumByFunc(iteratee) {
if (iteratee === undefined || iteratee === null) return item => item;
if (typeof iteratee === 'string') return item => item[iteratee];
return iteratee;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment