UNPKG

react-elegant-ui

Version:

Elegant UI components, made by BEM best practices for react

21 lines (20 loc) 454 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setRefValue = void 0; /** * Set value to any ref object */ var setRefValue = function (ref, value) { // Skip empty ref if (ref === null) return; if (typeof ref === 'function') { ref(value); } else if (typeof ref === 'object') { ref.current = value; } else { throw Error('Unknown type of ref object'); } }; exports.setRefValue = setRefValue;