Comparing version 1.0.0 to 2.0.0
'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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
2567
7
36