Skip to content

anio-js-foundation/create-modifier-function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@anio-js-foundation/create-modifier-function

Create a function that accepts modifiers.

import createModifierFunction from "@anio-js-foundation/create-modifier-function"

const fn = createModifierFunction(function(modifier, ...args) {
	console.log("i got called with modifiers", modifier, "and args", args)
}, ["black", "bold", "underline"])

// i got called with modifiers [] and args [ 1 ]
fn(1)
// i got called with modifiers [ 'black', 'bold' ] and args [ 1, 2, 3 ]
fn.black.bold(1, 2, 3)
// i got called with modifiers [ 'black' ] and args [ 1 ]
fn.black(1)

About

Create a function that accepts modifiers.

Resources

Stars

Watchers

Forks

Packages

No packages published