@leafage/toolkit
Version:
The React Server Side Render Framework
38 lines (34 loc) • 1.22 kB
JavaScript
/**
* @leafage/toolkit v1.3.2
*
* Copyright (c) Leafage.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
;
var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js');
var mergeFn = require('lodash/merge');
var mergeProps = function mergeProps() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return mergeFn.apply(void 0, [{}].concat(args));
};
var toArray = function toArray(value) {
return (Array.isArray(value) ? value : [value]).filter(Boolean);
};
var _applyPresets = function applyPresets(ctx) {
var presets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
if (!(presets !== null && presets !== void 0 && presets.length)) return ctx;
var _presets = _rollupPluginBabelHelpers.toArray(presets),
preset = _presets[0],
rest = _presets.slice(1);
preset === null || preset === void 0 || preset(ctx);
return _applyPresets(ctx, rest);
};
exports.applyPresets = _applyPresets;
exports.mergeProps = mergeProps;
exports.toArray = toArray;