UNPKG

688 BJavaScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8"use strict";
9
10const mergeInto = require('mergeInto');
11
12/**
13 * Shallow merges two structures into a return value, without mutating either.
14 *
15 * @param {?object} one Optional object with properties to merge from.
16 * @param {?object} two Optional object with properties to merge from.
17 * @return {object} The shallow extension of one by two.
18 */
19const merge = function(one, two) {
20 const result = {};
21 mergeInto(result, one);
22 mergeInto(result, two);
23 return result;
24};
25
26module.exports = merge;