Skip to content

Inherify is a function constructor to make easy and clean inherits prototypes.

License

Notifications You must be signed in to change notification settings

rubeniskov/inherify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inherify

Build Status Coverage Status Slack Status Version Downloads Node License

Issues Open Issue Resolution

Inherify is a function constructor to make easy and clean inherits prototypes.

NPM GRID

Installation

Install with npm install inherify --save.

Usage

To use, add the require node module:

    const Inherify = require('inherify');

    const CustomError = Inherify(Error, {
        __constructor: function(settings) {
            settings = typeof(settings) === 'string' ? {
                message: settings
            } : settings || {};
            this.name = 'CustomError';
            this.type = settings.type || 'Application';
            this.message = settings.message || 'An error occurred.';
            this.detail = settings.detail || '';
            this.extendedInfo = settings.extendedInfo || '';
            this.errorCode = settings.errorCode || '';
            Error.captureStackTrace(this, CustomError);
        }
    });

    throw new CustomError('Custom error raised!');

WTF

About

Inherify is a function constructor to make easy and clean inherits prototypes.

Resources

License

Stars

Watchers

Forks

Packages