UNPKG

537 BJavaScriptView Raw
1var arrayMap = require('./_arrayMap');
2
3/**
4 * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
5 * of key-value pairs for `object` corresponding to the property names of `props`.
6 *
7 * @private
8 * @param {Object} object The object to query.
9 * @param {Array} props The property names to get values for.
10 * @returns {Object} Returns the key-value pairs.
11 */
12function baseToPairs(object, props) {
13 return arrayMap(props, function(key) {
14 return [key, object[key]];
15 });
16}
17
18module.exports = baseToPairs;