21 lines
452 B
JavaScript
21 lines
452 B
JavaScript
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
exports.default = mergeRefs;
|
|
|
|
var toFnRef = function toFnRef(ref) {
|
|
return !ref || typeof ref === 'function' ? ref : function (value) {
|
|
ref.current = value;
|
|
};
|
|
};
|
|
|
|
function mergeRefs(refA, refB) {
|
|
var a = toFnRef(refA);
|
|
var b = toFnRef(refB);
|
|
return function (value) {
|
|
if (typeof a === 'function') a(value);
|
|
if (typeof b === 'function') b(value);
|
|
};
|
|
}
|
|
|
|
module.exports = exports.default; |