@leafage/toolkit
Version:
The React Server Side Render Framework
34 lines (31 loc) • 1.13 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
*/
import { toArray as _toArray } from './_virtual/_rollupPluginBabelHelpers.js';
import mergeFn from '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 = _toArray(presets),
preset = _presets[0],
rest = _presets.slice(1);
preset === null || preset === void 0 || preset(ctx);
return _applyPresets(ctx, rest);
};
export { _applyPresets as applyPresets, mergeProps, toArray };