Last active
May 30, 2018 21:50
-
-
Save DavidMellul/2dfc1760e9b09e284f50d9a003196c00 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We will implement a Prettier option : | |
// Remove parenthesis on ES6 functions using only a single parameter | |
// (arg) => { } becomes arg => { } | |
const es6Function = '(arg) => { }'; | |
const regex = /\((.+)\)/; | |
const cleanedSingleParameter = es6Function.replace(regex,'$1'); | |
console.log(cleanedSingleParameter); | |
// Prints : arg => { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment