https://github.com/shinnn/unglobbable
A glob pattern that lets node-glob emit an error
https://github.com/shinnn/unglobbable
cross-platform glob-pattern javascript nodejs test-fixtures
Last synced: 7 months ago
JSON representation
A glob pattern that lets node-glob emit an error
- Host: GitHub
- URL: https://github.com/shinnn/unglobbable
- Owner: shinnn
- License: isc
- Created: 2017-01-20T11:06:42.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-05-27T00:40:15.000Z (almost 7 years ago)
- Last Synced: 2025-08-06T21:51:38.399Z (8 months ago)
- Topics: cross-platform, glob-pattern, javascript, nodejs, test-fixtures
- Language: JavaScript
- Size: 38.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unglobbable
[](https://www.npmjs.com/package/unglobbable)
[](https://travis-ci.com/shinnn/unglobbable)
A glob pattern that lets [node-glob](https://github.com/isaacs/node-glob) and [fast-glob](https://github.com/mrmlnc/fast-glob) emit an error
```javascript
const glob = require('glob');
const unglobbable = require('unglobbable');
glob('safe/glob/pattern', err => {
!!err; //=> false
});
glob(unglobbable, err => {
!!err; //=> true
});
```
Useful for writing the failure test case. [Example](https://github.com/shinnn/glob-observable/blob/084a9ece8437d84fbeb9d1a5c758f20a86c44306/test.js#L126)
## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).
```
npm install unglobbable
```
## API
```javascript
import unglobbable from 'unglobbable';
```
### unglobbable
Value: `string` of the following:
| Platform | String |
|:---------|:----------------------------|
| Darwin | `/private/var/root/*` |
| Linux | `/proc/*/*/*/*` |
| Windows | `/Documents and Settings/*` |
| Others | `/**` |
```javascript
// On macOS
import glob from 'glob';
import unglobbable from 'unglobbable'; //=> '/private/var/root/*'
glob(unglobbable, err => {
err.message; //=> 'EACCES: permission denied, scandir '/private/var/root''
});
```
## License
[ISC License](./LICENSE) © 2018 - 2019 Watanabe Shinnosuke