From 726b81b19251674e149ccfbb1abacbd837fc6db0 Mon Sep 17 00:00:00 2001 From: LinuxWizard42 Date: Wed, 12 Oct 2022 23:08:57 +0300 Subject: Removed files that should not have been included in git --- node_modules/filenamify/filenamify.js | 40 ----------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 node_modules/filenamify/filenamify.js (limited to 'node_modules/filenamify/filenamify.js') 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; -- cgit v1.2.3-86-g962b