|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
510 bytes
|
| Line | |
|---|
| 1 | import globParent from 'glob-parent'
|
|---|
| 2 |
|
|---|
| 3 | // Based on `glob-base`
|
|---|
| 4 | // https://github.com/micromatch/glob-base/blob/master/index.js
|
|---|
| 5 | export function parseGlob(pattern) {
|
|---|
| 6 | let glob = pattern
|
|---|
| 7 | let base = globParent(pattern)
|
|---|
| 8 |
|
|---|
| 9 | if (base !== '.') {
|
|---|
| 10 | glob = pattern.substr(base.length)
|
|---|
| 11 | if (glob.charAt(0) === '/') {
|
|---|
| 12 | glob = glob.substr(1)
|
|---|
| 13 | }
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | if (glob.substr(0, 2) === './') {
|
|---|
| 17 | glob = glob.substr(2)
|
|---|
| 18 | } else if (glob.charAt(0) === '/') {
|
|---|
| 19 | glob = glob.substr(1)
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | return { base, glob }
|
|---|
| 23 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.