methodExists

Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.class

Check if one or more methods exists on a class instance

Params

  1. instance*-Object

    The instance to check the methods on

  2. methods*-String[]

    The methods to check

Return

  1. -Boolean|Array

    Return true if all is ok, and an array of missing methods if not

Example

class Coco {
   hello() {}
}
import { methodExists } from '@blackbyte/sugar/class';
const myInstance = new Coco();
methodExists(myInstance, 'hello', 'world'); // => ['world'];
methodExists(myInstance, 'hello'); // => true

Todo

  • testsnormal