UNPKG

blips

Version:

State management for the GraphQL heads

12 lines (9 loc) 262 B
export function when (condition, transform, data) { let bool = Boolean(condition) if (typeof condition === 'function') { bool = Boolean(condition(data)) } return bool ? typeof transform === 'function' ? transform(data) : transform : data }