@roots/bud-api
Version:
bud.js core module
15 lines (14 loc) • 519 B
JavaScript
import isArray from '@roots/bud-support/isArray';
import isString from '@roots/bud-support/isString';
export async function handleNamed(bud, name, value) {
const current = bud.hooks.filter(`build.entry`, {});
if (isArray(value) || isString(value)) {
return bud.hooks.on(`build.entry`, {
...current,
[name]: {
import: Array.isArray(value) ? value : [value],
},
});
}
return bud.hooks.on(`build.entry`, { ...current, [name]: value });
}