2.2.0 • Published 6 years ago

jsrap v2.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

JSRap

A Node.js module to wrap existing library functions with custom code.

experimental Downloads/week Build Status Test Coverage Maintainability

Installation

npm i jsrap

Usage

var { PrototypeWrapper } = require("jsrap");
var Target = require("some-class");

PrototypeWrapper(Target, "someMethod", {
  before() {
    console.info("Executed before someMethod");
  },
  after() {
    console.info("Executed after someMethod");
  }
});

Methods

All of the following methods may be passed in the options object.

before(...args: any[]): any[]

The before method is called with all of the arguments of the original function passed in. Your implementation must either return the arguments array, or void.

exceptionHandler(exception: any, ...args: any[]): any

This method is called whenever an exception is thrown by the original method. It's return value is saved as the method result if it's not void.

after(...args: any[]): any

This method is called after the original method has completed. All of the original arguments are passed to it, and it can return void or some other value that will be used as the method result. If void is returned, the previous result value is saved.

filterResults(result: any): any

Allows you to modify the results before returning. Whatever is returned from this function is used as the final result.

2.2.0

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.3

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.2.18

6 years ago

1.2.17

6 years ago

1.2.16

6 years ago

1.2.15

6 years ago

1.2.14

6 years ago

1.2.13

6 years ago

1.2.12

6 years ago

1.2.11

6 years ago

1.2.9

6 years ago

1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago