We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c0674f5 commit ef0c193Copy full SHA for ef0c193
src/util.js
@@ -0,0 +1,7 @@
1
+var isFunction = function(fn) {
2
+ return fn && {}.toString.call(fn) === '[object Function]';
3
+}
4
+
5
+module.exports = {
6
+ isFunction
7
test/util.js
@@ -0,0 +1,17 @@
+var assert = require('assert');
+var util = require('../src/util');
+describe('util', function() {
+ describe('isFunction', function() {
8
+ it('function should be properly detected', function() {
9
+ var f = function(f) { console.log(f); };
10
+ assert.equal(util.isFunction(f), true);
11
+ assert.equal(util.isFunction(console.log), true);
12
+ assert.equal(util.isFunction('foo'), false);
13
+ assert.equal(util.isFunction([1, 2]), false);
14
+ });
15
16
17
+});
0 commit comments