lib/snippet.js
function (fp, options) {
    if (typeof fp === 'function') {
      return fp.call(this, this.path);
    }

    var opts = extend({}, this.options, options);
    if (typeof fp === 'object') {
      opts = extend({}, opts, fp);
    }

    if (typeof fp === 'string' && ~fp.indexOf(':')) {
      fp = fp.replace(/:(\w+)/g, function (m, prop) {
        return opts[prop] || this[prop] || m;
      }.bind(this));
    }

    this.path = this.path || fp;
    var base = opts.base || this.base || path.dirname(fp);
    var name = opts.basename || this.relative || this.basename;
    var ext = opts.ext || this.extname || path.extname(fp);

    if (typeof fp === 'string' && fp[fp.length - 1] === '/') {
      base = fp;
    }

    var dest = path.join(base, utils.rewrite(name, ext));
    if (dest.slice(-1) === '.') {
      dest = dest.slice(0, dest.length - 1) + ext;
    }
    return dest;
  }
function (fp, options) {
    if (typeof fp === 'function') {
      return fp.call(this, this.path);
    }

    var opts = extend({}, this.options, options);
    if (typeof fp === 'object') {
      opts = extend({}, opts, fp);
    }

    if (typeof fp === 'string' && ~fp.indexOf(':')) {
      fp = fp.replace(/:(\w+)/g, function (m, prop) {
        return opts[prop] || this[prop] || m;
      }.bind(this));
    }

    this.path = this.path || fp;
    var base = opts.base || this.base || path.dirname(fp);
    var name = opts.basename || this.relative || this.basename;
    var ext = opts.ext || this.extname || path.extname(fp);

    if (typeof fp === 'string' && fp[fp.length - 1] === '/') {
      base = fp;
    }

    var dest = path.join(base, utils.rewrite(name, ext));
    if (dest.slice(-1) === '.') {
      dest = dest.slice(0, dest.length - 1) + ext;
    }
    return dest;
  }
function ( fp , options ) { if ( typeof fp === 'function' ) { return fp . call ( this , this . path ) ; } var opts = extend ( { } , this . options , options ) ; if ( typeof fp === 'object' ) { opts = extend ( { } , opts , fp ) ; } if ( typeof fp === 'string' && ~ fp . indexOf ( ':' ) ) { fp = fp . replace ( / :(\w+) / g , function ( m , prop ) { return opts [ prop ] || this [ prop ] || m ; } . bind ( this ) ) ; } this . path = this . path || fp ; var base = opts . base || this . base || path . dirname ( fp ) ; var name = opts . basename || this . relative || this . basename ; var ext = opts . ext || this . extname || path . extname ( fp ) ; if ( typeof fp === 'string' && fp [ fp . length - 1 ] === '/' ) { base = fp ; } var dest = path . join ( base , utils . rewrite ( name , ext ) ) ; if ( dest . slice ( - 1 ) === '.' ) { dest = dest . slice ( 0 , dest . length - 1 ) + ext ; } return dest ; }
Calculate the destination path based on the given function or `filepath`.

@name .dest
@param {String|Function} `fp`
@return {String} Returns the destination path.
@api public
Calculate the destination path based on the given function or filepath .