Hans 601f9b38f8 feat(@angular/cli): move angular-cli to @angular/cli (#4328)
This release is otherwise identical to beta.28.
2017-02-01 18:19:50 -08:00

32 lines
1.0 KiB
JavaScript

'use strict';
module.exports = {
/**
Returns a relative parent path string using the path provided
@method getRelativeParentPath
@param {String} path The path to relatively get to.
@return {String} the relative path string.
*/
getRelativeParentPath: function getRelativeParentPath(path, offset, slash) {
var offsetValue = offset || 0;
var trailingSlash = typeof slash === 'undefined' ? true : slash;
var outputPath = new Array(path.split('/').length + 1 - offsetValue).join('../');
return trailingSlash ? outputPath : outputPath.substr(0, outputPath.length - 1);
},
/**
Returns a relative path string using the path provided
@method getRelativePath
@param {String} path The path to relatively get to.
@return {String} the relative path string.
*/
getRelativePath: function getRelativePath(path, offset) {
var offsetValue = offset || 0;
var relativePath = new Array(path.split('/').length - offsetValue).join('../');
return relativePath || './';
}
};