Create fromEntries.js (#3809)

Rename fromPairs to fromEntries.
This commit is contained in:
Jason Yu
2018-06-01 14:33:34 +01:00
committed by John-David Dalton
parent 92a6575137
commit b8dfb7cc14

View File

@@ -1,5 +1,5 @@
/** /**
* The inverse of `toPairs`is method returns an object composed * The inverse of `entries`is method returns an object composed
* from key-value `pairs`. * from key-value `pairs`.
* *
* @since 4.0.0 * @since 4.0.0
@@ -8,10 +8,10 @@
* @returns {Object} Returns the new object. * @returns {Object} Returns the new object.
* @example * @example
* *
* fromPairs([['a', 1], ['b', 2]]) * fromEntries([['a', 1], ['b', 2]])
* // => { 'a': 1, 'b': 2 } * // => { 'a': 1, 'b': 2 }
*/ */
function fromPairs(pairs) { function fromEntries(pairs) {
const result = {} const result = {}
if (pairs == null) { if (pairs == null) {
return result return result
@@ -22,4 +22,4 @@ function fromPairs(pairs) {
return result return result
} }
export default fromPairs export default fromEntries