Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xotic750/is-function-x
Determine whether a given value is a function object.
https://github.com/xotic750/is-function-x
browser ecmascript function isfunction nodejs
Last synced: 3 months ago
JSON representation
Determine whether a given value is a function object.
- Host: GitHub
- URL: https://github.com/xotic750/is-function-x
- Owner: Xotic750
- License: mit
- Created: 2016-01-20T00:49:41.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T23:11:55.000Z (about 2 years ago)
- Last Synced: 2024-04-25T22:40:46.939Z (9 months ago)
- Topics: browser, ecmascript, function, isfunction, nodejs
- Language: JavaScript
- Homepage:
- Size: 2.67 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## is-function-x
Determine whether a given value is a function object.
### `module.exports(value, [allowClass])` ⇒
boolean
⏏Checks if `value` is classified as a `Function` object.
**Kind**: Exported function
**Returns**:boolean
- Returns `true` if `value` is correctly classified,
else `false`.| Param | Type | Default | Description |
| ------------ | -------------------- | ------------------ | ------------------------------ |
| value |\*
| | The value to check. |
| [allowClass] |boolean
|false
| Whether to filter ES6 classes. |**Example**
```js
import isFunction from 'is-function-x';console.log(isFunction()); // false
console.log(isFunction(Number.MIN_VALUE)); // false
console.log(isFunction('abc')); // false
console.log(isFunction(true)); // false
console.log(isFunction({name: 'abc'})); // false
console.log(isFunction(function() {})); // true
console.log(isFunction(new Function())); // true
console.log(isFunction(function* test1() {})); // true
console.log(isFunction(function test2(a, b) {})); // true
console.log(isFunction(async function test3() {})); // true
console.log(isFunction(class Test {})); // false
console.log(isFunction(class Test {}, true)); // true
console.log(
isFunction((x, y) => {
return this;
}),
); // true
```