npm.io
0.0.3 • Published 10 years ago

method-exists

Licence
MIT
Version
0.0.3
Deps
0
Vulns
0
Weekly
0

method exists

bool method_exists(object object, string method_name);

Installation

npm install method_exists --save

Basic Usage

const method_exists = require('method-exists');

class TestClass {
    testMethod () {
        console.log('This is testMethod');
    }
}

var result = method_exists(new TestClass, 'testMethod');
console.log(result);    // true;

var result = method_exists(new TestClass, 'noExistMethod');
console.log(result);    // false;

Keywords