Skip to content

Commit

Permalink
- fixed CustomTransform
Browse files Browse the repository at this point in the history
🪿
  • Loading branch information
maZahaca committed Oct 17, 2018
1 parent e10900f commit 3316520
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/transforms/transformsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ const transformsFactory = {
/**
* Adds custom transform
* @param {string} type
* @param {Function} transform
* @param {Function} transformFn
*/
addTransform(type, transform) {
if (typeof type !== 'string' || typeof transform !== 'function') {
addTransform(type, transformFn) {
if (typeof type !== 'string' || typeof transformFn !== 'function') {
throw new Error('addTransform accept "type" as string and "transform" as function which does transformation');
}

class CustomTransform extends Transform {
transform() {
transform.call(this, this._options);
doTransform() {
return transformFn(this._value, this._options, this._storage);
}
}

Expand Down

0 comments on commit 3316520

Please sign in to comment.