2015-03-02 11:36:55 -08:00
|
|
|
/**
|
2018-10-31 01:35:03 -07:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-03-02 11:36:55 -08:00
|
|
|
*
|
2018-10-31 01:35:03 -07:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-03-02 11:36:55 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2018-11-04 10:53:19 -08:00
|
|
|
const mergeInto = require('mergeInto');
|
2015-03-02 11:36:55 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shallow merges two structures into a return value, without mutating either.
|
|
|
|
*
|
|
|
|
* @param {?object} one Optional object with properties to merge from.
|
|
|
|
* @param {?object} two Optional object with properties to merge from.
|
|
|
|
* @return {object} The shallow extension of one by two.
|
|
|
|
*/
|
2018-11-04 10:53:19 -08:00
|
|
|
const merge = function(one, two) {
|
|
|
|
const result = {};
|
2015-03-02 11:36:55 -08:00
|
|
|
mergeInto(result, one);
|
|
|
|
mergeInto(result, two);
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = merge;
|