@nxworker/workspace
Version:
Nx plugin providing generators for managing workspace files, including the move-file generator for safely moving files between projects while updating all imports
29 lines (28 loc) • 818 B
JavaScript
/**
* Normalizes a path mapping entry to its first string value.
*
* TypeScript path mappings can be a string or an array of strings.
* This function normalizes to a single string.
*
* @param pathEntry - Single string or string array entry from tsconfig paths
* @returns The first path string or null when not resolvable
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "toFirstPath", {
enumerable: true,
get: function() {
return toFirstPath;
}
});
function toFirstPath(pathEntry) {
if (typeof pathEntry === 'string') {
return pathEntry;
}
if (Array.isArray(pathEntry) && typeof pathEntry[0] === 'string') {
return pathEntry[0];
}
return null;
}
//# sourceMappingURL=to-first-path.js.map