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