npm

Need private packages and team management tools?Check out npm Orgs. »

is-class-function

0.0.1 • Public • Published

is-class-function

Checks if function is an ES6 class. Supports classes declared in ES5 style but with at least one additional method in prototype or ES5 classes with inheritance. Native classes like Object, String, Function etc. treats as not a class-functions.

Install

Install on Node.JS with npm

npm install is-class-function

Usage

ES6 classes:

const isClassFn = require('is-class-function')
 
class EmptyClass {}
isClassFn(EmptyClass) // true
 
class SecondClass extends EmptyClass {}
isClassFn(SecondClass) // true

ES5 classes:

const isClassFn = require('is-class-function')
 
function func() {}
isClassFn(func) // false
 
const arrowFn = () => {}
isClassFn(arrowFn) // false
 
function ES5Class() {}
ES5Class.prototype.method = function() {}
isClassFn(ES5Class) // true

License

MIT © Taras Panasyuk

install

npm i is-class-function

Downloadsweekly downloads

5

version

0.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability