Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-fn

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-fn - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

9

index.js
'use strict';
var toString = Object.prototype.toString;
module.exports = function (x) {
return toString.call(x) === '[object Function]';
module.exports = input => {
const type = Object.prototype.toString.call(input);
return type === '[object Function]' ||
type === '[object GeneratorFunction]' ||
type === '[object AsyncFunction]';
};
{
"name": "is-fn",
"version": "1.0.0",
"description": "Check if a value is a function",
"license": "MIT",
"repository": "sindresorhus/is-fn",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"function",
"func",
"fn",
"check",
"detect",
"is",
"test",
"type"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "is-fn",
"version": "2.0.0",
"description": "Check if a value is a function",
"license": "MIT",
"repository": "sindresorhus/is-fn",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"function",
"func",
"fn",
"check",
"detect",
"is",
"test",
"type"
],
"devDependencies": {
"ava": "^1.0.1",
"xo": "^0.23.0"
}
}

@@ -5,7 +5,9 @@ # is-fn [![Build Status](https://travis-ci.org/sindresorhus/is-fn.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fn)

In Node.js, just use `typeof fn` which works exactly the same. This module can be useful in the browser where `typeof fn` has a myriad of [bugs](https://github.com/lodash/lodash/blob/8f621b38bfc67f64a9bf7af347e3398477790a39/lodash.js#L8171-L8173).
## Install
```
$ npm install --save is-fn
$ npm install is-fn
```

@@ -19,3 +21,3 @@

isFn(function () {});
isFn(() => {});
//=> true

@@ -28,4 +30,9 @@

## Related
- [@sindresorhus/is](https://github.com/sindresorhus/is) - Type check values
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc