JSFiddle - React, Tailwind, and code Playground
JavaScript
const countParams = callback => {
const matches = callback.match(/\((.*?)\)/)
return matches ? matches[1].split(",").map(param => param.trim()).length : 0
}
const fn = raw => {
console.log(raw[0])
//separate by commers
const types = raw[0].split(',')
return callback => {
const paramLength = countParams(callback.toString())
}
}
fn `...string,int`((a, b, c) => {
console.info(`${a} ${b}! ${c * c}`)
})