Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.
/ Group Public archive

The Group module is a powerful utility designed to simplify the manipulation of collections in JavaScript. It enables you to treat a set of elements as a single unit, allowing you to perform actions on the entire group without the need for cumbersome loops.

License

Notifications You must be signed in to change notification settings

EvitcaStudio/Group

Repository files navigation

Group

The Group module is a powerful utility designed to simplify the manipulation of collections in JavaScript. It enables you to treat a set of elements as a single unit, allowing you to perform actions on the entire group without the need for cumbersome loops.

// Example usage:
/**
 * An example group of objects with 'x' property.
 * @type {Group}
 */
const myGroup = Group.create([
  { x: 10, y: 20 },
  { x: 15, y: 25 },
  { x: 20, y: 30 }
]);

// Using forEach to change the 'x' value of each object in the group.
myGroup.forEach((pElement) => {
  pElement.x += 5;
}).forEach((pElement) => {
    console.log(pElement.x, pElement.y);
});
// Output: 15 20
//         20 25
//         25 30

// Example usage:
/**
 * An example group of numbers.
 * @type {Group}
 */
const myGroup2 = Group.create([1, 2, 3, 4]);

// Apply transformation and iterate over the elements.
myGroup2.map((pValue) => {
    return pValue * 3;
}).forEach((pValue) => {
    console.log(pValue);
});
// Output: 3, 6, 9, 12

About

The Group module is a powerful utility designed to simplify the manipulation of collections in JavaScript. It enables you to treat a set of elements as a single unit, allowing you to perform actions on the entire group without the need for cumbersome loops.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published