Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add object groupby documentation #80

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

shahzdvp
Copy link
Contributor

@shahzdvp shahzdvp commented Oct 9, 2024

Add documentation and example for array.groupBy() method

Description

This pull request adds comprehensive documentation and a practical example for the array.groupBy() method in JavaScript. This contribution aims to help developers understand and effectively use this method for grouping array elements.

Changes Made

  1. Documentation:

    • Created a new file src/content/docs/03-var/12_object-groupby.md
    • Provided detailed explanation of the object.groupBy() method
    • Included syntax, parameters, return value, and usage examples
    • Added notes on browser compatibility and alternatives
  2. Example:

    • Created a new file examples/03-12_object-groupby.mjs
    • Implemented a practical example using a sample inventory dataset
    • Demonstrated grouping of inventory items by their type
    • Added comments explaining each step of the process

Documentation Overview

The documentation covers:

  • Introduction to the array.groupBy() method
  • Detailed syntax and parameters
  • Return value explanation
  • Comprehensive description of the method's functionality
  • Multiple usage examples
  • Notes on compatibility and alternatives
  • Related methods for further exploration

Example Overview

The example demonstrates:

  • Practical usage of array.groupBy() with an array of objects
  • How to define the grouping callback function
  • Outputting the grouped result in a readable format
  • Extensive comments explaining the code and expected output

Testing and Formatting

  • Both the documentation and example have been reviewed for accuracy
  • The example has been tested locally and produces the expected output
  • Ran bun run format-examples-bun to ensure adherence to project formatting standards

Additional Notes

  • This contribution provides a complete learning resource on array.groupBy(), combining theory (documentation) and practice (example)
  • The documentation and example are designed to be beginner-friendly while also providing depth for more experienced developers

Checklist

  • Documentation follows the project's structure and style guidelines
  • Example code follows the project's coding standards
  • Comments have been added to explain the example code
  • The example has been tested and works as expected
  • The format-examples-bun script has been run on the new example file
  • Both documentation and example are consistent with each other

I'm open to any feedback or suggestions for improvement on both the documentation and the example. Thank you for reviewing this contribution!

Copy link

vercel bot commented Oct 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
some-drops-of-javascript ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 1:43am

@shahzdvp
Copy link
Contributor Author

shahzdvp commented Oct 9, 2024

ok i have changed the directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant