node_modules/snyk/dist/cli/139.index.js
/**
   * Run the provided validation method each time a submit event occur.
   * @param  {Rx.Observable} submit - submit event flow
   * @return {Object}        Object containing two observables: `success` and `error`
   */
Run the provided validation method each time a submit event occur.
@param  {Rx.Observable} submit - submit event flow
@return {Object}        Object containing two observables: `success` and `error`
Run the provided validation method each time a submit event occur . @param { Rx . Observable } submit - submit event flow @return { Object } Object containing two observables : ` success ` and ` error `
handleSubmitEvents(submit) {
    var self = this;
    var validate = runAsync(this.opt.validate);
    var asyncFilter = runAsync(this.opt.filter);
    var validation = submit.pipe(
      flatMap((value) =>
        asyncFilter(value, self.answers).then(
          (filteredValue) =>
            validate(filteredValue, self.answers).then(
              (isValid) => ({ isValid: isValid, value: filteredValue }),
              (err) => ({ isValid: err, value: filteredValue })
            ),
          (err) => ({ isValid: err })
        )
      ),
      share()
    );
    var success = validation.pipe(
      filter((state) => state.isValid === true),
      take(1)
    );
    var error = validation.pipe(
      filter((state) => state.isValid !== true),
      takeUntil(success)
    );
    return {
      success: success,
      error: error,
    };
  }
handleSubmitEvents ( submit ) { var self = this ; var validate = runAsync ( this . opt . validate ) ; var asyncFilter = runAsync ( this . opt . filter ) ; var validation = submit . pipe ( flatMap ( ( value ) => asyncFilter ( value , self . answers ) . then ( ( filteredValue ) => validate ( filteredValue , self . answers ) . then ( ( isValid ) => ( { isValid : isValid , value : filteredValue } ) , ( err ) => ( { isValid : err , value : filteredValue } ) ) , ( err ) => ( { isValid : err } ) ) ) , share ( ) ) ; var success = validation . pipe ( filter ( ( state ) => state . isValid === true ) , take ( 1 ) ) ; var error = validation . pipe ( filter ( ( state ) => state . isValid !== true ) , takeUntil ( success ) ) ; return { success : success , error : error , } ; }
Run the provided validation method each time a submit event occur.
Run the provided validation method each time a submit event occur .