UNPKG

328 BJavaScriptView Raw
1"use strict";
2
3const path = require('path');
4
5module.exports = function (name) {
6 let parts = path.normalize(name).split(path.sep);
7
8 if (parts[0].charAt(0) === '@') {
9 // Scoped module (e.g. @scope/module). Merge the first two parts back together.
10 parts.splice(0, 2, `${parts[0]}/${parts[1]}`);
11 }
12
13 return parts;
14};
\No newline at end of file