packages/core/lib/misc/conditions.js
function({options}, succeed, skip) {
    // Default to `options.target` if "true"
    if (typeof options.if_exists === 'boolean' && options.target) {
      options.if_exists = options.if_exists ? [options.target] : null;
    }
    return each(options.if_exists).call((if_exists, next) => {
      return this.fs.exists({
        target: if_exists
      }, (err, {exists}) => {
        if (exists) {
          this.log({
            message: `File exists ${if_exists}, continuing`,
            level: 'DEBUG',
            module: 'nikita/misc/conditions'
          });
          return next();
        } else {
          this.log({
            message: `File doesnt exists ${if_exists}, skipping`,
            level: 'INFO',
            module: 'nikita/misc/conditions'
          });
          return skip();
        }
      });
    }).next(succeed);
  }
function({options}, succeed, skip) {
    // Default to `options.target` if "true"
    if (typeof options.if_exists === 'boolean' && options.target) {
      options.if_exists = options.if_exists ? [options.target] : null;
    }
    return each(options.if_exists).call((if_exists, next) => {
      return this.fs.exists({
        target: if_exists
      }, (err, {exists}) => {
        if (exists) {
          this.log({
            message: `File exists ${if_exists}, continuing`,
            level: 'DEBUG',
            module: 'nikita/misc/conditions'
          });
          return next();
        } else {
          this.log({
            message: `File doesnt exists ${if_exists}, skipping`,
            level: 'INFO',
            module: 'nikita/misc/conditions'
          });
          return skip();
        }
      });
    }).next(succeed);
  }
function ( { options } , succeed , skip ) { // Default to `options.target` if "true" if ( typeof options . if_exists === 'boolean' && options . target ) { options . if_exists = options . if_exists ? [ options . target ] : null ; } return each ( options . if_exists ) . call ( ( if_exists , next ) => { return this . fs . exists ( { target : if_exists } , ( err , { exists } ) => { if ( exists ) { this . log ( { message : ` ${ if_exists } ` , level : 'DEBUG' , module : 'nikita/misc/conditions' } ) ; return next ( ) ; } else { this . log ( { message : ` ${ if_exists } ` , level : 'INFO' , module : 'nikita/misc/conditions' } ) ; return skip ( ) ; } } ) ; } ) . next ( succeed ) ; }
The callback `succeed` is called if all the provided paths exists otherwise the callback `skip` is called.
The callback succeed is called if all the provided paths exists otherwise the callback skip is called .