Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fs = require('fs');
- const mixinMap = {
- 'LimitMixin': 'limit',
- 'SdfsdMixin': 'sdfsd'
- };
- const filePath = 'testfile.js';
- let fileContent = fs.readFileSync(filePath);
- fileContent = replaceContent(fileContent.toString());
- fs.writeFile(filePath, fileContent, (error) => {
- if (error) {
- console.log(error);
- }
- console.log(`File ${filePath} succesfully written`);
- });
- function replaceContent(content) {
- for (const item in mixinMap) {
- if (content.includes(item)) {
- const paramRegex = ` \\* @param {.+} \\[options.${mixinMap[item]}][\\s\\S]+?((?= \\* @)|(?= \\*\\/))`;
- content = content.replace(new RegExp(paramRegex, 'g'), '');
- }
- }
- return content;
- }
- //ls -l -R | awk '{if ($2==1) print $9","}'
Add Comment
Please, Sign In to add comment