Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

es-abstract-is-callable

npetruzzelli16BSD-3-Clause0.1.0

A method to determine if an argument is a callable function with a call method

IsCallable, isCallable, is callable, callable, ECMAScript, ES, ecma, abstract, internal, operation, method, abstract operation, abstract operations, internal method, internal methods, JavaScript, ES5, ES2009, ES5.1, ES2011, ES6, ES2015, ES7, ES2016, ES8, ES2017

readme

IsCallable

A method to determine if an argument is a callable function with a call method. This method follows ECMAScript's specification for the 'IsCallable ' abstract operation.

Currently, this module only supports the ES2017 (ES8) specification.

This module follows the spec in order of operations, but has no way of checking internal methods. It checks against public methods instead. You may be interested in is-callable as an alternative.

Installation Using npm

npm install es-abstract-is-callable

Example Usage

var isCallable = require('es-abstract-is-callable')

var a = {
    yep: function() {},
    nope: "foo"
}

function b() {}

var c = {
    call: function() {}
}

console.log(isCallable(a))      // => false
console.log(isCallable(a.yep))  // => true
console.log(isCallable(a.nope)) // => false
console.log(isCallable(b))      // => true
console.log(isCallable(c))      // => true

Documentation

API

IsCallable ( argument )

The abstract operation IsCallable determines if argument, which must be an ECMAScript language value, is a callable function with a [[Call]] internal method.

A Boolean value is returned.

argument

Type: *

The value to check.

  • is-callable: "Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag."
  • es-abstract: a single library for multiple ECMAScript abstract operations.