UNPKG

@ou-imdt/utils

Version:

Utility library for interactive media development

12 lines 403 B
/** * Creates a mixin utility that applies multiple mixin functions to a base object. * @param {Object} base - The initial base object that will be extended. * @returns {Object} An object with a `with` method that takes multiple mixin functions. */ export default function mix(base) { return { with(...mixins) { return mixins.reduce((chained, mixin) => mixin(chained), base); } } }