Socket
Book a DemoInstallSign in
Socket

find-callback

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-callback

Finds and returns a node-style callback.

1.2.1
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Find Callback

Finds and returns a node-style callback (function that is the last argument) from given array or returns undefined if not found.

Install

npm install find-callback

Usage

var findCb = require('find-callback')

function foo(arg1, optionalArg, cb) {
  cb = findCb(arguments)
  //etc
  someAsyncFn(function() {
    //etc
    cb() // may be arguments[1] if the `optionalArg` was not used
  })
}

foo('some arg', function() {
  //etc
})

Parameters

array

Type: Array or arguments object

The array to search for a node-style callback. The last item in the array will be returned if it is a function.

Keywords

find

FAQs

Package last updated on 09 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.