schnee effeckt und fehler Korektur

This commit is contained in:
2023-08-14 17:52:24 +02:00
parent 4a843d4936
commit 79af4e9907
6813 changed files with 343821 additions and 356128 deletions

View File

@@ -1,4 +1,5 @@
'use strict';
module.exports = function () {
return /[<>:"\/\\|?*]/g;
};
/* eslint-disable no-control-regex */
// TODO: remove parens when Node.js 6 is targeted. Node.js 4 barfs at it.
module.exports = () => (/[<>:"\/\\|?*\x00-\x1F]/g);
module.exports.windowsNames = () => (/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i);

View File

@@ -1,6 +1,6 @@
{
"name": "filename-reserved-regex",
"version": "1.0.0",
"version": "2.0.0",
"description": "Regular expression for matching reserved filename characters",
"license": "MIT",
"repository": "sindresorhus/filename-reserved-regex",
@@ -10,10 +10,10 @@
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"scripts": {
"test": "node test.js"
"test": "xo && ava"
},
"files": [
"index.js"
@@ -23,9 +23,14 @@
"regex",
"regexp",
"filename",
"reserved"
"reserved",
"illegal"
],
"devDependencies": {
"ava": "0.0.4"
"ava": "*",
"xo": "*"
},
"xo": {
"esnext": true
}
}

View File

@@ -2,7 +2,7 @@
> Regular expression for matching reserved filename characters
On Unix-like systems `/` is reserved and [`<>:"/\|?*`](http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29#naming_conventions) on Windows.
On Unix-like systems `/` is reserved and [`<>:"/\|?*`](http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29#naming_conventions) as well as non-printable characters `\x00-\x1F` on Windows.
## Install
@@ -15,19 +15,35 @@ $ npm install --save filename-reserved-regex
## Usage
```js
var filenameReservedRegex = require('filename-reserved-regex');
const filenameReservedRegex = require('filename-reserved-regex');
filenameReservedRegex().test('foo/bar');
//=> false
filenameReservedRegex().test('foo-bar');
//=> true
filenameReservedRegex().test('foo-bar');
//=> false
'foo/bar'.replace(filenameReservedRegex(), '!');
//=> foo!bar
//=> 'foo!bar'
filenameReservedRegex.windowsNames().test('aux');
//=> true
```
## API
### filenameReservedRegex()
Returns a regex that matches all invalid characters.
### filenameReservedRegex.windowsNames()
Returns a exact-match case-insensitive regex that matches invalid Windows
filenames. These include `CON`, `PRN`, `AUX`, `NUL`, `COM1`, `COM2`, `COM3`, `COM4`, `COM5`,
`COM6`, `COM7`, `COM8`, `COM9`, `LPT1`, `LPT2`, `LPT3`, `LPT4`, `LPT5`, `LPT6`, `LPT7`, `LPT8`
and `LPT9`.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)