Created
March 25, 2021 21:28
-
-
Save guz-anton/4035c91e9f9cd73ba8d4add2b9abc65a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const toDigit = (...values) => { | |
const isValue = x => x != null && !isNaN(x) && isFinite(x); | |
return +values.find(isValue) || 0; | |
} | |
const toDigit = (...values) => +values.find(x => x != null && !isNaN(x) && isFinite(x)) || 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment