mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
19 lines
356 B
JavaScript
19 lines
356 B
JavaScript
/**
|
|
* Converts `map` to its key-value pairs.
|
|
*
|
|
* @private
|
|
* @param {Object} map The map to convert.
|
|
* @returns {Array} Returns the key-value pairs.
|
|
*/
|
|
function mapToArray(map) {
|
|
let index = -1
|
|
const result = new Array(map.size)
|
|
|
|
map.forEach((value, key) => {
|
|
result[++index] = [key, value]
|
|
})
|
|
return result
|
|
}
|
|
|
|
export default mapToArray
|