Created
November 1, 2020 18:11
-
-
Save rinchik/b4234e20d61428126c3dcb119b140519 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 shouldConvert = typeof value === 'number'; | |
const updatedValue = shouldConvert ? value - 1 : value; | |
processedCoordinates[coordinate] = updatedValue; | |
return processedCoordinates; | |
}, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment