Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple partial application with placeholders, example for discussion
export class Placeholder {}
export const _ = new Placeholder()
export const isPlaceholder = placeholder => placeholder instanceof Placeholder
export function bind( ...placeholders ) {
return ( ...fillers ) => this.call( this, ...placeholders.map(
item => isPlaceholder( item ) ? fillers.shift() : item
) )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment