Source: tasks/helpers/build-destinations.js

'use strict';

var path = require('path');

/**
 * @module tasks/helpers/build-destinations
 */
module.exports = {

    /**
     * getDestination
     * @param basePath
     * @param destination
     * @returns {*}
     */
    getDestination : function (basePath, destination) {

        if (!destination) {
            return basePath;
        }

        var parts = basePath.split(path.sep);

        if (parts[parts.length - 1] === '') {
            parts.pop();
        }

        parts[parts.length - 1] = destination;

        return parts.join(path.sep);
    }
};