Created
July 31, 2022 17:29
-
-
Save sbutterfield/f68ad0b1c6cfb9665b1dd81b3b7efd69 to your computer and use it in GitHub Desktop.
Efficient initializers for _last in map_ function
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
export const lastItemInMap = map => Array.from(map).pop(); | |
export const lastKeyInMap = map => Array.from(map.keys()).pop(); | |
export const lastValueInMap = map => Array.from(map.values()).pop(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment