{"_id":"success","_rev":"5-5e20fa7a99511a1740a23fb47ff421d8","name":"success","description":"Success/failure handler for Node.js callbacks","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"success","version":"0.1.0","description":"Success/failure handler for Node.js callbacks","main":"success.js","scripts":{"test":"node test/success.test.js"},"repository":{"type":"git","url":"git://github.com/rjrodger/success.git"},"keywords":["seneca","project","plugin"],"author":{"name":"Richard Rodger","url":"http://richardrodger.com"},"license":"MIT","dependencies":{},"peerDependencies":{},"devDependencies":{},"files":["README.md","LICENSE.txt","success.js"],"bugs":{"url":"https://github.com/rjrodger/success/issues"},"homepage":"https://github.com/rjrodger/success","_id":"success@0.1.0","dist":{"shasum":"d259c824fd10650b4e4eaa7a8ee26715531ce101","tarball":"https://registry.npmjs.org/success/-/success-0.1.0.tgz","integrity":"sha512-FJnC/VtP6IfAsso19LlF5XN+8TRBtpA8Z7nWs/zvnkLdYlWGgXEP7Aw8HdnT3+wrLajW8vmgZO7WO/OJ+96xhw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICsCW6P2tU0Z+iZl2Q8VmZLn8JSzrFTb+rmbTuRc4PZlAiB0eocnU5+KL/TlZbkLWStxnyjV1ydBqv+3/zwHhflBrg=="}]},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"rjrodger","email":"richard.rodger@nearform.com"},"maintainers":[{"name":"rjrodger","email":"richard.rodger@nearform.com"}]}},"readme":"success\n=======\n\n### Success/failure handler for Node.js callbacks\n\nA convenience function for passing errors to a callback that helps you avoid the need to write\n\n```JavaScript\nif( error ) return callback( error );\n```\n\nall the time.\n\nInstead, you can do this:\n\n```JavaScript\nvar success = require('success')\n\nfunction doStuff( err, callback ) {\n\n  doMoreStuff( success(callback, function(result) {\n\n    handleResult( result )\n  }))  \n}\n```\n\nThis replaces the plain version:\n\n```JavaScript\nvar success = require('success')\n\nfunction doStuff( err, callback ) {\n\n  doMoreStuff( function( err, result ) {\n    if( err ) return callback(err);\n\n    handleResult( result )\n  })\n}\n```\n\nIf you want to be quick and dirty, omitting the failure callback will\nprint the error (if it occurs) to standard output.\n\n```JavaScript\n  doMoreStuff( success(function(result) {\n\n    handleResult( result )\n  }))  \n```\n\n\n\n### Support\n\nIf you're using this module, feel free to contact me on twitter if you\nhave any questions! :) [@rjrodger](http://twitter.com/rjrodger)\n\nCurrent Version: 0.1.0\n\nTested on: node 0.10.24\n\n[![Build\nStatus](https://travis-ci.org/rjrodger/success.png?branch=master)](https://travis-ci.org/rjrodger/success)\n\n","maintainers":[{"name":"rjrodger","email":"richard.rodger@nearform.com"}],"time":{"modified":"2022-06-27T01:54:08.017Z","created":"2014-03-27T08:41:47.516Z","0.1.0":"2014-03-27T08:41:47.516Z"},"homepage":"https://github.com/rjrodger/success","keywords":["seneca","project","plugin"],"repository":{"type":"git","url":"git://github.com/rjrodger/success.git"},"author":{"name":"Richard Rodger","url":"http://richardrodger.com"},"bugs":{"url":"https://github.com/rjrodger/success/issues"},"license":"MIT","readmeFilename":"README.md","users":{"fgribreau":true}}