implemented
v1.0.0
Published
A simple javascript module for checking interface implementations.
Downloads
2
Readme
Implements
A simple javascript module for checking interface implementations.
Usage
Require
const implem = require('implements');
implem
is an object with the following properties:
| Property | Description |
| --- | --- |
| checkImplementation(interface, implementation)
| Check if interface is implemented, otherwise throws an error. |
| Property
| A class that represent a property of an implementation |
Property
The constructor has the following signature Property(type, args)
| Parameter | Type | Description |
| --- | --- | --- |
| type
| string | The js primitive type of the property |
| args
| number | If type is 'function' indicates the function number of arguments, otherwise is ignored |
Example
const implem = require('implemented');
const Property = implem.Property;
const interf = {
prop1: new Property('function', 3),
prop2: new Property('string'),
// ...
}
const obj = {};
implem.checkImplementation(interf, obj); // throws an error indicating the missing properties