lib/funcSubject.js
function factory(BaseClass, mapFunction) {
  function subject(value) {
    if (typeof mapFunction === 'function') {
      value = mapFunction.apply(undefined, arguments);
    } else if (typeof mapFunction !== 'undefined') {
      value = mapFunction;
    }
    subject.onNext(value);
    return value;
  }
  
  for (var key in BaseClass.prototype) {
    subject[key] = BaseClass.prototype[key];
  }

  BaseClass.apply(subject, [].slice.call(arguments, 2));

  return subject;
}
function factory(BaseClass, mapFunction) {
  function subject(value) {
    if (typeof mapFunction === 'function') {
      value = mapFunction.apply(undefined, arguments);
    } else if (typeof mapFunction !== 'undefined') {
      value = mapFunction;
    }
    subject.onNext(value);
    return value;
  }
  
  for (var key in BaseClass.prototype) {
    subject[key] = BaseClass.prototype[key];
  }

  BaseClass.apply(subject, [].slice.call(arguments, 2));

  return subject;
}
function factory ( BaseClass , mapFunction ) { function subject ( value ) { if ( typeof mapFunction === 'function' ) { value = mapFunction . apply ( undefined , arguments ) ; } else if ( typeof mapFunction !== 'undefined' ) { value = mapFunction ; } subject . onNext ( value ) ; return value ; } for ( var key in BaseClass . prototype ) { subject [ key ] = BaseClass . prototype [ key ] ; } BaseClass . apply ( subject , [ ] . slice . call ( arguments , 2 ) ) ; return subject ; }
Factory that allows you to create your custom `FuncSuject`

example:

var myFuncSubject = FuncSubject.factory(MyCustomSubject, (val1, val2) => val1 + val2, ...arguments);
Factory that allows you to create your custom FuncSuject