feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -13,7 +13,7 @@
* @returns {boolean} returns true if all the elements of passed arrays are strictly equal.
*/
exports.equals = (a, b) => {
module.exports.equals = (a, b) => {
if (a.length !== b.length) return false;
for (let i = 0; i < a.length; i++) {
if (a[i] !== b[i]) return false;
@@ -28,8 +28,13 @@ exports.equals = (a, b) => {
* @param {(value: T) => boolean} fn Partition function which partitions based on truthiness of result.
* @returns {[Array<T>, Array<T>]} returns the values of `arr` partitioned into two new arrays based on fn predicate.
*/
exports.groupBy = (arr = [], fn) => {
return arr.reduce(
module.exports.groupBy = (
// eslint-disable-next-line default-param-last
arr = [],
fn
) =>
arr.reduce(
/**
* @param {[Array<T>, Array<T>]} groups An accumulator storing already partitioned values returned from previous call.
* @param {T} value The value of the current element
@@ -41,4 +46,3 @@ exports.groupBy = (arr = [], fn) => {
},
[[], []]
);
};