e534a911f3
Prettier v2 has the following breaking changes: * enforces spaces between `function` and params * enforces trailing commas by default
26 lines
671 B
JavaScript
26 lines
671 B
JavaScript
import { extend } from '../utils';
|
|
|
|
export default function (instance) {
|
|
instance.registerDecorator(
|
|
'inline',
|
|
function (fn, props, container, options) {
|
|
let ret = fn;
|
|
if (!props.partials) {
|
|
props.partials = {};
|
|
ret = function (context, options) {
|
|
// Create a new partials stack frame prior to exec.
|
|
let original = container.partials;
|
|
container.partials = extend({}, original, props.partials);
|
|
let ret = fn(context, options);
|
|
container.partials = original;
|
|
return ret;
|
|
};
|
|
}
|
|
|
|
props.partials[options.args[0]] = options.fn;
|
|
|
|
return ret;
|
|
}
|
|
);
|
|
}
|