diff options
Diffstat (limited to 'node_modules/filenamify')
-rw-r--r-- | node_modules/filenamify/filenamify-path.d.ts | 8 | ||||
-rw-r--r-- | node_modules/filenamify/filenamify-path.js | 10 | ||||
-rw-r--r-- | node_modules/filenamify/filenamify.d.ts | 39 | ||||
-rw-r--r-- | node_modules/filenamify/filenamify.js | 40 | ||||
-rw-r--r-- | node_modules/filenamify/index.d.ts | 24 | ||||
-rw-r--r-- | node_modules/filenamify/index.js | 8 | ||||
-rw-r--r-- | node_modules/filenamify/license | 9 | ||||
-rw-r--r-- | node_modules/filenamify/package.json | 54 | ||||
-rw-r--r-- | node_modules/filenamify/readme.md | 74 |
9 files changed, 0 insertions, 266 deletions
diff --git a/node_modules/filenamify/filenamify-path.d.ts b/node_modules/filenamify/filenamify-path.d.ts deleted file mode 100644 index 2346602..0000000 --- a/node_modules/filenamify/filenamify-path.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import filenamify = require('./filenamify'); - -/** -Convert the filename in a path a valid filename and return the augmented path. -*/ -declare const filenamifyPath: (path: string, options?: filenamify.Options) => string; - -export = filenamifyPath; diff --git a/node_modules/filenamify/filenamify-path.js b/node_modules/filenamify/filenamify-path.js deleted file mode 100644 index 359c119..0000000 --- a/node_modules/filenamify/filenamify-path.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; -const path = require('path'); -const filenamify = require('./filenamify'); - -const filenamifyPath = (filePath, options) => { - filePath = path.resolve(filePath); - return path.join(path.dirname(filePath), filenamify(path.basename(filePath), options)); -}; - -module.exports = filenamifyPath; diff --git a/node_modules/filenamify/filenamify.d.ts b/node_modules/filenamify/filenamify.d.ts deleted file mode 100644 index cc17d11..0000000 --- a/node_modules/filenamify/filenamify.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -declare namespace filenamify { - interface Options { - /** - String to use as replacement for reserved filename characters. - - Cannot contain: `<` `>` `:` `"` `/` `\` `|` `?` `*` - - @default '!' - */ - readonly replacement?: string; - - /** - Truncate the filename to the given length. - - Systems generally allow up to 255 characters, but we default to 100 for usability reasons. - - @default 100 - */ - readonly maxLength?: number; - } -} - -/** -Convert a string to a valid filename. - -@example -``` -import filenamify = require('filenamify'); - -filenamify('<foo/bar>'); -//=> 'foo!bar' - -filenamify('foo:"bar"', {replacement: '🐴'}); -//=> 'foo🐴bar' -``` -*/ -declare const filenamify: (string: string, options?: filenamify.Options) => string; - -export = filenamify; diff --git a/node_modules/filenamify/filenamify.js b/node_modules/filenamify/filenamify.js deleted file mode 100644 index a548430..0000000 --- a/node_modules/filenamify/filenamify.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; -const trimRepeated = require('trim-repeated'); -const filenameReservedRegex = require('filename-reserved-regex'); -const stripOuter = require('strip-outer'); - -// Doesn't make sense to have longer filenames -const MAX_FILENAME_LENGTH = 100; - -const reControlChars = /[\u0000-\u001f\u0080-\u009f]/g; // eslint-disable-line no-control-regex -const reRelativePath = /^\.+/; -const reTrailingPeriods = /\.+$/; - -const filenamify = (string, options = {}) => { - if (typeof string !== 'string') { - throw new TypeError('Expected a string'); - } - - const replacement = options.replacement === undefined ? '!' : options.replacement; - - if (filenameReservedRegex().test(replacement) && reControlChars.test(replacement)) { - throw new Error('Replacement string cannot contain reserved filename characters'); - } - - string = string.replace(filenameReservedRegex(), replacement); - string = string.replace(reControlChars, replacement); - string = string.replace(reRelativePath, replacement); - string = string.replace(reTrailingPeriods, ''); - - if (replacement.length > 0) { - string = trimRepeated(string, replacement); - string = string.length > 1 ? stripOuter(string, replacement) : string; - } - - string = filenameReservedRegex.windowsNames().test(string) ? string + replacement : string; - string = string.slice(0, typeof options.maxLength === 'number' ? options.maxLength : MAX_FILENAME_LENGTH); - - return string; -}; - -module.exports = filenamify; diff --git a/node_modules/filenamify/index.d.ts b/node_modules/filenamify/index.d.ts deleted file mode 100644 index 4aea46f..0000000 --- a/node_modules/filenamify/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import filenamify = require('./filenamify'); -import filenamifyPath = require('./filenamify-path'); - -declare const filenamifyCombined: { - /** - Convert a string to a valid filename. - - @example - ``` - import filenamify = require('filenamify'); - - filenamify('<foo/bar>'); - //=> 'foo!bar' - - filenamify('foo:"bar"', {replacement: '🐴'}); - //=> 'foo🐴bar' - ``` - */ - (string: string, options?: filenamify.Options): string; - - path: typeof filenamifyPath; -}; - -export = filenamifyCombined; diff --git a/node_modules/filenamify/index.js b/node_modules/filenamify/index.js deleted file mode 100644 index 260bbd1..0000000 --- a/node_modules/filenamify/index.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; -const filenamify = require('./filenamify'); -const filenamifyPath = require('./filenamify-path'); - -const filenamifyCombined = filenamify; -filenamifyCombined.path = filenamifyPath; - -module.exports = filenamify; diff --git a/node_modules/filenamify/license b/node_modules/filenamify/license deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/filenamify/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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: - -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. diff --git a/node_modules/filenamify/package.json b/node_modules/filenamify/package.json deleted file mode 100644 index 9b22083..0000000 --- a/node_modules/filenamify/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "filenamify", - "version": "4.3.0", - "description": "Convert a string to a valid safe filename", - "license": "MIT", - "repository": "sindresorhus/filenamify", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "filenamify-path.d.ts", - "filenamify-path.js", - "filenamify.d.ts", - "filenamify.js", - "index.d.ts", - "index.js" - ], - "exports": { - ".": "./index.js", - "./browser": "./filenamify.js" - }, - "keywords": [ - "filename", - "safe", - "sanitize", - "file", - "name", - "string", - "path", - "filepath", - "convert", - "valid", - "dirname" - ], - "dependencies": { - "filename-reserved-regex": "^2.0.0", - "strip-outer": "^1.0.1", - "trim-repeated": "^1.0.0" - }, - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - } -} diff --git a/node_modules/filenamify/readme.md b/node_modules/filenamify/readme.md deleted file mode 100644 index 3b0d747..0000000 --- a/node_modules/filenamify/readme.md +++ /dev/null @@ -1,74 +0,0 @@ -# filenamify - -> Convert a string to a valid safe filename - -On Unix-like systems, `/` is reserved. On Windows, [`<>:"/\|?*`](http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29#naming_conventions) along with trailing periods are reserved. - -## Install - -``` -$ npm install filenamify -``` - -## Usage - -```js -const filenamify = require('filenamify'); - -filenamify('<foo/bar>'); -//=> 'foo!bar' - -filenamify('foo:"bar"', {replacement: '🐴'}); -//=> 'foo🐴bar' -``` - -## API - -### filenamify(string, options?) - -Convert a string to a valid filename. - -### filenamify.path(path, options?) - -Convert the filename in a path a valid filename and return the augmented path. - -#### options - -Type: `object` - -##### replacement - -Type: `string`\ -Default: `'!'` - -String to use as replacement for reserved filename characters. - -Cannot contain: `<` `>` `:` `"` `/` `\` `|` `?` `*` - -##### maxLength - -Type: `number`\ -Default: `100` - -Truncate the filename to the given length. - -Systems generally allow up to 255 characters, but we default to 100 for usability reasons. - -## Browser-only import - -You can also import `filenamify/browser`, which only imports `filenamify` and not `filenamify.path`, which relies on `path` being available or polyfilled. Importing `filenamify` this way is therefore useful when it is shipped using `webpack` or similar tools, and if `filenamify.path` is not needed. - -```js -const filenamify = require('filenamify/browser'); - -filenamify('<foo/bar>'); -//=> 'foo!bar' -``` - -## Related - -- [filenamify-cli](https://github.com/sindresorhus/filenamify-cli) - CLI for this module -- [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 |