!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/sync/node_modules/cron-parser/lib/   drwxr-xr-x
Free 12.97 GB of 57.97 GB (22.38%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     field_compactor.js (2.1 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
'use strict';

function buildRange(item) {
  return {
    start: item,
    count: 1
  };
}

function completeRangeWithItem(range, item) {
  range.end = item;
  range.step = item - range.start;
  range.count = 2;
}

function finalizeCurrentRange(results, currentRange, currentItemRange) {
  if (currentRange) {
    // Two elements do not form a range so split them into 2 single elements
    if (currentRange.count === 2) {
      results.push(buildRange(currentRange.start));
      results.push(buildRange(currentRange.end));
    } else {
      results.push(currentRange);
    }
  }
  if (currentItemRange) {
    results.push(currentItemRange);
  }
}

function compactField(arr) {
  var results = [];
  var currentRange = undefined;

  for (var i = 0; i < arr.length; i++) {
    var currentItem = arr[i];
    if (typeof currentItem !== 'number') {
      // String elements can't form a range
      finalizeCurrentRange(results, currentRange, buildRange(currentItem));
      currentRange = undefined;
    } else if (!currentRange) {
      // Start a new range
      currentRange = buildRange(currentItem);
    } else if (currentRange.count === 1) {
      // Guess that the current item starts a range
      completeRangeWithItem(currentRange, currentItem);
    } else {
      if (currentRange.step === currentItem - currentRange.end) {
        // We found another item that matches the current range
        currentRange.count++;
        currentRange.end = currentItem;
      } else if (currentRange.count === 2) { // The current range can't be continued
        // Break the first item of the current range into a single element, and try to start a new range with the second item
        results.push(buildRange(currentRange.start));
        currentRange = buildRange(currentRange.end);
        completeRangeWithItem(currentRange, currentItem);
      } else {
        // Persist the current range and start a new one with current item
        finalizeCurrentRange(results, currentRange);
        currentRange = buildRange(currentItem);
      }
    }
  }

  finalizeCurrentRange(results, currentRange);

  return results;
}

module.exports = compactField;

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0043 ]--