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,KAAK,eAAe,IAChD,GAAI,EAAK,MAAM,EAEf,IACI,IAAoB,EAAM,OAAS,GACrC,QAAQ,IAAI,0BACd,GAEJ,GACA,GACF","file":"/npm/spacesjs@1.5.5/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/spacesjs@1.5.5/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","#!/usr/bin/env node\n\nconst { stat, writeFile, existsSync, readdir, rename } = require('fs');\nconst { mkdir } = require('node:fs/promises');\nconst prompt = require('prompt-sync')();\nconst currentDirectory = process.cwd();\n\nconst args = process.argv;\nconst generateTestFiles = args.includes('test');\nconst renameRecursively = args.includes('recursive');\n\n// default regular expression: select all whitespace, hyphens, and underscores\nconst re = /([\\s\\-\\_]{1,})/g;\n\n// colors\nconst red = \"\\x1b[31m\";\nconst green = \"\\x1b[32m\";\nconst yellow = \"\\x1b[33m\";\nconst reset = \"\\x1b[0m\";\n\nconst dumbFileNames = [\n  'newfile    -.txt',\n  'Goofy Ass name---2.html',\n  '1gross -3.css',\n  'newfile___-4.doc',\n  'another file-5.txt',\n  'THUMBS-DOWN.svg',\n  'feminism -lol.png',\n];\n\nconst idioticFileNames = [\n  'your moms house.txt',\n  'BING---BONG.html'\n];\n\nconst nestedDirectyory = `${currentDirectory}/nested-directory`;\n\nconst createFiles = (files, location) => {\n  files.forEach(file => {\n    writeFile(`${location}/${file}`, 'dummy content', (err) => {      \n      if (err) throw err;\n    });\n  });\n};\n\nif (generateTestFiles) {\n  // generate files in the root of the current working directory\n  createFiles(dumbFileNames, currentDirectory);\n\n  // create new directory\n  mkdir(nestedDirectyory, { recursive: true })\n    .then(() => {\n      // generate files in the nested-directory folder\n      createFiles(idioticFileNames, nestedDirectyory);\n      console.log('files generated!');\n      process.exit();\n    })\n    .catch(err => {\n      throw err;\n    });\n}\n\n// recursive option\nlet recursiveWarning = '';\nif (renameRecursively) {\n  recursiveWarning = prompt(red + 'This will rename ALL files in ALL subfolders. Are you sure you want to do this? (y/n) ' + reset);\n}\n\nif (recursiveWarning.toLowerCase() === 'n' || recursiveWarning.toLowerCase() === 'no') {\n  console.log('Operation cancelled.');\n  process.exit();\n}\n\nreaddir(currentDirectory, { recursive: renameRecursively }, (err, files) => {\n  if (err) throw err;\n\n  if (!files.length) {\n    console.log('no files to rename');\n    process.exit();\n  }\n\n  let filesProcessed = 0,\n    directoriesSkipped = 0;\n\n  files.forEach(file => {\n    stat(file, (err, stats) => {\n      if (err) throw err;\n      \n      if (stats.isDirectory()) {\n        directoriesSkipped++;\n        console.log(yellow + `${file} is a directory. Skipping...` + reset);\n      } else {\n        // rename will fail if the directory has whitespace OR 2+ trailing hyphens\n        // but who names directories like that anyway?\n        rename(file, file.replace(re, \"-\").toLowerCase(), err => {\n          if (err) throw err;\n    \n          filesProcessed++;\n          if (filesProcessed === (files.length - directoriesSkipped)) {\n            console.log(green + 'files renamed!' + reset);\n          }\n        });\n      }\n    });\n  });\n});\n"]}