{"_id":"is-callback-function","_rev":"3374093","name":"is-callback-function","description":"Returns true if function is a callback. Checks its name is one of [common-callback-names][] - callback, cb, cb_, callback_, next, done, they can be customized, these are default.","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"tunnckocore","email":"mameto_100@mail.bg"},{"name":"vanchoy","email":"super.ludiq@gmail.com"}],"time":{"modified":"2024-08-26T02:59:52.000Z","created":"2016-03-18T14:15:01.087Z","1.0.1":"2016-05-09T05:36:58.532Z","1.0.0":"2016-03-18T14:15:01.087Z"},"users":{},"author":{"name":"Charlike Mike Reagent","email":"@tunnckoCore","url":"http://www.tunnckocore.tk"},"repository":{"type":"git","url":"git+https://github.com/tunnckocore/is-callback-function.git"},"versions":{"1.0.1":{"name":"is-callback-function","version":"1.0.1","description":"Returns true if function is a callback. Checks its name is one of [common-callback-names][] - callback, cb, cb_, callback_, next, done, they can be customized, these are default.","repository":{"type":"git","url":"git+https://github.com/tunnckocore/is-callback-function.git"},"author":{"name":"Charlike Mike Reagent","email":"@tunnckoCore","url":"http://www.tunnckocore.tk"},"precommit.silent":true,"main":"index.js","license":"MIT","scripts":{"test":"standard && node test.js"},"dependencies":{"common-callback-names":"^1.0.1","get-fn-name":"^1.0.0","in-array":"^0.1.0"},"devDependencies":{"assertit":"^0.1.0","is-async-function":"^1.1.1","pre-commit":"*"},"files":["index.js"],"keywords":["callback","cb","check","common","done","fn","function","is","is-callback-function","name","names","next","validate"],"verb":{"run":true,"toc":false,"layout":"empty","tasks":["readme"],"related":{"list":["is-async-function","function-arguments","arr-includes","get-fn-name","common-callback-names","in-array"]},"reflinks":["is-async-function","common-callback-names","in-array"],"lint":{"reflinks":true}},"gitHead":"123b14d4a6d21da7a1364ddc761eb4710cb06b3c","bugs":{"url":"https://github.com/tunnckocore/is-callback-function/issues"},"homepage":"https://github.com/tunnckocore/is-callback-function#readme","_id":"is-callback-function@1.0.1","_shasum":"06cba50c6209313f0bd4fa9ea57289e9ddfe72c2","_from":".","_npmVersion":"3.8.5","_nodeVersion":"5.8.0","_npmUser":{"name":"tunnckocore","email":"mameto_100@mail.bg"},"dist":{"shasum":"06cba50c6209313f0bd4fa9ea57289e9ddfe72c2","size":3693,"noattachment":false,"key":"/is-callback-function/-/is-callback-function-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/is-callback-function/download/is-callback-function-1.0.1.tgz"},"maintainers":[{"name":"tunnckocore","email":"mameto_100@mail.bg"},{"name":"vanchoy","email":"super.ludiq@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/is-callback-function-1.0.1.tgz_1462772217465_0.2619606819935143"},"directories":{},"publish_time":1462772218532,"_hasShrinkwrap":false,"_cnpm_publish_time":1462772218532,"_cnpmcore_publish_time":"2021-12-16T21:03:48.626Z"},"1.0.0":{"name":"is-callback-function","version":"1.0.0","description":"Returns true if function is a callback. Checks its name is one of [common-callback-names][] - callback, cb, cb_, callback_, next, done, they can be customized, these are default.","repository":{"type":"git","url":"git+https://github.com/tunnckocore/is-callback-function.git"},"author":{"name":"Charlike Mike Reagent","email":"@tunnckoCore","url":"http://www.tunnckocore.tk"},"precommit.silent":true,"main":"index.js","license":"MIT","scripts":{"test":"standard && node test.js"},"dependencies":{"common-callback-names":"^1.0.1","get-fn-name":"^1.0.0","in-array":"^0.1.0"},"devDependencies":{"assertit":"^0.1.0","is-async-function":"^1.1.1","pre-commit":"*"},"files":["index.js"],"keywords":["callback","cb","check","common","done","fn","function","is","is-callback-function","name","names","next","validate"],"verb":{"run":true,"toc":false,"layout":"empty","tasks":["readme"],"related":{"list":["is-async-function","function-arguments","arr-includes","get-fn-name","common-callback-names","in-array"]},"reflinks":["is-async-function","common-callback-names","in-array"],"lint":{"reflinks":true}},"gitHead":"afddd6ecdf3326c6f6893dff72e8cf6644e01545","bugs":{"url":"https://github.com/tunnckocore/is-callback-function/issues"},"homepage":"https://github.com/tunnckocore/is-callback-function#readme","_id":"is-callback-function@1.0.0","_shasum":"f2d37ce2012d505d84abef88e9c8c0f7121a9b6c","_from":".","_npmVersion":"3.8.2","_nodeVersion":"5.8.0","_npmUser":{"name":"tunnckocore","email":"mameto_100@mail.bg"},"dist":{"shasum":"f2d37ce2012d505d84abef88e9c8c0f7121a9b6c","size":3627,"noattachment":false,"key":"/is-callback-function/-/is-callback-function-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/is-callback-function/download/is-callback-function-1.0.0.tgz"},"maintainers":[{"name":"tunnckocore","email":"mameto_100@mail.bg"},{"name":"vanchoy","email":"super.ludiq@gmail.com"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/is-callback-function-1.0.0.tgz_1458310498886_0.3681258677970618"},"directories":{},"publish_time":1458310501087,"_hasShrinkwrap":false,"_cnpm_publish_time":1458310501087,"_cnpmcore_publish_time":"2021-12-16T21:03:48.844Z"}},"readme":"# [is-callback-function][author-www-url] [![npmjs.com][npmjs-img]][npmjs-url] [![The MIT License][license-img]][license-url] [![npm downloads][downloads-img]][downloads-url] \n\n> Returns true if function is a callback. Checks its name is one of [common-callback-names][] - callback, cb, cb_, callback_, next, done, they can be customized, these are default.\n\n[![code climate][codeclimate-img]][codeclimate-url] [![standard code style][standard-img]][standard-url] [![travis build status][travis-img]][travis-url] [![coverage status][coveralls-img]][coveralls-url] [![dependency status][david-img]][david-url]\n\n## Install\n```\nnpm i is-callback-function --save\n```\n\n## Usage\n> For more use-cases see the [tests](./test.js)\n\n```js\nconst isCallbackFunction = require('is-callback-function')\n```\n\n### [isCallbackFunction](index.js#L52)\n> Check if given `fn` is callback function or not. Notice that \"async\" functions are not `is-callback-function`, they are [is-async-function][] - it may be consfusing, but they are different.\n\n**Params**\n\n* `fn` **{Function}**    \n* `names` **{Array}**    \n* `returns` **{Boolean}**  \n\n**Example**\n\n```js\nvar fs = require('fs')\nvar isCallback = require('is-callback-function')\nvar isAsync = require('is-async-function')\n\nconsole.log(isCallback(fs.readFile)) // => false\nconsole.log(isAsync(fs.readFile)) // => true\n\nconsole.log(isCallback(function (foo, bar, cb) {})) // => false\nconsole.log(isAsync(function (foo, bar, cb) {})) // => true\n\nconsole.log(isCallback(function callback (foo, bar) {})) // => true\nconsole.log(isAsync(function callback (foo, bar) {})) // => false\n\nconsole.log(isCallback(function named (foo, cb) {})) // => false\nconsole.log(isAsync(function named (foo, cb) {})) // => true\n\nconsole.log(isCallback(function named (foo) {})) // => false\nconsole.log(isAsync(function named (foo) {})) // => false\n\nconsole.log(isCallback(function foo (bar) {}, ['baz', 'foo', 'qux'])) // => true\nconsole.log(isAsync(function foo (bar, qux) {}, ['baz', 'qux', 'aaa'])) // => true\nconsole.log(isAsync(function foo (bar, qux) {}, ['baz', 'aaa'])) // => false\n```\n\n## Whaaat?!\n> Need clarification? Both signatures are equal.\n\n- `is-callback-function` - checks the name of given function\n- `is-async-function` - checks the arguments names of given function\n\n## Related\n* [arr-includes](https://www.npmjs.com/package/arr-includes): Return true if any of passed values exists in array. Using [in-array][]. | [homepage](https://github.com/tunnckocore/arr-includes)\n* [common-callback-names](https://www.npmjs.com/package/common-callback-names): List of common callback names - callback, cb, callback_, next, done. | [homepage](https://github.com/tunnckocore/common-callback-names)\n* [function-arguments](https://www.npmjs.com/package/function-arguments): Get arguments of a function, useful for and used in dependency injectors.… [more](https://www.npmjs.com/package/function-arguments) | [homepage](https://github.com/tunnckocore/function-arguments)\n* [get-fn-name](https://www.npmjs.com/package/get-fn-name): Get function name with strictness and correctness in mind. Also works for… [more](https://www.npmjs.com/package/get-fn-name) | [homepage](https://github.com/tunnckocore/get-fn-name)\n* [in-array](https://www.npmjs.com/package/in-array): Return true if a value exists in an array. Faster than using… [more](https://www.npmjs.com/package/in-array) | [homepage](https://github.com/jonschlinkert/in-array)\n* [is-async-function](https://www.npmjs.com/package/is-async-function): Is function really asynchronous function? Trying to guess that based on check… [more](https://www.npmjs.com/package/is-async-function) | [homepage](https://github.com/tunnckocore/is-async-function)\n\n## Contributing\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/tunnckoCore/is-callback-function/issues/new).  \nBut before doing anything, please read the [CONTRIBUTING.md](./CONTRIBUTING.md) guidelines.\n\n## [Charlike Make Reagent](http://j.mp/1stW47C) [![new message to charlike][new-message-img]][new-message-url] [![freenode #charlike][freenode-img]][freenode-url]\n\n[![tunnckoCore.tk][author-www-img]][author-www-url] [![keybase tunnckoCore][keybase-img]][keybase-url] [![tunnckoCore npm][author-npm-img]][author-npm-url] [![tunnckoCore twitter][author-twitter-img]][author-twitter-url] [![tunnckoCore github][author-github-img]][author-github-url]\n\n[common-callback-names]: https://github.com/tunnckocore/common-callback-names\n[in-array]: https://github.com/jonschlinkert/in-array\n[is-async-function]: https://github.com/tunnckocore/is-async-function\n\n[npmjs-url]: https://www.npmjs.com/package/is-callback-function\n[npmjs-img]: https://img.shields.io/npm/v/is-callback-function.svg?label=is-callback-function\n\n[license-url]: https://github.com/tunnckoCore/is-callback-function/blob/master/LICENSE\n[license-img]: https://img.shields.io/npm/l/is-callback-function.svg\n\n[downloads-url]: https://www.npmjs.com/package/is-callback-function\n[downloads-img]: https://img.shields.io/npm/dm/is-callback-function.svg\n\n[codeclimate-url]: https://codeclimate.com/github/tunnckoCore/is-callback-function\n[codeclimate-img]: https://img.shields.io/codeclimate/github/tunnckoCore/is-callback-function.svg\n\n[travis-url]: https://travis-ci.org/tunnckoCore/is-callback-function\n[travis-img]: https://img.shields.io/travis/tunnckoCore/is-callback-function/master.svg\n\n[coveralls-url]: https://coveralls.io/r/tunnckoCore/is-callback-function\n[coveralls-img]: https://img.shields.io/coveralls/tunnckoCore/is-callback-function.svg\n\n[david-url]: https://david-dm.org/tunnckoCore/is-callback-function\n[david-img]: https://img.shields.io/david/tunnckoCore/is-callback-function.svg\n\n[standard-url]: https://github.com/feross/standard\n[standard-img]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n\n[author-www-url]: http://www.tunnckocore.tk\n[author-www-img]: https://img.shields.io/badge/www-tunnckocore.tk-fe7d37.svg\n\n[keybase-url]: https://keybase.io/tunnckocore\n[keybase-img]: https://img.shields.io/badge/keybase-tunnckocore-8a7967.svg\n\n[author-npm-url]: https://www.npmjs.com/~tunnckocore\n[author-npm-img]: https://img.shields.io/badge/npm-~tunnckocore-cb3837.svg\n\n[author-twitter-url]: https://twitter.com/tunnckoCore\n[author-twitter-img]: https://img.shields.io/badge/twitter-@tunnckoCore-55acee.svg\n\n[author-github-url]: https://github.com/tunnckoCore\n[author-github-img]: https://img.shields.io/badge/github-@tunnckoCore-4183c4.svg\n\n[freenode-url]: http://webchat.freenode.net/?channels=charlike\n[freenode-img]: https://img.shields.io/badge/freenode-%23charlike-5654a4.svg\n\n[new-message-url]: https://github.com/tunnckoCore/ama\n[new-message-img]: https://img.shields.io/badge/ask%20me-anything-green.svg","_attachments":{},"homepage":"https://github.com/tunnckocore/is-callback-function#readme","bugs":{"url":"https://github.com/tunnckocore/is-callback-function/issues"},"license":"MIT"}