Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/terkelg/globalyzer
Detect and extract the static part of a glob string.
https://github.com/terkelg/globalyzer
extract glob globbing parser strings
Last synced: 2 months ago
JSON representation
Detect and extract the static part of a glob string.
- Host: GitHub
- URL: https://github.com/terkelg/globalyzer
- Owner: terkelg
- License: mit
- Created: 2018-04-15T06:39:40.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-22T03:24:09.000Z (almost 3 years ago)
- Last Synced: 2024-10-31T18:14:43.081Z (3 months ago)
- Topics: extract, glob, globbing, parser, strings
- Language: JavaScript
- Homepage:
- Size: 54.7 KB
- Stars: 10
- Watchers: 3
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# globalyzer [![Build Status](https://travis-ci.org/terkelg/globalyzer.svg?branch=master)](https://travis-ci.org/terkelg/globalyzer)[![Build status](https://ci.appveyor.com/api/projects/status/0xqnmxt99rsnnjqh?svg=true)](https://ci.appveyor.com/project/terkelg/globalyzer)
> Detect and extract the static part of a glob string
Utility to detect if a string contains a glob and then split it in a glob and none-glob part.
## Install
```
npm install globalyzer --save
```## Usage
```js
const globalyzer = require('globalyzer');globalyzer('foo/bar/.git/');
// => { base: 'foo/bar/.git/', glob: '', isGlob: false }globalyzer('foo/bar/**/baz');
// => { base: 'foo/bar', glob: '**/baz', isGlob: true }
```## API
### globalyzer(glob, options)
Type: `function`
Returns: `{ base, glob, isGlob }`Returns an object with the (non-glob) base path and the actual pattern and a is-glob flag.
#### options.strict
Type: `Boolean`
Default: `true`Be strict about what's a glob and what's not
#### glob
Type: `String`
Glob string to analyze.
## Credit
This is a fork of [is-glob](https://github.com/micromatch/is-glob) and [glob-base](https://github.com/micromatch/glob-base)
## License
MIT © [Terkel Gjervig](https://terkel.com)