method-exists

0.0.3 • Public • Published

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;

Package Sidebar

Install

npm i method-exists

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • npm