1

Looking at source code of 'util' module you can see isFunction method definition:

function isFunction(arg) {
   return typeof arg === 'function';
};
exports.isFunction = isFunction;

But when I run node, 'isFunction' is missing in util library:

var util = require('util');
'isFunction' in util; //false

What am I missing? Where 'isFunction' method is being deleted from 'util'?

2
  • Maybe you require a node module called util? Try require('./util.js') Feb 27, 2014 at 9:00
  • @NULL I have no my own module with name 'util'. require('./util.js') results: Error: Cannot find module './util.js'
    – alexpods
    Feb 27, 2014 at 9:03

2 Answers 2

5

you're looking at the code for the master branch, v0.11. you're testing it on a stable branch, probably v0.10.x, which doesn't have these utilities yet.

1
  • Yeah! You're right! I was testing it on v0.10.25 version. Thanks!
    – alexpods
    Feb 27, 2014 at 17:41
-2

Also I suggest you to use a module called lodash

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.