summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/_helpers
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/locutus/php/_helpers')
-rw-r--r--node_modules/locutus/php/_helpers/_bc.js1258
-rw-r--r--node_modules/locutus/php/_helpers/_bc.js.map1
-rw-r--r--node_modules/locutus/php/_helpers/_phpCastString.js69
-rw-r--r--node_modules/locutus/php/_helpers/_phpCastString.js.map1
-rw-r--r--node_modules/locutus/php/_helpers/_php_cast_int.js58
-rw-r--r--node_modules/locutus/php/_helpers/_php_cast_int.js.map1
-rw-r--r--node_modules/locutus/php/_helpers/index.js6
-rw-r--r--node_modules/locutus/php/_helpers/index.js.map1
8 files changed, 0 insertions, 1395 deletions
diff --git a/node_modules/locutus/php/_helpers/_bc.js b/node_modules/locutus/php/_helpers/_bc.js
deleted file mode 100644
index ac27204..0000000
--- a/node_modules/locutus/php/_helpers/_bc.js
+++ /dev/null
@@ -1,1258 +0,0 @@
-'use strict';
-
-module.exports = function _bc() {
- // eslint-disable-line camelcase
- // discuss at: http://locutus.io/php/_helpers/_bc
- // original by: lmeyrick (https://sourceforge.net/projects/bcmath-js/)
- // improved by: Brett Zamir (http://brett-zamir.me)
- // example 1: var $bc = _bc()
- // example 1: var $result = $bc.PLUS
- // returns 1: '+'
-
- /**
- * BC Math Library for Javascript
- * Ported from the PHP5 bcmath extension source code,
- * which uses the Libbcmath package...
- * Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- * Copyright (C) 2000 Philip A. Nelson
- * The Free Software Foundation, Inc.
- * 59 Temple Place, Suite 330
- * Boston, MA 02111-1307 USA.
- * e-mail: philnelson@acm.org
- * us-mail: Philip A. Nelson
- * Computer Science Department, 9062
- * Western Washington University
- * Bellingham, WA 98226-9062
- *
- * bcmath-js homepage:
- *
- * This code is covered under the LGPL licence, and can be used however you want :)
- * Be kind and share any decent code changes.
- */
-
- /**
- * Binary Calculator (BC) Arbitrary Precision Mathematics Lib v0.10 (LGPL)
- * Copy of Libbcmath included in PHP5 src
- *
- * Note: this is just the shared library file and does not include the php-style functions.
- * use bcmath{-min}.js for functions like bcadd, bcsub etc.
- *
- * Feel free to use how-ever you want, just email any bug-fixes/improvements
- * to the sourceforge project:
- *
- *
- * Ported from the PHP5 bcmath extension source code,
- * which uses the Libbcmath package...
- * Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- * Copyright (C) 2000 Philip A. Nelson
- * The Free Software Foundation, Inc.
- * 59 Temple Place, Suite 330
- * Boston, MA 02111-1307 USA.
- * e-mail: philnelson@acm.org
- * us-mail: Philip A. Nelson
- * Computer Science Department, 9062
- * Western Washington University
- * Bellingham, WA 98226-9062
- */
-
- var Libbcmath = {
- PLUS: '+',
- MINUS: '-',
- BASE: 10,
- // must be 10 (for now)
- scale: 0,
- // default scale
- /**
- * Basic number structure
- */
- bc_num: function bc_num() {
- this.n_sign = null; // sign
- this.n_len = null; // (int) The number of digits before the decimal point.
- this.n_scale = null; // (int) The number of digits after the decimal point.
- // this.n_refs = null; // (int) The number of pointers to this number.
- // this.n_text = null; // ?? Linked list for available list.
- this.n_value = null; // array as value, where 1.23 = [1,2,3]
- this.toString = function () {
- var r, tmp;
- tmp = this.n_value.join('');
-
- // add minus sign (if applicable) then add the integer part
- r = (this.n_sign === Libbcmath.PLUS ? '' : this.n_sign) + tmp.substr(0, this.n_len);
-
- // if decimal places, add a . and the decimal part
- if (this.n_scale > 0) {
- r += '.' + tmp.substr(this.n_len, this.n_scale);
- }
- return r;
- };
- },
-
- /**
- * Base add function
- *
- // Here is the full add routine that takes care of negative numbers.
- // N1 is added to N2 and the result placed into RESULT. SCALE_MIN
- // is the minimum scale for the result.
- *
- * @param {bc_num} n1
- * @param {bc_num} n2
- * @param {int} scaleMin
- * @return bc_num
- */
- bc_add: function bc_add(n1, n2, scaleMin) {
- var sum, cmpRes, resScale;
-
- if (n1.n_sign === n2.n_sign) {
- sum = Libbcmath._bc_do_add(n1, n2, scaleMin);
- sum.n_sign = n1.n_sign;
- } else {
- // subtraction must be done.
- cmpRes = Libbcmath._bc_do_compare(n1, n2, false, false); // Compare magnitudes.
- switch (cmpRes) {
- case -1:
- // n1 is less than n2, subtract n1 from n2.
- sum = Libbcmath._bc_do_sub(n2, n1, scaleMin);
- sum.n_sign = n2.n_sign;
- break;
-
- case 0:
- // They are equal! return zero with the correct scale!
- resScale = Libbcmath.MAX(scaleMin, Libbcmath.MAX(n1.n_scale, n2.n_scale));
- sum = Libbcmath.bc_new_num(1, resScale);
- Libbcmath.memset(sum.n_value, 0, 0, resScale + 1);
- break;
-
- case 1:
- // n2 is less than n1, subtract n2 from n1.
- sum = Libbcmath._bc_do_sub(n1, n2, scaleMin);
- sum.n_sign = n1.n_sign;
- }
- }
- return sum;
- },
-
- /**
- * This is the "user callable" routine to compare numbers N1 and N2.
- * @param {bc_num} n1
- * @param {bc_num} n2
- * @return int -1, 0, 1 (n1 < n2, ===, n1 > n2)
- */
- bc_compare: function bc_compare(n1, n2) {
- return Libbcmath._bc_do_compare(n1, n2, true, false);
- },
-
- _one_mult: function _one_mult(num, nPtr, size, digit, result, rPtr) {
- var carry, value; // int
- var nptr, rptr; // int pointers
- if (digit === 0) {
- Libbcmath.memset(result, 0, 0, size); // memset (result, 0, size);
- } else {
- if (digit === 1) {
- Libbcmath.memcpy(result, rPtr, num, nPtr, size); // memcpy (result, num, size);
- } else {
- // Initialize
- nptr = nPtr + size - 1; // nptr = (unsigned char *) (num+size-1);
- rptr = rPtr + size - 1; // rptr = (unsigned char *) (result+size-1);
- carry = 0;
-
- while (size-- > 0) {
- value = num[nptr--] * digit + carry; // value = *nptr-- * digit + carry;
- result[rptr--] = value % Libbcmath.BASE; // @CHECK cint //*rptr-- = value % BASE;
- carry = Math.floor(value / Libbcmath.BASE); // @CHECK cint //carry = value / BASE;
- }
-
- if (carry !== 0) {
- result[rptr] = carry;
- }
- }
- }
- },
-
- bc_divide: function bc_divide(n1, n2, scale) {
- // var quot // bc_num return
- var qval; // bc_num
- var num1, num2; // string
- var ptr1, ptr2, n2ptr, qptr; // int pointers
- var scale1, val; // int
- var len1, len2, scale2, qdigits, extra, count; // int
- var qdig, qguess, borrow, carry; // int
- var mval; // string
- var zero; // char
- var norm; // int
- // var ptrs // return object from one_mul
- // Test for divide by zero. (return failure)
- if (Libbcmath.bc_is_zero(n2)) {
- return -1;
- }
-
- // Test for zero divide by anything (return zero)
- if (Libbcmath.bc_is_zero(n1)) {
- return Libbcmath.bc_new_num(1, scale);
- }
-
- /* Test for n1 equals n2 (return 1 as n1 nor n2 are zero)
- if (Libbcmath.bc_compare(n1, n2, Libbcmath.MAX(n1.n_scale, n2.n_scale)) === 0) {
- quot=Libbcmath.bc_new_num(1, scale);
- quot.n_value[0] = 1;
- return quot;
- }
- */
-
- // Test for divide by 1. If it is we must truncate.
- // @todo: check where scale > 0 too.. can't see why not
- // (ie bc_is_zero - add bc_is_one function)
- if (n2.n_scale === 0) {
- if (n2.n_len === 1 && n2.n_value[0] === 1) {
- qval = Libbcmath.bc_new_num(n1.n_len, scale); // qval = bc_new_num (n1->n_len, scale);
- qval.n_sign = n1.n_sign === n2.n_sign ? Libbcmath.PLUS : Libbcmath.MINUS;
- // memset (&qval->n_value[n1->n_len],0,scale):
- Libbcmath.memset(qval.n_value, n1.n_len, 0, scale);
- // memcpy (qval->n_value, n1->n_value, n1->n_len + MIN(n1->n_scale,scale)):
- Libbcmath.memcpy(qval.n_value, 0, n1.n_value, 0, n1.n_len + Libbcmath.MIN(n1.n_scale, scale));
- // can we return here? not in c src, but can't see why-not.
- // return qval;
- }
- }
-
- /* Set up the divide. Move the decimal point on n1 by n2's scale.
- Remember, zeros on the end of num2 are wasted effort for dividing. */
- scale2 = n2.n_scale; // scale2 = n2->n_scale;
- n2ptr = n2.n_len + scale2 - 1; // n2ptr = (unsigned char *) n2.n_value+n2.n_len+scale2-1;
- while (scale2 > 0 && n2.n_value[n2ptr--] === 0) {
- scale2--;
- }
-
- len1 = n1.n_len + scale2;
- scale1 = n1.n_scale - scale2;
- if (scale1 < scale) {
- extra = scale - scale1;
- } else {
- extra = 0;
- }
-
- // num1 = (unsigned char *) safe_emalloc (1, n1.n_len+n1.n_scale, extra+2):
- num1 = Libbcmath.safe_emalloc(1, n1.n_len + n1.n_scale, extra + 2);
- if (num1 === null) {
- Libbcmath.bc_out_of_memory();
- }
- // memset (num1, 0, n1->n_len+n1->n_scale+extra+2):
- Libbcmath.memset(num1, 0, 0, n1.n_len + n1.n_scale + extra + 2);
- // memcpy (num1+1, n1.n_value, n1.n_len+n1.n_scale):
- Libbcmath.memcpy(num1, 1, n1.n_value, 0, n1.n_len + n1.n_scale);
- // len2 = n2->n_len + scale2:
- len2 = n2.n_len + scale2;
- // num2 = (unsigned char *) safe_emalloc (1, len2, 1):
- num2 = Libbcmath.safe_emalloc(1, len2, 1);
- if (num2 === null) {
- Libbcmath.bc_out_of_memory();
- }
- // memcpy (num2, n2.n_value, len2):
- Libbcmath.memcpy(num2, 0, n2.n_value, 0, len2);
- // *(num2+len2) = 0:
- num2[len2] = 0;
- // n2ptr = num2:
- n2ptr = 0;
- // while (*n2ptr === 0):
- while (num2[n2ptr] === 0) {
- n2ptr++;
- len2--;
- }
-
- // Calculate the number of quotient digits.
- if (len2 > len1 + scale) {
- qdigits = scale + 1;
- zero = true;
- } else {
- zero = false;
- if (len2 > len1) {
- qdigits = scale + 1; // One for the zero integer part.
- } else {
- qdigits = len1 - len2 + scale + 1;
- }
- }
-
- // Allocate and zero the storage for the quotient.
- // qval = bc_new_num (qdigits-scale,scale);
- qval = Libbcmath.bc_new_num(qdigits - scale, scale);
- // memset (qval->n_value, 0, qdigits);
- Libbcmath.memset(qval.n_value, 0, 0, qdigits);
- // Allocate storage for the temporary storage mval.
- // mval = (unsigned char *) safe_emalloc (1, len2, 1);
- mval = Libbcmath.safe_emalloc(1, len2, 1);
- if (mval === null) {
- Libbcmath.bc_out_of_memory();
- }
-
- // Now for the full divide algorithm.
- if (!zero) {
- // Normalize
- // norm = Libbcmath.cint(10 / (Libbcmath.cint(n2.n_value[n2ptr]) + 1));
- // norm = 10 / ((int)*n2ptr + 1)
- norm = Math.floor(10 / (n2.n_value[n2ptr] + 1)); // norm = 10 / ((int)*n2ptr + 1);
- if (norm !== 1) {
- // Libbcmath._one_mult(num1, len1+scale1+extra+1, norm, num1);
- Libbcmath._one_mult(num1, 0, len1 + scale1 + extra + 1, norm, num1, 0);
- // Libbcmath._one_mult(n2ptr, len2, norm, n2ptr);
- Libbcmath._one_mult(n2.n_value, n2ptr, len2, norm, n2.n_value, n2ptr);
- // @todo: Check: Is the pointer affected by the call? if so,
- // maybe need to adjust points on return?
- }
-
- // Initialize divide loop.
- qdig = 0;
- if (len2 > len1) {
- qptr = len2 - len1; // qptr = (unsigned char *) qval.n_value+len2-len1;
- } else {
- qptr = 0; // qptr = (unsigned char *) qval.n_value;
- }
-
- // Loop
- while (qdig <= len1 + scale - len2) {
- // Calculate the quotient digit guess.
- if (n2.n_value[n2ptr] === num1[qdig]) {
- qguess = 9;
- } else {
- qguess = Math.floor((num1[qdig] * 10 + num1[qdig + 1]) / n2.n_value[n2ptr]);
- }
- // Test qguess.
-
- if (n2.n_value[n2ptr + 1] * qguess > (num1[qdig] * 10 + num1[qdig + 1] - n2.n_value[n2ptr] * qguess) * 10 + num1[qdig + 2]) {
- qguess--;
- // And again.
- if (n2.n_value[n2ptr + 1] * qguess > (num1[qdig] * 10 + num1[qdig + 1] - n2.n_value[n2ptr] * qguess) * 10 + num1[qdig + 2]) {
- qguess--;
- }
- }
-
- // Multiply and subtract.
- borrow = 0;
- if (qguess !== 0) {
- mval[0] = 0; //* mval = 0; // @CHECK is this to fix ptr2 < 0?
- // _one_mult (n2ptr, len2, qguess, mval+1); // @CHECK
- Libbcmath._one_mult(n2.n_value, n2ptr, len2, qguess, mval, 1);
- ptr1 = qdig + len2; // (unsigned char *) num1+qdig+len2;
- ptr2 = len2; // (unsigned char *) mval+len2;
- // @todo: CHECK: Does a negative pointer return null?
- // ptr2 can be < 0 here as ptr1 = len2, thus count < len2+1 will always fail ?
- for (count = 0; count < len2 + 1; count++) {
- if (ptr2 < 0) {
- // val = Libbcmath.cint(num1[ptr1]) - 0 - borrow;
- // val = (int) *ptr1 - (int) *ptr2-- - borrow;
- val = num1[ptr1] - 0 - borrow; // val = (int) *ptr1 - (int) *ptr2-- - borrow;
- } else {
- // val = Libbcmath.cint(num1[ptr1]) - Libbcmath.cint(mval[ptr2--]) - borrow;
- // val = (int) *ptr1 - (int) *ptr2-- - borrow;
- // val = (int) *ptr1 - (int) *ptr2-- - borrow;
- val = num1[ptr1] - mval[ptr2--] - borrow;
- }
- if (val < 0) {
- val += 10;
- borrow = 1;
- } else {
- borrow = 0;
- }
- num1[ptr1--] = val;
- }
- }
-
- // Test for negative result.
- if (borrow === 1) {
- qguess--;
- ptr1 = qdig + len2; // (unsigned char *) num1+qdig+len2;
- ptr2 = len2 - 1; // (unsigned char *) n2ptr+len2-1;
- carry = 0;
- for (count = 0; count < len2; count++) {
- if (ptr2 < 0) {
- // val = Libbcmath.cint(num1[ptr1]) + 0 + carry;
- // val = (int) *ptr1 + (int) *ptr2-- + carry;
- // val = (int) *ptr1 + (int) *ptr2-- + carry;
- val = num1[ptr1] + 0 + carry;
- } else {
- // val = Libbcmath.cint(num1[ptr1]) + Libbcmath.cint(n2.n_value[ptr2--]) + carry;
- // val = (int) *ptr1 + (int) *ptr2-- + carry;
- // val = (int) *ptr1 + (int) *ptr2-- + carry;
- val = num1[ptr1] + n2.n_value[ptr2--] + carry;
- }
- if (val > 9) {
- val -= 10;
- carry = 1;
- } else {
- carry = 0;
- }
- num1[ptr1--] = val; //* ptr1-- = val;
- }
- if (carry === 1) {
- // num1[ptr1] = Libbcmath.cint((num1[ptr1] + 1) % 10);
- // *ptr1 = (*ptr1 + 1) % 10; // @CHECK
- // *ptr1 = (*ptr1 + 1) % 10; // @CHECK
- num1[ptr1] = (num1[ptr1] + 1) % 10;
- }
- }
-
- // We now know the quotient digit.
- qval.n_value[qptr++] = qguess; //* qptr++ = qguess;
- qdig++;
- }
- }
-
- // Clean up and return the number.
- qval.n_sign = n1.n_sign === n2.n_sign ? Libbcmath.PLUS : Libbcmath.MINUS;
- if (Libbcmath.bc_is_zero(qval)) {
- qval.n_sign = Libbcmath.PLUS;
- }
- Libbcmath._bc_rm_leading_zeros(qval);
-
- return qval;
-
- // return 0; // Everything is OK.
- },
-
- MUL_BASE_DIGITS: 80,
- MUL_SMALL_DIGITS: 80 / 4,
- // #define MUL_SMALL_DIGITS mul_base_digits/4
-
- /* The multiply routine. N2 times N1 is put int PROD with the scale of
- the result being MIN(N2 scale+N1 scale, MAX (SCALE, N2 scale, N1 scale)).
- */
- /**
- * @param n1 bc_num
- * @param n2 bc_num
- * @param scale [int] optional
- */
- bc_multiply: function bc_multiply(n1, n2, scale) {
- var pval; // bc_num
- var len1, len2; // int
- var fullScale, prodScale; // int
- // Initialize things.
- len1 = n1.n_len + n1.n_scale;
- len2 = n2.n_len + n2.n_scale;
- fullScale = n1.n_scale + n2.n_scale;
- prodScale = Libbcmath.MIN(fullScale, Libbcmath.MAX(scale, Libbcmath.MAX(n1.n_scale, n2.n_scale)));
-
- // pval = Libbcmath.bc_init_num(); // allow pass by ref
- // Do the multiply
- pval = Libbcmath._bc_rec_mul(n1, len1, n2, len2, fullScale);
-
- // Assign to prod and clean up the number.
- pval.n_sign = n1.n_sign === n2.n_sign ? Libbcmath.PLUS : Libbcmath.MINUS;
- // pval.n_value = pval.nPtr;
- pval.n_len = len2 + len1 + 1 - fullScale;
- pval.n_scale = prodScale;
- Libbcmath._bc_rm_leading_zeros(pval);
- if (Libbcmath.bc_is_zero(pval)) {
- pval.n_sign = Libbcmath.PLUS;
- }
- // bc_free_num (prod);
- return pval;
- },
-
- new_sub_num: function new_sub_num(length, scale, value) {
- var ptr = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
-
- var temp = new Libbcmath.bc_num(); // eslint-disable-line new-cap
- temp.n_sign = Libbcmath.PLUS;
- temp.n_len = length;
- temp.n_scale = scale;
- temp.n_value = Libbcmath.safe_emalloc(1, length + scale, 0);
- Libbcmath.memcpy(temp.n_value, 0, value, ptr, length + scale);
- return temp;
- },
-
- _bc_simp_mul: function _bc_simp_mul(n1, n1len, n2, n2len, fullScale) {
- var prod; // bc_num
- var n1ptr, n2ptr, pvptr; // char *n1ptr, *n2ptr, *pvptr;
- var n1end, n2end; // char *n1end, *n2end; // To the end of n1 and n2.
- var indx, sum, prodlen; // int indx, sum, prodlen;
- prodlen = n1len + n2len + 1;
-
- prod = Libbcmath.bc_new_num(prodlen, 0);
-
- n1end = n1len - 1; // (char *) (n1->n_value + n1len - 1);
- n2end = n2len - 1; // (char *) (n2->n_value + n2len - 1);
- pvptr = prodlen - 1; // (char *) ((*prod)->n_value + prodlen - 1);
- sum = 0;
-
- // Here is the loop...
- for (indx = 0; indx < prodlen - 1; indx++) {
- // (char *) (n1end - MAX(0, indx-n2len+1));
- n1ptr = n1end - Libbcmath.MAX(0, indx - n2len + 1);
- // (char *) (n2end - MIN(indx, n2len-1));
- n2ptr = n2end - Libbcmath.MIN(indx, n2len - 1);
- while (n1ptr >= 0 && n2ptr <= n2end) {
- // sum += *n1ptr-- * *n2ptr++;
- sum += n1.n_value[n1ptr--] * n2.n_value[n2ptr++];
- }
- //* pvptr-- = sum % BASE;
- prod.n_value[pvptr--] = Math.floor(sum % Libbcmath.BASE);
- sum = Math.floor(sum / Libbcmath.BASE); // sum = sum / BASE;
- }
- prod.n_value[pvptr] = sum; //* pvptr = sum;
- return prod;
- },
-
- /* A special adder/subtractor for the recursive divide and conquer
- multiply algorithm. Note: if sub is called, accum must
- be larger that what is being subtracted. Also, accum and val
- must have n_scale = 0. (e.g. they must look like integers. *) */
- _bc_shift_addsub: function _bc_shift_addsub(accum, val, shift, sub) {
- var accp, valp; // signed char *accp, *valp;
- var count, carry; // int count, carry;
- count = val.n_len;
- if (val.n_value[0] === 0) {
- count--;
- }
-
- // assert (accum->n_len+accum->n_scale >= shift+count);
- if (accum.n_len + accum.n_scale < shift + count) {
- throw new Error('len + scale < shift + count'); // ?? I think that's what assert does :)
- }
-
- // Set up pointers and others
- // (signed char *)(accum->n_value + accum->n_len + accum->n_scale - shift - 1);
- accp = accum.n_len + accum.n_scale - shift - 1;
- valp = val.n_len - 1; // (signed char *)(val->n_value + val->n_len - 1);
- carry = 0;
- if (sub) {
- // Subtraction, carry is really borrow.
- while (count--) {
- accum.n_value[accp] -= val.n_value[valp--] + carry; //* accp -= *valp-- + carry;
- if (accum.n_value[accp] < 0) {
- // if (*accp < 0)
- carry = 1;
- accum.n_value[accp--] += Libbcmath.BASE; //* accp-- += BASE;
- } else {
- carry = 0;
- accp--;
- }
- }
- while (carry) {
- accum.n_value[accp] -= carry; //* accp -= carry;
- if (accum.n_value[accp] < 0) {
- // if (*accp < 0)
- accum.n_value[accp--] += Libbcmath.BASE; // *accp-- += BASE;
- } else {
- carry = 0;
- }
- }
- } else {
- // Addition
- while (count--) {
- accum.n_value[accp] += val.n_value[valp--] + carry; //* accp += *valp-- + carry;
- if (accum.n_value[accp] > Libbcmath.BASE - 1) {
- // if (*accp > (BASE-1))
- carry = 1;
- accum.n_value[accp--] -= Libbcmath.BASE; //* accp-- -= BASE;
- } else {
- carry = 0;
- accp--;
- }
- }
- while (carry) {
- accum.n_value[accp] += carry; //* accp += carry;
- if (accum.n_value[accp] > Libbcmath.BASE - 1) {
- // if (*accp > (BASE-1))
- accum.n_value[accp--] -= Libbcmath.BASE; //* accp-- -= BASE;
- } else {
- carry = 0;
- }
- }
- }
- return true; // accum is the pass-by-reference return
- },
-
- /* Recursive divide and conquer multiply algorithm.
- based on
- Let u = u0 + u1*(b^n)
- Let v = v0 + v1*(b^n)
- Then uv = (B^2n+B^n)*u1*v1 + B^n*(u1-u0)*(v0-v1) + (B^n+1)*u0*v0
- B is the base of storage, number of digits in u1,u0 close to equal.
- */
- _bc_rec_mul: function _bc_rec_mul(u, ulen, v, vlen, fullScale) {
- var prod; // @return
- var u0, u1, v0, v1; // bc_num
- // var u0len,
- // var v0len // int
- var m1, m2, m3, d1, d2; // bc_num
- var n, prodlen, m1zero; // int
- var d1len, d2len; // int
- // Base case?
- if (ulen + vlen < Libbcmath.MUL_BASE_DIGITS || ulen < Libbcmath.MUL_SMALL_DIGITS || vlen < Libbcmath.MUL_SMALL_DIGITS) {
- return Libbcmath._bc_simp_mul(u, ulen, v, vlen, fullScale);
- }
-
- // Calculate n -- the u and v split point in digits.
- n = Math.floor((Libbcmath.MAX(ulen, vlen) + 1) / 2);
-
- // Split u and v.
- if (ulen < n) {
- u1 = Libbcmath.bc_init_num(); // u1 = bc_copy_num (BCG(_zero_));
- u0 = Libbcmath.new_sub_num(ulen, 0, u.n_value);
- } else {
- u1 = Libbcmath.new_sub_num(ulen - n, 0, u.n_value);
- u0 = Libbcmath.new_sub_num(n, 0, u.n_value, ulen - n);
- }
- if (vlen < n) {
- v1 = Libbcmath.bc_init_num(); // bc_copy_num (BCG(_zero_));
- v0 = Libbcmath.new_sub_num(vlen, 0, v.n_value);
- } else {
- v1 = Libbcmath.new_sub_num(vlen - n, 0, v.n_value);
- v0 = Libbcmath.new_sub_num(n, 0, v.n_value, vlen - n);
- }
- Libbcmath._bc_rm_leading_zeros(u1);
- Libbcmath._bc_rm_leading_zeros(u0);
- // var u0len = u0.n_len
- Libbcmath._bc_rm_leading_zeros(v1);
- Libbcmath._bc_rm_leading_zeros(v0);
- // var v0len = v0.n_len
-
- m1zero = Libbcmath.bc_is_zero(u1) || Libbcmath.bc_is_zero(v1);
-
- // Calculate sub results ...
- d1 = Libbcmath.bc_init_num(); // needed?
- d2 = Libbcmath.bc_init_num(); // needed?
- d1 = Libbcmath.bc_sub(u1, u0, 0);
- d1len = d1.n_len;
-
- d2 = Libbcmath.bc_sub(v0, v1, 0);
- d2len = d2.n_len;
-
- // Do recursive multiplies and shifted adds.
- if (m1zero) {
- m1 = Libbcmath.bc_init_num(); // bc_copy_num (BCG(_zero_));
- } else {
- // m1 = Libbcmath.bc_init_num(); //allow pass-by-ref
- m1 = Libbcmath._bc_rec_mul(u1, u1.n_len, v1, v1.n_len, 0);
- }
- if (Libbcmath.bc_is_zero(d1) || Libbcmath.bc_is_zero(d2)) {
- m2 = Libbcmath.bc_init_num(); // bc_copy_num (BCG(_zero_));
- } else {
- // m2 = Libbcmath.bc_init_num(); //allow pass-by-ref
- m2 = Libbcmath._bc_rec_mul(d1, d1len, d2, d2len, 0);
- }
-
- if (Libbcmath.bc_is_zero(u0) || Libbcmath.bc_is_zero(v0)) {
- m3 = Libbcmath.bc_init_num(); // bc_copy_num (BCG(_zero_));
- } else {
- // m3 = Libbcmath.bc_init_num(); //allow pass-by-ref
- m3 = Libbcmath._bc_rec_mul(u0, u0.n_len, v0, v0.n_len, 0);
- }
-
- // Initialize product
- prodlen = ulen + vlen + 1;
- prod = Libbcmath.bc_new_num(prodlen, 0);
-
- if (!m1zero) {
- Libbcmath._bc_shift_addsub(prod, m1, 2 * n, 0);
- Libbcmath._bc_shift_addsub(prod, m1, n, 0);
- }
- Libbcmath._bc_shift_addsub(prod, m3, n, 0);
- Libbcmath._bc_shift_addsub(prod, m3, 0, 0);
- Libbcmath._bc_shift_addsub(prod, m2, n, d1.n_sign !== d2.n_sign);
-
- return prod;
- // Now clean up!
- // bc_free_num (&u1);
- // bc_free_num (&u0);
- // bc_free_num (&v1);
- // bc_free_num (&m1);
- // bc_free_num (&v0);
- // bc_free_num (&m2);
- // bc_free_num (&m3);
- // bc_free_num (&d1);
- // bc_free_num (&d2);
- },
-
- /**
- *
- * @param {bc_num} n1
- * @param {bc_num} n2
- * @param {boolean} useSign
- * @param {boolean} ignoreLast
- * @return -1, 0, 1 (see bc_compare)
- */
- _bc_do_compare: function _bc_do_compare(n1, n2, useSign, ignoreLast) {
- var n1ptr, n2ptr; // int
- var count; // int
- // First, compare signs.
- if (useSign && n1.n_sign !== n2.n_sign) {
- if (n1.n_sign === Libbcmath.PLUS) {
- return 1; // Positive N1 > Negative N2
- } else {
- return -1; // Negative N1 < Positive N1
- }
- }
-
- // Now compare the magnitude.
- if (n1.n_len !== n2.n_len) {
- if (n1.n_len > n2.n_len) {
- // Magnitude of n1 > n2.
- if (!useSign || n1.n_sign === Libbcmath.PLUS) {
- return 1;
- } else {
- return -1;
- }
- } else {
- // Magnitude of n1 < n2.
- if (!useSign || n1.n_sign === Libbcmath.PLUS) {
- return -1;
- } else {
- return 1;
- }
- }
- }
-
- /* If we get here, they have the same number of integer digits.
- check the integer part and the equal length part of the fraction. */
- count = n1.n_len + Math.min(n1.n_scale, n2.n_scale);
- n1ptr = 0;
- n2ptr = 0;
-
- while (count > 0 && n1.n_value[n1ptr] === n2.n_value[n2ptr]) {
- n1ptr++;
- n2ptr++;
- count--;
- }
-
- if (ignoreLast && count === 1 && n1.n_scale === n2.n_scale) {
- return 0;
- }
-
- if (count !== 0) {
- if (n1.n_value[n1ptr] > n2.n_value[n2ptr]) {
- // Magnitude of n1 > n2.
- if (!useSign || n1.n_sign === Libbcmath.PLUS) {
- return 1;
- } else {
- return -1;
- }
- } else {
- // Magnitude of n1 < n2.
- if (!useSign || n1.n_sign === Libbcmath.PLUS) {
- return -1;
- } else {
- return 1;
- }
- }
- }
-
- // They are equal up to the last part of the equal part of the fraction.
- if (n1.n_scale !== n2.n_scale) {
- if (n1.n_scale > n2.n_scale) {
- for (count = n1.n_scale - n2.n_scale; count > 0; count--) {
- if (n1.n_value[n1ptr++] !== 0) {
- // Magnitude of n1 > n2.
- if (!useSign || n1.n_sign === Libbcmath.PLUS) {
- return 1;
- } else {
- return -1;
- }
- }
- }
- } else {
- for (count = n2.n_scale - n1.n_scale; count > 0; count--) {
- if (n2.n_value[n2ptr++] !== 0) {
- // Magnitude of n1 < n2.
- if (!useSign || n1.n_sign === Libbcmath.PLUS) {
- return -1;
- } else {
- return 1;
- }
- }
- }
- }
- }
-
- // They must be equal!
- return 0;
- },
-
- /* Here is the full subtract routine that takes care of negative numbers.
- N2 is subtracted from N1 and the result placed in RESULT. SCALE_MIN
- is the minimum scale for the result. */
- bc_sub: function bc_sub(n1, n2, scaleMin) {
- var diff; // bc_num
- var cmpRes, resScale; // int
- if (n1.n_sign !== n2.n_sign) {
- diff = Libbcmath._bc_do_add(n1, n2, scaleMin);
- diff.n_sign = n1.n_sign;
- } else {
- // subtraction must be done.
- // Compare magnitudes.
- cmpRes = Libbcmath._bc_do_compare(n1, n2, false, false);
- switch (cmpRes) {
- case -1:
- // n1 is less than n2, subtract n1 from n2.
- diff = Libbcmath._bc_do_sub(n2, n1, scaleMin);
- diff.n_sign = n2.n_sign === Libbcmath.PLUS ? Libbcmath.MINUS : Libbcmath.PLUS;
- break;
- case 0:
- // They are equal! return zero!
- resScale = Libbcmath.MAX(scaleMin, Libbcmath.MAX(n1.n_scale, n2.n_scale));
- diff = Libbcmath.bc_new_num(1, resScale);
- Libbcmath.memset(diff.n_value, 0, 0, resScale + 1);
- break;
- case 1:
- // n2 is less than n1, subtract n2 from n1.
- diff = Libbcmath._bc_do_sub(n1, n2, scaleMin);
- diff.n_sign = n1.n_sign;
- break;
- }
- }
-
- // Clean up and return.
- // bc_free_num (result);
- //* result = diff;
- return diff;
- },
-
- _bc_do_add: function _bc_do_add(n1, n2, scaleMin) {
- var sum; // bc_num
- var sumScale, sumDigits; // int
- var n1ptr, n2ptr, sumptr; // int
- var carry, n1bytes, n2bytes; // int
- var tmp; // int
-
- // Prepare sum.
- sumScale = Libbcmath.MAX(n1.n_scale, n2.n_scale);
- sumDigits = Libbcmath.MAX(n1.n_len, n2.n_len) + 1;
- sum = Libbcmath.bc_new_num(sumDigits, Libbcmath.MAX(sumScale, scaleMin));
-
- // Start with the fraction part. Initialize the pointers.
- n1bytes = n1.n_scale;
- n2bytes = n2.n_scale;
- n1ptr = n1.n_len + n1bytes - 1;
- n2ptr = n2.n_len + n2bytes - 1;
- sumptr = sumScale + sumDigits - 1;
-
- // Add the fraction part. First copy the longer fraction
- // (ie when adding 1.2345 to 1 we know .2345 is correct already) .
- if (n1bytes !== n2bytes) {
- if (n1bytes > n2bytes) {
- // n1 has more dp then n2
- while (n1bytes > n2bytes) {
- sum.n_value[sumptr--] = n1.n_value[n1ptr--];
- // *sumptr-- = *n1ptr--;
- n1bytes--;
- }
- } else {
- // n2 has more dp then n1
- while (n2bytes > n1bytes) {
- sum.n_value[sumptr--] = n2.n_value[n2ptr--];
- // *sumptr-- = *n2ptr--;
- n2bytes--;
- }
- }
- }
-
- // Now add the remaining fraction part and equal size integer parts.
- n1bytes += n1.n_len;
- n2bytes += n2.n_len;
- carry = 0;
- while (n1bytes > 0 && n2bytes > 0) {
- // add the two numbers together
- tmp = n1.n_value[n1ptr--] + n2.n_value[n2ptr--] + carry;
- // *sumptr = *n1ptr-- + *n2ptr-- + carry;
- // check if they are >= 10 (impossible to be more then 18)
- if (tmp >= Libbcmath.BASE) {
- carry = 1;
- tmp -= Libbcmath.BASE; // yep, subtract 10, add a carry
- } else {
- carry = 0;
- }
- sum.n_value[sumptr] = tmp;
- sumptr--;
- n1bytes--;
- n2bytes--;
- }
-
- // Now add carry the [rest of the] longer integer part.
- if (n1bytes === 0) {
- // n2 is a bigger number then n1
- while (n2bytes-- > 0) {
- tmp = n2.n_value[n2ptr--] + carry;
- // *sumptr = *n2ptr-- + carry;
- if (tmp >= Libbcmath.BASE) {
- carry = 1;
- tmp -= Libbcmath.BASE;
- } else {
- carry = 0;
- }
- sum.n_value[sumptr--] = tmp;
- }
- } else {
- // n1 is bigger then n2..
- while (n1bytes-- > 0) {
- tmp = n1.n_value[n1ptr--] + carry;
- // *sumptr = *n1ptr-- + carry;
- if (tmp >= Libbcmath.BASE) {
- carry = 1;
- tmp -= Libbcmath.BASE;
- } else {
- carry = 0;
- }
- sum.n_value[sumptr--] = tmp;
- }
- }
-
- // Set final carry.
- if (carry === 1) {
- sum.n_value[sumptr] += 1;
- // *sumptr += 1;
- }
-
- // Adjust sum and return.
- Libbcmath._bc_rm_leading_zeros(sum);
- return sum;
- },
-
- /**
- * Perform a subtraction
- *
- * Perform subtraction: N2 is subtracted from N1 and the value is
- * returned. The signs of N1 and N2 are ignored. Also, N1 is
- * assumed to be larger than N2. SCALE_MIN is the minimum scale
- * of the result.
- *
- * Basic school maths says to subtract 2 numbers..
- * 1. make them the same length, the decimal places, and the integer part
- * 2. start from the right and subtract the two numbers from each other
- * 3. if the sum of the 2 numbers < 0, carry -1 to the next set and add 10
- * (ie 18 > carry 1 becomes 8). thus 0.9 + 0.9 = 1.8
- *
- * @param {bc_num} n1
- * @param {bc_num} n2
- * @param {int} scaleMin
- * @return bc_num
- */
- _bc_do_sub: function _bc_do_sub(n1, n2, scaleMin) {
- var diff; // bc_num
- var diffScale, diffLen; // int
- var minScale, minLen; // int
- var n1ptr, n2ptr, diffptr; // int
- var borrow, count, val; // int
- // Allocate temporary storage.
- diffLen = Libbcmath.MAX(n1.n_len, n2.n_len);
- diffScale = Libbcmath.MAX(n1.n_scale, n2.n_scale);
- minLen = Libbcmath.MIN(n1.n_len, n2.n_len);
- minScale = Libbcmath.MIN(n1.n_scale, n2.n_scale);
- diff = Libbcmath.bc_new_num(diffLen, Libbcmath.MAX(diffScale, scaleMin));
-
- /* Not needed?
- // Zero extra digits made by scaleMin.
- if (scaleMin > diffScale) {
- diffptr = (char *) (diff->n_value + diffLen + diffScale);
- for (count = scaleMin - diffScale; count > 0; count--) {
- *diffptr++ = 0;
- }
- }
- */
-
- // Initialize the subtract.
- n1ptr = n1.n_len + n1.n_scale - 1;
- n2ptr = n2.n_len + n2.n_scale - 1;
- diffptr = diffLen + diffScale - 1;
-
- // Subtract the numbers.
- borrow = 0;
-
- // Take care of the longer scaled number.
- if (n1.n_scale !== minScale) {
- // n1 has the longer scale
- for (count = n1.n_scale - minScale; count > 0; count--) {
- diff.n_value[diffptr--] = n1.n_value[n1ptr--];
- // *diffptr-- = *n1ptr--;
- }
- } else {
- // n2 has the longer scale
- for (count = n2.n_scale - minScale; count > 0; count--) {
- val = 0 - n2.n_value[n2ptr--] - borrow;
- // val = - *n2ptr-- - borrow;
- if (val < 0) {
- val += Libbcmath.BASE;
- borrow = 1;
- } else {
- borrow = 0;
- }
- diff.n_value[diffptr--] = val;
- //* diffptr-- = val;
- }
- }
-
- // Now do the equal length scale and integer parts.
- for (count = 0; count < minLen + minScale; count++) {
- val = n1.n_value[n1ptr--] - n2.n_value[n2ptr--] - borrow;
- // val = *n1ptr-- - *n2ptr-- - borrow;
- if (val < 0) {
- val += Libbcmath.BASE;
- borrow = 1;
- } else {
- borrow = 0;
- }
- diff.n_value[diffptr--] = val;
- //* diffptr-- = val;
- }
-
- // If n1 has more digits then n2, we now do that subtract.
- if (diffLen !== minLen) {
- for (count = diffLen - minLen; count > 0; count--) {
- val = n1.n_value[n1ptr--] - borrow;
- // val = *n1ptr-- - borrow;
- if (val < 0) {
- val += Libbcmath.BASE;
- borrow = 1;
- } else {
- borrow = 0;
- }
- diff.n_value[diffptr--] = val;
- }
- }
-
- // Clean up and return.
- Libbcmath._bc_rm_leading_zeros(diff);
- return diff;
- },
-
- /**
- *
- * @param {int} length
- * @param {int} scale
- * @return bc_num
- */
- bc_new_num: function bc_new_num(length, scale) {
- var temp; // bc_num
- temp = new Libbcmath.bc_num(); // eslint-disable-line new-cap
- temp.n_sign = Libbcmath.PLUS;
- temp.n_len = length;
- temp.n_scale = scale;
- temp.n_value = Libbcmath.safe_emalloc(1, length + scale, 0);
- Libbcmath.memset(temp.n_value, 0, 0, length + scale);
- return temp;
- },
-
- safe_emalloc: function safe_emalloc(size, len, extra) {
- return Array(size * len + extra);
- },
-
- /**
- * Create a new number
- */
- bc_init_num: function bc_init_num() {
- return new Libbcmath.bc_new_num(1, 0); // eslint-disable-line new-cap
- },
-
- _bc_rm_leading_zeros: function _bc_rm_leading_zeros(num) {
- // We can move n_value to point to the first non zero digit!
- while (num.n_value[0] === 0 && num.n_len > 1) {
- num.n_value.shift();
- num.n_len--;
- }
- },
-
- /**
- * Convert to bc_num detecting scale
- */
- php_str2num: function php_str2num(str) {
- var p;
- p = str.indexOf('.');
- if (p === -1) {
- return Libbcmath.bc_str2num(str, 0);
- } else {
- return Libbcmath.bc_str2num(str, str.length - p);
- }
- },
-
- CH_VAL: function CH_VAL(c) {
- return c - '0'; // ??
- },
-
- BCD_CHAR: function BCD_CHAR(d) {
- return d + '0'; // ??
- },
-
- isdigit: function isdigit(c) {
- return isNaN(parseInt(c, 10));
- },
-
- bc_str2num: function bc_str2num(strIn, scale) {
- var str, num, ptr, digits, strscale, zeroInt, nptr;
- // remove any non-expected characters
- // Check for valid number and count digits.
-
- str = strIn.split(''); // convert to array
- ptr = 0; // str
- digits = 0;
- strscale = 0;
- zeroInt = false;
- if (str[ptr] === '+' || str[ptr] === '-') {
- ptr++; // Sign
- }
- while (str[ptr] === '0') {
- ptr++; // Skip leading zeros.
- }
- // while (Libbcmath.isdigit(str[ptr])) {
- while (str[ptr] % 1 === 0) {
- // Libbcmath.isdigit(str[ptr])) {
- ptr++;
- digits++; // digits
- }
-
- if (str[ptr] === '.') {
- ptr++; // decimal point
- }
- // while (Libbcmath.isdigit(str[ptr])) {
- while (str[ptr] % 1 === 0) {
- // Libbcmath.isdigit(str[ptr])) {
- ptr++;
- strscale++; // digits
- }
-
- if (str[ptr] || digits + strscale === 0) {
- // invalid number, return 0
- return Libbcmath.bc_init_num();
- //* num = bc_copy_num (BCG(_zero_));
- }
-
- // Adjust numbers and allocate storage and initialize fields.
- strscale = Libbcmath.MIN(strscale, scale);
- if (digits === 0) {
- zeroInt = true;
- digits = 1;
- }
-
- num = Libbcmath.bc_new_num(digits, strscale);
-
- // Build the whole number.
- ptr = 0; // str
- if (str[ptr] === '-') {
- num.n_sign = Libbcmath.MINUS;
- // (*num)->n_sign = MINUS;
- ptr++;
- } else {
- num.n_sign = Libbcmath.PLUS;
- // (*num)->n_sign = PLUS;
- if (str[ptr] === '+') {
- ptr++;
- }
- }
- while (str[ptr] === '0') {
- ptr++; // Skip leading zeros.
- }
-
- nptr = 0; // (*num)->n_value;
- if (zeroInt) {
- num.n_value[nptr++] = 0;
- digits = 0;
- }
- for (; digits > 0; digits--) {
- num.n_value[nptr++] = Libbcmath.CH_VAL(str[ptr++]);
- //* nptr++ = CH_VAL(*ptr++);
- }
-
- // Build the fractional part.
- if (strscale > 0) {
- ptr++; // skip the decimal point!
- for (; strscale > 0; strscale--) {
- num.n_value[nptr++] = Libbcmath.CH_VAL(str[ptr++]);
- }
- }
-
- return num;
- },
-
- cint: function cint(v) {
- if (typeof v === 'undefined') {
- v = 0;
- }
- var x = parseInt(v, 10);
- if (isNaN(x)) {
- x = 0;
- }
- return x;
- },
-
- /**
- * Basic min function
- * @param {int} a
- * @param {int} b
- */
- MIN: function MIN(a, b) {
- return a > b ? b : a;
- },
-
- /**
- * Basic max function
- * @param {int} a
- * @param {int} b
- */
- MAX: function MAX(a, b) {
- return a > b ? a : b;
- },
-
- /**
- * Basic odd function
- * @param {int} a
- */
- ODD: function ODD(a) {
- return a & 1;
- },
-
- /**
- * replicate c function
- * @param {array} r return (by reference)
- * @param {int} ptr
- * @param {string} chr char to fill
- * @param {int} len length to fill
- */
- memset: function memset(r, ptr, chr, len) {
- var i;
- for (i = 0; i < len; i++) {
- r[ptr + i] = chr;
- }
- },
-
- /**
- * Replacement c function
- * Obviously can't work like c does, so we've added an "offset"
- * param so you could do memcpy(dest+1, src, len) as memcpy(dest, 1, src, len)
- * Also only works on arrays
- */
- memcpy: function memcpy(dest, ptr, src, srcptr, len) {
- var i;
- for (i = 0; i < len; i++) {
- dest[ptr + i] = src[srcptr + i];
- }
- return true;
- },
-
- /**
- * Determine if the number specified is zero or not
- * @param {bc_num} num number to check
- * @return boolean true when zero, false when not zero.
- */
- bc_is_zero: function bc_is_zero(num) {
- var count; // int
- var nptr; // int
- // Quick check.
- // if (num === BCG(_zero_)) return TRUE;
- // Initialize
- count = num.n_len + num.n_scale;
- nptr = 0; // num->n_value;
- // The check
- while (count > 0 && num.n_value[nptr++] === 0) {
- count--;
- }
-
- if (count !== 0) {
- return false;
- } else {
- return true;
- }
- },
-
- bc_out_of_memory: function bc_out_of_memory() {
- throw new Error('(BC) Out of memory');
- }
- };
- return Libbcmath;
-};
-//# sourceMappingURL=_bc.js.map \ No newline at end of file
diff --git a/node_modules/locutus/php/_helpers/_bc.js.map b/node_modules/locutus/php/_helpers/_bc.js.map
deleted file mode 100644
index f60e863..0000000
--- a/node_modules/locutus/php/_helpers/_bc.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["../../../src/php/_helpers/_bc.js"],"names":["module","exports","_bc","Libbcmath","PLUS","MINUS","BASE","scale","bc_num","n_sign","n_len","n_scale","n_value","toString","r","tmp","join","substr","bc_add","n1","n2","scaleMin","sum","cmpRes","resScale","_bc_do_add","_bc_do_compare","_bc_do_sub","MAX","bc_new_num","memset","bc_compare","_one_mult","num","nPtr","size","digit","result","rPtr","carry","value","nptr","rptr","memcpy","Math","floor","bc_divide","qval","num1","num2","ptr1","ptr2","n2ptr","qptr","scale1","val","len1","len2","scale2","qdigits","extra","count","qdig","qguess","borrow","mval","zero","norm","bc_is_zero","MIN","safe_emalloc","bc_out_of_memory","_bc_rm_leading_zeros","MUL_BASE_DIGITS","MUL_SMALL_DIGITS","bc_multiply","pval","fullScale","prodScale","_bc_rec_mul","new_sub_num","length","ptr","temp","_bc_simp_mul","n1len","n2len","prod","n1ptr","pvptr","n1end","n2end","indx","prodlen","_bc_shift_addsub","accum","shift","sub","accp","valp","Error","u","ulen","v","vlen","u0","u1","v0","v1","m1","m2","m3","d1","d2","n","m1zero","d1len","d2len","bc_init_num","bc_sub","useSign","ignoreLast","min","diff","sumScale","sumDigits","sumptr","n1bytes","n2bytes","diffScale","diffLen","minScale","minLen","diffptr","len","Array","php_str2num","str","p","indexOf","bc_str2num","CH_VAL","c","BCD_CHAR","d","isdigit","isNaN","parseInt","strIn","digits","strscale","zeroInt","split","cint","x","a","b","ODD","chr","i","dest","src","srcptr"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,G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Cd;;;;;;;AAOA7H,YAAQ,gBAAUhB,CAAV,EAAaoE,GAAb,EAAkB4E,GAAlB,EAAuBxB,GAAvB,EAA4B;AAClC,UAAIyB,CAAJ;AACA,WAAKA,IAAI,CAAT,EAAYA,IAAIzB,GAAhB,EAAqByB,GAArB,EAA0B;AACxBjJ,UAAEoE,MAAM6E,CAAR,IAAaD,GAAb;AACD;AACF,KAznCa;;AA2nCd;;;;;;AAMAnH,YAAQ,gBAAUqH,IAAV,EAAgB9E,GAAhB,EAAqB+E,GAArB,EAA0BC,MAA1B,EAAkC5B,GAAlC,EAAuC;AAC7C,UAAIyB,CAAJ;AACA,WAAKA,IAAI,CAAT,EAAYA,IAAIzB,GAAhB,EAAqByB,GAArB,EAA0B;AACxBC,aAAK9E,MAAM6E,CAAX,IAAgBE,IAAIC,SAASH,CAAb,CAAhB;AACD;AACD,aAAO,IAAP;AACD,KAvoCa;;AAyoCd;;;;;AAKA3F,gBAAY,oBAAUnC,GAAV,EAAe;AACzB,UAAI4B,KAAJ,CADyB,CACf;AACV,UAAIpB,IAAJ,CAFyB,CAEhB;AACT;AACA;AACA;AACAoB,cAAQ5B,IAAIvB,KAAJ,GAAYuB,IAAItB,OAAxB;AACA8B,aAAO,CAAP,CAPyB,CAOhB;AACT;AACA,aAAQoB,QAAQ,CAAT,IAAgB5B,IAAIrB,OAAJ,CAAY6B,MAAZ,MAAwB,CAA/C,EAAmD;AACjDoB;AACD;;AAED,UAAIA,UAAU,CAAd,EAAiB;AACf,eAAO,KAAP;AACD,OAFD,MAEO;AACL,eAAO,IAAP;AACD;AACF,KAhqCa;;AAkqCdU,sBAAkB,4BAAY;AAC5B,YAAM,IAAI6B,KAAJ,CAAU,oBAAV,CAAN;AACD;AApqCa,GAAhB;AAsqCA,SAAOjG,SAAP;AACD,CA7tCD","file":"_bc.js","sourcesContent":["module.exports = function _bc () { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/_helpers/_bc\n // original by: lmeyrick (https://sourceforge.net/projects/bcmath-js/)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // example 1: var $bc = _bc()\n // example 1: var $result = $bc.PLUS\n // returns 1: '+'\n\n /**\n * BC Math Library for Javascript\n * Ported from the PHP5 bcmath extension source code,\n * which uses the Libbcmath package...\n * Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.\n * Copyright (C) 2000 Philip A. Nelson\n * The Free Software Foundation, Inc.\n * 59 Temple Place, Suite 330\n * Boston, MA 02111-1307 USA.\n * e-mail: philnelson@acm.org\n * us-mail: Philip A. Nelson\n * Computer Science Department, 9062\n * Western Washington University\n * Bellingham, WA 98226-9062\n *\n * bcmath-js homepage:\n *\n * This code is covered under the LGPL licence, and can be used however you want :)\n * Be kind and share any decent code changes.\n */\n\n /**\n * Binary Calculator (BC) Arbitrary Precision Mathematics Lib v0.10 (LGPL)\n * Copy of Libbcmath included in PHP5 src\n *\n * Note: this is just the shared library file and does not include the php-style functions.\n * use bcmath{-min}.js for functions like bcadd, bcsub etc.\n *\n * Feel free to use how-ever you want, just email any bug-fixes/improvements\n * to the sourceforge project:\n *\n *\n * Ported from the PHP5 bcmath extension source code,\n * which uses the Libbcmath package...\n * Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.\n * Copyright (C) 2000 Philip A. Nelson\n * The Free Software Foundation, Inc.\n * 59 Temple Place, Suite 330\n * Boston, MA 02111-1307 USA.\n * e-mail: philnelson@acm.org\n * us-mail: Philip A. Nelson\n * Computer Science Department, 9062\n * Western Washington University\n * Bellingham, WA 98226-9062\n */\n\n var Libbcmath = {\n PLUS: '+',\n MINUS: '-',\n BASE: 10,\n // must be 10 (for now)\n scale: 0,\n // default scale\n /**\n * Basic number structure\n */\n bc_num: function () {\n this.n_sign = null // sign\n this.n_len = null // (int) The number of digits before the decimal point.\n this.n_scale = null // (int) The number of digits after the decimal point.\n // this.n_refs = null; // (int) The number of pointers to this number.\n // this.n_text = null; // ?? Linked list for available list.\n this.n_value = null // array as value, where 1.23 = [1,2,3]\n this.toString = function () {\n var r, tmp\n tmp = this.n_value.join('')\n\n // add minus sign (if applicable) then add the integer part\n r = ((this.n_sign === Libbcmath.PLUS) ? '' : this.n_sign) + tmp.substr(0, this.n_len)\n\n // if decimal places, add a . and the decimal part\n if (this.n_scale > 0) {\n r += '.' + tmp.substr(this.n_len, this.n_scale)\n }\n return r\n }\n },\n\n /**\n * Base add function\n *\n // Here is the full add routine that takes care of negative numbers.\n // N1 is added to N2 and the result placed into RESULT. SCALE_MIN\n // is the minimum scale for the result.\n *\n * @param {bc_num} n1\n * @param {bc_num} n2\n * @param {int} scaleMin\n * @return bc_num\n */\n bc_add: function (n1, n2, scaleMin) {\n var sum, cmpRes, resScale\n\n if (n1.n_sign === n2.n_sign) {\n sum = Libbcmath._bc_do_add(n1, n2, scaleMin)\n sum.n_sign = n1.n_sign\n } else { // subtraction must be done.\n cmpRes = Libbcmath._bc_do_compare(n1, n2, false, false) // Compare magnitudes.\n switch (cmpRes) {\n case -1:\n // n1 is less than n2, subtract n1 from n2.\n sum = Libbcmath._bc_do_sub(n2, n1, scaleMin)\n sum.n_sign = n2.n_sign\n break\n\n case 0:\n // They are equal! return zero with the correct scale!\n resScale = Libbcmath.MAX(scaleMin, Libbcmath.MAX(n1.n_scale, n2.n_scale))\n sum = Libbcmath.bc_new_num(1, resScale)\n Libbcmath.memset(sum.n_value, 0, 0, resScale + 1)\n break\n\n case 1:\n // n2 is less than n1, subtract n2 from n1.\n sum = Libbcmath._bc_do_sub(n1, n2, scaleMin)\n sum.n_sign = n1.n_sign\n }\n }\n return sum\n },\n\n /**\n * This is the \"user callable\" routine to compare numbers N1 and N2.\n * @param {bc_num} n1\n * @param {bc_num} n2\n * @return int -1, 0, 1 (n1 < n2, ===, n1 > n2)\n */\n bc_compare: function (n1, n2) {\n return Libbcmath._bc_do_compare(n1, n2, true, false)\n },\n\n _one_mult: function (num, nPtr, size, digit, result, rPtr) {\n var carry, value // int\n var nptr, rptr // int pointers\n if (digit === 0) {\n Libbcmath.memset(result, 0, 0, size) // memset (result, 0, size);\n } else {\n if (digit === 1) {\n Libbcmath.memcpy(result, rPtr, num, nPtr, size) // memcpy (result, num, size);\n } else { // Initialize\n nptr = nPtr + size - 1 // nptr = (unsigned char *) (num+size-1);\n rptr = rPtr + size - 1 // rptr = (unsigned char *) (result+size-1);\n carry = 0\n\n while (size-- > 0) {\n value = num[nptr--] * digit + carry // value = *nptr-- * digit + carry;\n result[rptr--] = value % Libbcmath.BASE // @CHECK cint //*rptr-- = value % BASE;\n carry = Math.floor(value / Libbcmath.BASE) // @CHECK cint //carry = value / BASE;\n }\n\n if (carry !== 0) {\n result[rptr] = carry\n }\n }\n }\n },\n\n bc_divide: function (n1, n2, scale) {\n // var quot // bc_num return\n var qval // bc_num\n var num1, num2 // string\n var ptr1, ptr2, n2ptr, qptr // int pointers\n var scale1, val // int\n var len1, len2, scale2, qdigits, extra, count // int\n var qdig, qguess, borrow, carry // int\n var mval // string\n var zero // char\n var norm // int\n // var ptrs // return object from one_mul\n // Test for divide by zero. (return failure)\n if (Libbcmath.bc_is_zero(n2)) {\n return -1\n }\n\n // Test for zero divide by anything (return zero)\n if (Libbcmath.bc_is_zero(n1)) {\n return Libbcmath.bc_new_num(1, scale)\n }\n\n /* Test for n1 equals n2 (return 1 as n1 nor n2 are zero)\n if (Libbcmath.bc_compare(n1, n2, Libbcmath.MAX(n1.n_scale, n2.n_scale)) === 0) {\n quot=Libbcmath.bc_new_num(1, scale);\n quot.n_value[0] = 1;\n return quot;\n }\n */\n\n // Test for divide by 1. If it is we must truncate.\n // @todo: check where scale > 0 too.. can't see why not\n // (ie bc_is_zero - add bc_is_one function)\n if (n2.n_scale === 0) {\n if (n2.n_len === 1 && n2.n_value[0] === 1) {\n qval = Libbcmath.bc_new_num(n1.n_len, scale) // qval = bc_new_num (n1->n_len, scale);\n qval.n_sign = (n1.n_sign === n2.n_sign ? Libbcmath.PLUS : Libbcmath.MINUS)\n // memset (&qval->n_value[n1->n_len],0,scale):\n Libbcmath.memset(qval.n_value, n1.n_len, 0, scale)\n // memcpy (qval->n_value, n1->n_value, n1->n_len + MIN(n1->n_scale,scale)):\n Libbcmath.memcpy(\n qval.n_value, 0, n1.n_value, 0, n1.n_len + Libbcmath.MIN(n1.n_scale, scale)\n )\n // can we return here? not in c src, but can't see why-not.\n // return qval;\n }\n }\n\n /* Set up the divide. Move the decimal point on n1 by n2's scale.\n Remember, zeros on the end of num2 are wasted effort for dividing. */\n scale2 = n2.n_scale // scale2 = n2->n_scale;\n n2ptr = n2.n_len + scale2 - 1 // n2ptr = (unsigned char *) n2.n_value+n2.n_len+scale2-1;\n while ((scale2 > 0) && (n2.n_value[n2ptr--] === 0)) {\n scale2--\n }\n\n len1 = n1.n_len + scale2\n scale1 = n1.n_scale - scale2\n if (scale1 < scale) {\n extra = scale - scale1\n } else {\n extra = 0\n }\n\n // num1 = (unsigned char *) safe_emalloc (1, n1.n_len+n1.n_scale, extra+2):\n num1 = Libbcmath.safe_emalloc(1, n1.n_len + n1.n_scale, extra + 2)\n if (num1 === null) {\n Libbcmath.bc_out_of_memory()\n }\n // memset (num1, 0, n1->n_len+n1->n_scale+extra+2):\n Libbcmath.memset(num1, 0, 0, n1.n_len + n1.n_scale + extra + 2)\n // memcpy (num1+1, n1.n_value, n1.n_len+n1.n_scale):\n Libbcmath.memcpy(num1, 1, n1.n_value, 0, n1.n_len + n1.n_scale)\n // len2 = n2->n_len + scale2:\n len2 = n2.n_len + scale2\n // num2 = (unsigned char *) safe_emalloc (1, len2, 1):\n num2 = Libbcmath.safe_emalloc(1, len2, 1)\n if (num2 === null) {\n Libbcmath.bc_out_of_memory()\n }\n // memcpy (num2, n2.n_value, len2):\n Libbcmath.memcpy(num2, 0, n2.n_value, 0, len2)\n // *(num2+len2) = 0:\n num2[len2] = 0\n // n2ptr = num2:\n n2ptr = 0\n // while (*n2ptr === 0):\n while (num2[n2ptr] === 0) {\n n2ptr++\n len2--\n }\n\n // Calculate the number of quotient digits.\n if (len2 > len1 + scale) {\n qdigits = scale + 1\n zero = true\n } else {\n zero = false\n if (len2 > len1) {\n qdigits = scale + 1 // One for the zero integer part.\n } else {\n qdigits = len1 - len2 + scale + 1\n }\n }\n\n // Allocate and zero the storage for the quotient.\n // qval = bc_new_num (qdigits-scale,scale);\n qval = Libbcmath.bc_new_num(qdigits - scale, scale)\n // memset (qval->n_value, 0, qdigits);\n Libbcmath.memset(qval.n_value, 0, 0, qdigits)\n // Allocate storage for the temporary storage mval.\n // mval = (unsigned char *) safe_emalloc (1, len2, 1);\n mval = Libbcmath.safe_emalloc(1, len2, 1)\n if (mval === null) {\n Libbcmath.bc_out_of_memory()\n }\n\n // Now for the full divide algorithm.\n if (!zero) { // Normalize\n // norm = Libbcmath.cint(10 / (Libbcmath.cint(n2.n_value[n2ptr]) + 1));\n // norm = 10 / ((int)*n2ptr + 1)\n norm = Math.floor(10 / (n2.n_value[n2ptr] + 1)) // norm = 10 / ((int)*n2ptr + 1);\n if (norm !== 1) {\n // Libbcmath._one_mult(num1, len1+scale1+extra+1, norm, num1);\n Libbcmath._one_mult(num1, 0, len1 + scale1 + extra + 1, norm, num1, 0)\n // Libbcmath._one_mult(n2ptr, len2, norm, n2ptr);\n Libbcmath._one_mult(n2.n_value, n2ptr, len2, norm, n2.n_value, n2ptr)\n // @todo: Check: Is the pointer affected by the call? if so,\n // maybe need to adjust points on return?\n }\n\n // Initialize divide loop.\n qdig = 0\n if (len2 > len1) {\n qptr = len2 - len1 // qptr = (unsigned char *) qval.n_value+len2-len1;\n } else {\n qptr = 0 // qptr = (unsigned char *) qval.n_value;\n }\n\n // Loop\n while (qdig <= len1 + scale - len2) { // Calculate the quotient digit guess.\n if (n2.n_value[n2ptr] === num1[qdig]) {\n qguess = 9\n } else {\n qguess = Math.floor((num1[qdig] * 10 + num1[qdig + 1]) / n2.n_value[n2ptr])\n }\n // Test qguess.\n\n if (n2.n_value[n2ptr + 1] * qguess >\n (num1[qdig] * 10 + num1[qdig + 1] - n2.n_value[n2ptr] * qguess) *\n 10 + num1[qdig + 2]) {\n qguess--\n // And again.\n if (n2.n_value[n2ptr + 1] * qguess >\n (num1[qdig] * 10 + num1[qdig + 1] - n2.n_value[n2ptr] * qguess) *\n 10 + num1[qdig + 2]) {\n qguess--\n }\n }\n\n // Multiply and subtract.\n borrow = 0\n if (qguess !== 0) {\n mval[0] = 0 //* mval = 0; // @CHECK is this to fix ptr2 < 0?\n // _one_mult (n2ptr, len2, qguess, mval+1); // @CHECK\n Libbcmath._one_mult(n2.n_value, n2ptr, len2, qguess, mval, 1)\n ptr1 = qdig + len2 // (unsigned char *) num1+qdig+len2;\n ptr2 = len2 // (unsigned char *) mval+len2;\n // @todo: CHECK: Does a negative pointer return null?\n // ptr2 can be < 0 here as ptr1 = len2, thus count < len2+1 will always fail ?\n for (count = 0; count < len2 + 1; count++) {\n if (ptr2 < 0) {\n // val = Libbcmath.cint(num1[ptr1]) - 0 - borrow;\n // val = (int) *ptr1 - (int) *ptr2-- - borrow;\n val = num1[ptr1] - 0 - borrow // val = (int) *ptr1 - (int) *ptr2-- - borrow;\n } else {\n // val = Libbcmath.cint(num1[ptr1]) - Libbcmath.cint(mval[ptr2--]) - borrow;\n // val = (int) *ptr1 - (int) *ptr2-- - borrow;\n // val = (int) *ptr1 - (int) *ptr2-- - borrow;\n val = num1[ptr1] - mval[ptr2--] - borrow\n }\n if (val < 0) {\n val += 10\n borrow = 1\n } else {\n borrow = 0\n }\n num1[ptr1--] = val\n }\n }\n\n // Test for negative result.\n if (borrow === 1) {\n qguess--\n ptr1 = qdig + len2 // (unsigned char *) num1+qdig+len2;\n ptr2 = len2 - 1 // (unsigned char *) n2ptr+len2-1;\n carry = 0\n for (count = 0; count < len2; count++) {\n if (ptr2 < 0) {\n // val = Libbcmath.cint(num1[ptr1]) + 0 + carry;\n // val = (int) *ptr1 + (int) *ptr2-- + carry;\n // val = (int) *ptr1 + (int) *ptr2-- + carry;\n val = num1[ptr1] + 0 + carry\n } else {\n // val = Libbcmath.cint(num1[ptr1]) + Libbcmath.cint(n2.n_value[ptr2--]) + carry;\n // val = (int) *ptr1 + (int) *ptr2-- + carry;\n // val = (int) *ptr1 + (int) *ptr2-- + carry;\n val = num1[ptr1] + n2.n_value[ptr2--] + carry\n }\n if (val > 9) {\n val -= 10\n carry = 1\n } else {\n carry = 0\n }\n num1[ptr1--] = val //* ptr1-- = val;\n }\n if (carry === 1) {\n // num1[ptr1] = Libbcmath.cint((num1[ptr1] + 1) % 10);\n // *ptr1 = (*ptr1 + 1) % 10; // @CHECK\n // *ptr1 = (*ptr1 + 1) % 10; // @CHECK\n num1[ptr1] = (num1[ptr1] + 1) % 10\n }\n }\n\n // We now know the quotient digit.\n qval.n_value[qptr++] = qguess //* qptr++ = qguess;\n qdig++\n }\n }\n\n // Clean up and return the number.\n qval.n_sign = (n1.n_sign === n2.n_sign ? Libbcmath.PLUS : Libbcmath.MINUS)\n if (Libbcmath.bc_is_zero(qval)) {\n qval.n_sign = Libbcmath.PLUS\n }\n Libbcmath._bc_rm_leading_zeros(qval)\n\n return qval\n\n // return 0; // Everything is OK.\n },\n\n MUL_BASE_DIGITS: 80,\n MUL_SMALL_DIGITS: (80 / 4),\n // #define MUL_SMALL_DIGITS mul_base_digits/4\n\n /* The multiply routine. N2 times N1 is put int PROD with the scale of\n the result being MIN(N2 scale+N1 scale, MAX (SCALE, N2 scale, N1 scale)).\n */\n /**\n * @param n1 bc_num\n * @param n2 bc_num\n * @param scale [int] optional\n */\n bc_multiply: function (n1, n2, scale) {\n var pval // bc_num\n var len1, len2 // int\n var fullScale, prodScale // int\n // Initialize things.\n len1 = n1.n_len + n1.n_scale\n len2 = n2.n_len + n2.n_scale\n fullScale = n1.n_scale + n2.n_scale\n prodScale = Libbcmath.MIN(\n fullScale, Libbcmath.MAX(scale, Libbcmath.MAX(n1.n_scale, n2.n_scale))\n )\n\n // pval = Libbcmath.bc_init_num(); // allow pass by ref\n // Do the multiply\n pval = Libbcmath._bc_rec_mul(n1, len1, n2, len2, fullScale)\n\n // Assign to prod and clean up the number.\n pval.n_sign = (n1.n_sign === n2.n_sign ? Libbcmath.PLUS : Libbcmath.MINUS)\n // pval.n_value = pval.nPtr;\n pval.n_len = len2 + len1 + 1 - fullScale\n pval.n_scale = prodScale\n Libbcmath._bc_rm_leading_zeros(pval)\n if (Libbcmath.bc_is_zero(pval)) {\n pval.n_sign = Libbcmath.PLUS\n }\n // bc_free_num (prod);\n return pval\n },\n\n new_sub_num: function (length, scale, value, ptr = 0) {\n var temp = new Libbcmath.bc_num() // eslint-disable-line new-cap\n temp.n_sign = Libbcmath.PLUS\n temp.n_len = length\n temp.n_scale = scale\n temp.n_value = Libbcmath.safe_emalloc(1, length + scale, 0)\n Libbcmath.memcpy(temp.n_value, 0, value, ptr, length + scale)\n return temp\n },\n\n _bc_simp_mul: function (n1, n1len, n2, n2len, fullScale) {\n var prod // bc_num\n var n1ptr, n2ptr, pvptr // char *n1ptr, *n2ptr, *pvptr;\n var n1end, n2end // char *n1end, *n2end; // To the end of n1 and n2.\n var indx, sum, prodlen // int indx, sum, prodlen;\n prodlen = n1len + n2len + 1\n\n prod = Libbcmath.bc_new_num(prodlen, 0)\n\n n1end = n1len - 1 // (char *) (n1->n_value + n1len - 1);\n n2end = n2len - 1 // (char *) (n2->n_value + n2len - 1);\n pvptr = prodlen - 1 // (char *) ((*prod)->n_value + prodlen - 1);\n sum = 0\n\n // Here is the loop...\n for (indx = 0; indx < prodlen - 1; indx++) {\n // (char *) (n1end - MAX(0, indx-n2len+1));\n n1ptr = n1end - Libbcmath.MAX(0, indx - n2len + 1)\n // (char *) (n2end - MIN(indx, n2len-1));\n n2ptr = n2end - Libbcmath.MIN(indx, n2len - 1)\n while ((n1ptr >= 0) && (n2ptr <= n2end)) {\n // sum += *n1ptr-- * *n2ptr++;\n sum += n1.n_value[n1ptr--] * n2.n_value[n2ptr++]\n }\n //* pvptr-- = sum % BASE;\n prod.n_value[pvptr--] = Math.floor(sum % Libbcmath.BASE)\n sum = Math.floor(sum / Libbcmath.BASE) // sum = sum / BASE;\n }\n prod.n_value[pvptr] = sum //* pvptr = sum;\n return prod\n },\n\n /* A special adder/subtractor for the recursive divide and conquer\n multiply algorithm. Note: if sub is called, accum must\n be larger that what is being subtracted. Also, accum and val\n must have n_scale = 0. (e.g. they must look like integers. *) */\n _bc_shift_addsub: function (accum, val, shift, sub) {\n var accp, valp // signed char *accp, *valp;\n var count, carry // int count, carry;\n count = val.n_len\n if (val.n_value[0] === 0) {\n count--\n }\n\n // assert (accum->n_len+accum->n_scale >= shift+count);\n if (accum.n_len + accum.n_scale < shift + count) {\n throw new Error('len + scale < shift + count') // ?? I think that's what assert does :)\n }\n\n // Set up pointers and others\n // (signed char *)(accum->n_value + accum->n_len + accum->n_scale - shift - 1);\n accp = accum.n_len + accum.n_scale - shift - 1\n valp = val.n_len - 1 // (signed char *)(val->n_value + val->n_len - 1);\n carry = 0\n if (sub) {\n // Subtraction, carry is really borrow.\n while (count--) {\n accum.n_value[accp] -= val.n_value[valp--] + carry //* accp -= *valp-- + carry;\n if (accum.n_value[accp] < 0) { // if (*accp < 0)\n carry = 1\n accum.n_value[accp--] += Libbcmath.BASE //* accp-- += BASE;\n } else {\n carry = 0\n accp--\n }\n }\n while (carry) {\n accum.n_value[accp] -= carry //* accp -= carry;\n if (accum.n_value[accp] < 0) { // if (*accp < 0)\n accum.n_value[accp--] += Libbcmath.BASE // *accp-- += BASE;\n } else {\n carry = 0\n }\n }\n } else {\n // Addition\n while (count--) {\n accum.n_value[accp] += val.n_value[valp--] + carry //* accp += *valp-- + carry;\n if (accum.n_value[accp] > (Libbcmath.BASE - 1)) { // if (*accp > (BASE-1))\n carry = 1\n accum.n_value[accp--] -= Libbcmath.BASE //* accp-- -= BASE;\n } else {\n carry = 0\n accp--\n }\n }\n while (carry) {\n accum.n_value[accp] += carry //* accp += carry;\n if (accum.n_value[accp] > (Libbcmath.BASE - 1)) { // if (*accp > (BASE-1))\n accum.n_value[accp--] -= Libbcmath.BASE //* accp-- -= BASE;\n } else {\n carry = 0\n }\n }\n }\n return true // accum is the pass-by-reference return\n },\n\n /* Recursive divide and conquer multiply algorithm.\n based on\n Let u = u0 + u1*(b^n)\n Let v = v0 + v1*(b^n)\n Then uv = (B^2n+B^n)*u1*v1 + B^n*(u1-u0)*(v0-v1) + (B^n+1)*u0*v0\n\n B is the base of storage, number of digits in u1,u0 close to equal.\n */\n _bc_rec_mul: function (u, ulen, v, vlen, fullScale) {\n var prod // @return\n var u0, u1, v0, v1 // bc_num\n // var u0len,\n // var v0len // int\n var m1, m2, m3, d1, d2 // bc_num\n var n, prodlen, m1zero // int\n var d1len, d2len // int\n // Base case?\n if ((ulen + vlen) < Libbcmath.MUL_BASE_DIGITS ||\n ulen < Libbcmath.MUL_SMALL_DIGITS ||\n vlen < Libbcmath.MUL_SMALL_DIGITS) {\n return Libbcmath._bc_simp_mul(u, ulen, v, vlen, fullScale)\n }\n\n // Calculate n -- the u and v split point in digits.\n n = Math.floor((Libbcmath.MAX(ulen, vlen) + 1) / 2)\n\n // Split u and v.\n if (ulen < n) {\n u1 = Libbcmath.bc_init_num() // u1 = bc_copy_num (BCG(_zero_));\n u0 = Libbcmath.new_sub_num(ulen, 0, u.n_value)\n } else {\n u1 = Libbcmath.new_sub_num(ulen - n, 0, u.n_value)\n u0 = Libbcmath.new_sub_num(n, 0, u.n_value, ulen - n)\n }\n if (vlen < n) {\n v1 = Libbcmath.bc_init_num() // bc_copy_num (BCG(_zero_));\n v0 = Libbcmath.new_sub_num(vlen, 0, v.n_value)\n } else {\n v1 = Libbcmath.new_sub_num(vlen - n, 0, v.n_value)\n v0 = Libbcmath.new_sub_num(n, 0, v.n_value, vlen - n)\n }\n Libbcmath._bc_rm_leading_zeros(u1)\n Libbcmath._bc_rm_leading_zeros(u0)\n // var u0len = u0.n_len\n Libbcmath._bc_rm_leading_zeros(v1)\n Libbcmath._bc_rm_leading_zeros(v0)\n // var v0len = v0.n_len\n\n m1zero = Libbcmath.bc_is_zero(u1) || Libbcmath.bc_is_zero(v1)\n\n // Calculate sub results ...\n d1 = Libbcmath.bc_init_num() // needed?\n d2 = Libbcmath.bc_init_num() // needed?\n d1 = Libbcmath.bc_sub(u1, u0, 0)\n d1len = d1.n_len\n\n d2 = Libbcmath.bc_sub(v0, v1, 0)\n d2len = d2.n_len\n\n // Do recursive multiplies and shifted adds.\n if (m1zero) {\n m1 = Libbcmath.bc_init_num() // bc_copy_num (BCG(_zero_));\n } else {\n // m1 = Libbcmath.bc_init_num(); //allow pass-by-ref\n m1 = Libbcmath._bc_rec_mul(u1, u1.n_len, v1, v1.n_len, 0)\n }\n if (Libbcmath.bc_is_zero(d1) || Libbcmath.bc_is_zero(d2)) {\n m2 = Libbcmath.bc_init_num() // bc_copy_num (BCG(_zero_));\n } else {\n // m2 = Libbcmath.bc_init_num(); //allow pass-by-ref\n m2 = Libbcmath._bc_rec_mul(d1, d1len, d2, d2len, 0)\n }\n\n if (Libbcmath.bc_is_zero(u0) || Libbcmath.bc_is_zero(v0)) {\n m3 = Libbcmath.bc_init_num() // bc_copy_num (BCG(_zero_));\n } else {\n // m3 = Libbcmath.bc_init_num(); //allow pass-by-ref\n m3 = Libbcmath._bc_rec_mul(u0, u0.n_len, v0, v0.n_len, 0)\n }\n\n // Initialize product\n prodlen = ulen + vlen + 1\n prod = Libbcmath.bc_new_num(prodlen, 0)\n\n if (!m1zero) {\n Libbcmath._bc_shift_addsub(prod, m1, 2 * n, 0)\n Libbcmath._bc_shift_addsub(prod, m1, n, 0)\n }\n Libbcmath._bc_shift_addsub(prod, m3, n, 0)\n Libbcmath._bc_shift_addsub(prod, m3, 0, 0)\n Libbcmath._bc_shift_addsub(prod, m2, n, d1.n_sign !== d2.n_sign)\n\n return prod\n // Now clean up!\n // bc_free_num (&u1);\n // bc_free_num (&u0);\n // bc_free_num (&v1);\n // bc_free_num (&m1);\n // bc_free_num (&v0);\n // bc_free_num (&m2);\n // bc_free_num (&m3);\n // bc_free_num (&d1);\n // bc_free_num (&d2);\n },\n\n /**\n *\n * @param {bc_num} n1\n * @param {bc_num} n2\n * @param {boolean} useSign\n * @param {boolean} ignoreLast\n * @return -1, 0, 1 (see bc_compare)\n */\n _bc_do_compare: function (n1, n2, useSign, ignoreLast) {\n var n1ptr, n2ptr // int\n var count // int\n // First, compare signs.\n if (useSign && (n1.n_sign !== n2.n_sign)) {\n if (n1.n_sign === Libbcmath.PLUS) {\n return (1) // Positive N1 > Negative N2\n } else {\n return (-1) // Negative N1 < Positive N1\n }\n }\n\n // Now compare the magnitude.\n if (n1.n_len !== n2.n_len) {\n if (n1.n_len > n2.n_len) { // Magnitude of n1 > n2.\n if (!useSign || (n1.n_sign === Libbcmath.PLUS)) {\n return (1)\n } else {\n return (-1)\n }\n } else { // Magnitude of n1 < n2.\n if (!useSign || (n1.n_sign === Libbcmath.PLUS)) {\n return (-1)\n } else {\n return (1)\n }\n }\n }\n\n /* If we get here, they have the same number of integer digits.\n check the integer part and the equal length part of the fraction. */\n count = n1.n_len + Math.min(n1.n_scale, n2.n_scale)\n n1ptr = 0\n n2ptr = 0\n\n while ((count > 0) && (n1.n_value[n1ptr] === n2.n_value[n2ptr])) {\n n1ptr++\n n2ptr++\n count--\n }\n\n if (ignoreLast && (count === 1) && (n1.n_scale === n2.n_scale)) {\n return (0)\n }\n\n if (count !== 0) {\n if (n1.n_value[n1ptr] > n2.n_value[n2ptr]) { // Magnitude of n1 > n2.\n if (!useSign || n1.n_sign === Libbcmath.PLUS) {\n return (1)\n } else {\n return (-1)\n }\n } else { // Magnitude of n1 < n2.\n if (!useSign || n1.n_sign === Libbcmath.PLUS) {\n return (-1)\n } else {\n return (1)\n }\n }\n }\n\n // They are equal up to the last part of the equal part of the fraction.\n if (n1.n_scale !== n2.n_scale) {\n if (n1.n_scale > n2.n_scale) {\n for (count = (n1.n_scale - n2.n_scale); count > 0; count--) {\n if (n1.n_value[n1ptr++] !== 0) { // Magnitude of n1 > n2.\n if (!useSign || n1.n_sign === Libbcmath.PLUS) {\n return (1)\n } else {\n return (-1)\n }\n }\n }\n } else {\n for (count = (n2.n_scale - n1.n_scale); count > 0; count--) {\n if (n2.n_value[n2ptr++] !== 0) { // Magnitude of n1 < n2.\n if (!useSign || n1.n_sign === Libbcmath.PLUS) {\n return (-1)\n } else {\n return (1)\n }\n }\n }\n }\n }\n\n // They must be equal!\n return (0)\n },\n\n /* Here is the full subtract routine that takes care of negative numbers.\n N2 is subtracted from N1 and the result placed in RESULT. SCALE_MIN\n is the minimum scale for the result. */\n bc_sub: function (n1, n2, scaleMin) {\n var diff // bc_num\n var cmpRes, resScale // int\n if (n1.n_sign !== n2.n_sign) {\n diff = Libbcmath._bc_do_add(n1, n2, scaleMin)\n diff.n_sign = n1.n_sign\n } else { // subtraction must be done.\n // Compare magnitudes.\n cmpRes = Libbcmath._bc_do_compare(n1, n2, false, false)\n switch (cmpRes) {\n case -1:\n // n1 is less than n2, subtract n1 from n2.\n diff = Libbcmath._bc_do_sub(n2, n1, scaleMin)\n diff.n_sign = (n2.n_sign === Libbcmath.PLUS ? Libbcmath.MINUS : Libbcmath.PLUS)\n break\n case 0:\n // They are equal! return zero!\n resScale = Libbcmath.MAX(scaleMin, Libbcmath.MAX(n1.n_scale, n2.n_scale))\n diff = Libbcmath.bc_new_num(1, resScale)\n Libbcmath.memset(diff.n_value, 0, 0, resScale + 1)\n break\n case 1:\n // n2 is less than n1, subtract n2 from n1.\n diff = Libbcmath._bc_do_sub(n1, n2, scaleMin)\n diff.n_sign = n1.n_sign\n break\n }\n }\n\n // Clean up and return.\n // bc_free_num (result);\n //* result = diff;\n return diff\n },\n\n _bc_do_add: function (n1, n2, scaleMin) {\n var sum // bc_num\n var sumScale, sumDigits // int\n var n1ptr, n2ptr, sumptr // int\n var carry, n1bytes, n2bytes // int\n var tmp // int\n\n // Prepare sum.\n sumScale = Libbcmath.MAX(n1.n_scale, n2.n_scale)\n sumDigits = Libbcmath.MAX(n1.n_len, n2.n_len) + 1\n sum = Libbcmath.bc_new_num(sumDigits, Libbcmath.MAX(sumScale, scaleMin))\n\n // Start with the fraction part. Initialize the pointers.\n n1bytes = n1.n_scale\n n2bytes = n2.n_scale\n n1ptr = (n1.n_len + n1bytes - 1)\n n2ptr = (n2.n_len + n2bytes - 1)\n sumptr = (sumScale + sumDigits - 1)\n\n // Add the fraction part. First copy the longer fraction\n // (ie when adding 1.2345 to 1 we know .2345 is correct already) .\n if (n1bytes !== n2bytes) {\n if (n1bytes > n2bytes) {\n // n1 has more dp then n2\n while (n1bytes > n2bytes) {\n sum.n_value[sumptr--] = n1.n_value[n1ptr--]\n // *sumptr-- = *n1ptr--;\n n1bytes--\n }\n } else {\n // n2 has more dp then n1\n while (n2bytes > n1bytes) {\n sum.n_value[sumptr--] = n2.n_value[n2ptr--]\n // *sumptr-- = *n2ptr--;\n n2bytes--\n }\n }\n }\n\n // Now add the remaining fraction part and equal size integer parts.\n n1bytes += n1.n_len\n n2bytes += n2.n_len\n carry = 0\n while ((n1bytes > 0) && (n2bytes > 0)) {\n // add the two numbers together\n tmp = n1.n_value[n1ptr--] + n2.n_value[n2ptr--] + carry\n // *sumptr = *n1ptr-- + *n2ptr-- + carry;\n // check if they are >= 10 (impossible to be more then 18)\n if (tmp >= Libbcmath.BASE) {\n carry = 1\n tmp -= Libbcmath.BASE // yep, subtract 10, add a carry\n } else {\n carry = 0\n }\n sum.n_value[sumptr] = tmp\n sumptr--\n n1bytes--\n n2bytes--\n }\n\n // Now add carry the [rest of the] longer integer part.\n if (n1bytes === 0) {\n // n2 is a bigger number then n1\n while (n2bytes-- > 0) {\n tmp = n2.n_value[n2ptr--] + carry\n // *sumptr = *n2ptr-- + carry;\n if (tmp >= Libbcmath.BASE) {\n carry = 1\n tmp -= Libbcmath.BASE\n } else {\n carry = 0\n }\n sum.n_value[sumptr--] = tmp\n }\n } else {\n // n1 is bigger then n2..\n while (n1bytes-- > 0) {\n tmp = n1.n_value[n1ptr--] + carry\n // *sumptr = *n1ptr-- + carry;\n if (tmp >= Libbcmath.BASE) {\n carry = 1\n tmp -= Libbcmath.BASE\n } else {\n carry = 0\n }\n sum.n_value[sumptr--] = tmp\n }\n }\n\n // Set final carry.\n if (carry === 1) {\n sum.n_value[sumptr] += 1\n // *sumptr += 1;\n }\n\n // Adjust sum and return.\n Libbcmath._bc_rm_leading_zeros(sum)\n return sum\n },\n\n /**\n * Perform a subtraction\n *\n * Perform subtraction: N2 is subtracted from N1 and the value is\n * returned. The signs of N1 and N2 are ignored. Also, N1 is\n * assumed to be larger than N2. SCALE_MIN is the minimum scale\n * of the result.\n *\n * Basic school maths says to subtract 2 numbers..\n * 1. make them the same length, the decimal places, and the integer part\n * 2. start from the right and subtract the two numbers from each other\n * 3. if the sum of the 2 numbers < 0, carry -1 to the next set and add 10\n * (ie 18 > carry 1 becomes 8). thus 0.9 + 0.9 = 1.8\n *\n * @param {bc_num} n1\n * @param {bc_num} n2\n * @param {int} scaleMin\n * @return bc_num\n */\n _bc_do_sub: function (n1, n2, scaleMin) {\n var diff // bc_num\n var diffScale, diffLen // int\n var minScale, minLen // int\n var n1ptr, n2ptr, diffptr // int\n var borrow, count, val // int\n // Allocate temporary storage.\n diffLen = Libbcmath.MAX(n1.n_len, n2.n_len)\n diffScale = Libbcmath.MAX(n1.n_scale, n2.n_scale)\n minLen = Libbcmath.MIN(n1.n_len, n2.n_len)\n minScale = Libbcmath.MIN(n1.n_scale, n2.n_scale)\n diff = Libbcmath.bc_new_num(diffLen, Libbcmath.MAX(diffScale, scaleMin))\n\n /* Not needed?\n // Zero extra digits made by scaleMin.\n if (scaleMin > diffScale) {\n diffptr = (char *) (diff->n_value + diffLen + diffScale);\n for (count = scaleMin - diffScale; count > 0; count--) {\n *diffptr++ = 0;\n }\n }\n */\n\n // Initialize the subtract.\n n1ptr = (n1.n_len + n1.n_scale - 1)\n n2ptr = (n2.n_len + n2.n_scale - 1)\n diffptr = (diffLen + diffScale - 1)\n\n // Subtract the numbers.\n borrow = 0\n\n // Take care of the longer scaled number.\n if (n1.n_scale !== minScale) {\n // n1 has the longer scale\n for (count = n1.n_scale - minScale; count > 0; count--) {\n diff.n_value[diffptr--] = n1.n_value[n1ptr--]\n // *diffptr-- = *n1ptr--;\n }\n } else {\n // n2 has the longer scale\n for (count = n2.n_scale - minScale; count > 0; count--) {\n val = 0 - n2.n_value[n2ptr--] - borrow\n // val = - *n2ptr-- - borrow;\n if (val < 0) {\n val += Libbcmath.BASE\n borrow = 1\n } else {\n borrow = 0\n }\n diff.n_value[diffptr--] = val\n //* diffptr-- = val;\n }\n }\n\n // Now do the equal length scale and integer parts.\n for (count = 0; count < minLen + minScale; count++) {\n val = n1.n_value[n1ptr--] - n2.n_value[n2ptr--] - borrow\n // val = *n1ptr-- - *n2ptr-- - borrow;\n if (val < 0) {\n val += Libbcmath.BASE\n borrow = 1\n } else {\n borrow = 0\n }\n diff.n_value[diffptr--] = val\n //* diffptr-- = val;\n }\n\n // If n1 has more digits then n2, we now do that subtract.\n if (diffLen !== minLen) {\n for (count = diffLen - minLen; count > 0; count--) {\n val = n1.n_value[n1ptr--] - borrow\n // val = *n1ptr-- - borrow;\n if (val < 0) {\n val += Libbcmath.BASE\n borrow = 1\n } else {\n borrow = 0\n }\n diff.n_value[diffptr--] = val\n }\n }\n\n // Clean up and return.\n Libbcmath._bc_rm_leading_zeros(diff)\n return diff\n },\n\n /**\n *\n * @param {int} length\n * @param {int} scale\n * @return bc_num\n */\n bc_new_num: function (length, scale) {\n var temp // bc_num\n temp = new Libbcmath.bc_num() // eslint-disable-line new-cap\n temp.n_sign = Libbcmath.PLUS\n temp.n_len = length\n temp.n_scale = scale\n temp.n_value = Libbcmath.safe_emalloc(1, length + scale, 0)\n Libbcmath.memset(temp.n_value, 0, 0, length + scale)\n return temp\n },\n\n safe_emalloc: function (size, len, extra) {\n return Array((size * len) + extra)\n },\n\n /**\n * Create a new number\n */\n bc_init_num: function () {\n return new Libbcmath.bc_new_num(1, 0) // eslint-disable-line new-cap\n },\n\n _bc_rm_leading_zeros: function (num) {\n // We can move n_value to point to the first non zero digit!\n while ((num.n_value[0] === 0) && (num.n_len > 1)) {\n num.n_value.shift()\n num.n_len--\n }\n },\n\n /**\n * Convert to bc_num detecting scale\n */\n php_str2num: function (str) {\n var p\n p = str.indexOf('.')\n if (p === -1) {\n return Libbcmath.bc_str2num(str, 0)\n } else {\n return Libbcmath.bc_str2num(str, (str.length - p))\n }\n },\n\n CH_VAL: function (c) {\n return c - '0' // ??\n },\n\n BCD_CHAR: function (d) {\n return d + '0' // ??\n },\n\n isdigit: function (c) {\n return isNaN(parseInt(c, 10))\n },\n\n bc_str2num: function (strIn, scale) {\n var str, num, ptr, digits, strscale, zeroInt, nptr\n // remove any non-expected characters\n // Check for valid number and count digits.\n\n str = strIn.split('') // convert to array\n ptr = 0 // str\n digits = 0\n strscale = 0\n zeroInt = false\n if ((str[ptr] === '+') || (str[ptr] === '-')) {\n ptr++ // Sign\n }\n while (str[ptr] === '0') {\n ptr++ // Skip leading zeros.\n }\n // while (Libbcmath.isdigit(str[ptr])) {\n while ((str[ptr]) % 1 === 0) { // Libbcmath.isdigit(str[ptr])) {\n ptr++\n digits++ // digits\n }\n\n if (str[ptr] === '.') {\n ptr++ // decimal point\n }\n // while (Libbcmath.isdigit(str[ptr])) {\n while ((str[ptr]) % 1 === 0) { // Libbcmath.isdigit(str[ptr])) {\n ptr++\n strscale++ // digits\n }\n\n if ((str[ptr]) || (digits + strscale === 0)) {\n // invalid number, return 0\n return Libbcmath.bc_init_num()\n //* num = bc_copy_num (BCG(_zero_));\n }\n\n // Adjust numbers and allocate storage and initialize fields.\n strscale = Libbcmath.MIN(strscale, scale)\n if (digits === 0) {\n zeroInt = true\n digits = 1\n }\n\n num = Libbcmath.bc_new_num(digits, strscale)\n\n // Build the whole number.\n ptr = 0 // str\n if (str[ptr] === '-') {\n num.n_sign = Libbcmath.MINUS\n // (*num)->n_sign = MINUS;\n ptr++\n } else {\n num.n_sign = Libbcmath.PLUS\n // (*num)->n_sign = PLUS;\n if (str[ptr] === '+') {\n ptr++\n }\n }\n while (str[ptr] === '0') {\n ptr++ // Skip leading zeros.\n }\n\n nptr = 0 // (*num)->n_value;\n if (zeroInt) {\n num.n_value[nptr++] = 0\n digits = 0\n }\n for (; digits > 0; digits--) {\n num.n_value[nptr++] = Libbcmath.CH_VAL(str[ptr++])\n //* nptr++ = CH_VAL(*ptr++);\n }\n\n // Build the fractional part.\n if (strscale > 0) {\n ptr++ // skip the decimal point!\n for (; strscale > 0; strscale--) {\n num.n_value[nptr++] = Libbcmath.CH_VAL(str[ptr++])\n }\n }\n\n return num\n },\n\n cint: function (v) {\n if (typeof v === 'undefined') {\n v = 0\n }\n var x = parseInt(v, 10)\n if (isNaN(x)) {\n x = 0\n }\n return x\n },\n\n /**\n * Basic min function\n * @param {int} a\n * @param {int} b\n */\n MIN: function (a, b) {\n return ((a > b) ? b : a)\n },\n\n /**\n * Basic max function\n * @param {int} a\n * @param {int} b\n */\n MAX: function (a, b) {\n return ((a > b) ? a : b)\n },\n\n /**\n * Basic odd function\n * @param {int} a\n */\n ODD: function (a) {\n return (a & 1)\n },\n\n /**\n * replicate c function\n * @param {array} r return (by reference)\n * @param {int} ptr\n * @param {string} chr char to fill\n * @param {int} len length to fill\n */\n memset: function (r, ptr, chr, len) {\n var i\n for (i = 0; i < len; i++) {\n r[ptr + i] = chr\n }\n },\n\n /**\n * Replacement c function\n * Obviously can't work like c does, so we've added an \"offset\"\n * param so you could do memcpy(dest+1, src, len) as memcpy(dest, 1, src, len)\n * Also only works on arrays\n */\n memcpy: function (dest, ptr, src, srcptr, len) {\n var i\n for (i = 0; i < len; i++) {\n dest[ptr + i] = src[srcptr + i]\n }\n return true\n },\n\n /**\n * Determine if the number specified is zero or not\n * @param {bc_num} num number to check\n * @return boolean true when zero, false when not zero.\n */\n bc_is_zero: function (num) {\n var count // int\n var nptr // int\n // Quick check.\n // if (num === BCG(_zero_)) return TRUE;\n // Initialize\n count = num.n_len + num.n_scale\n nptr = 0 // num->n_value;\n // The check\n while ((count > 0) && (num.n_value[nptr++] === 0)) {\n count--\n }\n\n if (count !== 0) {\n return false\n } else {\n return true\n }\n },\n\n bc_out_of_memory: function () {\n throw new Error('(BC) Out of memory')\n }\n }\n return Libbcmath\n}\n"]} \ No newline at end of file
diff --git a/node_modules/locutus/php/_helpers/_phpCastString.js b/node_modules/locutus/php/_helpers/_phpCastString.js
deleted file mode 100644
index 8228372..0000000
--- a/node_modules/locutus/php/_helpers/_phpCastString.js
+++ /dev/null
@@ -1,69 +0,0 @@
-'use strict';
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-module.exports = function _phpCastString(value) {
- // original by: Rafał Kukawski
- // example 1: _phpCastString(true)
- // returns 1: '1'
- // example 2: _phpCastString(false)
- // returns 2: ''
- // example 3: _phpCastString('foo')
- // returns 3: 'foo'
- // example 4: _phpCastString(0/0)
- // returns 4: 'NAN'
- // example 5: _phpCastString(1/0)
- // returns 5: 'INF'
- // example 6: _phpCastString(-1/0)
- // returns 6: '-INF'
- // example 7: _phpCastString(null)
- // returns 7: ''
- // example 8: _phpCastString(undefined)
- // returns 8: ''
- // example 9: _phpCastString([])
- // returns 9: 'Array'
- // example 10: _phpCastString({})
- // returns 10: 'Object'
- // example 11: _phpCastString(0)
- // returns 11: '0'
- // example 12: _phpCastString(1)
- // returns 12: '1'
- // example 13: _phpCastString(3.14)
- // returns 13: '3.14'
-
- var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
-
- switch (type) {
- case 'boolean':
- return value ? '1' : '';
- case 'string':
- return value;
- case 'number':
- if (isNaN(value)) {
- return 'NAN';
- }
-
- if (!isFinite(value)) {
- return (value < 0 ? '-' : '') + 'INF';
- }
-
- return value + '';
- case 'undefined':
- return '';
- case 'object':
- if (Array.isArray(value)) {
- return 'Array';
- }
-
- if (value !== null) {
- return 'Object';
- }
-
- return '';
- case 'function':
- // fall through
- default:
- throw new Error('Unsupported value type');
- }
-};
-//# sourceMappingURL=_phpCastString.js.map \ No newline at end of file
diff --git a/node_modules/locutus/php/_helpers/_phpCastString.js.map b/node_modules/locutus/php/_helpers/_phpCastString.js.map
deleted file mode 100644
index 281aae6..0000000
--- a/node_modules/locutus/php/_helpers/_phpCastString.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["../../../src/php/_helpers/_phpCastString.js"],"names":["module","exports","_phpCastString","value","type","isNaN","isFinite","Array","isArray","Error"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,cAAT,CAAyBC,KAAzB,EAAgC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,cAAcD,KAAd,yCAAcA,KAAd,CAAJ;;AAEA,UAAQC,IAAR;AACE,SAAK,SAAL;AACE,aAAOD,QAAQ,GAAR,GAAc,EAArB;AACF,SAAK,QAAL;AACE,aAAOA,KAAP;AACF,SAAK,QAAL;AACE,UAAIE,MAAMF,KAAN,CAAJ,EAAkB;AAChB,eAAO,KAAP;AACD;;AAED,UAAI,CAACG,SAASH,KAAT,CAAL,EAAsB;AACpB,eAAO,CAACA,QAAQ,CAAR,GAAY,GAAZ,GAAkB,EAAnB,IAAyB,KAAhC;AACD;;AAED,aAAOA,QAAQ,EAAf;AACF,SAAK,WAAL;AACE,aAAO,EAAP;AACF,SAAK,QAAL;AACE,UAAII,MAAMC,OAAN,CAAcL,KAAd,CAAJ,EAA0B;AACxB,eAAO,OAAP;AACD;;AAED,UAAIA,UAAU,IAAd,EAAoB;AAClB,eAAO,QAAP;AACD;;AAED,aAAO,EAAP;AACF,SAAK,UAAL;AACE;AACF;AACE,YAAM,IAAIM,KAAJ,CAAU,wBAAV,CAAN;AA9BJ;AAgCD,CA/DD","file":"_phpCastString.js","sourcesContent":["module.exports = function _phpCastString (value) {\n // original by: Rafał Kukawski\n // example 1: _phpCastString(true)\n // returns 1: '1'\n // example 2: _phpCastString(false)\n // returns 2: ''\n // example 3: _phpCastString('foo')\n // returns 3: 'foo'\n // example 4: _phpCastString(0/0)\n // returns 4: 'NAN'\n // example 5: _phpCastString(1/0)\n // returns 5: 'INF'\n // example 6: _phpCastString(-1/0)\n // returns 6: '-INF'\n // example 7: _phpCastString(null)\n // returns 7: ''\n // example 8: _phpCastString(undefined)\n // returns 8: ''\n // example 9: _phpCastString([])\n // returns 9: 'Array'\n // example 10: _phpCastString({})\n // returns 10: 'Object'\n // example 11: _phpCastString(0)\n // returns 11: '0'\n // example 12: _phpCastString(1)\n // returns 12: '1'\n // example 13: _phpCastString(3.14)\n // returns 13: '3.14'\n\n var type = typeof value\n\n switch (type) {\n case 'boolean':\n return value ? '1' : ''\n case 'string':\n return value\n case 'number':\n if (isNaN(value)) {\n return 'NAN'\n }\n\n if (!isFinite(value)) {\n return (value < 0 ? '-' : '') + 'INF'\n }\n\n return value + ''\n case 'undefined':\n return ''\n case 'object':\n if (Array.isArray(value)) {\n return 'Array'\n }\n\n if (value !== null) {\n return 'Object'\n }\n\n return ''\n case 'function':\n // fall through\n default:\n throw new Error('Unsupported value type')\n }\n}\n"]} \ No newline at end of file
diff --git a/node_modules/locutus/php/_helpers/_php_cast_int.js b/node_modules/locutus/php/_helpers/_php_cast_int.js
deleted file mode 100644
index b9724e4..0000000
--- a/node_modules/locutus/php/_helpers/_php_cast_int.js
+++ /dev/null
@@ -1,58 +0,0 @@
-'use strict';
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-module.exports = function _php_cast_int(value) {
- // eslint-disable-line camelcase
- // original by: Rafał Kukawski
- // example 1: _php_cast_int(false)
- // returns 1: 0
- // example 2: _php_cast_int(true)
- // returns 2: 1
- // example 3: _php_cast_int(0)
- // returns 3: 0
- // example 4: _php_cast_int(1)
- // returns 4: 1
- // example 5: _php_cast_int(3.14)
- // returns 5: 3
- // example 6: _php_cast_int('')
- // returns 6: 0
- // example 7: _php_cast_int('0')
- // returns 7: 0
- // example 8: _php_cast_int('abc')
- // returns 8: 0
- // example 9: _php_cast_int(null)
- // returns 9: 0
- // example 10: _php_cast_int(undefined)
- // returns 10: 0
- // example 11: _php_cast_int('123abc')
- // returns 11: 123
- // example 12: _php_cast_int('123e4')
- // returns 12: 123
- // example 13: _php_cast_int(0x200000001)
- // returns 13: 8589934593
-
- var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
-
- switch (type) {
- case 'number':
- if (isNaN(value) || !isFinite(value)) {
- // from PHP 7, NaN and Infinity are casted to 0
- return 0;
- }
-
- return value < 0 ? Math.ceil(value) : Math.floor(value);
- case 'string':
- return parseInt(value, 10) || 0;
- case 'boolean':
- // fall through
- default:
- // Behaviour for types other than float, string, boolean
- // is undefined and can change any time.
- // To not invent complex logic
- // that mimics PHP 7.0 behaviour
- // casting value->bool->number is used
- return +!!value;
- }
-};
-//# sourceMappingURL=_php_cast_int.js.map \ No newline at end of file
diff --git a/node_modules/locutus/php/_helpers/_php_cast_int.js.map b/node_modules/locutus/php/_helpers/_php_cast_int.js.map
deleted file mode 100644
index b16d748..0000000
--- a/node_modules/locutus/php/_helpers/_php_cast_int.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["../../../src/php/_helpers/_php_cast_int.js"],"names":["module","exports","_php_cast_int","value","type","isNaN","isFinite","Math","ceil","floor","parseInt"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,aAAT,CAAwBC,KAAxB,EAA+B;AAAE;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,cAAcD,KAAd,yCAAcA,KAAd,CAAJ;;AAEA,UAAQC,IAAR;AACE,SAAK,QAAL;AACE,UAAIC,MAAMF,KAAN,KAAgB,CAACG,SAASH,KAAT,CAArB,EAAsC;AACpC;AACA,eAAO,CAAP;AACD;;AAED,aAAOA,QAAQ,CAAR,GAAYI,KAAKC,IAAL,CAAUL,KAAV,CAAZ,GAA+BI,KAAKE,KAAL,CAAWN,KAAX,CAAtC;AACF,SAAK,QAAL;AACE,aAAOO,SAASP,KAAT,EAAgB,EAAhB,KAAuB,CAA9B;AACF,SAAK,SAAL;AACE;AACF;AACE;AACA;AACA;AACA;AACA;AACA,aAAO,CAAC,CAAC,CAACA,KAAV;AAlBJ;AAoBD,CAnDD","file":"_php_cast_int.js","sourcesContent":["module.exports = function _php_cast_int (value) { // eslint-disable-line camelcase\n // original by: Rafał Kukawski\n // example 1: _php_cast_int(false)\n // returns 1: 0\n // example 2: _php_cast_int(true)\n // returns 2: 1\n // example 3: _php_cast_int(0)\n // returns 3: 0\n // example 4: _php_cast_int(1)\n // returns 4: 1\n // example 5: _php_cast_int(3.14)\n // returns 5: 3\n // example 6: _php_cast_int('')\n // returns 6: 0\n // example 7: _php_cast_int('0')\n // returns 7: 0\n // example 8: _php_cast_int('abc')\n // returns 8: 0\n // example 9: _php_cast_int(null)\n // returns 9: 0\n // example 10: _php_cast_int(undefined)\n // returns 10: 0\n // example 11: _php_cast_int('123abc')\n // returns 11: 123\n // example 12: _php_cast_int('123e4')\n // returns 12: 123\n // example 13: _php_cast_int(0x200000001)\n // returns 13: 8589934593\n\n var type = typeof value\n\n switch (type) {\n case 'number':\n if (isNaN(value) || !isFinite(value)) {\n // from PHP 7, NaN and Infinity are casted to 0\n return 0\n }\n\n return value < 0 ? Math.ceil(value) : Math.floor(value)\n case 'string':\n return parseInt(value, 10) || 0\n case 'boolean':\n // fall through\n default:\n // Behaviour for types other than float, string, boolean\n // is undefined and can change any time.\n // To not invent complex logic\n // that mimics PHP 7.0 behaviour\n // casting value->bool->number is used\n return +!!value\n }\n}\n"]} \ No newline at end of file
diff --git a/node_modules/locutus/php/_helpers/index.js b/node_modules/locutus/php/_helpers/index.js
deleted file mode 100644
index df2507e..0000000
--- a/node_modules/locutus/php/_helpers/index.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-module.exports['_bc'] = require('./_bc');
-module.exports['_phpCastString'] = require('./_phpCastString');
-module.exports['_php_cast_int'] = require('./_php_cast_int');
-//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/node_modules/locutus/php/_helpers/index.js.map b/node_modules/locutus/php/_helpers/index.js.map
deleted file mode 100644
index 7d41666..0000000
--- a/node_modules/locutus/php/_helpers/index.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["../../../src/php/_helpers/index.js"],"names":["module","exports","require"],"mappings":";;AAAAA,OAAOC,OAAP,CAAe,KAAf,IAAwBC,QAAQ,OAAR,CAAxB;AACAF,OAAOC,OAAP,CAAe,gBAAf,IAAmCC,QAAQ,kBAAR,CAAnC;AACAF,OAAOC,OAAP,CAAe,eAAf,IAAkCC,QAAQ,iBAAR,CAAlC","file":"index.js","sourcesContent":["module.exports['_bc'] = require('./_bc')\nmodule.exports['_phpCastString'] = require('./_phpCastString')\nmodule.exports['_php_cast_int'] = require('./_php_cast_int')\n"]} \ No newline at end of file