UNPKG

angular15-generator

Version:

CLI tool to generate Angular 1.5 w/ TypeScript Routes and Components like Angular 2 CLI

30 lines (20 loc) 532 B
'use strict'; let path = require('path'); class PathUtil { static stripPathIfPResent(nameWithPossiblePath) { let pathObject = path.parse(nameWithPossiblePath); return pathObject.base; } static getPathDir(nameWithPossiblePath) { let pathObject = path.parse(nameWithPossiblePath); if (pathObject.dir !== '') { if (pathObject.dir.startsWith('../')) { return pathObject.dir; } else { return './' + pathObject.dir; } } return '.'; } } module.exports = PathUtil;