Last active
November 3, 2020 15:57
-
-
Save rinchik/b93b5067456ee7f2ea4686571dfb3991 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 makeCoordinatesZeroBased = rawCoordinates => Object.entries(rawCoordinates) | |
.reduce((processedCoordinates, [coordinate, value]) => { | |
const isCoordinateValid = typeof value === 'number'; | |
let updatedValue = value; | |
if (isCoordinateValid) | |
updatedValue = value - 1; | |
processedCoordinates[coordinate] = updatedValue; | |
return processedCoordinates; | |
}, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment