An identity closure refers to a function which calls another function and returns the result, usually doing no intermediary translation.
const shout = x => x.toUpperCase()
const identityClosure = x => shout(x)
const inputs = [
'(usually)', 'no', 'need',
'for', 'identity', 'closures'
]
inputs.map(identityClosure) === inputs.map(shout)
inputs.map(x => shout(x)) === inputs.map(shout)
NB The only valid case for an identity closure is when there is a scope / binding which breaks in the tacit (un-closured) form.
Watch out for this anti-pattern: needless aliases make it harder when tracking a function through a codebase. Be explicit about what your function does by naming it clearly. However, at the same time be careful about explicit function arity, especially when using native Array.prototype.map
.