@putout/plugin-merge-duplicate-functions
v2.0.0
Published
šPutout plugin adds ability to merge duplicate functions
Downloads
23,044
Readme
@putout/plugin-merge-duplicate-functions
Functions are one of the fundamental building blocks in JavaScript. A function in JavaScript is similar to a procedureāa set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the output. To use a function, you must define it somewhere in the scope from which you wish to call it.
(c) MDN
šPutout plugin adds ability to find and merge duplicate functions. Checkout in šPutout Editor.
Install
npm i @putout/plugin-merge-duplicate-functions
Rule
{
"rules": {
"merge-duplicate-functions": "on"
}
}
ā Example of incorrect code
const isFn = (a) => typeof a === 'function';
const isFn1 = (a) => typeof a === 'function';
const isFn2 = (a) => typeof a === 'function';
isFn(1);
isFn1(2);
ā Example of correct code
const isFn = (a) => typeof a === 'function';
isFn(1);
isFn(2);
License
MIT