2.0.0 • Published 7 years ago
isa-plain-function v2.0.0
isa-plain-function
Simple check to see if a function has any prototype members.
Sometimes it's useful to check if a function can be considered "class-like".
This is the case when the prototype
of that function has been modified.
Installation
npm install isa-plain-function
Usage
var isaPlainFunction = require('isa-plain-function');
isaPlainFunction( function(){} ); // true
var Foo = function(){};
Foo.prototype = {
awesome: true,
};
isaPlainFunction( Foo ); // false
Check the test for edge cases.
Note
This module uses Object.getOwnPropertyNames
when available to detect any
non-ennumerable properties created using Object.defineProperty
and co.