Created
May 8, 2019 06:53
-
-
Save andeemarks/60d8ba409a5c7809ef4ff7df38e4c8d4 to your computer and use it in GitHub Desktop.
Adam Woods' implementation of FEN formatting using match.length to reduce consecutive spaces to numbers
This file contains hidden or 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
export default board => | |
`${chunk(board, 8) | |
.map(row => row.join('')) | |
.map(str => str.replace(/\.+/g, match => match.length)) | |
.join('/')} w - - 0 1`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment