blips
Version:
State management for the GraphQL heads
13 lines (10 loc) • 311 B
JavaScript
;
exports.__esModule = true;
exports.when = when;
function when(condition, transform, data) {
var bool = Boolean(condition);
if (typeof condition === 'function') {
bool = Boolean(condition(data));
}
return bool ? typeof transform === 'function' ? transform(data) : transform : data;
}