Git Product home page Git Product logo

node-callback-wrappers's People

Contributors

femto113 avatar

Watchers

 avatar

node-callback-wrappers's Issues

do you need a new release at npm? No nextIfError function

I need to use the nextIfError function but the installed version from npm does not have it...

Here is the snapshot from my node repository
screen shot 2015-01-22 at 12 18 01 am

And below is the package.json from the same folder.

Thanks and good work!

{
"name": "callback-wrappers",
"version": "0.2.0",
"description": "wrappers for async callbacks that implement common error handling scenarios",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"repository": {
"type": "git",
"url": "git://github.com/femto113/node-callback-wrappers.git"
},
"keywords": [
"callback",
"async"
],
"author": {
"name": "Ken Woodruff",
"email": "[email protected]"
},
"license": "MIT",
"readmeFilename": "README.md",
"readme": "# callback-wrappers\n\nFunction wrappers for async callbacks that implement common, simple error handling scenarios.\n\n## Install\n\nbash\n npm install callback-wrappers\n\n\n## Description\n\nMost async methods in the node world expect a callback with an (error, data) signature.\nIn programming scenarios where complex error handling is impossible or unneccessary (for\nexample you can simply log the error and exit the process) this can generate a lot\nof repetitive, boilerplate, error-handling code that can obscure your real logic, e.g.\n\njavascript\nasyncFunction1({ ... }, function (error, data) {\n if (error) {\n console.error(error);\n process.exit(1);\n } else {\n // some real logic here\n asyncFunction2({ ... }, function (error, data) {\n if (error) {\n console.error(error);\n process.exit(2);\n } else {\n // some more real logic here\n }\n });\n }\n});\n\n\nThis module provides a bunch of wrappers that take a function with just (data) signature\nand produce a function with the (error, data) signature and the boiler plate logic in place.\nFor example the exitIfError wrapper has the exact logic shown above, allowing for us to \ncollapse that example down to\n\njavascript\nvar exitIfError = require(\"callback-wrappers\").exitIfError;\n\nasyncFunction1({ ... }, exitIfError(1, function (data) {\n // some real logic here\n asyncFunction2({ ... }, exitIfError(2, function (data) {\n // some more real logic here\n });\n});\n\n\n### Function.prototype option\n\nIf messing with built-in objects' prototypes doesn't skeeve you out, you can use\nthe Function() export to get Function.prototype decorated with all of the wrappers\nand our example can look like\n\njavascript\nrequire(\"callback-wrappers\").Function();\n\nasyncFunction1({ ... }, function (data) {\n // some real logic here\n asyncFunction2({ ... }, function (data) {\n // some more real logic here\n }.exitIfError(2));\n}.exitIfError(1));\n\n\n### long & short wrapper names\n\nThe wrappers all follow a naming convention of actionIfError, where\naction is one of log, abort, exit, or throw. For brevity these\ncan be referenced by the initials l, a, x, and t, followed by ie \n(for "If Error"). Note that in all cases the error is logged, and in no case,\nincluding logIfError, will the wrapped function be called if the \nerror parameter isn't empty.\n\n## Change Log\n\n- 0.2.0: using Object.defineProperty to make the Function.prototype extensions not enumerable\n- 0.1.0: created\n\n## Acknowledgements\n\nThanks go to the nodejs group for comments and suggestions.\n\n## License\n\nMIT\n",
"_id": "[email protected]",
"dist": {
"shasum": "4ac3776caa21fa9939b80028dddb4bbe36510889",
"tarball": "http://registry.npmjs.org/callback-wrappers/-/callback-wrappers-0.2.0.tgz"
},
"_from": "callback-wrappers@*",
"_npmVersion": "1.2.15",
"_npmUser": {
"name": "femto113",
"email": "[email protected]"
},
"maintainers": [
{
"name": "femto113",
"email": "[email protected]"
}
],
"directories": {},
"_shasum": "4ac3776caa21fa9939b80028dddb4bbe36510889",
"_resolved": "https://registry.npmjs.org/callback-wrappers/-/callback-wrappers-0.2.0.tgz",
"bugs": {
"url": "https://github.com/femto113/node-callback-wrappers/issues"
},
"homepage": "https://github.com/femto113/node-callback-wrappers"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.