{"_id":"@abydin/convert-array-to-object","_rev":"5-86edd370063655c405358b7cf8f14b2c","name":"@abydin/convert-array-to-object","dist-tags":{"latest":"2.4.0"},"versions":{"1.0.0":{"name":"@abydin/convert-array-to-object","version":"1.0.0","description":"This s a lightweight and versatile npm package designed to streamline the transformation of arrays into structured JavaScript objects. Whether you're dealing with data manipulation, API responses, or form submissions, this utility simplifies the process o","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"ISC","_id":"@abydin/convert-array-to-object@1.0.0","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-8Wdg1uBBTXm0M8Wy3ZVDC+0ZhGhwa4baEUv4qwI/QdeYlUxuCj03t0vXt0LuRtEAOmTARRz+3X+XWNOG4xc9nw==","shasum":"49c24c970ce99e01cda2f8774f2abf9eb1794d97","tarball":"https://registry.npmjs.org/@abydin/convert-array-to-object/-/convert-array-to-object-1.0.0.tgz","fileCount":2,"unpackedSize":761,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDZw8EThUuIQJz7tAxv4fQEdV27s1up1opKnmIXIDRVSAIhANIWtiCR+1sAePNstld4aSVHXuKmzyPmQZd4oUh7b8z/"}]},"_npmUser":{"name":"abydin","email":"abideenayinde7@gmail.com"},"directories":{},"maintainers":[{"name":"abydin","email":"abideenayinde7@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/convert-array-to-object_1.0.0_1700557630076_0.7008576083824123"},"_hasShrinkwrap":false},"2.0.0":{"name":"@abydin/convert-array-to-object","version":"2.0.0","description":"This s a lightweight and versatile npm package designed to streamline the transformation of arrays into structured JavaScript objects. Whether you're dealing with data manipulation, API responses, or form submissions, this utility simplifies the process o","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Abideen Ayinde"},"license":"ISC","_id":"@abydin/convert-array-to-object@2.0.0","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-YiQ0EHtT6XM2DakbJ9w4mXv6IsxCoyLuB4Gy/Y8llHTdx7u+QJxgOmEjG7kfZOYOEvBVhLlWRs6dmM/4jvpwGA==","shasum":"150d058809d515ac3715141d618543e6e7b2b65e","tarball":"https://registry.npmjs.org/@abydin/convert-array-to-object/-/convert-array-to-object-2.0.0.tgz","fileCount":3,"unpackedSize":5149,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFRqnrY5kwh2uzNMsaB3iRm2JiN4kmh1PdKbDo5reIJXAiEA+RRkWzn5RST9cIpugezC8lwWcy1N7sjD2uDRyh7z8hI="}]},"_npmUser":{"name":"abydin","email":"abideenayinde7@gmail.com"},"directories":{},"maintainers":[{"name":"abydin","email":"abideenayinde7@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/convert-array-to-object_2.0.0_1700562383941_0.2492048560198561"},"_hasShrinkwrap":false},"2.1.0":{"name":"@abydin/convert-array-to-object","version":"2.1.0","description":"This s a lightweight and versatile npm package designed to streamline the transformation of arrays into structured JavaScript objects. Whether you're dealing with data manipulation, API responses, or form submissions, this utility simplifies the process o","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Abideen Ayinde"},"license":"MIT","_id":"@abydin/convert-array-to-object@2.1.0","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-Yx2JrLhDDH3ZGnGEpjVlmGNwqYsWBeV+6630nEcQ+vYDdnZ4JT3Jr8YJEYAsYgf405fyhCNGbCb4L0lYb5p1SQ==","shasum":"f296a3cb1d1fbd3ce7993dd18d941205bf976b97","tarball":"https://registry.npmjs.org/@abydin/convert-array-to-object/-/convert-array-to-object-2.1.0.tgz","fileCount":3,"unpackedSize":5159,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEFBrdtu2IH0nZe+coHMFMEoFF6DCC83wUkQ6Lns9YB2AiBHk3CxJG+KLp9VAscd1XNZAiAwUNhLwijUxpmSFY7LVg=="}]},"_npmUser":{"name":"abydin","email":"abideenayinde7@gmail.com"},"directories":{},"maintainers":[{"name":"abydin","email":"abideenayinde7@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/convert-array-to-object_2.1.0_1700562598426_0.7183657581486247"},"_hasShrinkwrap":false},"2.2.0":{"name":"@abydin/convert-array-to-object","version":"2.2.0","description":"This s a lightweight and versatile npm package designed to streamline the transformation of arrays into structured JavaScript objects. Whether you're dealing with data manipulation, API responses, or form submissions, this utility simplifies the process o","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Abideen Ayinde"},"license":"MIT","keywords":["convert-arr-to-obj","array conversion","object transformation","data manipulation","JavaScript utility","array to object mapping","array manipulation","callback function","key-based transformation","data processing","array transformation","utility function","data structure conversion"],"_id":"@abydin/convert-array-to-object@2.2.0","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-8DgBo7EIKrTaH6ISQlrWTQiBZSxyV1Y/Be0nV8DEomqrj7BhgdHTQrxNoUBsjfvHJxwJbASvaybmI7gvAv1ChA==","shasum":"bac9ebadccd9588eb5e34badaa19ed7cd965a73d","tarball":"https://registry.npmjs.org/@abydin/convert-array-to-object/-/convert-array-to-object-2.2.0.tgz","fileCount":3,"unpackedSize":5830,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCug0OLJwzIMXJmOPurN4UHRSaYURRautp6tmpMRI7ctAIgXBzrpbosYp056Fn4d2hTuQ23rK5r8pyA2evpxTJFacM="}]},"_npmUser":{"name":"abydin","email":"abideenayinde7@gmail.com"},"directories":{},"maintainers":[{"name":"abydin","email":"abideenayinde7@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/convert-array-to-object_2.2.0_1700562869535_0.8873057577239691"},"_hasShrinkwrap":false},"2.3.0":{"name":"@abydin/convert-array-to-object","version":"2.3.0","description":"This s a lightweight and versatile npm package designed to streamline the transformation of arrays into structured JavaScript objects. Whether you're dealing with data manipulation, API responses, or form submissions, this utility simplifies the process o","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Abideen Ayinde"},"license":"MIT","keywords":["convert-arr-to-obj","array conversion","object transformation","data manipulation","JavaScript utility","array to object mapping","array manipulation","callback function","key-based transformation","data processing","array transformation","utility function","data structure conversion"],"_id":"@abydin/convert-array-to-object@2.3.0","gitHead":"1291c7ef07037cc42eb205e0d3f36bce520dd85d","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-O51aIRw7bw4hQdMT6lUr2u9vH99O4N6vjTXGEEby994lpymx3UvBkN5ISqJn32McMdpm935Q2VNOJ34u7fWc9g==","shasum":"62e611b18d626e4c21fa9bc24087f03e886239b0","tarball":"https://registry.npmjs.org/@abydin/convert-array-to-object/-/convert-array-to-object-2.3.0.tgz","fileCount":3,"unpackedSize":5696,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCqgjwNVtRmAFbjNvvrVsQnLPHTr/GZNYpQKW2j8G/IiQIhAOFtw+LOEp2f8rNBVgXtoqq/uLF0eNwEx6trsOPpGrpN"}]},"_npmUser":{"name":"abydin","email":"abideenayinde7@gmail.com"},"directories":{},"maintainers":[{"name":"abydin","email":"abideenayinde7@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/convert-array-to-object_2.3.0_1700819473763_0.8672265723094434"},"_hasShrinkwrap":false},"2.4.0":{"name":"@abydin/convert-array-to-object","version":"2.4.0","description":"This s a lightweight and versatile npm package designed to streamline the transformation of arrays into structured JavaScript objects. Whether you're dealing with data manipulation, API responses, or form submissions, this utility simplifies the process o","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Abideen Ayinde"},"license":"MIT","keywords":["convert-arr-to-obj","array conversion","object transformation","data manipulation","JavaScript utility","array to object mapping","array manipulation","callback function","key-based transformation","data processing","array transformation","utility function","data structure conversion"],"_id":"@abydin/convert-array-to-object@2.4.0","gitHead":"95a7d4145768d6cff8cfd5113b357d425e124a04","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-r/haySe9JmGIFZxSnFnEY6ZdsIQJq2OJAqFe8LUpOCXEBFRmq0XPIHE9/0BQ31I0t4EUfARSPh838KxSXuc7Sw==","shasum":"a5558c55db71061015aba5b4faf9afb2fac0a7e4","tarball":"https://registry.npmjs.org/@abydin/convert-array-to-object/-/convert-array-to-object-2.4.0.tgz","fileCount":3,"unpackedSize":5725,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHH7qRfLHWhzRKrGqPCSGBjPzI9Xyj2kGoySw+As4YrvAiEAzu6CAfUh2FpBOB64PL9/o0tNk7RDier9X/J2UKPr7q8="}]},"_npmUser":{"name":"abydin","email":"abideenayinde7@gmail.com"},"directories":{},"maintainers":[{"name":"abydin","email":"abideenayinde7@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/convert-array-to-object_2.4.0_1700839588569_0.10246264913590042"},"_hasShrinkwrap":false}},"time":{"created":"2023-11-21T09:07:09.985Z","1.0.0":"2023-11-21T09:07:10.232Z","modified":"2023-11-24T15:26:28.940Z","2.0.0":"2023-11-21T10:26:24.130Z","2.1.0":"2023-11-21T10:29:58.657Z","2.2.0":"2023-11-21T10:34:29.716Z","2.3.0":"2023-11-24T09:51:13.918Z","2.4.0":"2023-11-24T15:26:28.756Z"},"maintainers":[{"name":"abydin","email":"abideenayinde7@gmail.com"}],"description":"This s a lightweight and versatile npm package designed to streamline the transformation of arrays into structured JavaScript objects. Whether you're dealing with data manipulation, API responses, or form submissions, this utility simplifies the process o","license":"MIT","readme":"# convert-array-to-object\n\n<!-- [![npm version](https://badge.fury.io/js/convert-array-to-object.svg)](https://badge.fury.io/js/convert-array-to-object) -->\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nEffortlessly convert arrays into structured JavaScript objects with the `convert-array-to-object` npm package. This lightweight utility simplifies the process of transforming arrays into key-value paired objects, enhancing your data manipulation tasks.\n\n## Installation\n\ninstall with Npm\n\n```bash\nnpm install @abydin/convert-array-to-object\n```\n\ninstall with Yarn\n\n```bash\nyarn add @abydin/convert-array-to-object\n```\n\n## Usage\n\nHere are some examples of how to use the `convertArrToObj` function:\n\n## Usage\n\n```javascript\nconst convertArrToObj = require(\"@abydin/convert-array-to-object\");\n\n// Example usage:\nconst inputArray = [\n\t{ id: 1, name: \"John\" },\n\t{ id: 2, name: \"Jane\" },\n\t{ id: 3, name: \"Doe\" },\n];\n\n// Without reArr option\nconst outputObject = convertArrToObj({\n\tarr: inputArray,\n\tcallBack: (item) => item.name,\n\tkey: \"id\",\n});\n\nconsole.log(outputObject);\n// Output: { '1': 'John', '2': 'Jane', '3': 'Doe' }\n\n// With reArr option\nconst outputArray = convertArrToObj({\n\tarr: inputArray,\n\tcallBack: (item) => item.name,\n\tkey: \"id\",\n\treArr: true,\n});\n\nconsole.log(outputArray);\n// Output: [ 'John', 'Jane', 'Doe' ]\n```\n\n## API\n\n### `convertArrToObj(options)`\n\n#### Parameters\n\n- `options` (Object):\n  - `arr` (Array): The input array of objects.\n  - `callBack` (Function, optional): A callback function to transform each item in the array.\n  - `key` (String): The key to use as the property in the resulting object or array.\n  - `reArr` (Boolean, optional): If set to `true`, the function returns an array of values instead of an object.\n\n#### Returns\n\n- If `reArr` is `false` (default): Returns an object where keys are taken from the specified `key` and values are the result of the optional `callBack` function.\n- If `reArr` is `true`: Returns an array of values derived from the specified `key` and optional `callBack` function.\n\n### Examples\n\n#### Basic Usage\n\n```javascript\nconst inputArray = [\n\t{ id: 1, name: \"John\" },\n\t{ id: 2, name: \"Jane\" },\n\t{ id: 3, name: \"Doe\" },\n];\n\nconst outputObject = convertArrToObj({\n\tarr: inputArray,\n\tkey: \"id\",\n});\n\nconsole.log(outputObject);\n// Output: { '1': { id: 1, name: 'John' }, '2': { id: 2, name: 'Jane' }, '3': { id: 3, name: 'Doe' } }\n```\n\n### Transforming Values with Callback\n\nYou can use the `callBack` option to transform values during the conversion process. The `callBack` function takes each item in the array as its argument and should return the transformed value.\n\n#### Example\n\n```javascript\nconst inputArray = [\n\t{ id: 1, name: \"John\" },\n\t{ id: 2, name: \"Jane\" },\n\t{ id: 3, name: \"Doe\" },\n];\n\nconst outputObject = convertArrToObj({\n\tarr: inputArray,\n\tkey: \"id\",\n\tcallBack: (item) => item.name.toUpperCase(),\n});\n\nconsole.log(outputObject);\n// Output: { '1': 'JOHN', '2': 'JANE', '3': 'DOE' }\n```\n\n### Using reArr Option\n\nThe `reArr` option allows you to control the output format. When set to `true`, the function returns an array of values instead of an object.\n\n#### Example\n\nConsider an array of user objects:\n\n```javascript\nconst users = [\n\t{ id: 1, name: \"John\", age: 25 },\n\t{ id: 2, name: \"Jane\", age: 30 },\n\t{ id: 3, name: \"Doe\", age: 22 },\n];\nconst userNamesArray = convertArrToObj({\n\tarr: users,\n\tkey: \"id\",\n\tcallBack: (user) => user.name,\n\treArr: true,\n});\n\nconsole.log(userNamesArray);\n// Output: [ 'John', 'Jane', 'Doe' ]\n```\n\n## Keywords\n\n- `convert-arr-to-obj`\n- `array conversion`\n- `object transformation`\n- `data manipulation`\n- `JavaScript utility`\n- `array to object mapping`\n- `array manipulation`\n- `callback function`\n- `key-based transformation`\n- `data processing`\n- `array transformation`\n- `utility function`\n- `data structure conversion`\n\n## Contributing\n\nWe welcome contributions to this project. If you have a feature request, bug report, or want to improve documentation, please feel free to open an issue or submit a pull request.\n\n### Contribution Guidelines\n\n1. Fork the repository.\n2. Create a new branch: `git checkout -b <branch_name>`.\n3. Make your changes and commit them: `git commit -m '<commit_message>'`.\n4. Push your changes to the branch: `git push origin <branch_name>`.\n5. Submit a pull request.\n\n### License\n\nThis project is licensed under the MIT License.\n","readmeFilename":"README.md","author":{"name":"Abideen Ayinde"},"keywords":["convert-arr-to-obj","array conversion","object transformation","data manipulation","JavaScript utility","array to object mapping","array manipulation","callback function","key-based transformation","data processing","array transformation","utility function","data structure conversion"]}