NASA Proceeds to Mars

    This package has been deprecated

    Author message:

    no longer supported


    0.0.4 • Public • Published


    iEnhance is a base module for iSeries Packages that supports declaritively extending the capability of existing classes or instances without modifying them. iEnhanced classes can be wrapped by other iEnhanced classes. The best way to describe it is as Proxy based, aspect oriented inheritance.

    Build Status Codacy Badge Test Coverage


    Compatible with Chrome, Firefox, and Node.js. Due to lack of built-in standards support IE, Edge, and Safari are not currently supported. Compatibility tests sponsored by


    npm install iEnhance



    Enhancing Classes: iEnhance(objectOrConstructor,properties)

    iEhance takes an object or a constructor as an argument and transparently adds the properties in the properties argument. Once enhanced, the object or constructor and its instances will behave as if the properties are native to their implementation.


    function aConstructor() { }
    aConstructor = iEnhance(aConstructor,{
        aClassMethod: classMethod() { return "hello"; },
        prototype: {
            anInstanceMethodFromPrototype: instanceMethodFromPrototype() { return "there"; }
        instance: {
            anInstanceProperty: {enumerable:true,configurable:true,writable:true,initialize() { return []; }
    var o = {},
        o = iEnhance(o,{
        anObjectMethod: objectMethod() { return "hello"; }


    objectOrConstructor - A class constructor or an object.

    properties - Properties is an object of the form:

        directMethodOrPropertyName: directMethodOrPropertyValue, // will shadow duplicate names on original
        prototype: { // Only relevant when first argument is a constructor.
            // The prototype property is invisible to code using enhanced instances. 
            // Attemptes to retrieve the prototype return the instance's true prototype.
            // However, subproperties are returned as if they existed on the original
            // prototype and will shadow duplicate names.
            prototypeMethodOrPropertyName: prototypeMethodOrPropertyValue,
        instance: { // Only relevant when first argument is a constructor.
            // Descriptors are used to create properties directly on instances created by an enhanced constructor.
            instanceMethodOrPropertyDescriptor: { // behaves almost identically to built-in descriptor
                enumerable: true | false,
                configurable: true | false,
                writable: true | false,
                initialize: <function that returns a value> // optional initialization function
                value: <a value> // will get overwritten if initialize is also provided

    The initialize function is provided as part of property descriptors to ensure any objects are specific to the instance. If an object is provided for the value property of a descriptor, then the object will be shared across all instances. This behavior is supported by specifying a property on the prototype, so value should not typically be specified.

    Return Value

    Returns a Proxy.

    Release History

    2016-07-08 v0.0.4 - Documentation updates. Code style improvements.

    2016-06-25 through 2016-07-07 v0.0.1 - v0.0.3 Initial code and documentation.


    npm i iEnhance

    DownloadsWeekly Downloads






    Last publish


    • anywhichway