{"_id":"@arndesk/attempt","name":"@arndesk/attempt","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@arndesk/attempt","version":"1.0.0","description":"A simple utility to handle promises with optional logging and error throwing.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"dependencies":{},"repository":{"type":"git","url":"git+https://github.com/arndesk/attempt.git"},"engines":{"node":">=8"},"keywords":["promise","async","await","attempt","try-catch","error handling"],"author":{"name":"Arnob Arjun","email":"mauraiz55@gmail.com"},"license":"MIT","homepage":"https://github.com/arndesk/attempt#readme","_id":"@arndesk/attempt@1.0.0","gitHead":"2dcd0e9eafc22996bbd0f25e14138f715e45fb7d","bugs":{"url":"https://github.com/arndesk/attempt/issues"},"_nodeVersion":"18.16.0","_npmVersion":"9.8.0","dist":{"integrity":"sha512-ZfmAnl4lVJfQBCxBJuQUu7bmxjjBqwvD/ydJ8UGCPNZaZOcyuFzjNwT3/iKa5MyqrCl16AOD4bC8rOjQ2J+esQ==","shasum":"ece2a1f23d3da08e755d0bee3595b7bc39d613a0","tarball":"https://registry.npmjs.org/@arndesk/attempt/-/attempt-1.0.0.tgz","fileCount":4,"unpackedSize":3854,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGjBmyDA5ZPaxBZ7EreSjR5LsQC2qvLtOwy7EhF5tSJhAiAzWvstfZo6OHmF+EqYlapfX9BsqipT7Rif6xaTax2/1A=="}]},"_npmUser":{"name":"arndesk","email":"arndesk1@gmail.com"},"directories":{},"maintainers":[{"name":"arndesk","email":"arndesk1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/attempt_1.0.0_1691527227044_0.15333075209695912"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-08T20:40:26.928Z","1.0.0":"2023-08-08T20:40:27.198Z","modified":"2023-08-08T20:40:27.434Z"},"maintainers":[{"name":"arndesk","email":"arndesk1@gmail.com"}],"description":"A simple utility to handle promises with optional logging and error throwing.","homepage":"https://github.com/arndesk/attempt#readme","keywords":["promise","async","await","attempt","try-catch","error handling"],"repository":{"type":"git","url":"git+https://github.com/arndesk/attempt.git"},"author":{"name":"Arnob Arjun","email":"mauraiz55@gmail.com"},"bugs":{"url":"https://github.com/arndesk/attempt/issues"},"license":"MIT","readme":"<br />\n\n<h1 align=\"center\">@arndesk/attempt</h1>\n<h4 align=\"center\">A simple utility to handle promises with optional logging and error throwing.</h4>\n\n<p align=\"center\">\n  <a href=\"#get-started\">Get Started</a> &bull;\n  <a href=\"#installation\">Installation</a> &bull;\n  <a href=\"#usage\">Usage</a> &bull;\n  <a href=\"#features\">Features</a> &bull;\n  <a href=\"#contributing\">Contributing</a> &bull;\n  <a href=\"#license\">License</a>\n</p>\n\n<h2 id=\"get-started\">Get Started</h2>\n\n<h3 id=\"installation\">Installation</h3>\n\n<p>Use <code>npm</code> to install this package:</p>\n\n<pre>\n<code>npm install @arndesk/attempt</code>\n</pre>\n\n<h3 id=\"usage\">Usage</h3>\n\n<p>Here's a basic example of how to use @arndesk/attempt in your code:</p>\n\n<pre>\n<code>\nconst attempt = require('@arndesk/attempt');\n\nasync function demo() {\n    let result;\n\n    // Testing successful promise\n    result = await attempt(Promise.resolve(\"All good\"), \"Testing success\");\n    console.log(result);\n\n    // Testing rejected promise without throwing the error\n    result = await attempt(Promise.reject(new Error(\"Oops\")), \"Testing failure\");\n    console.log(result);\n}\n\ndemo();\n\n</code>\n</pre>\n\n<h2 id=\"features\">Features</h2>\n\n<ul>\n  <li>Handles promises with optional logging based on the provided description.</li>\n  <li>Can either throw or return errors based on a flag.</li>\n  <li>Useful for standardized error handling in asynchronous operations.</li>\n</ul>\n","readmeFilename":"README.md"}