schnee effeckt und fehler Korektur
This commit is contained in:
45
node_modules/filenamify/index.js
generated
vendored
45
node_modules/filenamify/index.js
generated
vendored
@@ -1,43 +1,46 @@
|
||||
'use strict';
|
||||
var path = require('path');
|
||||
var trimRepeated = require('trim-repeated');
|
||||
var filenameReservedRegex = require('filename-reserved-regex');
|
||||
var stripOuter = require('strip-outer');
|
||||
const path = require('path');
|
||||
const trimRepeated = require('trim-repeated');
|
||||
const filenameReservedRegex = require('filename-reserved-regex');
|
||||
const stripOuter = require('strip-outer');
|
||||
|
||||
// doesn't make sense to have longer filenames
|
||||
var MAX_FILENAME_LENGTH = 100;
|
||||
// Doesn't make sense to have longer filenames
|
||||
const MAX_FILENAME_LENGTH = 100;
|
||||
|
||||
var reControlChars = /[\x00-\x1f\x80-\x9f]/g;
|
||||
var reRelativePath = /^\.+/;
|
||||
const reControlChars = /[\u0000-\u001f\u0080-\u009f]/g; // eslint-disable-line no-control-regex
|
||||
const reRelativePath = /^\.+/;
|
||||
|
||||
var fn = module.exports = function (str, opts) {
|
||||
if (typeof str !== 'string') {
|
||||
const fn = (string, options) => {
|
||||
if (typeof string !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
options = options || {};
|
||||
|
||||
var replacement = opts.replacement || '!';
|
||||
const replacement = options.replacement === undefined ? '!' : options.replacement;
|
||||
|
||||
if (filenameReservedRegex().test(replacement) && reControlChars.test(replacement)) {
|
||||
throw new Error('Replacement string cannot contain reserved filename characters');
|
||||
}
|
||||
|
||||
str = str.replace(filenameReservedRegex(), replacement);
|
||||
str = str.replace(reControlChars, replacement);
|
||||
str = str.replace(reRelativePath, replacement);
|
||||
string = string.replace(filenameReservedRegex(), replacement);
|
||||
string = string.replace(reControlChars, replacement);
|
||||
string = string.replace(reRelativePath, replacement);
|
||||
|
||||
if (replacement.length > 0) {
|
||||
str = trimRepeated(str, replacement);
|
||||
str = str.length > 1 ? stripOuter(str, replacement) : str;
|
||||
string = trimRepeated(string, replacement);
|
||||
string = string.length > 1 ? stripOuter(string, replacement) : string;
|
||||
}
|
||||
|
||||
str = str.slice(0, MAX_FILENAME_LENGTH);
|
||||
string = filenameReservedRegex.windowsNames().test(string) ? string + replacement : string;
|
||||
string = string.slice(0, MAX_FILENAME_LENGTH);
|
||||
|
||||
return str;
|
||||
return string;
|
||||
};
|
||||
|
||||
fn.path = function (pth, opts) {
|
||||
fn.path = (pth, options) => {
|
||||
pth = path.resolve(pth);
|
||||
return path.join(path.dirname(pth), fn(path.basename(pth), opts));
|
||||
return path.join(path.dirname(pth), fn(path.basename(pth), options));
|
||||
};
|
||||
|
||||
module.exports = fn;
|
||||
|
||||
20
node_modules/filenamify/license
generated
vendored
20
node_modules/filenamify/license
generated
vendored
@@ -1,21 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
82
node_modules/filenamify/package.json
generated
vendored
82
node_modules/filenamify/package.json
generated
vendored
@@ -1,43 +1,43 @@
|
||||
{
|
||||
"name": "filenamify",
|
||||
"version": "1.2.1",
|
||||
"description": "Convert a string to a valid safe filename",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/filenamify",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"filename",
|
||||
"safe",
|
||||
"sanitize",
|
||||
"file",
|
||||
"name",
|
||||
"string",
|
||||
"path",
|
||||
"filepath",
|
||||
"convert",
|
||||
"valid",
|
||||
"dirname"
|
||||
],
|
||||
"dependencies": {
|
||||
"filename-reserved-regex": "^1.0.0",
|
||||
"strip-outer": "^1.0.0",
|
||||
"trim-repeated": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
"name": "filenamify",
|
||||
"version": "2.1.0",
|
||||
"description": "Convert a string to a valid safe filename",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/filenamify",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"filename",
|
||||
"safe",
|
||||
"sanitize",
|
||||
"file",
|
||||
"name",
|
||||
"string",
|
||||
"path",
|
||||
"filepath",
|
||||
"convert",
|
||||
"valid",
|
||||
"dirname"
|
||||
],
|
||||
"dependencies": {
|
||||
"filename-reserved-regex": "^2.0.0",
|
||||
"strip-outer": "^1.0.0",
|
||||
"trim-repeated": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
|
||||
4
node_modules/filenamify/readme.md
generated
vendored
4
node_modules/filenamify/readme.md
generated
vendored
@@ -8,7 +8,7 @@ On Unix-like systems `/` is reserved and [`<>:"/\|?*`](http://msdn.microsoft.com
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save filenamify
|
||||
$ npm install filenamify
|
||||
```
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ Cannot contain: `<` `>` `:` `"` `/` `\` `|` `?` `*`
|
||||
|
||||
- [filenamify-url](https://github.com/sindresorhus/filenamify-url) - Convert a URL to a valid filename
|
||||
- [valid-filename](https://github.com/sindresorhus/valid-filename) - Check if a string is a valid filename
|
||||
- [unused-filename](https://github.com/sindresorhus/unused-filename) - Get a unused filename by appending a number if it exists
|
||||
- [slugify](https://github.com/sindresorhus/slugify) - Slugify a string
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Reference in New Issue
Block a user