mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 18:06:45 +00:00
24 lines
713 B
JavaScript
24 lines
713 B
JavaScript
import {appendContextPath, blockParams, createFrame, isEmpty, isFunction} from '../utils';
|
|
|
|
export default function(instance) {
|
|
instance.registerHelper('with', function(context, options) {
|
|
if (isFunction(context)) { context = context.call(this); }
|
|
|
|
let fn = options.fn;
|
|
|
|
if (!isEmpty(context)) {
|
|
let data = options.data;
|
|
if (options.data && options.ids) {
|
|
data = createFrame(options.data);
|
|
data.contextPath = appendContextPath(options.data.contextPath, options.ids[0]);
|
|
}
|
|
|
|
return fn(context, {
|
|
data: data,
|
|
blockParams: blockParams([context], [data && data.contextPath])
|
|
});
|
|
} else {
|
|
return options.inverse(this);
|
|
}
|
|
});
|
|
}
|