From 72ca3af8575a7a8b62b40638d745326897a89142 Mon Sep 17 00:00:00 2001 From: Walamana Date: Tue, 6 Aug 2024 22:13:11 +0200 Subject: [PATCH] Initial commit --- node_modules/.bin/mime | 15 - node_modules/.bin/mime.cmd | 7 - node_modules/.bin/uuid | 15 - node_modules/.bin/uuid.cmd | 7 - node_modules/accepts/package.json | 24 +- node_modules/array-flatten/package.json | 13 +- node_modules/bignumber.js/LICENCE | 46 +- node_modules/bignumber.js/README.md | 818 +-- node_modules/bignumber.js/bignumber.d.ts | 2590 ++++---- node_modules/bignumber.js/bignumber.js | 5468 ++++++++--------- node_modules/bignumber.js/bower.json | 72 +- node_modules/bignumber.js/doc/API.html | 4394 ++++++------- node_modules/bignumber.js/package.json | 13 +- .../node_modules/depd/package.json | 23 +- .../node_modules/http-errors/package.json | 23 +- .../node_modules/mime-db/package.json | 23 +- .../node_modules/mime-types/package.json | 23 +- .../body-parser/node_modules/qs/package.json | 13 +- .../node_modules/statuses/package.json | 23 +- .../node_modules/type-is/package.json | 23 +- node_modules/body-parser/package.json | 24 +- node_modules/bytes/package.json | 15 +- node_modules/content-disposition/package.json | 13 +- node_modules/content-type/package.json | 26 +- node_modules/cookie-parser/package.json | 24 +- node_modules/cookie-signature/package.json | 14 +- node_modules/cookie/package.json | 14 +- node_modules/core-util-is/package.json | 23 +- node_modules/cors/package.json | 24 +- node_modules/debug/package.json | 14 +- node_modules/depd/package.json | 25 +- node_modules/destroy/package.json | 23 +- node_modules/ee-first/package.json | 13 +- node_modules/encodeurl/package.json | 23 +- node_modules/errorhandler/package.json | 24 +- node_modules/escape-html/package.json | 24 +- node_modules/etag/package.json | 23 +- node_modules/express-force-ssl/package.json | 24 +- .../node_modules/body-parser/package.json | 13 +- .../node_modules/iconv-lite/package.json | 13 +- .../node_modules/raw-body/package.json | 13 +- node_modules/express/package.json | 36 +- node_modules/finalhandler/package.json | 13 +- node_modules/forwarded/package.json | 23 +- node_modules/fresh/package.json | 13 +- node_modules/hashmap/.jshintrc | 56 +- node_modules/hashmap/Readme.md | 340 +- node_modules/hashmap/hashmap.js | 420 +- node_modules/hashmap/package.json | 24 +- .../node_modules/setprototypeof/package.json | 13 +- node_modules/http-errors/package.json | 27 +- node_modules/iconv-lite/package.json | 13 +- node_modules/inherits/package.json | 18 +- node_modules/ipaddr.js/package.json | 13 +- node_modules/isarray/package.json | 23 +- node_modules/lodash._baseassign/package.json | 23 +- node_modules/lodash._basecopy/package.json | 23 +- .../lodash._bindcallback/package.json | 23 +- .../lodash._createassigner/package.json | 23 +- node_modules/lodash._getnative/package.json | 23 +- .../lodash._isiterateecall/package.json | 23 +- node_modules/lodash.assign/package.json | 23 +- node_modules/lodash.isarguments/package.json | 23 +- node_modules/lodash.isarray/package.json | 23 +- node_modules/lodash.keys/package.json | 23 +- node_modules/lodash.restparam/package.json | 23 +- node_modules/media-typer/package.json | 14 +- node_modules/merge-descriptors/package.json | 13 +- node_modules/methods/package.json | 23 +- node_modules/mime-db/package.json | 23 +- node_modules/mime-types/package.json | 23 +- node_modules/mime/cli.js | 0 node_modules/mime/package.json | 13 +- node_modules/ms/package.json | 13 +- node_modules/mysql/package.json | 24 +- node_modules/negotiator/package.json | 13 +- node_modules/object-assign/package.json | 23 +- node_modules/on-finished/package.json | 24 +- node_modules/parseurl/package.json | 23 +- node_modules/path-to-regexp/package.json | 13 +- node_modules/path/LICENSE | 36 +- node_modules/path/README.md | 30 +- node_modules/path/package.json | 24 +- node_modules/path/path.js | 1256 ++-- .../process-nextick-args/package.json | 23 +- node_modules/process/package.json | 23 +- node_modules/proxy-addr/package.json | 23 +- node_modules/qs/package.json | 17 +- node_modules/range-parser/package.json | 23 +- .../raw-body/node_modules/depd/package.json | 23 +- .../node_modules/http-errors/package.json | 13 +- .../node_modules/statuses/package.json | 23 +- node_modules/raw-body/package.json | 13 +- node_modules/readable-stream/package.json | 13 +- node_modules/safe-buffer/package.json | 18 +- node_modules/safer-buffer/package.json | 23 +- node_modules/send/package.json | 13 +- node_modules/serve-static/package.json | 13 +- node_modules/setprototypeof/package.json | 17 +- node_modules/sqlstring/package.json | 13 +- node_modules/statuses/package.json | 23 +- node_modules/string_decoder/package.json | 23 +- node_modules/type-is/package.json | 27 +- node_modules/underscore/package.json | 24 +- node_modules/unpipe/package.json | 14 +- node_modules/util-deprecate/package.json | 23 +- .../util/node_modules/inherits/package.json | 13 +- node_modules/util/package.json | 23 +- node_modules/utils-merge/package.json | 13 +- node_modules/uuid/bin/uuid | 0 node_modules/uuid/package.json | 24 +- node_modules/vary/package.json | 24 +- package-lock.json | 160 +- server.sh | 1 + start.sh | 4 + 115 files changed, 8932 insertions(+), 8670 deletions(-) delete mode 100644 node_modules/.bin/mime delete mode 100644 node_modules/.bin/mime.cmd delete mode 100644 node_modules/.bin/uuid delete mode 100644 node_modules/.bin/uuid.cmd mode change 100644 => 100755 node_modules/mime/cli.js mode change 100644 => 100755 node_modules/uuid/bin/uuid create mode 100755 server.sh create mode 100755 start.sh diff --git a/node_modules/.bin/mime b/node_modules/.bin/mime deleted file mode 100644 index 0dbddf0..0000000 --- a/node_modules/.bin/mime +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../mime/cli.js" "$@" - ret=$? -else - node "$basedir/../mime/cli.js" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/.bin/mime.cmd b/node_modules/.bin/mime.cmd deleted file mode 100644 index 8169562..0000000 --- a/node_modules/.bin/mime.cmd +++ /dev/null @@ -1,7 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\..\mime\cli.js" %* -) ELSE ( - @SETLOCAL - @SET PATHEXT=%PATHEXT:;.JS;=;% - node "%~dp0\..\mime\cli.js" %* -) \ No newline at end of file diff --git a/node_modules/.bin/uuid b/node_modules/.bin/uuid deleted file mode 100644 index f3bfcf4..0000000 --- a/node_modules/.bin/uuid +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../uuid/bin/uuid" "$@" - ret=$? -else - node "$basedir/../uuid/bin/uuid" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/.bin/uuid.cmd b/node_modules/.bin/uuid.cmd deleted file mode 100644 index da52d68..0000000 --- a/node_modules/.bin/uuid.cmd +++ /dev/null @@ -1,7 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\..\uuid\bin\uuid" %* -) ELSE ( - @SETLOCAL - @SET PATHEXT=%PATHEXT:;.JS;=;% - node "%~dp0\..\uuid\bin\uuid" %* -) \ No newline at end of file diff --git a/node_modules/accepts/package.json b/node_modules/accepts/package.json index 4379813..4be68f4 100644 --- a/node_modules/accepts/package.json +++ b/node_modules/accepts/package.json @@ -1,31 +1,36 @@ { - "_from": "accepts@~1.3.4", + "_args": [ + [ + "accepts@1.3.4", + "/var/www/backend/minis-data" + ] + ], + "_from": "accepts@1.3.4", "_id": "accepts@1.3.4", "_inBundle": false, "_integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", "_location": "/accepts", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "accepts@~1.3.4", + "raw": "accepts@1.3.4", "name": "accepts", "escapedName": "accepts", - "rawSpec": "~1.3.4", + "rawSpec": "1.3.4", "saveSpec": null, - "fetchSpec": "~1.3.4" + "fetchSpec": "1.3.4" }, "_requiredBy": [ + "/errorhandler", "/express" ], "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", - "_shasum": "86246758c7dd6d21a6474ff084a4740ec05eb21f", - "_spec": "accepts@~1.3.4", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.3.4", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/accepts/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -41,7 +46,6 @@ "mime-types": "~2.1.16", "negotiator": "0.6.1" }, - "deprecated": false, "description": "Higher-level content negotiation", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/array-flatten/package.json b/node_modules/array-flatten/package.json index f6ce7bd..0c231fa 100644 --- a/node_modules/array-flatten/package.json +++ b/node_modules/array-flatten/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "array-flatten@1.1.1", + "/var/www/backend/minis-data" + ] + ], "_from": "array-flatten@1.1.1", "_id": "array-flatten@1.1.1", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "_shasum": "9a5f699051b1e7073328f2a008968b64ea2955d2", - "_spec": "array-flatten@1.1.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.1.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "Blake Embrey", "email": "hello@blakeembrey.com", @@ -30,8 +35,6 @@ "bugs": { "url": "https://github.com/blakeembrey/array-flatten/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Flatten an array of nested arrays into a single flat array", "devDependencies": { "istanbul": "^0.3.13", diff --git a/node_modules/bignumber.js/LICENCE b/node_modules/bignumber.js/LICENCE index 270a4ca..3ab8dd3 100644 --- a/node_modules/bignumber.js/LICENCE +++ b/node_modules/bignumber.js/LICENCE @@ -1,23 +1,23 @@ -The MIT Licence. - -Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 Michael Mclaughlin - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - +The MIT Licence. + +Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 Michael Mclaughlin + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/bignumber.js/README.md b/node_modules/bignumber.js/README.md index 6d99226..71eff2a 100644 --- a/node_modules/bignumber.js/README.md +++ b/node_modules/bignumber.js/README.md @@ -1,409 +1,409 @@ -![bignumber.js](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/bignumberjs.png) - -A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic. - -[![Build Status](https://travis-ci.org/MikeMcl/bignumber.js.svg)](https://travis-ci.org/MikeMcl/bignumber.js) - -
- -## Features - - - Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal - - 8 KB minified and gzipped - - Simple API but full-featured - - Works with numbers with or without fraction digits in bases from 2 to 64 inclusive - - Replicates the `toExponential`, `toFixed`, `toPrecision` and `toString` methods of JavaScript's Number type - - Includes a `toFraction` and a correctly-rounded `squareRoot` method - - Supports cryptographically-secure pseudo-random number generation - - No dependencies - - Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only - - Comprehensive [documentation](http://mikemcl.github.io/bignumber.js/) and test set - -![API](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/API.png) - -If a smaller and simpler library is required see [big.js](https://github.com/MikeMcl/big.js/). -It's less than half the size but only works with decimal numbers and only has half the methods. -It also does not allow `NaN` or `Infinity`, or have the configuration options of this library. - -See also [decimal.js](https://github.com/MikeMcl/decimal.js/), which among other things adds support for non-integer powers, and performs all operations to a specified number of significant digits. - -## Load - -The library is the single JavaScript file *bignumber.js* (or minified, *bignumber.min.js*). - -```html - -``` - -For [Node.js](http://nodejs.org), the library is available from the [npm](https://npmjs.org/) registry - - $ npm install bignumber.js - -```javascript -var BigNumber = require('bignumber.js'); -``` - -To load with AMD loader libraries such as [requireJS](http://requirejs.org/): - -```javascript -require(['path/to/bignumber'], function(BigNumber) { - // Use BigNumber here in local scope. No global BigNumber. -}); -``` - -## Use - -*In all examples below, `var`, semicolons and `toString` calls are not shown. -If a commented-out value is in quotes it means `toString` has been called on the preceding expression.* - -The library exports a single function: `BigNumber`, the constructor of BigNumber instances. - -It accepts a value of type number *(up to 15 significant digits only)*, string or BigNumber object, - -```javascript -x = new BigNumber(123.4567) -y = new BigNumber('123456.7e-3') -z = new BigNumber(x) -x.equals(y) && y.equals(z) && x.equals(z) // true -``` - - -and a base from 2 to 64 inclusive can be specified. - -```javascript -x = new BigNumber(1011, 2) // "11" -y = new BigNumber('zz.9', 36) // "1295.25" -z = x.plus(y) // "1306.25" -``` - -A BigNumber is immutable in the sense that it is not changed by its methods. - -```javascript -0.3 - 0.1 // 0.19999999999999998 -x = new BigNumber(0.3) -x.minus(0.1) // "0.2" -x // "0.3" -``` - -The methods that return a BigNumber can be chained. - -```javascript -x.dividedBy(y).plus(z).times(9).floor() -x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').ceil() -``` - -Many method names have a shorter alias. - -```javascript -x.squareRoot().dividedBy(y).toPower(3).equals(x.sqrt().div(y).pow(3)) // true -x.cmp(y.mod(z).neg()) == 1 && x.comparedTo(y.modulo(z).negated()) == 1 // true -``` - -Like JavaScript's number type, there are `toExponential`, `toFixed` and `toPrecision` methods - -```javascript -x = new BigNumber(255.5) -x.toExponential(5) // "2.55500e+2" -x.toFixed(5) // "255.50000" -x.toPrecision(5) // "255.50" -x.toNumber() // 255.5 -``` - - and a base can be specified for `toString`. - - ```javascript - x.toString(16) // "ff.8" - ``` - -There is also a `toFormat` method which may be useful for internationalisation - -```javascript -y = new BigNumber('1234567.898765') -y.toFormat(2) // "1,234,567.90" -``` - -The maximum number of decimal places of the result of an operation involving division (i.e. a division, square root, base conversion or negative power operation) is set using the `config` method of the `BigNumber` constructor. - -The other arithmetic operations always give the exact result. - -```javascript -BigNumber.config({ DECIMAL_PLACES: 10, ROUNDING_MODE: 4 }) - -x = new BigNumber(2); -y = new BigNumber(3); -z = x.div(y) // "0.6666666667" -z.sqrt() // "0.8164965809" -z.pow(-3) // "3.3749999995" -z.toString(2) // "0.1010101011" -z.times(z) // "0.44444444448888888889" -z.times(z).round(10) // "0.4444444445" -``` - -There is a `toFraction` method with an optional *maximum denominator* argument - -```javascript -y = new BigNumber(355) -pi = y.dividedBy(113) // "3.1415929204" -pi.toFraction() // [ "7853982301", "2500000000" ] -pi.toFraction(1000) // [ "355", "113" ] -``` - -and `isNaN` and `isFinite` methods, as `NaN` and `Infinity` are valid `BigNumber` values. - -```javascript -x = new BigNumber(NaN) // "NaN" -y = new BigNumber(Infinity) // "Infinity" -x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite() // true -``` - -The value of a BigNumber is stored in a decimal floating point format in terms of a coefficient, exponent and sign. - - -```javascript -x = new BigNumber(-123.456); -x.c // [ 123, 45600000000000 ] coefficient (i.e. significand) -x.e // 2 exponent -x.s // -1 sign -``` - - -Multiple BigNumber constructors can be created, each with their own independent configuration which applies to all BigNumber's created from it. - -```javascript -// Set DECIMAL_PLACES for the original BigNumber constructor -BigNumber.config({ DECIMAL_PLACES: 10 }) - -// Create another BigNumber constructor, optionally passing in a configuration object -BN = BigNumber.another({ DECIMAL_PLACES: 5 }) - -x = new BigNumber(1) -y = new BN(1) - -x.div(3) // '0.3333333333' -y.div(3) // '0.33333' -``` - -For futher information see the [API](http://mikemcl.github.io/bignumber.js/) reference in the *doc* directory. - -## Test - -The *test* directory contains the test scripts for each method. - -The tests can be run with Node or a browser. For Node use - - $ npm test - -or - - $ node test/every-test - -To test a single method, e.g. - - $ node test/toFraction - -For the browser, see *every-test.html* and *single-test.html* in the *test/browser* directory. - -*bignumber-vs-number.html* enables some of the methods of bignumber.js to be compared with those of JavaScript's number type. - -## Versions - -Version 1.x.x of this library is still supported on the 'original' branch. The advantages of later versions are that they are considerably faster for numbers with many digits and that there are some added methods (see Change Log below). The disadvantages are more lines of code and increased code complexity, and the loss of simplicity in no longer having the coefficient of a BigNumber stored in base 10. - -## Performance - -See the [README](https://github.com/MikeMcl/bignumber.js/tree/master/perf) in the *perf* directory. - -## Build - -For Node, if [uglify-js](https://github.com/mishoo/UglifyJS2) is installed - - npm install uglify-js -g - -then - - npm run build - -will create *bignumber.min.js*. - -A source map will also be created in the root directory. - -## Feedback - -Open an issue, or email - -Michael - -M8ch88l@gmail.com - -## Licence - -MIT. - -See [LICENCE](https://github.com/MikeMcl/bignumber.js/blob/master/LICENCE). - -## Change Log - -#### 4.0.4 -* 03/09/2017 -* Add missing aliases to *bignumber.d.ts*. - -#### 4.0.3 -* 30/08/2017 -* Add types: *bignumber.d.ts*. - -#### 4.0.2 -* 03/05/2017 -* #120 Workaround Safari/Webkit bug. - -#### 4.0.1 -* 05/04/2017 -* #121 BigNumber.default to BigNumber['default']. - -#### 4.0.0 -* 09/01/2017 -* Replace BigNumber.isBigNumber method with isBigNumber prototype property. - -#### 3.1.2 -* 08/01/2017 -* Minor documentation edit. - -#### 3.1.1 -* 08/01/2017 -* Uncomment `isBigNumber` tests. -* Ignore dot files. - -#### 3.1.0 -* 08/01/2017 -* Add `isBigNumber` method. - -#### 3.0.2 -* 08/01/2017 -* Bugfix: Possible incorrect value of `ERRORS` after a `BigNumber.another` call (due to `parseNumeric` declaration in outer scope). - -#### 3.0.1 -* 23/11/2016 -* Apply fix for old ipads with `%` issue, see #57 and #102. -* Correct error message. - -#### 3.0.0 -* 09/11/2016 -* Remove `require('crypto')` - leave it to the user. -* Add `BigNumber.set` as `BigNumber.config` alias. -* Default `POW_PRECISION` to `0`. - -#### 2.4.0 -* 14/07/2016 -* #97 Add exports to support ES6 imports. - -#### 2.3.0 -* 07/03/2016 -* #86 Add modulus parameter to `toPower`. - -#### 2.2.0 -* 03/03/2016 -* #91 Permit larger JS integers. - -#### 2.1.4 -* 15/12/2015 -* Correct UMD. - -#### 2.1.3 -* 13/12/2015 -* Refactor re global object and crypto availability when bundling. - -#### 2.1.2 -* 10/12/2015 -* Bugfix: `window.crypto` not assigned to `crypto`. - -#### 2.1.1 -* 09/12/2015 -* Prevent code bundler from adding `crypto` shim. - -#### 2.1.0 -* 26/10/2015 -* For `valueOf` and `toJSON`, include the minus sign with negative zero. - -#### 2.0.8 -* 2/10/2015 -* Internal round function bugfix. - -#### 2.0.6 -* 31/03/2015 -* Add bower.json. Tweak division after in-depth review. - -#### 2.0.5 -* 25/03/2015 -* Amend README. Remove bitcoin address. - -#### 2.0.4 -* 25/03/2015 -* Critical bugfix #58: division. - -#### 2.0.3 -* 18/02/2015 -* Amend README. Add source map. - -#### 2.0.2 -* 18/02/2015 -* Correct links. - -#### 2.0.1 -* 18/02/2015 -* Add `max`, `min`, `precision`, `random`, `shift`, `toDigits` and `truncated` methods. -* Add the short-forms: `add`, `mul`, `sd`, `sub` and `trunc`. -* Add an `another` method to enable multiple independent constructors to be created. -* Add support for the base 2, 8 and 16 prefixes `0b`, `0o` and `0x`. -* Enable a rounding mode to be specified as a second parameter to `toExponential`, `toFixed`, `toFormat` and `toPrecision`. -* Add a `CRYPTO` configuration property so cryptographically-secure pseudo-random number generation can be specified. -* Add a `MODULO_MODE` configuration property to enable the rounding mode used by the `modulo` operation to be specified. -* Add a `POW_PRECISION` configuration property to enable the number of significant digits calculated by the power operation to be limited. -* Improve code quality. -* Improve documentation. - -#### 2.0.0 -* 29/12/2014 -* Add `dividedToIntegerBy`, `isInteger` and `toFormat` methods. -* Remove the following short-forms: `isF`, `isZ`, `toE`, `toF`, `toFr`, `toN`, `toP`, `toS`. -* Store a BigNumber's coefficient in base 1e14, rather than base 10. -* Add fast path for integers to BigNumber constructor. -* Incorporate the library into the online documentation. - -#### 1.5.0 -* 13/11/2014 -* Add `toJSON` and `decimalPlaces` methods. - -#### 1.4.1 -* 08/06/2014 -* Amend README. - -#### 1.4.0 -* 08/05/2014 -* Add `toNumber`. - -#### 1.3.0 -* 08/11/2013 -* Ensure correct rounding of `sqrt` in all, rather than almost all, cases. -* Maximum radix to 64. - -#### 1.2.1 -* 17/10/2013 -* Sign of zero when x < 0 and x + (-x) = 0. - -#### 1.2.0 -* 19/9/2013 -* Throw Error objects for stack. - -#### 1.1.1 -* 22/8/2013 -* Show original value in constructor error message. - -#### 1.1.0 -* 1/8/2013 -* Allow numbers with trailing radix point. - -#### 1.0.1 -* Bugfix: error messages with incorrect method name - -#### 1.0.0 -* 8/11/2012 -* Initial release +![bignumber.js](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/bignumberjs.png) + +A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic. + +[![Build Status](https://travis-ci.org/MikeMcl/bignumber.js.svg)](https://travis-ci.org/MikeMcl/bignumber.js) + +
+ +## Features + + - Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal + - 8 KB minified and gzipped + - Simple API but full-featured + - Works with numbers with or without fraction digits in bases from 2 to 64 inclusive + - Replicates the `toExponential`, `toFixed`, `toPrecision` and `toString` methods of JavaScript's Number type + - Includes a `toFraction` and a correctly-rounded `squareRoot` method + - Supports cryptographically-secure pseudo-random number generation + - No dependencies + - Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only + - Comprehensive [documentation](http://mikemcl.github.io/bignumber.js/) and test set + +![API](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/API.png) + +If a smaller and simpler library is required see [big.js](https://github.com/MikeMcl/big.js/). +It's less than half the size but only works with decimal numbers and only has half the methods. +It also does not allow `NaN` or `Infinity`, or have the configuration options of this library. + +See also [decimal.js](https://github.com/MikeMcl/decimal.js/), which among other things adds support for non-integer powers, and performs all operations to a specified number of significant digits. + +## Load + +The library is the single JavaScript file *bignumber.js* (or minified, *bignumber.min.js*). + +```html + +``` + +For [Node.js](http://nodejs.org), the library is available from the [npm](https://npmjs.org/) registry + + $ npm install bignumber.js + +```javascript +var BigNumber = require('bignumber.js'); +``` + +To load with AMD loader libraries such as [requireJS](http://requirejs.org/): + +```javascript +require(['path/to/bignumber'], function(BigNumber) { + // Use BigNumber here in local scope. No global BigNumber. +}); +``` + +## Use + +*In all examples below, `var`, semicolons and `toString` calls are not shown. +If a commented-out value is in quotes it means `toString` has been called on the preceding expression.* + +The library exports a single function: `BigNumber`, the constructor of BigNumber instances. + +It accepts a value of type number *(up to 15 significant digits only)*, string or BigNumber object, + +```javascript +x = new BigNumber(123.4567) +y = new BigNumber('123456.7e-3') +z = new BigNumber(x) +x.equals(y) && y.equals(z) && x.equals(z) // true +``` + + +and a base from 2 to 64 inclusive can be specified. + +```javascript +x = new BigNumber(1011, 2) // "11" +y = new BigNumber('zz.9', 36) // "1295.25" +z = x.plus(y) // "1306.25" +``` + +A BigNumber is immutable in the sense that it is not changed by its methods. + +```javascript +0.3 - 0.1 // 0.19999999999999998 +x = new BigNumber(0.3) +x.minus(0.1) // "0.2" +x // "0.3" +``` + +The methods that return a BigNumber can be chained. + +```javascript +x.dividedBy(y).plus(z).times(9).floor() +x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').ceil() +``` + +Many method names have a shorter alias. + +```javascript +x.squareRoot().dividedBy(y).toPower(3).equals(x.sqrt().div(y).pow(3)) // true +x.cmp(y.mod(z).neg()) == 1 && x.comparedTo(y.modulo(z).negated()) == 1 // true +``` + +Like JavaScript's number type, there are `toExponential`, `toFixed` and `toPrecision` methods + +```javascript +x = new BigNumber(255.5) +x.toExponential(5) // "2.55500e+2" +x.toFixed(5) // "255.50000" +x.toPrecision(5) // "255.50" +x.toNumber() // 255.5 +``` + + and a base can be specified for `toString`. + + ```javascript + x.toString(16) // "ff.8" + ``` + +There is also a `toFormat` method which may be useful for internationalisation + +```javascript +y = new BigNumber('1234567.898765') +y.toFormat(2) // "1,234,567.90" +``` + +The maximum number of decimal places of the result of an operation involving division (i.e. a division, square root, base conversion or negative power operation) is set using the `config` method of the `BigNumber` constructor. + +The other arithmetic operations always give the exact result. + +```javascript +BigNumber.config({ DECIMAL_PLACES: 10, ROUNDING_MODE: 4 }) + +x = new BigNumber(2); +y = new BigNumber(3); +z = x.div(y) // "0.6666666667" +z.sqrt() // "0.8164965809" +z.pow(-3) // "3.3749999995" +z.toString(2) // "0.1010101011" +z.times(z) // "0.44444444448888888889" +z.times(z).round(10) // "0.4444444445" +``` + +There is a `toFraction` method with an optional *maximum denominator* argument + +```javascript +y = new BigNumber(355) +pi = y.dividedBy(113) // "3.1415929204" +pi.toFraction() // [ "7853982301", "2500000000" ] +pi.toFraction(1000) // [ "355", "113" ] +``` + +and `isNaN` and `isFinite` methods, as `NaN` and `Infinity` are valid `BigNumber` values. + +```javascript +x = new BigNumber(NaN) // "NaN" +y = new BigNumber(Infinity) // "Infinity" +x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite() // true +``` + +The value of a BigNumber is stored in a decimal floating point format in terms of a coefficient, exponent and sign. + + +```javascript +x = new BigNumber(-123.456); +x.c // [ 123, 45600000000000 ] coefficient (i.e. significand) +x.e // 2 exponent +x.s // -1 sign +``` + + +Multiple BigNumber constructors can be created, each with their own independent configuration which applies to all BigNumber's created from it. + +```javascript +// Set DECIMAL_PLACES for the original BigNumber constructor +BigNumber.config({ DECIMAL_PLACES: 10 }) + +// Create another BigNumber constructor, optionally passing in a configuration object +BN = BigNumber.another({ DECIMAL_PLACES: 5 }) + +x = new BigNumber(1) +y = new BN(1) + +x.div(3) // '0.3333333333' +y.div(3) // '0.33333' +``` + +For futher information see the [API](http://mikemcl.github.io/bignumber.js/) reference in the *doc* directory. + +## Test + +The *test* directory contains the test scripts for each method. + +The tests can be run with Node or a browser. For Node use + + $ npm test + +or + + $ node test/every-test + +To test a single method, e.g. + + $ node test/toFraction + +For the browser, see *every-test.html* and *single-test.html* in the *test/browser* directory. + +*bignumber-vs-number.html* enables some of the methods of bignumber.js to be compared with those of JavaScript's number type. + +## Versions + +Version 1.x.x of this library is still supported on the 'original' branch. The advantages of later versions are that they are considerably faster for numbers with many digits and that there are some added methods (see Change Log below). The disadvantages are more lines of code and increased code complexity, and the loss of simplicity in no longer having the coefficient of a BigNumber stored in base 10. + +## Performance + +See the [README](https://github.com/MikeMcl/bignumber.js/tree/master/perf) in the *perf* directory. + +## Build + +For Node, if [uglify-js](https://github.com/mishoo/UglifyJS2) is installed + + npm install uglify-js -g + +then + + npm run build + +will create *bignumber.min.js*. + +A source map will also be created in the root directory. + +## Feedback + +Open an issue, or email + +Michael + +M8ch88l@gmail.com + +## Licence + +MIT. + +See [LICENCE](https://github.com/MikeMcl/bignumber.js/blob/master/LICENCE). + +## Change Log + +#### 4.0.4 +* 03/09/2017 +* Add missing aliases to *bignumber.d.ts*. + +#### 4.0.3 +* 30/08/2017 +* Add types: *bignumber.d.ts*. + +#### 4.0.2 +* 03/05/2017 +* #120 Workaround Safari/Webkit bug. + +#### 4.0.1 +* 05/04/2017 +* #121 BigNumber.default to BigNumber['default']. + +#### 4.0.0 +* 09/01/2017 +* Replace BigNumber.isBigNumber method with isBigNumber prototype property. + +#### 3.1.2 +* 08/01/2017 +* Minor documentation edit. + +#### 3.1.1 +* 08/01/2017 +* Uncomment `isBigNumber` tests. +* Ignore dot files. + +#### 3.1.0 +* 08/01/2017 +* Add `isBigNumber` method. + +#### 3.0.2 +* 08/01/2017 +* Bugfix: Possible incorrect value of `ERRORS` after a `BigNumber.another` call (due to `parseNumeric` declaration in outer scope). + +#### 3.0.1 +* 23/11/2016 +* Apply fix for old ipads with `%` issue, see #57 and #102. +* Correct error message. + +#### 3.0.0 +* 09/11/2016 +* Remove `require('crypto')` - leave it to the user. +* Add `BigNumber.set` as `BigNumber.config` alias. +* Default `POW_PRECISION` to `0`. + +#### 2.4.0 +* 14/07/2016 +* #97 Add exports to support ES6 imports. + +#### 2.3.0 +* 07/03/2016 +* #86 Add modulus parameter to `toPower`. + +#### 2.2.0 +* 03/03/2016 +* #91 Permit larger JS integers. + +#### 2.1.4 +* 15/12/2015 +* Correct UMD. + +#### 2.1.3 +* 13/12/2015 +* Refactor re global object and crypto availability when bundling. + +#### 2.1.2 +* 10/12/2015 +* Bugfix: `window.crypto` not assigned to `crypto`. + +#### 2.1.1 +* 09/12/2015 +* Prevent code bundler from adding `crypto` shim. + +#### 2.1.0 +* 26/10/2015 +* For `valueOf` and `toJSON`, include the minus sign with negative zero. + +#### 2.0.8 +* 2/10/2015 +* Internal round function bugfix. + +#### 2.0.6 +* 31/03/2015 +* Add bower.json. Tweak division after in-depth review. + +#### 2.0.5 +* 25/03/2015 +* Amend README. Remove bitcoin address. + +#### 2.0.4 +* 25/03/2015 +* Critical bugfix #58: division. + +#### 2.0.3 +* 18/02/2015 +* Amend README. Add source map. + +#### 2.0.2 +* 18/02/2015 +* Correct links. + +#### 2.0.1 +* 18/02/2015 +* Add `max`, `min`, `precision`, `random`, `shift`, `toDigits` and `truncated` methods. +* Add the short-forms: `add`, `mul`, `sd`, `sub` and `trunc`. +* Add an `another` method to enable multiple independent constructors to be created. +* Add support for the base 2, 8 and 16 prefixes `0b`, `0o` and `0x`. +* Enable a rounding mode to be specified as a second parameter to `toExponential`, `toFixed`, `toFormat` and `toPrecision`. +* Add a `CRYPTO` configuration property so cryptographically-secure pseudo-random number generation can be specified. +* Add a `MODULO_MODE` configuration property to enable the rounding mode used by the `modulo` operation to be specified. +* Add a `POW_PRECISION` configuration property to enable the number of significant digits calculated by the power operation to be limited. +* Improve code quality. +* Improve documentation. + +#### 2.0.0 +* 29/12/2014 +* Add `dividedToIntegerBy`, `isInteger` and `toFormat` methods. +* Remove the following short-forms: `isF`, `isZ`, `toE`, `toF`, `toFr`, `toN`, `toP`, `toS`. +* Store a BigNumber's coefficient in base 1e14, rather than base 10. +* Add fast path for integers to BigNumber constructor. +* Incorporate the library into the online documentation. + +#### 1.5.0 +* 13/11/2014 +* Add `toJSON` and `decimalPlaces` methods. + +#### 1.4.1 +* 08/06/2014 +* Amend README. + +#### 1.4.0 +* 08/05/2014 +* Add `toNumber`. + +#### 1.3.0 +* 08/11/2013 +* Ensure correct rounding of `sqrt` in all, rather than almost all, cases. +* Maximum radix to 64. + +#### 1.2.1 +* 17/10/2013 +* Sign of zero when x < 0 and x + (-x) = 0. + +#### 1.2.0 +* 19/9/2013 +* Throw Error objects for stack. + +#### 1.1.1 +* 22/8/2013 +* Show original value in constructor error message. + +#### 1.1.0 +* 1/8/2013 +* Allow numbers with trailing radix point. + +#### 1.0.1 +* Bugfix: error messages with incorrect method name + +#### 1.0.0 +* 8/11/2012 +* Initial release diff --git a/node_modules/bignumber.js/bignumber.d.ts b/node_modules/bignumber.js/bignumber.d.ts index 24df216..0d66319 100644 --- a/node_modules/bignumber.js/bignumber.d.ts +++ b/node_modules/bignumber.js/bignumber.d.ts @@ -1,1295 +1,1295 @@ -// Type definitions for Bignumber.js -// Project: bignumber.js -// Definitions by: Felix Becker https://github.com/felixfbecker - -export interface Format { - /** the decimal separator */ - decimalSeparator?: string; - /** the grouping separator of the integer part */ - groupSeparator?: string; - /** the primary grouping size of the integer part */ - groupSize?: number; - /** the secondary grouping size of the integer part */ - secondaryGroupSize?: number; - /** the grouping separator of the fraction part */ - fractionGroupSeparator?: string; - /** the grouping size of the fraction part */ - fractionGroupSize?: number; -} - -export interface Configuration { - - /** - * integer, `0` to `1e+9` inclusive - * - * The maximum number of decimal places of the results of operations involving division, i.e. division, square root - * and base conversion operations, and power operations with negative exponents. - * - * ```ts - * BigNumber.config({ DECIMAL_PLACES: 5 }) - * BigNumber.config(5) // equivalent - * ``` - * @default 20 - */ - DECIMAL_PLACES?: number; - - /** - * The rounding mode used in the above operations and the default rounding mode of round, toExponential, toFixed, - * toFormat and toPrecision. The modes are available as enumerated properties of the BigNumber constructor. - * @default [[RoundingMode.ROUND_HALF_UP]] - */ - ROUNDING_MODE?: RoundingMode; - - /** - * - `number`: integer, magnitude `0` to `1e+9` inclusive - * - `number[]`: [ integer `-1e+9` to `0` inclusive, integer `0` to `1e+9` inclusive ] - * - * The exponent value(s) at which `toString` returns exponential notation. - * - * If a single number is assigned, the value - * is the exponent magnitude. - * - * If an array of two numbers is assigned then the first number is the negative exponent - * value at and beneath which exponential notation is used, and the second number is the positive exponent value at - * and above which the same. - * - * For example, to emulate JavaScript numbers in terms of the exponent values at which - * they begin to use exponential notation, use [-7, 20]. - * - * ```ts - * BigNumber.config({ EXPONENTIAL_AT: 2 }) - * new BigNumber(12.3) // '12.3' e is only 1 - * new BigNumber(123) // '1.23e+2' - * new BigNumber(0.123) // '0.123' e is only -1 - * new BigNumber(0.0123) // '1.23e-2' - * - * BigNumber.config({ EXPONENTIAL_AT: [-7, 20] }) - * new BigNumber(123456789) // '123456789' e is only 8 - * new BigNumber(0.000000123) // '1.23e-7' - * - * // Almost never return exponential notation: - * BigNumber.config({ EXPONENTIAL_AT: 1e+9 }) - * - * // Always return exponential notation: - * BigNumber.config({ EXPONENTIAL_AT: 0 }) - * ``` - * Regardless of the value of `EXPONENTIAL_AT`, the `toFixed` method will always return a value in normal notation - * and the `toExponential` method will always return a value in exponential form. - * - * Calling `toString` with a base argument, e.g. `toString(10)`, will also always return normal notation. - * - * @default `[-7, 20]` - */ - EXPONENTIAL_AT?: number | [number, number]; - - /** - * - number: integer, magnitude `1` to `1e+9` inclusive - * - number[]: [ integer `-1e+9` to `-1` inclusive, integer `1` to `1e+9` inclusive ] - * - * The exponent value(s) beyond which overflow to `Infinity` and underflow to zero occurs. - * - * If a single number is - * assigned, it is the maximum exponent magnitude: values wth a positive exponent of greater magnitude become - * Infinity and those with a negative exponent of greater magnitude become zero. - * - * If an array of two numbers is - * assigned then the first number is the negative exponent limit and the second number is the positive exponent - * limit. - * - * For example, to emulate JavaScript numbers in terms of the exponent values at which they become zero and - * Infinity, use [-324, 308]. - * - * ```ts - * BigNumber.config({ RANGE: 500 }) - * BigNumber.config().RANGE // [ -500, 500 ] - * new BigNumber('9.999e499') // '9.999e+499' - * new BigNumber('1e500') // 'Infinity' - * new BigNumber('1e-499') // '1e-499' - * new BigNumber('1e-500') // '0' - * BigNumber.config({ RANGE: [-3, 4] }) - * new BigNumber(99999) // '99999' e is only 4 - * new BigNumber(100000) // 'Infinity' e is 5 - * new BigNumber(0.001) // '0.01' e is only -3 - * new BigNumber(0.0001) // '0' e is -4 - * ``` - * - * The largest possible magnitude of a finite BigNumber is `9.999...e+1000000000`. - * - * The smallest possible magnitude of a non-zero BigNumber is `1e-1000000000`. - * - * @default `[-1e+9, 1e+9]` - */ - RANGE?: number | [number, number]; - - /** - * - * The value that determines whether BigNumber Errors are thrown. If ERRORS is false, no errors will be thrown. - * `true`, `false`, `0` or `1`. - * ```ts - * BigNumber.config({ ERRORS: false }) - * ``` - * - * @default `true` - */ - ERRORS?: boolean | number; - - /** - * `true`, `false`, `0` or `1`. - * - * The value that determines whether cryptographically-secure pseudo-random number generation is used. - * - * If `CRYPTO` is set to `true` then the random method will generate random digits using `crypto.getRandomValues` in - * browsers that support it, or `crypto.randomBytes` if using a version of Node.js that supports it. - * - * If neither function is supported by the host environment then attempting to set `CRYPTO` to `true` will fail, and - * if [[Configuration.ERRORS]] is `true` an exception will be thrown. - * - * If `CRYPTO` is `false` then the source of randomness used will be `Math.random` (which is assumed to generate at - * least 30 bits of randomness). - * - * See [[BigNumber.random]]. - * - * ```ts - * BigNumber.config({ CRYPTO: true }) - * BigNumber.config().CRYPTO // true - * BigNumber.random() // 0.54340758610486147524 - * ``` - * - * @default `false` - */ - CRYPTO?: boolean | number; - - /** - * The modulo mode used when calculating the modulus: `a mod n`. - * - * The quotient, `q = a / n`, is calculated according to - * the [[Configuration.ROUNDING_MODE]] that corresponds to the chosen MODULO_MODE. - * - * The remainder, r, is calculated as: `r = a - n * q`. - * - * The modes that are most commonly used for the modulus/remainder operation are shown in the following table. - * Although the other rounding modes can be used, they may not give useful results. - * - * Property | Value | Description - * -------------------|:-----:|--------------------------------------------------------------------------------------- - * `ROUND_UP` | 0 | The remainder is positive if the dividend is negative, otherwise it is negative. - * `ROUND_DOWN` | 1 | The remainder has the same sign as the dividend. This uses 'truncating division' and matches the behaviour of JavaScript's remainder operator `%`. - * `ROUND_FLOOR` | 3 | The remainder has the same sign as the divisor. - * | | This matches Python's % operator. - * `ROUND_HALF_EVEN` | 6 | The IEEE 754 remainder function. - * `EUCLID` | 9 | The remainder is always positive. Euclidian division: `q = sign(n) * floor(a / abs(n))` - * - * The rounding/modulo modes are available as enumerated properties of the BigNumber constructor. - * - * See [[BigNumber.modulo]] - * - * ```ts - * BigNumber.config({ MODULO_MODE: BigNumber.EUCLID }) - * BigNumber.config({ MODULO_MODE: 9 }) // equivalent - * ``` - * - * @default [[RoundingMode.ROUND_DOWN]] - */ - MODULO_MODE?: RoundingMode; - - /** - * integer, `0` to `1e+9` inclusive. - * - * The maximum number of significant digits of the result of the power operation (unless a modulus is specified). - * - * If set to 0, the number of signifcant digits will not be limited. - * - * See [[BigNumber.toPower]] - * - * ```ts - * BigNumber.config({ POW_PRECISION: 100 }) - * ``` - * - * @default 100 - */ - POW_PRECISION?: number; - - /** - * The FORMAT object configures the format of the string returned by the `toFormat` method. The example below shows - * the properties of the FORMAT object that are recognised, and their default values. Unlike the other configuration - * properties, the values of the properties of the FORMAT object will not be checked for validity. The existing - * FORMAT object will simply be replaced by the object that is passed in. Note that all the properties shown below - * do not have to be included. - * - * See `toFormat` for examples of usage. - * - * ```ts - * BigNumber.config({ - * FORMAT: { - * // the decimal separator - * decimalSeparator: '.', - * // the grouping separator of the integer part - * groupSeparator: ',', - * // the primary grouping size of the integer part - * groupSize: 3, - * // the secondary grouping size of the integer part - * secondaryGroupSize: 0, - * // the grouping separator of the fraction part - * fractionGroupSeparator: ' ', - * // the grouping size of the fraction part - * fractionGroupSize: 0 - * } - * }); - * ``` - */ - FORMAT?: Format; -} - -/** - * The library's enumerated rounding modes are stored as properties of the constructor. - * (They are not referenced internally by the library itself.) - * Rounding modes 0 to 6 (inclusive) are the same as those of Java's BigDecimal class. - */ -declare enum RoundingMode { - /** Rounds away from zero */ - ROUND_UP = 0, - /** Rounds towards zero */ - ROUND_DOWN = 1, - /** Rounds towards Infinity */ - ROUND_CEIL = 2, - /** Rounds towards -Infinity */ - ROUND_FLOOR = 3, - /** - * Rounds towards nearest neighbour. If equidistant, rounds away from zero - */ - ROUND_HALF_UP = 4, - /** - * Rounds towards nearest neighbour. If equidistant, rounds towards zero - */ - ROUND_HALF_DOWN = 5, - /** - * Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour - */ - ROUND_HALF_EVEN = 6, - /** - * Rounds towards nearest neighbour. If equidistant, rounds towards `Infinity` - */ - ROUND_HALF_CEIL = 7, - /** - * Rounds towards nearest neighbour. If equidistant, rounds towards `-Infinity` - */ - ROUND_HALF_FLOOR = 8, - /** - * The remainder is always positive. Euclidian division: `q = sign(n) * floor(a / abs(n))` - */ - EUCLID = 9 -} - -export class BigNumber { - - /** Rounds away from zero */ - static ROUND_UP: RoundingMode; - - /** Rounds towards zero */ - static ROUND_DOWN: RoundingMode; - - /** Rounds towards Infinity */ - static ROUND_CEIL: RoundingMode; - - /** Rounds towards -Infinity */ - static ROUND_FLOOR: RoundingMode; - - /** - * Rounds towards nearest neighbour. If equidistant, rounds away from zero - */ - static ROUND_HALF_UP: RoundingMode; - - /** - * Rounds towards nearest neighbour. If equidistant, rounds towards zero - */ - static ROUND_HALF_DOWN: RoundingMode; - - /** - * Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour - */ - static ROUND_HALF_EVEN: RoundingMode; - - /** - * Rounds towards nearest neighbour. If equidistant, rounds towards `Infinity` - */ - static ROUND_HALF_CEIL: RoundingMode; - - /** - * Rounds towards nearest neighbour. If equidistant, rounds towards `-Infinity` - */ - static ROUND_HALF_FLOOR: RoundingMode; - - /** - * The remainder is always positive. Euclidian division: `q = sign(n) * floor(a / abs(n))` - */ - static EUCLID: RoundingMode; - - /** - * Returns a new independent BigNumber constructor with configuration as described by `obj` (see `config`), or with - * the default configuration if `obj` is `null` or `undefined`. - * - * ```ts - * BigNumber.config({ DECIMAL_PLACES: 5 }) - * BN = BigNumber.another({ DECIMAL_PLACES: 9 }) - * - * x = new BigNumber(1) - * y = new BN(1) - * - * x.div(3) // 0.33333 - * y.div(3) // 0.333333333 - * - * // BN = BigNumber.another({ DECIMAL_PLACES: 9 }) is equivalent to: - * BN = BigNumber.another() - * BN.config({ DECIMAL_PLACES: 9 }) - * ``` - */ - static another(config?: Configuration): typeof BigNumber; - - /** - * Configures the 'global' settings for this particular BigNumber constructor. Returns an object with the above - * properties and their current values. If the value to be assigned to any of the above properties is `null` or - * `undefined` it is ignored. See Errors for the treatment of invalid values. - */ - static config(config?: Configuration): Configuration; - - /** - * Configures the 'global' settings for this particular BigNumber constructor. Returns an object with the above - * properties and their current values. If the value to be assigned to any of the above properties is `null` or - * `undefined` it is ignored. See Errors for the treatment of invalid values. - */ - static config( - decimalPlaces?: number, - roundingMode?: RoundingMode, - exponentialAt?: number | [number, number], - range?: number | [number, number], - errors?: boolean | number, - crypto?: boolean | number, - moduloMode?: RoundingMode, - powPrecision?: number, - format?: Format - ): Configuration; - - /** - * Returns a BigNumber whose value is the maximum of `arg1`, `arg2`,... . The argument to this method can also be an - * array of values. The return value is always exact and unrounded. - * - * ```ts - * x = new BigNumber('3257869345.0378653') - * BigNumber.max(4e9, x, '123456789.9') // '4000000000' - * - * arr = [12, '13', new BigNumber(14)] - * BigNumber.max(arr) // '14' - * ``` - */ - static max(...args: Array): BigNumber; - static max(args: Array): BigNumber; - - /** - * See BigNumber for further parameter details. Returns a BigNumber whose value is the minimum of arg1, arg2,... . - * The argument to this method can also be an array of values. The return value is always exact and unrounded. - * - * ```ts - * x = new BigNumber('3257869345.0378653') - * BigNumber.min(4e9, x, '123456789.9') // '123456789.9' - * - * arr = [2, new BigNumber(-14), '-15.9999', -12] - * BigNumber.min(arr) // '-15.9999' - * ``` - */ - static min(...args: Array): BigNumber; - static min(args: Array): BigNumber; - - /** - * Returns a new BigNumber with a pseudo-random value equal to or greater than 0 and less than 1. - * - * The return value - * will have dp decimal places (or less if trailing zeros are produced). If dp is omitted then the number of decimal - * places will default to the current `DECIMAL_PLACES` setting. - * - * Depending on the value of this BigNumber constructor's - * `CRYPTO` setting and the support for the crypto object in the host environment, the random digits of the return - * value are generated by either `Math.random` (fastest), `crypto.getRandomValues` (Web Cryptography API in recent - * browsers) or `crypto.randomBytes` (Node.js). - * - * If `CRYPTO` is true, i.e. one of the crypto methods is to be used, the - * value of a returned BigNumber should be cryptographically-secure and statistically indistinguishable from a - * random value. - * - * ```ts - * BigNumber.config({ DECIMAL_PLACES: 10 }) - * BigNumber.random() // '0.4117936847' - * BigNumber.random(20) // '0.78193327636914089009' - * ``` - * - * @param dp integer, `0` to `1e+9` inclusive - */ - static random(dp?: number): BigNumber; - - /** - * Coefficient: Array of base `1e14` numbers or `null` - * @readonly - */ - c: number[]; - - /** - * Exponent: Integer, `-1000000000` to `1000000000` inclusive or `null` - * @readonly - */ - e: number; - - /** - * Sign: `-1`, `1` or `null` - * @readonly - */ - s: number; - - /** - * Returns a new instance of a BigNumber object. If a base is specified, the value is rounded according to the - * current [[Configuration.DECIMAL_PLACES]] and [[Configuration.ROUNDING_MODE]] configuration. See Errors for the treatment of an invalid value or base. - * - * ```ts - * x = new BigNumber(9) // '9' - * y = new BigNumber(x) // '9' - * - * // 'new' is optional if ERRORS is false - * BigNumber(435.345) // '435.345' - * - * new BigNumber('5032485723458348569331745.33434346346912144534543') - * new BigNumber('4.321e+4') // '43210' - * new BigNumber('-735.0918e-430') // '-7.350918e-428' - * new BigNumber(Infinity) // 'Infinity' - * new BigNumber(NaN) // 'NaN' - * new BigNumber('.5') // '0.5' - * new BigNumber('+2') // '2' - * new BigNumber(-10110100.1, 2) // '-180.5' - * new BigNumber(-0b10110100.1) // '-180.5' - * new BigNumber('123412421.234324', 5) // '607236.557696' - * new BigNumber('ff.8', 16) // '255.5' - * new BigNumber('0xff.8') // '255.5' - * ``` - * - * The following throws `not a base 2 number` if [[Configuration.ERRORS]] is true, otherwise it returns a BigNumber with value `NaN`. - * - * ```ts - * new BigNumber(9, 2) - * ``` - * - * The following throws `number type has more than 15 significant digits` if [[Configuration.ERRORS]] is true, otherwise it returns a BigNumber with value `96517860459076820`. - * - * ```ts - * new BigNumber(96517860459076817.4395) - * ``` - * - * The following throws `not a number` if [[Configuration.ERRORS]] is true, otherwise it returns a BigNumber with value `NaN`. - * - * ```ts - * new BigNumber('blurgh') - * ``` - * - * A value is only rounded by the constructor if a base is specified. - * - * ```ts - * BigNumber.config({ DECIMAL_PLACES: 5 }) - * new BigNumber(1.23456789) // '1.23456789' - * new BigNumber(1.23456789, 10) // '1.23457' - * ``` - * - * @param value A numeric value. - * - * Legitimate values include `±0`, `±Infinity` and `NaN`. - * - * Values of type `number` with more than 15 significant digits are considered invalid (if [[Configuration.ERRORS]] - * is `true`) as calling `toString` or `valueOf` on such numbers may not result in the intended value. - * - * There is no limit to the number of digits of a value of type `string` (other than that of JavaScript's maximum - * array size). - * - * Decimal string values may be in exponential, as well as normal (fixed-point) notation. Non-decimal values must be - * in normal notation. String values in hexadecimal literal form, e.g. `'0xff'`, are valid, as are string values - * with the octal and binary prefixs `'0o'` and `'0b'`. - * - * String values in octal literal form without the prefix will be interpreted as decimals, e.g. `'011'` is - * interpreted as 11, not 9. - * - * Values in any base may have fraction digits. - * - * For bases from 10 to 36, lower and/or upper case letters can be used to represent values from 10 to 35. - * - * For bases above 36, a-z represents values from 10 to 35, A-Z from 36 to 61, and $ and _ represent 62 and 63 - * respectively (this can be changed by editing the ALPHABET variable near the top of the source file). - * - * @param base integer, 2 to 64 inclusive - * - * The base of value. If base is omitted, or is `null` or `undefined`, base 10 is assumed. - */ - constructor(value: number | string | BigNumber, base?: number); - - /** - * Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this BigNumber. The - * return value is always exact and unrounded. - * ```ts - * x = new BigNumber(-0.8) - * y = x.absoluteValue() // '0.8' - * z = y.abs() // '0.8' - * ``` - * @alias [[BigNumber.abs]] - */ - absoluteValue(): BigNumber; - - /** - * See [[BigNumber.absoluteValue]] - */ - abs(): BigNumber; - - /** - * See [[plus]] - */ - add(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in the direction of - * positive `Infinity`. - * - * ```ts - * x = new BigNumber(1.3) - * x.ceil() // '2' - * y = new BigNumber(-1.8) - * y.ceil() // '-1' - * ``` - */ - ceil(): BigNumber; - - /** - * Returns | | - * :-------:|---------------------------------------------------------------| - * 1 | If the value of this BigNumber is greater than the value of n - * -1 | If the value of this BigNumber is less than the value of n - * 0 | If this BigNumber and n have the same value - * null | If the value of either this BigNumber or n is NaN - * - * ```ts - * x = new BigNumber(Infinity) - * y = new BigNumber(5) - * x.comparedTo(y) // 1 - * x.comparedTo(x.minus(1)) // 0 - * y.cmp(NaN) // null - * y.cmp('110', 2) // -1 - * ``` - * - * @alias [[cmp]] - */ - comparedTo(n: number | string | BigNumber, base?: number): number; - - /** - * See [[comparedTo]] - */ - cmp(n: number | string | BigNumber, base?: number): number; - - /** - * Return the number of decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is - * `±Infinity` or `NaN`. - * - * ```ts - * x = new BigNumber(123.45) - * x.decimalPlaces() // 2 - * y = new BigNumber('9.9e-101') - * y.dp() // 102 - * ``` - * - * @alias [[dp]] - */ - decimalPlaces(): number; - - /** - * See [[decimalPlaces]] - */ - dp(): number; - - /** - * Returns a BigNumber whose value is the value of this BigNumber divided by n, rounded according to the current - * DECIMAL_PLACES and ROUNDING_MODE configuration. - * - * ```ts - * x = new BigNumber(355) - * y = new BigNumber(113) - * x.dividedBy(y) // '3.14159292035398230088' - * x.div(5) // '71' - * x.div(47, 16) // '5' - * ``` - * - * @alias [[div]] - */ - dividedBy(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * See [[dividedBy]] - */ - div(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * Return a BigNumber whose value is the integer part of dividing the value of this BigNumber by n. - * - * ```ts - * x = new BigNumber(5) - * y = new BigNumber(3) - * x.dividedToIntegerBy(y) // '1' - * x.divToInt(0.7) // '7' - * x.divToInt('0.f', 16) // '5' - * ``` - * - * @alias [[divToInt]] - */ - dividedToIntegerBy(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * See [[dividedToIntegerBy]] - */ - divToInt(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * Returns true if the value of this BigNumber equals the value of `n`, otherwise returns `false`. As with JavaScript, - * `NaN` does not equal `NaN`. - * - * Note: This method uses the [[comparedTo]] internally. - * - * ```ts - * 0 === 1e-324 // true - * x = new BigNumber(0) - * x.equals('1e-324') // false - * BigNumber(-0).eq(x) // true ( -0 === 0 ) - * BigNumber(255).eq('ff', 16) // true - * - * y = new BigNumber(NaN) - * y.equals(NaN) // false - * ``` - * - * @alias [[eq]] - */ - equals(n: number | string | BigNumber, base?: number): boolean; - - /** - * See [[equals]] - */ - eq(n: number | string | BigNumber, base?: number): boolean; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in the direction of - * negative `Infinity`. - * - * ```ts - * x = new BigNumber(1.8) - * x.floor() // '1' - * y = new BigNumber(-1.3) - * y.floor() // '-2' - * ``` - */ - floor(): BigNumber; - - /** - * Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise returns `false`. - * - * Note: This method uses the comparedTo method internally. - * - * ```ts - * 0.1 > (0.3 - 0.2) // true - * x = new BigNumber(0.1) - * x.greaterThan(BigNumber(0.3).minus(0.2)) // false - * BigNumber(0).gt(x) // false - * BigNumber(11, 3).gt(11.1, 2) // true - * ``` - * - * @alias [[gt]] - */ - greaterThan(n: number | string | BigNumber, base?: number): boolean; - - /** - * See [[greaterThan]] - */ - gt(n: number | string | BigNumber, base?: number): boolean; - - /** - * Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`, otherwise returns `false`. - * - * Note: This method uses the comparedTo method internally. - * - * @alias [[gte]] - */ - greaterThanOrEqualTo(n: number | string | BigNumber, base?: number): boolean; - - /** - * See [[greaterThanOrEqualTo]] - */ - gte(n: number | string | BigNumber, base?: number): boolean; - - /** - * Returns true if the value of this BigNumber is a finite number, otherwise returns false. The only possible - * non-finite values of a BigNumber are `NaN`, `Infinity` and `-Infinity`. - * - * Note: The native method `isFinite()` can be used if `n <= Number.MAX_VALUE`. - */ - isFinite(): boolean; - - /** - * Returns true if the value of this BigNumber is a whole number, otherwise returns false. - * @alias [[isInt]] - */ - isInteger(): boolean; - - /** - * See [[isInteger]] - */ - isInt(): boolean; - - /** - * Returns `true` if the value of this BigNumber is `NaN`, otherwise returns `false`. - * - * Note: The native method isNaN() can also be used. - */ - isNaN(): boolean; - - /** - * Returns true if the value of this BigNumber is negative, otherwise returns false. - * - * Note: `n < 0` can be used if `n <= * -Number.MIN_VALUE`. - * - * @alias [[isNeg]] - */ - isNegative(): boolean; - - /** - * See [[isNegative]] - */ - isNeg(): boolean; - - /** - * Returns true if the value of this BigNumber is zero or minus zero, otherwise returns false. - * - * Note: `n == 0` can be used if `n >= Number.MIN_VALUE`. - */ - isZero(): boolean; - - /** - * Returns true if the value of this BigNumber is less than the value of n, otherwise returns false. - * - * Note: This method uses [[comparedTo]] internally. - * - * @alias [[lt]] - */ - lessThan(n: number | string | BigNumber, base?: number): boolean; - - /** - * See [[lessThan]] - */ - lt(n: number | string | BigNumber, base?: number): boolean; - - /** - * Returns true if the value of this BigNumber is less than or equal the value of n, otherwise returns false. - * - * Note: This method uses [[comparedTo]] internally. - */ - lessThanOrEqualTo(n: number | string | BigNumber, base?: number): boolean; - - /** - * See [[lessThanOrEqualTo]] - */ - lte(n: number | string | BigNumber, base?: number): boolean; - - /** - * Returns a BigNumber whose value is the value of this BigNumber minus `n`. - * - * The return value is always exact and unrounded. - * - * @alias [[sub]] - */ - minus(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber modulo n, i.e. the integer remainder of dividing - * this BigNumber by n. - * - * The value returned, and in particular its sign, is dependent on the value of the [[Configuration.MODULO_MODE]] - * setting of this BigNumber constructor. If it is `1` (default value), the result will have the same sign as this - * BigNumber, and it will match that of Javascript's `%` operator (within the limits of double precision) and - * BigDecimal's remainder method. - * - * The return value is always exact and unrounded. - * - * ```ts - * 1 % 0.9 // 0.09999999999999998 - * x = new BigNumber(1) - * x.modulo(0.9) // '0.1' - * y = new BigNumber(33) - * y.mod('a', 33) // '3' - * ``` - * - * @alias [[mod]] - */ - modulo(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * See [[modulo]] - */ - mod(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * See [[times]] - */ - mul(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by -1. - * - * ```ts - * x = new BigNumber(1.8) - * x.negated() // '-1.8' - * y = new BigNumber(-1.3) - * y.neg() // '1.3' - * ``` - * - * @alias [[neg]] - */ - negated(): BigNumber; - - /** - * See [[negated]] - */ - neg(): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber plus `n`. - * - * The return value is always exact and unrounded. - * - * @alias [[add]] - */ - plus(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * If z is true or 1 then any trailing zeros of the integer part of a number are counted as significant digits, - * otherwise they are not. - * - * @param z true, false, 0 or 1 - * @alias [[sd]] - */ - precision(z?: boolean | number): number; - - /** - * See [[precision]] - */ - sd(z?: boolean | number): number; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode rm to a maximum of dp - * decimal places. - * - * - if dp is omitted, or is null or undefined, the return value is n rounded to a whole number. - * - if rm is omitted, or is null or undefined, ROUNDING_MODE is used. - * - * ```ts - * x = 1234.56 - * Math.round(x) // 1235 - * y = new BigNumber(x) - * y.round() // '1235' - * y.round(1) // '1234.6' - * y.round(2) // '1234.56' - * y.round(10) // '1234.56' - * y.round(0, 1) // '1234' - * y.round(0, 6) // '1235' - * y.round(1, 1) // '1234.5' - * y.round(1, BigNumber.ROUND_HALF_EVEN) // '1234.6' - * y // '1234.56' - * ``` - * - * @param dp integer, 0 to 1e+9 inclusive - * @param rm integer, 0 to 8 inclusive - */ - round(dp?: number, rm?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber shifted n places. - * - * The shift is of the decimal point, i.e. of powers of ten, and is to the left if n is negative or to the right if - * n is positive. The return value is always exact and unrounded. - * - * @param n integer, -9007199254740991 to 9007199254740991 inclusive - */ - shift(n: number): BigNumber; - - /** - * Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the - * current DECIMAL_PLACES and ROUNDING_MODE configuration. - * - * The return value will be correctly rounded, i.e. rounded - * as if the result was first calculated to an infinite number of correct digits before rounding. - * - * @alias [[sqrt]] - */ - squareRoot(): BigNumber; - - /** - * See [[squareRoot]] - */ - sqrt(): BigNumber; - - /** - * See [[minus]] - */ - sub(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber times n. - * - * The return value is always exact and unrounded. - * - * @alias [[mul]] - */ - times(n: number | string | BigNumber, base?: number): BigNumber; - - /** - * Returns a BigNumber whose value is the value of this BigNumber rounded to sd significant digits using rounding mode rm. - * - * If sd is omitted or is null or undefined, the return value will not be rounded. - * - * If rm is omitted or is null or undefined, ROUNDING_MODE will be used. - * - * ```ts - * BigNumber.config({ precision: 5, rounding: 4 }) - * x = new BigNumber(9876.54321) - * - * x.toDigits() // '9876.5' - * x.toDigits(6) // '9876.54' - * x.toDigits(6, BigNumber.ROUND_UP) // '9876.55' - * x.toDigits(2) // '9900' - * x.toDigits(2, 1) // '9800' - * x // '9876.54321' - * ``` - * - * @param sd integer, 1 to 1e+9 inclusive - * @param rm integer, 0 to 8 inclusive - */ - toDigits(sd?: number, rm?: number): BigNumber; - - /** - * Returns a string representing the value of this BigNumber in exponential notation rounded using rounding mode rm - * to dp decimal places, i.e with one digit before the decimal point and dp digits after it. - * - * If the value of this BigNumber in exponential notation has fewer than dp fraction digits, the return value will - * be appended with zeros accordingly. - * - * If dp is omitted, or is null or undefined, the number of digits after the decimal point defaults to the minimum - * number of digits necessary to represent the value exactly. - * - * If rm is omitted or is null or undefined, ROUNDING_MODE is used. - * - * ```ts - * x = 45.6 - * y = new BigNumber(x) - * x.toExponential() // '4.56e+1' - * y.toExponential() // '4.56e+1' - * x.toExponential(0) // '5e+1' - * y.toExponential(0) // '5e+1' - * x.toExponential(1) // '4.6e+1' - * y.toExponential(1) // '4.6e+1' - * y.toExponential(1, 1) // '4.5e+1' (ROUND_DOWN) - * x.toExponential(3) // '4.560e+1' - * y.toExponential(3) // '4.560e+1' - * ``` - * - * @param dp integer, 0 to 1e+9 inclusive - * @param rm integer, 0 to 8 inclusive - */ - toExponential(dp?: number, rm?: number): string; - - /** - * Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to dp decimal - * places using rounding mode `rm`. - * - * If the value of this BigNumber in normal notation has fewer than `dp` fraction digits, the return value will be - * appended with zeros accordingly. - * - * Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or equal to 1021, this - * method will always return normal notation. - * - * If dp is omitted or is `null` or `undefined`, the return value will be unrounded and in normal notation. This is also - * unlike `Number.prototype.toFixed`, which returns the value to zero decimal places. - * - * It is useful when fixed-point notation is required and the current `EXPONENTIAL_AT` setting causes toString to - * return exponential notation. - * - * If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. - * - * ```ts - * x = 3.456 - * y = new BigNumber(x) - * x.toFixed() // '3' - * y.toFixed() // '3.456' - * y.toFixed(0) // '3' - * x.toFixed(2) // '3.46' - * y.toFixed(2) // '3.46' - * y.toFixed(2, 1) // '3.45' (ROUND_DOWN) - * x.toFixed(5) // '3.45600' - * y.toFixed(5) // '3.45600' - * ``` - * - * @param dp integer, 0 to 1e+9 inclusive - * @param rm integer, 0 to 8 inclusive - */ - toFixed(dp?: number, rm?: number): string; - - /** - * Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to dp decimal - * places using rounding mode `rm`, and formatted according to the properties of the FORMAT object. - * - * See the examples below for the properties of the `FORMAT` object, their types and their usage. - * - * If `dp` is omitted or is `null` or `undefined`, then the return value is not rounded to a fixed number of decimal - * places. - * - * If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. - * - * ```ts - * format = { - * decimalSeparator: '.', - * groupSeparator: ',', - * groupSize: 3, - * secondaryGroupSize: 0, - * fractionGroupSeparator: ' ', - * fractionGroupSize: 0 - * } - * BigNumber.config({ FORMAT: format }) - * - * x = new BigNumber('123456789.123456789') - * x.toFormat() // '123,456,789.123456789' - * x.toFormat(1) // '123,456,789.1' - * - * // If a reference to the object assigned to FORMAT has been retained, - * // the format properties can be changed directly - * format.groupSeparator = ' ' - * format.fractionGroupSize = 5 - * x.toFormat() // '123 456 789.12345 6789' - * - * BigNumber.config({ - * FORMAT: { - * decimalSeparator = ',', - * groupSeparator = '.', - * groupSize = 3, - * secondaryGroupSize = 2 - * } - * }) - * - * x.toFormat(6) // '12.34.56.789,123' - * ``` - * - * @param dp integer, 0 to 1e+9 inclusive - * @param rm integer, 0 to 8 inclusive - */ - toFormat(dp?: number, rm?: number): string; - - /** - * Returns a string array representing the value of this BigNumber as a simple fraction with an integer numerator - * and an integer denominator. The denominator will be a positive non-zero value less than or equal to max. - * - * If a maximum denominator, max, is not specified, or is null or undefined, the denominator will be the lowest - * value necessary to represent the number exactly. - * - * ```ts - * x = new BigNumber(1.75) - * x.toFraction() // '7, 4' - * - * pi = new BigNumber('3.14159265358') - * pi.toFraction() // '157079632679,50000000000' - * pi.toFraction(100000) // '312689, 99532' - * pi.toFraction(10000) // '355, 113' - * pi.toFraction(100) // '311, 99' - * pi.toFraction(10) // '22, 7' - * pi.toFraction(1) // '3, 1' - * ``` - * - * @param max integer >= `1` and < `Infinity` - */ - toFraction(max?: number | string | BigNumber): [string, string]; - - /** - * Same as [[valueOf]] - * - * ```ts - * x = new BigNumber('177.7e+457') - * y = new BigNumber(235.4325) - * z = new BigNumber('0.0098074') - * - * // Serialize an array of three BigNumbers - * str = JSON.stringify( [x, y, z] ) - * // "["1.777e+459","235.4325","0.0098074"]" - * - * // Return an array of three BigNumbers - * JSON.parse(str, function (key, val) { - * return key === '' ? val : new BigNumber(val) - * }) - * ``` - */ - toJSON(): string; - - /** - * Returns the value of this BigNumber as a JavaScript number primitive. - * - * Type coercion with, for example, the unary plus operator will also work, except that a BigNumber with the value - * minus zero will be converted to positive zero. - * - * ```ts - * x = new BigNumber(456.789) - * x.toNumber() // 456.789 - * +x // 456.789 - * - * y = new BigNumber('45987349857634085409857349856430985') - * y.toNumber() // 4.598734985763409e+34 - * - * z = new BigNumber(-0) - * 1 / +z // Infinity - * 1 / z.toNumber() // -Infinity - * ``` - */ - toNumber(): number; - - /** - * Returns a BigNumber whose value is the value of this BigNumber raised to the power `n`, and optionally modulo `a` - * modulus `m`. - * - * If `n` is negative the result is rounded according to the current [[Configuration.DECIMAL_PLACES]] and - * [[Configuration.ROUNDING_MODE]] configuration. - * - * If `n` is not an integer or is out of range: - * - If `ERRORS` is `true` a BigNumber Error is thrown, - * - else if `n` is greater than `9007199254740991`, it is interpreted as `Infinity`; - * - else if n is less than `-9007199254740991`, it is interpreted as `-Infinity`; - * - else if `n` is otherwise a number, it is truncated to an integer; - * - else it is interpreted as `NaN`. - * - * As the number of digits of the result of the power operation can grow so large so quickly, e.g. - * 123.45610000 has over 50000 digits, the number of significant digits calculated is limited to the - * value of the [[Configuration.POW_PRECISION]] setting (default value: `100`) unless a modulus `m` is specified. - * - * Set [[Configuration.POW_PRECISION]] to `0` for an unlimited number of significant digits to be calculated (this - * will cause the method to slow dramatically for larger exponents). - * - * Negative exponents will be calculated to the number of decimal places specified by - * [[Configuration.DECIMAL_PLACES]] (but not to more than [[Configuration.POW_PRECISION]] significant digits). - * - * If `m` is specified and the value of `m`, `n` and this BigNumber are positive integers, then a fast modular - * exponentiation algorithm is used, otherwise if any of the values is not a positive integer the operation will - * simply be performed as `x.toPower(n).modulo(m)` with a `POW_PRECISION` of `0`. - * - * ```ts - * Math.pow(0.7, 2) // 0.48999999999999994 - * x = new BigNumber(0.7) - * x.toPower(2) // '0.49' - * BigNumber(3).pow(-2) // '0.11111111111111111111' - * ``` - * - * @param n integer, -9007199254740991 to 9007199254740991 inclusive - * @alias [[pow]] - */ - toPower(n: number, m?: number | string | BigNumber): BigNumber; - - /** - * See [[toPower]] - */ - pow(n: number, m?: number | string | BigNumber): BigNumber; - - /** - * Returns a string representing the value of this BigNumber rounded to `sd` significant digits using rounding mode - * rm. - * - * - If `sd` is less than the number of digits necessary to represent the integer part of the value in normal - * (fixed-point) notation, then exponential notation is used. - * - If `sd` is omitted, or is `null` or `undefined`, then the return value is the same as `n.toString()`. - * - If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. - * - * ```ts - * x = 45.6 - * y = new BigNumber(x) - * x.toPrecision() // '45.6' - * y.toPrecision() // '45.6' - * x.toPrecision(1) // '5e+1' - * y.toPrecision(1) // '5e+1' - * y.toPrecision(2, 0) // '4.6e+1' (ROUND_UP) - * y.toPrecision(2, 1) // '4.5e+1' (ROUND_DOWN) - * x.toPrecision(5) // '45.600' - * y.toPrecision(5) // '45.600' - * ``` - * - * @param sd integer, 1 to 1e+9 inclusive - * @param rm integer, 0 to 8 inclusive - */ - toPrecision(sd?: number, rm?: number): string; - - /** - * Returns a string representing the value of this BigNumber in the specified base, or base 10 if base is omitted or - * is `null` or `undefined`. - * - * For bases above 10, values from 10 to 35 are represented by a-z (as with `Number.prototype.toString`), 36 to 61 by - * A-Z, and 62 and 63 by `$` and `_` respectively. - * - * If a base is specified the value is rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` - * configuration. - * - * If a base is not specified, and this BigNumber has a positive exponent that is equal to or greater than the - * positive component of the current `EXPONENTIAL_AT` setting, or a negative exponent equal to or less than the - * negative component of the setting, then exponential notation is returned. - * - * If base is `null` or `undefined` it is ignored. - * - * ```ts - * x = new BigNumber(750000) - * x.toString() // '750000' - * BigNumber.config({ EXPONENTIAL_AT: 5 }) - * x.toString() // '7.5e+5' - * - * y = new BigNumber(362.875) - * y.toString(2) // '101101010.111' - * y.toString(9) // '442.77777777777777777778' - * y.toString(32) // 'ba.s' - * - * BigNumber.config({ DECIMAL_PLACES: 4 }); - * z = new BigNumber('1.23456789') - * z.toString() // '1.23456789' - * z.toString(10) // '1.2346' - * ``` - * - * @param base integer, 2 to 64 inclusive - */ - toString(base?: number): string; - - /** - * Returns a BigNumber whose value is the value of this BigNumber truncated to a whole number. - * - * ```ts - * x = new BigNumber(123.456) - * x.truncated() // '123' - * y = new BigNumber(-12.3) - * y.trunc() // '-12' - * ``` - * - * @alias [[trunc]] - */ - truncated(): BigNumber; - - /** - * See [[truncated]] - */ - trunc(): BigNumber; - - /** - * As [[toString]], but does not accept a base argument and includes the minus sign for negative zero.` - * - * ```ts - * x = new BigNumber('-0') - * x.toString() // '0' - * x.valueOf() // '-0' - * y = new BigNumber('1.777e+457') - * y.valueOf() // '1.777e+457' - * ``` - */ - valueOf(): string; -} - -export default BigNumber; +// Type definitions for Bignumber.js +// Project: bignumber.js +// Definitions by: Felix Becker https://github.com/felixfbecker + +export interface Format { + /** the decimal separator */ + decimalSeparator?: string; + /** the grouping separator of the integer part */ + groupSeparator?: string; + /** the primary grouping size of the integer part */ + groupSize?: number; + /** the secondary grouping size of the integer part */ + secondaryGroupSize?: number; + /** the grouping separator of the fraction part */ + fractionGroupSeparator?: string; + /** the grouping size of the fraction part */ + fractionGroupSize?: number; +} + +export interface Configuration { + + /** + * integer, `0` to `1e+9` inclusive + * + * The maximum number of decimal places of the results of operations involving division, i.e. division, square root + * and base conversion operations, and power operations with negative exponents. + * + * ```ts + * BigNumber.config({ DECIMAL_PLACES: 5 }) + * BigNumber.config(5) // equivalent + * ``` + * @default 20 + */ + DECIMAL_PLACES?: number; + + /** + * The rounding mode used in the above operations and the default rounding mode of round, toExponential, toFixed, + * toFormat and toPrecision. The modes are available as enumerated properties of the BigNumber constructor. + * @default [[RoundingMode.ROUND_HALF_UP]] + */ + ROUNDING_MODE?: RoundingMode; + + /** + * - `number`: integer, magnitude `0` to `1e+9` inclusive + * - `number[]`: [ integer `-1e+9` to `0` inclusive, integer `0` to `1e+9` inclusive ] + * + * The exponent value(s) at which `toString` returns exponential notation. + * + * If a single number is assigned, the value + * is the exponent magnitude. + * + * If an array of two numbers is assigned then the first number is the negative exponent + * value at and beneath which exponential notation is used, and the second number is the positive exponent value at + * and above which the same. + * + * For example, to emulate JavaScript numbers in terms of the exponent values at which + * they begin to use exponential notation, use [-7, 20]. + * + * ```ts + * BigNumber.config({ EXPONENTIAL_AT: 2 }) + * new BigNumber(12.3) // '12.3' e is only 1 + * new BigNumber(123) // '1.23e+2' + * new BigNumber(0.123) // '0.123' e is only -1 + * new BigNumber(0.0123) // '1.23e-2' + * + * BigNumber.config({ EXPONENTIAL_AT: [-7, 20] }) + * new BigNumber(123456789) // '123456789' e is only 8 + * new BigNumber(0.000000123) // '1.23e-7' + * + * // Almost never return exponential notation: + * BigNumber.config({ EXPONENTIAL_AT: 1e+9 }) + * + * // Always return exponential notation: + * BigNumber.config({ EXPONENTIAL_AT: 0 }) + * ``` + * Regardless of the value of `EXPONENTIAL_AT`, the `toFixed` method will always return a value in normal notation + * and the `toExponential` method will always return a value in exponential form. + * + * Calling `toString` with a base argument, e.g. `toString(10)`, will also always return normal notation. + * + * @default `[-7, 20]` + */ + EXPONENTIAL_AT?: number | [number, number]; + + /** + * - number: integer, magnitude `1` to `1e+9` inclusive + * - number[]: [ integer `-1e+9` to `-1` inclusive, integer `1` to `1e+9` inclusive ] + * + * The exponent value(s) beyond which overflow to `Infinity` and underflow to zero occurs. + * + * If a single number is + * assigned, it is the maximum exponent magnitude: values wth a positive exponent of greater magnitude become + * Infinity and those with a negative exponent of greater magnitude become zero. + * + * If an array of two numbers is + * assigned then the first number is the negative exponent limit and the second number is the positive exponent + * limit. + * + * For example, to emulate JavaScript numbers in terms of the exponent values at which they become zero and + * Infinity, use [-324, 308]. + * + * ```ts + * BigNumber.config({ RANGE: 500 }) + * BigNumber.config().RANGE // [ -500, 500 ] + * new BigNumber('9.999e499') // '9.999e+499' + * new BigNumber('1e500') // 'Infinity' + * new BigNumber('1e-499') // '1e-499' + * new BigNumber('1e-500') // '0' + * BigNumber.config({ RANGE: [-3, 4] }) + * new BigNumber(99999) // '99999' e is only 4 + * new BigNumber(100000) // 'Infinity' e is 5 + * new BigNumber(0.001) // '0.01' e is only -3 + * new BigNumber(0.0001) // '0' e is -4 + * ``` + * + * The largest possible magnitude of a finite BigNumber is `9.999...e+1000000000`. + * + * The smallest possible magnitude of a non-zero BigNumber is `1e-1000000000`. + * + * @default `[-1e+9, 1e+9]` + */ + RANGE?: number | [number, number]; + + /** + * + * The value that determines whether BigNumber Errors are thrown. If ERRORS is false, no errors will be thrown. + * `true`, `false`, `0` or `1`. + * ```ts + * BigNumber.config({ ERRORS: false }) + * ``` + * + * @default `true` + */ + ERRORS?: boolean | number; + + /** + * `true`, `false`, `0` or `1`. + * + * The value that determines whether cryptographically-secure pseudo-random number generation is used. + * + * If `CRYPTO` is set to `true` then the random method will generate random digits using `crypto.getRandomValues` in + * browsers that support it, or `crypto.randomBytes` if using a version of Node.js that supports it. + * + * If neither function is supported by the host environment then attempting to set `CRYPTO` to `true` will fail, and + * if [[Configuration.ERRORS]] is `true` an exception will be thrown. + * + * If `CRYPTO` is `false` then the source of randomness used will be `Math.random` (which is assumed to generate at + * least 30 bits of randomness). + * + * See [[BigNumber.random]]. + * + * ```ts + * BigNumber.config({ CRYPTO: true }) + * BigNumber.config().CRYPTO // true + * BigNumber.random() // 0.54340758610486147524 + * ``` + * + * @default `false` + */ + CRYPTO?: boolean | number; + + /** + * The modulo mode used when calculating the modulus: `a mod n`. + * + * The quotient, `q = a / n`, is calculated according to + * the [[Configuration.ROUNDING_MODE]] that corresponds to the chosen MODULO_MODE. + * + * The remainder, r, is calculated as: `r = a - n * q`. + * + * The modes that are most commonly used for the modulus/remainder operation are shown in the following table. + * Although the other rounding modes can be used, they may not give useful results. + * + * Property | Value | Description + * -------------------|:-----:|--------------------------------------------------------------------------------------- + * `ROUND_UP` | 0 | The remainder is positive if the dividend is negative, otherwise it is negative. + * `ROUND_DOWN` | 1 | The remainder has the same sign as the dividend. This uses 'truncating division' and matches the behaviour of JavaScript's remainder operator `%`. + * `ROUND_FLOOR` | 3 | The remainder has the same sign as the divisor. + * | | This matches Python's % operator. + * `ROUND_HALF_EVEN` | 6 | The IEEE 754 remainder function. + * `EUCLID` | 9 | The remainder is always positive. Euclidian division: `q = sign(n) * floor(a / abs(n))` + * + * The rounding/modulo modes are available as enumerated properties of the BigNumber constructor. + * + * See [[BigNumber.modulo]] + * + * ```ts + * BigNumber.config({ MODULO_MODE: BigNumber.EUCLID }) + * BigNumber.config({ MODULO_MODE: 9 }) // equivalent + * ``` + * + * @default [[RoundingMode.ROUND_DOWN]] + */ + MODULO_MODE?: RoundingMode; + + /** + * integer, `0` to `1e+9` inclusive. + * + * The maximum number of significant digits of the result of the power operation (unless a modulus is specified). + * + * If set to 0, the number of signifcant digits will not be limited. + * + * See [[BigNumber.toPower]] + * + * ```ts + * BigNumber.config({ POW_PRECISION: 100 }) + * ``` + * + * @default 100 + */ + POW_PRECISION?: number; + + /** + * The FORMAT object configures the format of the string returned by the `toFormat` method. The example below shows + * the properties of the FORMAT object that are recognised, and their default values. Unlike the other configuration + * properties, the values of the properties of the FORMAT object will not be checked for validity. The existing + * FORMAT object will simply be replaced by the object that is passed in. Note that all the properties shown below + * do not have to be included. + * + * See `toFormat` for examples of usage. + * + * ```ts + * BigNumber.config({ + * FORMAT: { + * // the decimal separator + * decimalSeparator: '.', + * // the grouping separator of the integer part + * groupSeparator: ',', + * // the primary grouping size of the integer part + * groupSize: 3, + * // the secondary grouping size of the integer part + * secondaryGroupSize: 0, + * // the grouping separator of the fraction part + * fractionGroupSeparator: ' ', + * // the grouping size of the fraction part + * fractionGroupSize: 0 + * } + * }); + * ``` + */ + FORMAT?: Format; +} + +/** + * The library's enumerated rounding modes are stored as properties of the constructor. + * (They are not referenced internally by the library itself.) + * Rounding modes 0 to 6 (inclusive) are the same as those of Java's BigDecimal class. + */ +declare enum RoundingMode { + /** Rounds away from zero */ + ROUND_UP = 0, + /** Rounds towards zero */ + ROUND_DOWN = 1, + /** Rounds towards Infinity */ + ROUND_CEIL = 2, + /** Rounds towards -Infinity */ + ROUND_FLOOR = 3, + /** + * Rounds towards nearest neighbour. If equidistant, rounds away from zero + */ + ROUND_HALF_UP = 4, + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards zero + */ + ROUND_HALF_DOWN = 5, + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour + */ + ROUND_HALF_EVEN = 6, + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards `Infinity` + */ + ROUND_HALF_CEIL = 7, + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards `-Infinity` + */ + ROUND_HALF_FLOOR = 8, + /** + * The remainder is always positive. Euclidian division: `q = sign(n) * floor(a / abs(n))` + */ + EUCLID = 9 +} + +export class BigNumber { + + /** Rounds away from zero */ + static ROUND_UP: RoundingMode; + + /** Rounds towards zero */ + static ROUND_DOWN: RoundingMode; + + /** Rounds towards Infinity */ + static ROUND_CEIL: RoundingMode; + + /** Rounds towards -Infinity */ + static ROUND_FLOOR: RoundingMode; + + /** + * Rounds towards nearest neighbour. If equidistant, rounds away from zero + */ + static ROUND_HALF_UP: RoundingMode; + + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards zero + */ + static ROUND_HALF_DOWN: RoundingMode; + + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour + */ + static ROUND_HALF_EVEN: RoundingMode; + + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards `Infinity` + */ + static ROUND_HALF_CEIL: RoundingMode; + + /** + * Rounds towards nearest neighbour. If equidistant, rounds towards `-Infinity` + */ + static ROUND_HALF_FLOOR: RoundingMode; + + /** + * The remainder is always positive. Euclidian division: `q = sign(n) * floor(a / abs(n))` + */ + static EUCLID: RoundingMode; + + /** + * Returns a new independent BigNumber constructor with configuration as described by `obj` (see `config`), or with + * the default configuration if `obj` is `null` or `undefined`. + * + * ```ts + * BigNumber.config({ DECIMAL_PLACES: 5 }) + * BN = BigNumber.another({ DECIMAL_PLACES: 9 }) + * + * x = new BigNumber(1) + * y = new BN(1) + * + * x.div(3) // 0.33333 + * y.div(3) // 0.333333333 + * + * // BN = BigNumber.another({ DECIMAL_PLACES: 9 }) is equivalent to: + * BN = BigNumber.another() + * BN.config({ DECIMAL_PLACES: 9 }) + * ``` + */ + static another(config?: Configuration): typeof BigNumber; + + /** + * Configures the 'global' settings for this particular BigNumber constructor. Returns an object with the above + * properties and their current values. If the value to be assigned to any of the above properties is `null` or + * `undefined` it is ignored. See Errors for the treatment of invalid values. + */ + static config(config?: Configuration): Configuration; + + /** + * Configures the 'global' settings for this particular BigNumber constructor. Returns an object with the above + * properties and their current values. If the value to be assigned to any of the above properties is `null` or + * `undefined` it is ignored. See Errors for the treatment of invalid values. + */ + static config( + decimalPlaces?: number, + roundingMode?: RoundingMode, + exponentialAt?: number | [number, number], + range?: number | [number, number], + errors?: boolean | number, + crypto?: boolean | number, + moduloMode?: RoundingMode, + powPrecision?: number, + format?: Format + ): Configuration; + + /** + * Returns a BigNumber whose value is the maximum of `arg1`, `arg2`,... . The argument to this method can also be an + * array of values. The return value is always exact and unrounded. + * + * ```ts + * x = new BigNumber('3257869345.0378653') + * BigNumber.max(4e9, x, '123456789.9') // '4000000000' + * + * arr = [12, '13', new BigNumber(14)] + * BigNumber.max(arr) // '14' + * ``` + */ + static max(...args: Array): BigNumber; + static max(args: Array): BigNumber; + + /** + * See BigNumber for further parameter details. Returns a BigNumber whose value is the minimum of arg1, arg2,... . + * The argument to this method can also be an array of values. The return value is always exact and unrounded. + * + * ```ts + * x = new BigNumber('3257869345.0378653') + * BigNumber.min(4e9, x, '123456789.9') // '123456789.9' + * + * arr = [2, new BigNumber(-14), '-15.9999', -12] + * BigNumber.min(arr) // '-15.9999' + * ``` + */ + static min(...args: Array): BigNumber; + static min(args: Array): BigNumber; + + /** + * Returns a new BigNumber with a pseudo-random value equal to or greater than 0 and less than 1. + * + * The return value + * will have dp decimal places (or less if trailing zeros are produced). If dp is omitted then the number of decimal + * places will default to the current `DECIMAL_PLACES` setting. + * + * Depending on the value of this BigNumber constructor's + * `CRYPTO` setting and the support for the crypto object in the host environment, the random digits of the return + * value are generated by either `Math.random` (fastest), `crypto.getRandomValues` (Web Cryptography API in recent + * browsers) or `crypto.randomBytes` (Node.js). + * + * If `CRYPTO` is true, i.e. one of the crypto methods is to be used, the + * value of a returned BigNumber should be cryptographically-secure and statistically indistinguishable from a + * random value. + * + * ```ts + * BigNumber.config({ DECIMAL_PLACES: 10 }) + * BigNumber.random() // '0.4117936847' + * BigNumber.random(20) // '0.78193327636914089009' + * ``` + * + * @param dp integer, `0` to `1e+9` inclusive + */ + static random(dp?: number): BigNumber; + + /** + * Coefficient: Array of base `1e14` numbers or `null` + * @readonly + */ + c: number[]; + + /** + * Exponent: Integer, `-1000000000` to `1000000000` inclusive or `null` + * @readonly + */ + e: number; + + /** + * Sign: `-1`, `1` or `null` + * @readonly + */ + s: number; + + /** + * Returns a new instance of a BigNumber object. If a base is specified, the value is rounded according to the + * current [[Configuration.DECIMAL_PLACES]] and [[Configuration.ROUNDING_MODE]] configuration. See Errors for the treatment of an invalid value or base. + * + * ```ts + * x = new BigNumber(9) // '9' + * y = new BigNumber(x) // '9' + * + * // 'new' is optional if ERRORS is false + * BigNumber(435.345) // '435.345' + * + * new BigNumber('5032485723458348569331745.33434346346912144534543') + * new BigNumber('4.321e+4') // '43210' + * new BigNumber('-735.0918e-430') // '-7.350918e-428' + * new BigNumber(Infinity) // 'Infinity' + * new BigNumber(NaN) // 'NaN' + * new BigNumber('.5') // '0.5' + * new BigNumber('+2') // '2' + * new BigNumber(-10110100.1, 2) // '-180.5' + * new BigNumber(-0b10110100.1) // '-180.5' + * new BigNumber('123412421.234324', 5) // '607236.557696' + * new BigNumber('ff.8', 16) // '255.5' + * new BigNumber('0xff.8') // '255.5' + * ``` + * + * The following throws `not a base 2 number` if [[Configuration.ERRORS]] is true, otherwise it returns a BigNumber with value `NaN`. + * + * ```ts + * new BigNumber(9, 2) + * ``` + * + * The following throws `number type has more than 15 significant digits` if [[Configuration.ERRORS]] is true, otherwise it returns a BigNumber with value `96517860459076820`. + * + * ```ts + * new BigNumber(96517860459076817.4395) + * ``` + * + * The following throws `not a number` if [[Configuration.ERRORS]] is true, otherwise it returns a BigNumber with value `NaN`. + * + * ```ts + * new BigNumber('blurgh') + * ``` + * + * A value is only rounded by the constructor if a base is specified. + * + * ```ts + * BigNumber.config({ DECIMAL_PLACES: 5 }) + * new BigNumber(1.23456789) // '1.23456789' + * new BigNumber(1.23456789, 10) // '1.23457' + * ``` + * + * @param value A numeric value. + * + * Legitimate values include `±0`, `±Infinity` and `NaN`. + * + * Values of type `number` with more than 15 significant digits are considered invalid (if [[Configuration.ERRORS]] + * is `true`) as calling `toString` or `valueOf` on such numbers may not result in the intended value. + * + * There is no limit to the number of digits of a value of type `string` (other than that of JavaScript's maximum + * array size). + * + * Decimal string values may be in exponential, as well as normal (fixed-point) notation. Non-decimal values must be + * in normal notation. String values in hexadecimal literal form, e.g. `'0xff'`, are valid, as are string values + * with the octal and binary prefixs `'0o'` and `'0b'`. + * + * String values in octal literal form without the prefix will be interpreted as decimals, e.g. `'011'` is + * interpreted as 11, not 9. + * + * Values in any base may have fraction digits. + * + * For bases from 10 to 36, lower and/or upper case letters can be used to represent values from 10 to 35. + * + * For bases above 36, a-z represents values from 10 to 35, A-Z from 36 to 61, and $ and _ represent 62 and 63 + * respectively (this can be changed by editing the ALPHABET variable near the top of the source file). + * + * @param base integer, 2 to 64 inclusive + * + * The base of value. If base is omitted, or is `null` or `undefined`, base 10 is assumed. + */ + constructor(value: number | string | BigNumber, base?: number); + + /** + * Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this BigNumber. The + * return value is always exact and unrounded. + * ```ts + * x = new BigNumber(-0.8) + * y = x.absoluteValue() // '0.8' + * z = y.abs() // '0.8' + * ``` + * @alias [[BigNumber.abs]] + */ + absoluteValue(): BigNumber; + + /** + * See [[BigNumber.absoluteValue]] + */ + abs(): BigNumber; + + /** + * See [[plus]] + */ + add(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in the direction of + * positive `Infinity`. + * + * ```ts + * x = new BigNumber(1.3) + * x.ceil() // '2' + * y = new BigNumber(-1.8) + * y.ceil() // '-1' + * ``` + */ + ceil(): BigNumber; + + /** + * Returns | | + * :-------:|---------------------------------------------------------------| + * 1 | If the value of this BigNumber is greater than the value of n + * -1 | If the value of this BigNumber is less than the value of n + * 0 | If this BigNumber and n have the same value + * null | If the value of either this BigNumber or n is NaN + * + * ```ts + * x = new BigNumber(Infinity) + * y = new BigNumber(5) + * x.comparedTo(y) // 1 + * x.comparedTo(x.minus(1)) // 0 + * y.cmp(NaN) // null + * y.cmp('110', 2) // -1 + * ``` + * + * @alias [[cmp]] + */ + comparedTo(n: number | string | BigNumber, base?: number): number; + + /** + * See [[comparedTo]] + */ + cmp(n: number | string | BigNumber, base?: number): number; + + /** + * Return the number of decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is + * `±Infinity` or `NaN`. + * + * ```ts + * x = new BigNumber(123.45) + * x.decimalPlaces() // 2 + * y = new BigNumber('9.9e-101') + * y.dp() // 102 + * ``` + * + * @alias [[dp]] + */ + decimalPlaces(): number; + + /** + * See [[decimalPlaces]] + */ + dp(): number; + + /** + * Returns a BigNumber whose value is the value of this BigNumber divided by n, rounded according to the current + * DECIMAL_PLACES and ROUNDING_MODE configuration. + * + * ```ts + * x = new BigNumber(355) + * y = new BigNumber(113) + * x.dividedBy(y) // '3.14159292035398230088' + * x.div(5) // '71' + * x.div(47, 16) // '5' + * ``` + * + * @alias [[div]] + */ + dividedBy(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * See [[dividedBy]] + */ + div(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * Return a BigNumber whose value is the integer part of dividing the value of this BigNumber by n. + * + * ```ts + * x = new BigNumber(5) + * y = new BigNumber(3) + * x.dividedToIntegerBy(y) // '1' + * x.divToInt(0.7) // '7' + * x.divToInt('0.f', 16) // '5' + * ``` + * + * @alias [[divToInt]] + */ + dividedToIntegerBy(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * See [[dividedToIntegerBy]] + */ + divToInt(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * Returns true if the value of this BigNumber equals the value of `n`, otherwise returns `false`. As with JavaScript, + * `NaN` does not equal `NaN`. + * + * Note: This method uses the [[comparedTo]] internally. + * + * ```ts + * 0 === 1e-324 // true + * x = new BigNumber(0) + * x.equals('1e-324') // false + * BigNumber(-0).eq(x) // true ( -0 === 0 ) + * BigNumber(255).eq('ff', 16) // true + * + * y = new BigNumber(NaN) + * y.equals(NaN) // false + * ``` + * + * @alias [[eq]] + */ + equals(n: number | string | BigNumber, base?: number): boolean; + + /** + * See [[equals]] + */ + eq(n: number | string | BigNumber, base?: number): boolean; + + /** + * Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in the direction of + * negative `Infinity`. + * + * ```ts + * x = new BigNumber(1.8) + * x.floor() // '1' + * y = new BigNumber(-1.3) + * y.floor() // '-2' + * ``` + */ + floor(): BigNumber; + + /** + * Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise returns `false`. + * + * Note: This method uses the comparedTo method internally. + * + * ```ts + * 0.1 > (0.3 - 0.2) // true + * x = new BigNumber(0.1) + * x.greaterThan(BigNumber(0.3).minus(0.2)) // false + * BigNumber(0).gt(x) // false + * BigNumber(11, 3).gt(11.1, 2) // true + * ``` + * + * @alias [[gt]] + */ + greaterThan(n: number | string | BigNumber, base?: number): boolean; + + /** + * See [[greaterThan]] + */ + gt(n: number | string | BigNumber, base?: number): boolean; + + /** + * Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`, otherwise returns `false`. + * + * Note: This method uses the comparedTo method internally. + * + * @alias [[gte]] + */ + greaterThanOrEqualTo(n: number | string | BigNumber, base?: number): boolean; + + /** + * See [[greaterThanOrEqualTo]] + */ + gte(n: number | string | BigNumber, base?: number): boolean; + + /** + * Returns true if the value of this BigNumber is a finite number, otherwise returns false. The only possible + * non-finite values of a BigNumber are `NaN`, `Infinity` and `-Infinity`. + * + * Note: The native method `isFinite()` can be used if `n <= Number.MAX_VALUE`. + */ + isFinite(): boolean; + + /** + * Returns true if the value of this BigNumber is a whole number, otherwise returns false. + * @alias [[isInt]] + */ + isInteger(): boolean; + + /** + * See [[isInteger]] + */ + isInt(): boolean; + + /** + * Returns `true` if the value of this BigNumber is `NaN`, otherwise returns `false`. + * + * Note: The native method isNaN() can also be used. + */ + isNaN(): boolean; + + /** + * Returns true if the value of this BigNumber is negative, otherwise returns false. + * + * Note: `n < 0` can be used if `n <= * -Number.MIN_VALUE`. + * + * @alias [[isNeg]] + */ + isNegative(): boolean; + + /** + * See [[isNegative]] + */ + isNeg(): boolean; + + /** + * Returns true if the value of this BigNumber is zero or minus zero, otherwise returns false. + * + * Note: `n == 0` can be used if `n >= Number.MIN_VALUE`. + */ + isZero(): boolean; + + /** + * Returns true if the value of this BigNumber is less than the value of n, otherwise returns false. + * + * Note: This method uses [[comparedTo]] internally. + * + * @alias [[lt]] + */ + lessThan(n: number | string | BigNumber, base?: number): boolean; + + /** + * See [[lessThan]] + */ + lt(n: number | string | BigNumber, base?: number): boolean; + + /** + * Returns true if the value of this BigNumber is less than or equal the value of n, otherwise returns false. + * + * Note: This method uses [[comparedTo]] internally. + */ + lessThanOrEqualTo(n: number | string | BigNumber, base?: number): boolean; + + /** + * See [[lessThanOrEqualTo]] + */ + lte(n: number | string | BigNumber, base?: number): boolean; + + /** + * Returns a BigNumber whose value is the value of this BigNumber minus `n`. + * + * The return value is always exact and unrounded. + * + * @alias [[sub]] + */ + minus(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * Returns a BigNumber whose value is the value of this BigNumber modulo n, i.e. the integer remainder of dividing + * this BigNumber by n. + * + * The value returned, and in particular its sign, is dependent on the value of the [[Configuration.MODULO_MODE]] + * setting of this BigNumber constructor. If it is `1` (default value), the result will have the same sign as this + * BigNumber, and it will match that of Javascript's `%` operator (within the limits of double precision) and + * BigDecimal's remainder method. + * + * The return value is always exact and unrounded. + * + * ```ts + * 1 % 0.9 // 0.09999999999999998 + * x = new BigNumber(1) + * x.modulo(0.9) // '0.1' + * y = new BigNumber(33) + * y.mod('a', 33) // '3' + * ``` + * + * @alias [[mod]] + */ + modulo(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * See [[modulo]] + */ + mod(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * See [[times]] + */ + mul(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by -1. + * + * ```ts + * x = new BigNumber(1.8) + * x.negated() // '-1.8' + * y = new BigNumber(-1.3) + * y.neg() // '1.3' + * ``` + * + * @alias [[neg]] + */ + negated(): BigNumber; + + /** + * See [[negated]] + */ + neg(): BigNumber; + + /** + * Returns a BigNumber whose value is the value of this BigNumber plus `n`. + * + * The return value is always exact and unrounded. + * + * @alias [[add]] + */ + plus(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * If z is true or 1 then any trailing zeros of the integer part of a number are counted as significant digits, + * otherwise they are not. + * + * @param z true, false, 0 or 1 + * @alias [[sd]] + */ + precision(z?: boolean | number): number; + + /** + * See [[precision]] + */ + sd(z?: boolean | number): number; + + /** + * Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode rm to a maximum of dp + * decimal places. + * + * - if dp is omitted, or is null or undefined, the return value is n rounded to a whole number. + * - if rm is omitted, or is null or undefined, ROUNDING_MODE is used. + * + * ```ts + * x = 1234.56 + * Math.round(x) // 1235 + * y = new BigNumber(x) + * y.round() // '1235' + * y.round(1) // '1234.6' + * y.round(2) // '1234.56' + * y.round(10) // '1234.56' + * y.round(0, 1) // '1234' + * y.round(0, 6) // '1235' + * y.round(1, 1) // '1234.5' + * y.round(1, BigNumber.ROUND_HALF_EVEN) // '1234.6' + * y // '1234.56' + * ``` + * + * @param dp integer, 0 to 1e+9 inclusive + * @param rm integer, 0 to 8 inclusive + */ + round(dp?: number, rm?: number): BigNumber; + + /** + * Returns a BigNumber whose value is the value of this BigNumber shifted n places. + * + * The shift is of the decimal point, i.e. of powers of ten, and is to the left if n is negative or to the right if + * n is positive. The return value is always exact and unrounded. + * + * @param n integer, -9007199254740991 to 9007199254740991 inclusive + */ + shift(n: number): BigNumber; + + /** + * Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the + * current DECIMAL_PLACES and ROUNDING_MODE configuration. + * + * The return value will be correctly rounded, i.e. rounded + * as if the result was first calculated to an infinite number of correct digits before rounding. + * + * @alias [[sqrt]] + */ + squareRoot(): BigNumber; + + /** + * See [[squareRoot]] + */ + sqrt(): BigNumber; + + /** + * See [[minus]] + */ + sub(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * Returns a BigNumber whose value is the value of this BigNumber times n. + * + * The return value is always exact and unrounded. + * + * @alias [[mul]] + */ + times(n: number | string | BigNumber, base?: number): BigNumber; + + /** + * Returns a BigNumber whose value is the value of this BigNumber rounded to sd significant digits using rounding mode rm. + * + * If sd is omitted or is null or undefined, the return value will not be rounded. + * + * If rm is omitted or is null or undefined, ROUNDING_MODE will be used. + * + * ```ts + * BigNumber.config({ precision: 5, rounding: 4 }) + * x = new BigNumber(9876.54321) + * + * x.toDigits() // '9876.5' + * x.toDigits(6) // '9876.54' + * x.toDigits(6, BigNumber.ROUND_UP) // '9876.55' + * x.toDigits(2) // '9900' + * x.toDigits(2, 1) // '9800' + * x // '9876.54321' + * ``` + * + * @param sd integer, 1 to 1e+9 inclusive + * @param rm integer, 0 to 8 inclusive + */ + toDigits(sd?: number, rm?: number): BigNumber; + + /** + * Returns a string representing the value of this BigNumber in exponential notation rounded using rounding mode rm + * to dp decimal places, i.e with one digit before the decimal point and dp digits after it. + * + * If the value of this BigNumber in exponential notation has fewer than dp fraction digits, the return value will + * be appended with zeros accordingly. + * + * If dp is omitted, or is null or undefined, the number of digits after the decimal point defaults to the minimum + * number of digits necessary to represent the value exactly. + * + * If rm is omitted or is null or undefined, ROUNDING_MODE is used. + * + * ```ts + * x = 45.6 + * y = new BigNumber(x) + * x.toExponential() // '4.56e+1' + * y.toExponential() // '4.56e+1' + * x.toExponential(0) // '5e+1' + * y.toExponential(0) // '5e+1' + * x.toExponential(1) // '4.6e+1' + * y.toExponential(1) // '4.6e+1' + * y.toExponential(1, 1) // '4.5e+1' (ROUND_DOWN) + * x.toExponential(3) // '4.560e+1' + * y.toExponential(3) // '4.560e+1' + * ``` + * + * @param dp integer, 0 to 1e+9 inclusive + * @param rm integer, 0 to 8 inclusive + */ + toExponential(dp?: number, rm?: number): string; + + /** + * Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to dp decimal + * places using rounding mode `rm`. + * + * If the value of this BigNumber in normal notation has fewer than `dp` fraction digits, the return value will be + * appended with zeros accordingly. + * + * Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or equal to 1021, this + * method will always return normal notation. + * + * If dp is omitted or is `null` or `undefined`, the return value will be unrounded and in normal notation. This is also + * unlike `Number.prototype.toFixed`, which returns the value to zero decimal places. + * + * It is useful when fixed-point notation is required and the current `EXPONENTIAL_AT` setting causes toString to + * return exponential notation. + * + * If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. + * + * ```ts + * x = 3.456 + * y = new BigNumber(x) + * x.toFixed() // '3' + * y.toFixed() // '3.456' + * y.toFixed(0) // '3' + * x.toFixed(2) // '3.46' + * y.toFixed(2) // '3.46' + * y.toFixed(2, 1) // '3.45' (ROUND_DOWN) + * x.toFixed(5) // '3.45600' + * y.toFixed(5) // '3.45600' + * ``` + * + * @param dp integer, 0 to 1e+9 inclusive + * @param rm integer, 0 to 8 inclusive + */ + toFixed(dp?: number, rm?: number): string; + + /** + * Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to dp decimal + * places using rounding mode `rm`, and formatted according to the properties of the FORMAT object. + * + * See the examples below for the properties of the `FORMAT` object, their types and their usage. + * + * If `dp` is omitted or is `null` or `undefined`, then the return value is not rounded to a fixed number of decimal + * places. + * + * If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. + * + * ```ts + * format = { + * decimalSeparator: '.', + * groupSeparator: ',', + * groupSize: 3, + * secondaryGroupSize: 0, + * fractionGroupSeparator: ' ', + * fractionGroupSize: 0 + * } + * BigNumber.config({ FORMAT: format }) + * + * x = new BigNumber('123456789.123456789') + * x.toFormat() // '123,456,789.123456789' + * x.toFormat(1) // '123,456,789.1' + * + * // If a reference to the object assigned to FORMAT has been retained, + * // the format properties can be changed directly + * format.groupSeparator = ' ' + * format.fractionGroupSize = 5 + * x.toFormat() // '123 456 789.12345 6789' + * + * BigNumber.config({ + * FORMAT: { + * decimalSeparator = ',', + * groupSeparator = '.', + * groupSize = 3, + * secondaryGroupSize = 2 + * } + * }) + * + * x.toFormat(6) // '12.34.56.789,123' + * ``` + * + * @param dp integer, 0 to 1e+9 inclusive + * @param rm integer, 0 to 8 inclusive + */ + toFormat(dp?: number, rm?: number): string; + + /** + * Returns a string array representing the value of this BigNumber as a simple fraction with an integer numerator + * and an integer denominator. The denominator will be a positive non-zero value less than or equal to max. + * + * If a maximum denominator, max, is not specified, or is null or undefined, the denominator will be the lowest + * value necessary to represent the number exactly. + * + * ```ts + * x = new BigNumber(1.75) + * x.toFraction() // '7, 4' + * + * pi = new BigNumber('3.14159265358') + * pi.toFraction() // '157079632679,50000000000' + * pi.toFraction(100000) // '312689, 99532' + * pi.toFraction(10000) // '355, 113' + * pi.toFraction(100) // '311, 99' + * pi.toFraction(10) // '22, 7' + * pi.toFraction(1) // '3, 1' + * ``` + * + * @param max integer >= `1` and < `Infinity` + */ + toFraction(max?: number | string | BigNumber): [string, string]; + + /** + * Same as [[valueOf]] + * + * ```ts + * x = new BigNumber('177.7e+457') + * y = new BigNumber(235.4325) + * z = new BigNumber('0.0098074') + * + * // Serialize an array of three BigNumbers + * str = JSON.stringify( [x, y, z] ) + * // "["1.777e+459","235.4325","0.0098074"]" + * + * // Return an array of three BigNumbers + * JSON.parse(str, function (key, val) { + * return key === '' ? val : new BigNumber(val) + * }) + * ``` + */ + toJSON(): string; + + /** + * Returns the value of this BigNumber as a JavaScript number primitive. + * + * Type coercion with, for example, the unary plus operator will also work, except that a BigNumber with the value + * minus zero will be converted to positive zero. + * + * ```ts + * x = new BigNumber(456.789) + * x.toNumber() // 456.789 + * +x // 456.789 + * + * y = new BigNumber('45987349857634085409857349856430985') + * y.toNumber() // 4.598734985763409e+34 + * + * z = new BigNumber(-0) + * 1 / +z // Infinity + * 1 / z.toNumber() // -Infinity + * ``` + */ + toNumber(): number; + + /** + * Returns a BigNumber whose value is the value of this BigNumber raised to the power `n`, and optionally modulo `a` + * modulus `m`. + * + * If `n` is negative the result is rounded according to the current [[Configuration.DECIMAL_PLACES]] and + * [[Configuration.ROUNDING_MODE]] configuration. + * + * If `n` is not an integer or is out of range: + * - If `ERRORS` is `true` a BigNumber Error is thrown, + * - else if `n` is greater than `9007199254740991`, it is interpreted as `Infinity`; + * - else if n is less than `-9007199254740991`, it is interpreted as `-Infinity`; + * - else if `n` is otherwise a number, it is truncated to an integer; + * - else it is interpreted as `NaN`. + * + * As the number of digits of the result of the power operation can grow so large so quickly, e.g. + * 123.45610000 has over 50000 digits, the number of significant digits calculated is limited to the + * value of the [[Configuration.POW_PRECISION]] setting (default value: `100`) unless a modulus `m` is specified. + * + * Set [[Configuration.POW_PRECISION]] to `0` for an unlimited number of significant digits to be calculated (this + * will cause the method to slow dramatically for larger exponents). + * + * Negative exponents will be calculated to the number of decimal places specified by + * [[Configuration.DECIMAL_PLACES]] (but not to more than [[Configuration.POW_PRECISION]] significant digits). + * + * If `m` is specified and the value of `m`, `n` and this BigNumber are positive integers, then a fast modular + * exponentiation algorithm is used, otherwise if any of the values is not a positive integer the operation will + * simply be performed as `x.toPower(n).modulo(m)` with a `POW_PRECISION` of `0`. + * + * ```ts + * Math.pow(0.7, 2) // 0.48999999999999994 + * x = new BigNumber(0.7) + * x.toPower(2) // '0.49' + * BigNumber(3).pow(-2) // '0.11111111111111111111' + * ``` + * + * @param n integer, -9007199254740991 to 9007199254740991 inclusive + * @alias [[pow]] + */ + toPower(n: number, m?: number | string | BigNumber): BigNumber; + + /** + * See [[toPower]] + */ + pow(n: number, m?: number | string | BigNumber): BigNumber; + + /** + * Returns a string representing the value of this BigNumber rounded to `sd` significant digits using rounding mode + * rm. + * + * - If `sd` is less than the number of digits necessary to represent the integer part of the value in normal + * (fixed-point) notation, then exponential notation is used. + * - If `sd` is omitted, or is `null` or `undefined`, then the return value is the same as `n.toString()`. + * - If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used. + * + * ```ts + * x = 45.6 + * y = new BigNumber(x) + * x.toPrecision() // '45.6' + * y.toPrecision() // '45.6' + * x.toPrecision(1) // '5e+1' + * y.toPrecision(1) // '5e+1' + * y.toPrecision(2, 0) // '4.6e+1' (ROUND_UP) + * y.toPrecision(2, 1) // '4.5e+1' (ROUND_DOWN) + * x.toPrecision(5) // '45.600' + * y.toPrecision(5) // '45.600' + * ``` + * + * @param sd integer, 1 to 1e+9 inclusive + * @param rm integer, 0 to 8 inclusive + */ + toPrecision(sd?: number, rm?: number): string; + + /** + * Returns a string representing the value of this BigNumber in the specified base, or base 10 if base is omitted or + * is `null` or `undefined`. + * + * For bases above 10, values from 10 to 35 are represented by a-z (as with `Number.prototype.toString`), 36 to 61 by + * A-Z, and 62 and 63 by `$` and `_` respectively. + * + * If a base is specified the value is rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` + * configuration. + * + * If a base is not specified, and this BigNumber has a positive exponent that is equal to or greater than the + * positive component of the current `EXPONENTIAL_AT` setting, or a negative exponent equal to or less than the + * negative component of the setting, then exponential notation is returned. + * + * If base is `null` or `undefined` it is ignored. + * + * ```ts + * x = new BigNumber(750000) + * x.toString() // '750000' + * BigNumber.config({ EXPONENTIAL_AT: 5 }) + * x.toString() // '7.5e+5' + * + * y = new BigNumber(362.875) + * y.toString(2) // '101101010.111' + * y.toString(9) // '442.77777777777777777778' + * y.toString(32) // 'ba.s' + * + * BigNumber.config({ DECIMAL_PLACES: 4 }); + * z = new BigNumber('1.23456789') + * z.toString() // '1.23456789' + * z.toString(10) // '1.2346' + * ``` + * + * @param base integer, 2 to 64 inclusive + */ + toString(base?: number): string; + + /** + * Returns a BigNumber whose value is the value of this BigNumber truncated to a whole number. + * + * ```ts + * x = new BigNumber(123.456) + * x.truncated() // '123' + * y = new BigNumber(-12.3) + * y.trunc() // '-12' + * ``` + * + * @alias [[trunc]] + */ + truncated(): BigNumber; + + /** + * See [[truncated]] + */ + trunc(): BigNumber; + + /** + * As [[toString]], but does not accept a base argument and includes the minus sign for negative zero.` + * + * ```ts + * x = new BigNumber('-0') + * x.toString() // '0' + * x.valueOf() // '-0' + * y = new BigNumber('1.777e+457') + * y.valueOf() // '1.777e+457' + * ``` + */ + valueOf(): string; +} + +export default BigNumber; diff --git a/node_modules/bignumber.js/bignumber.js b/node_modules/bignumber.js/bignumber.js index c299378..fcd45ea 100644 --- a/node_modules/bignumber.js/bignumber.js +++ b/node_modules/bignumber.js/bignumber.js @@ -1,2734 +1,2734 @@ -/*! bignumber.js v4.0.4 https://github.com/MikeMcl/bignumber.js/LICENCE */ - -;(function (globalObj) { - 'use strict'; - - /* - bignumber.js v4.0.4 - A JavaScript library for arbitrary-precision arithmetic. - https://github.com/MikeMcl/bignumber.js - Copyright (c) 2017 Michael Mclaughlin - MIT Expat Licence - */ - - - var BigNumber, - isNumeric = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, - mathceil = Math.ceil, - mathfloor = Math.floor, - notBool = ' not a boolean or binary digit', - roundingMode = 'rounding mode', - tooManyDigits = 'number type has more than 15 significant digits', - ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_', - BASE = 1e14, - LOG_BASE = 14, - MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1 - // MAX_INT32 = 0x7fffffff, // 2^31 - 1 - POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], - SQRT_BASE = 1e7, - - /* - * The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and - * the arguments to toExponential, toFixed, toFormat, and toPrecision, beyond which an - * exception is thrown (if ERRORS is true). - */ - MAX = 1E9; // 0 to MAX_INT32 - - - /* - * Create and return a BigNumber constructor. - */ - function constructorFactory(config) { - var div, parseNumeric, - - // id tracks the caller function, so its name can be included in error messages. - id = 0, - P = BigNumber.prototype, - ONE = new BigNumber(1), - - - /********************************* EDITABLE DEFAULTS **********************************/ - - - /* - * The default values below must be integers within the inclusive ranges stated. - * The values can also be changed at run-time using BigNumber.config. - */ - - // The maximum number of decimal places for operations involving division. - DECIMAL_PLACES = 20, // 0 to MAX - - /* - * The rounding mode used when rounding to the above decimal places, and when using - * toExponential, toFixed, toFormat and toPrecision, and round (default value). - * UP 0 Away from zero. - * DOWN 1 Towards zero. - * CEIL 2 Towards +Infinity. - * FLOOR 3 Towards -Infinity. - * HALF_UP 4 Towards nearest neighbour. If equidistant, up. - * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. - * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. - * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. - * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. - */ - ROUNDING_MODE = 4, // 0 to 8 - - // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS] - - // The exponent value at and beneath which toString returns exponential notation. - // Number type: -7 - TO_EXP_NEG = -7, // 0 to -MAX - - // The exponent value at and above which toString returns exponential notation. - // Number type: 21 - TO_EXP_POS = 21, // 0 to MAX - - // RANGE : [MIN_EXP, MAX_EXP] - - // The minimum exponent value, beneath which underflow to zero occurs. - // Number type: -324 (5e-324) - MIN_EXP = -1e7, // -1 to -MAX - - // The maximum exponent value, above which overflow to Infinity occurs. - // Number type: 308 (1.7976931348623157e+308) - // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow. - MAX_EXP = 1e7, // 1 to MAX - - // Whether BigNumber Errors are ever thrown. - ERRORS = true, // true or false - - // Change to intValidatorNoErrors if ERRORS is false. - isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors - - // Whether to use cryptographically-secure random number generation, if available. - CRYPTO = false, // true or false - - /* - * The modulo mode used when calculating the modulus: a mod n. - * The quotient (q = a / n) is calculated according to the corresponding rounding mode. - * The remainder (r) is calculated as: r = a - n * q. - * - * UP 0 The remainder is positive if the dividend is negative, else is negative. - * DOWN 1 The remainder has the same sign as the dividend. - * This modulo mode is commonly known as 'truncated division' and is - * equivalent to (a % n) in JavaScript. - * FLOOR 3 The remainder has the same sign as the divisor (Python %). - * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function. - * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). - * The remainder is always positive. - * - * The truncated division, floored division, Euclidian division and IEEE 754 remainder - * modes are commonly used for the modulus operation. - * Although the other rounding modes can also be used, they may not give useful results. - */ - MODULO_MODE = 1, // 0 to 9 - - // The maximum number of significant digits of the result of the toPower operation. - // If POW_PRECISION is 0, there will be unlimited significant digits. - POW_PRECISION = 0, // 0 to MAX - - // The format specification used by the BigNumber.prototype.toFormat method. - FORMAT = { - decimalSeparator: '.', - groupSeparator: ',', - groupSize: 3, - secondaryGroupSize: 0, - fractionGroupSeparator: '\xA0', // non-breaking space - fractionGroupSize: 0 - }; - - - /******************************************************************************************/ - - - // CONSTRUCTOR - - - /* - * The BigNumber constructor and exported function. - * Create and return a new instance of a BigNumber object. - * - * n {number|string|BigNumber} A numeric value. - * [b] {number} The base of n. Integer, 2 to 64 inclusive. - */ - function BigNumber( n, b ) { - var c, e, i, num, len, str, - x = this; - - // Enable constructor usage without new. - if ( !( x instanceof BigNumber ) ) { - - // 'BigNumber() constructor call without new: {n}' - if (ERRORS) raise( 26, 'constructor call without new', n ); - return new BigNumber( n, b ); - } - - // 'new BigNumber() base not an integer: {b}' - // 'new BigNumber() base out of range: {b}' - if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) { - - // Duplicate. - if ( n instanceof BigNumber ) { - x.s = n.s; - x.e = n.e; - x.c = ( n = n.c ) ? n.slice() : n; - id = 0; - return; - } - - if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) { - x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1; - - // Fast path for integers. - if ( n === ~~n ) { - for ( e = 0, i = n; i >= 10; i /= 10, e++ ); - x.e = e; - x.c = [n]; - id = 0; - return; - } - - str = n + ''; - } else { - if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num ); - x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1; - } - } else { - b = b | 0; - str = n + ''; - - // Ensure return value is rounded to DECIMAL_PLACES as with other bases. - // Allow exponential notation to be used with base 10 argument. - if ( b == 10 ) { - x = new BigNumber( n instanceof BigNumber ? n : str ); - return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE ); - } - - // Avoid potential interpretation of Infinity and NaN as base 44+ values. - // Any number in exponential form will fail due to the [Ee][+-]. - if ( ( num = typeof n == 'number' ) && n * 0 != 0 || - !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) + - '(?:\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) { - return parseNumeric( x, str, num, b ); - } - - if (num) { - x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1; - - if ( ERRORS && str.replace( /^0\.0*|\./, '' ).length > 15 ) { - - // 'new BigNumber() number type has more than 15 significant digits: {n}' - raise( id, tooManyDigits, n ); - } - - // Prevent later check for length on converted number. - num = false; - } else { - x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1; - } - - str = convertBase( str, 10, b, x.s ); - } - - // Decimal point? - if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' ); - - // Exponential form? - if ( ( i = str.search( /e/i ) ) > 0 ) { - - // Determine exponent. - if ( e < 0 ) e = i; - e += +str.slice( i + 1 ); - str = str.substring( 0, i ); - } else if ( e < 0 ) { - - // Integer. - e = str.length; - } - - // Determine leading zeros. - for ( i = 0; str.charCodeAt(i) === 48; i++ ); - - // Determine trailing zeros. - for ( len = str.length; str.charCodeAt(--len) === 48; ); - str = str.slice( i, len + 1 ); - - if (str) { - len = str.length; - - // Disallow numbers with over 15 significant digits if number type. - // 'new BigNumber() number type has more than 15 significant digits: {n}' - if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) { - raise( id, tooManyDigits, x.s * n ); - } - - e = e - i - 1; - - // Overflow? - if ( e > MAX_EXP ) { - - // Infinity. - x.c = x.e = null; - - // Underflow? - } else if ( e < MIN_EXP ) { - - // Zero. - x.c = [ x.e = 0 ]; - } else { - x.e = e; - x.c = []; - - // Transform base - - // e is the base 10 exponent. - // i is where to slice str to get the first element of the coefficient array. - i = ( e + 1 ) % LOG_BASE; - if ( e < 0 ) i += LOG_BASE; - - if ( i < len ) { - if (i) x.c.push( +str.slice( 0, i ) ); - - for ( len -= LOG_BASE; i < len; ) { - x.c.push( +str.slice( i, i += LOG_BASE ) ); - } - - str = str.slice(i); - i = LOG_BASE - str.length; - } else { - i -= len; - } - - for ( ; i--; str += '0' ); - x.c.push( +str ); - } - } else { - - // Zero. - x.c = [ x.e = 0 ]; - } - - id = 0; - } - - - // CONSTRUCTOR PROPERTIES - - - BigNumber.another = constructorFactory; - - BigNumber.ROUND_UP = 0; - BigNumber.ROUND_DOWN = 1; - BigNumber.ROUND_CEIL = 2; - BigNumber.ROUND_FLOOR = 3; - BigNumber.ROUND_HALF_UP = 4; - BigNumber.ROUND_HALF_DOWN = 5; - BigNumber.ROUND_HALF_EVEN = 6; - BigNumber.ROUND_HALF_CEIL = 7; - BigNumber.ROUND_HALF_FLOOR = 8; - BigNumber.EUCLID = 9; - - - /* - * Configure infrequently-changing library-wide settings. - * - * Accept an object or an argument list, with one or many of the following properties or - * parameters respectively: - * - * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive - * ROUNDING_MODE {number} Integer, 0 to 8 inclusive - * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or - * [integer -MAX to 0 incl., 0 to MAX incl.] - * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or - * [integer -MAX to -1 incl., integer 1 to MAX incl.] - * ERRORS {boolean|number} true, false, 1 or 0 - * CRYPTO {boolean|number} true, false, 1 or 0 - * MODULO_MODE {number} 0 to 9 inclusive - * POW_PRECISION {number} 0 to MAX inclusive - * FORMAT {object} See BigNumber.prototype.toFormat - * decimalSeparator {string} - * groupSeparator {string} - * groupSize {number} - * secondaryGroupSize {number} - * fractionGroupSeparator {string} - * fractionGroupSize {number} - * - * (The values assigned to the above FORMAT object properties are not checked for validity.) - * - * E.g. - * BigNumber.config(20, 4) is equivalent to - * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 }) - * - * Ignore properties/parameters set to null or undefined. - * Return an object with the properties current values. - */ - BigNumber.config = BigNumber.set = function () { - var v, p, - i = 0, - r = {}, - a = arguments, - o = a[0], - has = o && typeof o == 'object' - ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; } - : function () { if ( a.length > i ) return ( v = a[i++] ) != null; }; - - // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive. - // 'config() DECIMAL_PLACES not an integer: {v}' - // 'config() DECIMAL_PLACES out of range: {v}' - if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) { - DECIMAL_PLACES = v | 0; - } - r[p] = DECIMAL_PLACES; - - // ROUNDING_MODE {number} Integer, 0 to 8 inclusive. - // 'config() ROUNDING_MODE not an integer: {v}' - // 'config() ROUNDING_MODE out of range: {v}' - if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) { - ROUNDING_MODE = v | 0; - } - r[p] = ROUNDING_MODE; - - // EXPONENTIAL_AT {number|number[]} - // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive]. - // 'config() EXPONENTIAL_AT not an integer: {v}' - // 'config() EXPONENTIAL_AT out of range: {v}' - if ( has( p = 'EXPONENTIAL_AT' ) ) { - - if ( isArray(v) ) { - if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) { - TO_EXP_NEG = v[0] | 0; - TO_EXP_POS = v[1] | 0; - } - } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) { - TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 ); - } - } - r[p] = [ TO_EXP_NEG, TO_EXP_POS ]; - - // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or - // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive]. - // 'config() RANGE not an integer: {v}' - // 'config() RANGE cannot be zero: {v}' - // 'config() RANGE out of range: {v}' - if ( has( p = 'RANGE' ) ) { - - if ( isArray(v) ) { - if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) { - MIN_EXP = v[0] | 0; - MAX_EXP = v[1] | 0; - } - } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) { - if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 ); - else if (ERRORS) raise( 2, p + ' cannot be zero', v ); - } - } - r[p] = [ MIN_EXP, MAX_EXP ]; - - // ERRORS {boolean|number} true, false, 1 or 0. - // 'config() ERRORS not a boolean or binary digit: {v}' - if ( has( p = 'ERRORS' ) ) { - - if ( v === !!v || v === 1 || v === 0 ) { - id = 0; - isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors; - } else if (ERRORS) { - raise( 2, p + notBool, v ); - } - } - r[p] = ERRORS; - - // CRYPTO {boolean|number} true, false, 1 or 0. - // 'config() CRYPTO not a boolean or binary digit: {v}' - // 'config() crypto unavailable: {crypto}' - if ( has( p = 'CRYPTO' ) ) { - - if ( v === true || v === false || v === 1 || v === 0 ) { - if (v) { - v = typeof crypto == 'undefined'; - if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) { - CRYPTO = true; - } else if (ERRORS) { - raise( 2, 'crypto unavailable', v ? void 0 : crypto ); - } else { - CRYPTO = false; - } - } else { - CRYPTO = false; - } - } else if (ERRORS) { - raise( 2, p + notBool, v ); - } - } - r[p] = CRYPTO; - - // MODULO_MODE {number} Integer, 0 to 9 inclusive. - // 'config() MODULO_MODE not an integer: {v}' - // 'config() MODULO_MODE out of range: {v}' - if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) { - MODULO_MODE = v | 0; - } - r[p] = MODULO_MODE; - - // POW_PRECISION {number} Integer, 0 to MAX inclusive. - // 'config() POW_PRECISION not an integer: {v}' - // 'config() POW_PRECISION out of range: {v}' - if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) { - POW_PRECISION = v | 0; - } - r[p] = POW_PRECISION; - - // FORMAT {object} - // 'config() FORMAT not an object: {v}' - if ( has( p = 'FORMAT' ) ) { - - if ( typeof v == 'object' ) { - FORMAT = v; - } else if (ERRORS) { - raise( 2, p + ' not an object', v ); - } - } - r[p] = FORMAT; - - return r; - }; - - - /* - * Return a new BigNumber whose value is the maximum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.max = function () { return maxOrMin( arguments, P.lt ); }; - - - /* - * Return a new BigNumber whose value is the minimum of the arguments. - * - * arguments {number|string|BigNumber} - */ - BigNumber.min = function () { return maxOrMin( arguments, P.gt ); }; - - - /* - * Return a new BigNumber with a random value equal to or greater than 0 and less than 1, - * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing - * zeros are produced). - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * - * 'random() decimal places not an integer: {dp}' - * 'random() decimal places out of range: {dp}' - * 'random() crypto unavailable: {crypto}' - */ - BigNumber.random = (function () { - var pow2_53 = 0x20000000000000; - - // Return a 53 bit integer n, where 0 <= n < 9007199254740992. - // Check if Math.random() produces more than 32 bits of randomness. - // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits. - // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1. - var random53bitInt = (Math.random() * pow2_53) & 0x1fffff - ? function () { return mathfloor( Math.random() * pow2_53 ); } - : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) + - (Math.random() * 0x800000 | 0); }; - - return function (dp) { - var a, b, e, k, v, - i = 0, - c = [], - rand = new BigNumber(ONE); - - dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0; - k = mathceil( dp / LOG_BASE ); - - if (CRYPTO) { - - // Browsers supporting crypto.getRandomValues. - if (crypto.getRandomValues) { - - a = crypto.getRandomValues( new Uint32Array( k *= 2 ) ); - - for ( ; i < k; ) { - - // 53 bits: - // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2) - // 11111 11111111 11111111 11111111 11100000 00000000 00000000 - // ((Math.pow(2, 32) - 1) >>> 11).toString(2) - // 11111 11111111 11111111 - // 0x20000 is 2^21. - v = a[i] * 0x20000 + (a[i + 1] >>> 11); - - // Rejection sampling: - // 0 <= v < 9007199254740992 - // Probability that v >= 9e15, is - // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251 - if ( v >= 9e15 ) { - b = crypto.getRandomValues( new Uint32Array(2) ); - a[i] = b[0]; - a[i + 1] = b[1]; - } else { - - // 0 <= v <= 8999999999999999 - // 0 <= (v % 1e14) <= 99999999999999 - c.push( v % 1e14 ); - i += 2; - } - } - i = k / 2; - - // Node.js supporting crypto.randomBytes. - } else if (crypto.randomBytes) { - - // buffer - a = crypto.randomBytes( k *= 7 ); - - for ( ; i < k; ) { - - // 0x1000000000000 is 2^48, 0x10000000000 is 2^40 - // 0x100000000 is 2^32, 0x1000000 is 2^24 - // 11111 11111111 11111111 11111111 11111111 11111111 11111111 - // 0 <= v < 9007199254740992 - v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) + - ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) + - ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6]; - - if ( v >= 9e15 ) { - crypto.randomBytes(7).copy( a, i ); - } else { - - // 0 <= (v % 1e14) <= 99999999999999 - c.push( v % 1e14 ); - i += 7; - } - } - i = k / 7; - } else { - CRYPTO = false; - if (ERRORS) raise( 14, 'crypto unavailable', crypto ); - } - } - - // Use Math.random. - if (!CRYPTO) { - - for ( ; i < k; ) { - v = random53bitInt(); - if ( v < 9e15 ) c[i++] = v % 1e14; - } - } - - k = c[--i]; - dp %= LOG_BASE; - - // Convert trailing digits to zeros according to dp. - if ( k && dp ) { - v = POWS_TEN[LOG_BASE - dp]; - c[i] = mathfloor( k / v ) * v; - } - - // Remove trailing elements which are zero. - for ( ; c[i] === 0; c.pop(), i-- ); - - // Zero? - if ( i < 0 ) { - c = [ e = 0 ]; - } else { - - // Remove leading elements which are zero and adjust exponent accordingly. - for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE); - - // Count the digits of the first element of c to determine leading zeros, and... - for ( i = 1, v = c[0]; v >= 10; v /= 10, i++); - - // adjust the exponent accordingly. - if ( i < LOG_BASE ) e -= LOG_BASE - i; - } - - rand.e = e; - rand.c = c; - return rand; - }; - })(); - - - // PRIVATE FUNCTIONS - - - // Convert a numeric string of baseIn to a numeric string of baseOut. - function convertBase( str, baseOut, baseIn, sign ) { - var d, e, k, r, x, xc, y, - i = str.indexOf( '.' ), - dp = DECIMAL_PLACES, - rm = ROUNDING_MODE; - - if ( baseIn < 37 ) str = str.toLowerCase(); - - // Non-integer. - if ( i >= 0 ) { - k = POW_PRECISION; - - // Unlimited precision. - POW_PRECISION = 0; - str = str.replace( '.', '' ); - y = new BigNumber(baseIn); - x = y.pow( str.length - i ); - POW_PRECISION = k; - - // Convert str as if an integer, then restore the fraction part by dividing the - // result by its base raised to a power. - y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut ); - y.e = y.c.length; - } - - // Convert the number as integer. - xc = toBaseOut( str, baseIn, baseOut ); - e = k = xc.length; - - // Remove trailing zeros. - for ( ; xc[--k] == 0; xc.pop() ); - if ( !xc[0] ) return '0'; - - if ( i < 0 ) { - --e; - } else { - x.c = xc; - x.e = e; - - // sign is needed for correct rounding. - x.s = sign; - x = div( x, y, dp, rm, baseOut ); - xc = x.c; - r = x.r; - e = x.e; - } - - d = e + dp + 1; - - // The rounding digit, i.e. the digit to the right of the digit that may be rounded up. - i = xc[d]; - k = baseOut / 2; - r = r || d < 0 || xc[d + 1] != null; - - r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) ) - : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 || - rm == ( x.s < 0 ? 8 : 7 ) ); - - if ( d < 1 || !xc[0] ) { - - // 1^-dp or 0. - str = r ? toFixedPoint( '1', -dp ) : '0'; - } else { - xc.length = d; - - if (r) { - - // Rounding up may mean the previous digit has to be rounded up and so on. - for ( --baseOut; ++xc[--d] > baseOut; ) { - xc[d] = 0; - - if ( !d ) { - ++e; - xc = [1].concat(xc); - } - } - } - - // Determine trailing zeros. - for ( k = xc.length; !xc[--k]; ); - - // E.g. [4, 11, 15] becomes 4bf. - for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) ); - str = toFixedPoint( str, e ); - } - - // The caller will add the sign. - return str; - } - - - // Perform division in the specified base. Called by div and convertBase. - div = (function () { - - // Assume non-zero x and k. - function multiply( x, k, base ) { - var m, temp, xlo, xhi, - carry = 0, - i = x.length, - klo = k % SQRT_BASE, - khi = k / SQRT_BASE | 0; - - for ( x = x.slice(); i--; ) { - xlo = x[i] % SQRT_BASE; - xhi = x[i] / SQRT_BASE | 0; - m = khi * xlo + xhi * klo; - temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry; - carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi; - x[i] = temp % base; - } - - if (carry) x = [carry].concat(x); - - return x; - } - - function compare( a, b, aL, bL ) { - var i, cmp; - - if ( aL != bL ) { - cmp = aL > bL ? 1 : -1; - } else { - - for ( i = cmp = 0; i < aL; i++ ) { - - if ( a[i] != b[i] ) { - cmp = a[i] > b[i] ? 1 : -1; - break; - } - } - } - return cmp; - } - - function subtract( a, b, aL, base ) { - var i = 0; - - // Subtract b from a. - for ( ; aL--; ) { - a[aL] -= i; - i = a[aL] < b[aL] ? 1 : 0; - a[aL] = i * base + a[aL] - b[aL]; - } - - // Remove leading zeros. - for ( ; !a[0] && a.length > 1; a.splice(0, 1) ); - } - - // x: dividend, y: divisor. - return function ( x, y, dp, rm, base ) { - var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, - yL, yz, - s = x.s == y.s ? 1 : -1, - xc = x.c, - yc = y.c; - - // Either NaN, Infinity or 0? - if ( !xc || !xc[0] || !yc || !yc[0] ) { - - return new BigNumber( - - // Return NaN if either NaN, or both Infinity or 0. - !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN : - - // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0. - xc && xc[0] == 0 || !yc ? s * 0 : s / 0 - ); - } - - q = new BigNumber(s); - qc = q.c = []; - e = x.e - y.e; - s = dp + e + 1; - - if ( !base ) { - base = BASE; - e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE ); - s = s / LOG_BASE | 0; - } - - // Result exponent may be one less then the current value of e. - // The coefficients of the BigNumbers from convertBase may have trailing zeros. - for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ ); - if ( yc[i] > ( xc[i] || 0 ) ) e--; - - if ( s < 0 ) { - qc.push(1); - more = true; - } else { - xL = xc.length; - yL = yc.length; - i = 0; - s += 2; - - // Normalise xc and yc so highest order digit of yc is >= base / 2. - - n = mathfloor( base / ( yc[0] + 1 ) ); - - // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1. - // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) { - if ( n > 1 ) { - yc = multiply( yc, n, base ); - xc = multiply( xc, n, base ); - yL = yc.length; - xL = xc.length; - } - - xi = yL; - rem = xc.slice( 0, yL ); - remL = rem.length; - - // Add zeros to make remainder as long as divisor. - for ( ; remL < yL; rem[remL++] = 0 ); - yz = yc.slice(); - yz = [0].concat(yz); - yc0 = yc[0]; - if ( yc[1] >= base / 2 ) yc0++; - // Not necessary, but to prevent trial digit n > base, when using base 3. - // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15; - - do { - n = 0; - - // Compare divisor and remainder. - cmp = compare( yc, rem, yL, remL ); - - // If divisor < remainder. - if ( cmp < 0 ) { - - // Calculate trial digit, n. - - rem0 = rem[0]; - if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 ); - - // n is how many times the divisor goes into the current remainder. - n = mathfloor( rem0 / yc0 ); - - // Algorithm: - // 1. product = divisor * trial digit (n) - // 2. if product > remainder: product -= divisor, n-- - // 3. remainder -= product - // 4. if product was < remainder at 2: - // 5. compare new remainder and divisor - // 6. If remainder > divisor: remainder -= divisor, n++ - - if ( n > 1 ) { - - // n may be > base only when base is 3. - if (n >= base) n = base - 1; - - // product = divisor * trial digit. - prod = multiply( yc, n, base ); - prodL = prod.length; - remL = rem.length; - - // Compare product and remainder. - // If product > remainder. - // Trial digit n too high. - // n is 1 too high about 5% of the time, and is not known to have - // ever been more than 1 too high. - while ( compare( prod, rem, prodL, remL ) == 1 ) { - n--; - - // Subtract divisor from product. - subtract( prod, yL < prodL ? yz : yc, prodL, base ); - prodL = prod.length; - cmp = 1; - } - } else { - - // n is 0 or 1, cmp is -1. - // If n is 0, there is no need to compare yc and rem again below, - // so change cmp to 1 to avoid it. - // If n is 1, leave cmp as -1, so yc and rem are compared again. - if ( n == 0 ) { - - // divisor < remainder, so n must be at least 1. - cmp = n = 1; - } - - // product = divisor - prod = yc.slice(); - prodL = prod.length; - } - - if ( prodL < remL ) prod = [0].concat(prod); - - // Subtract product from remainder. - subtract( rem, prod, remL, base ); - remL = rem.length; - - // If product was < remainder. - if ( cmp == -1 ) { - - // Compare divisor and new remainder. - // If divisor < new remainder, subtract divisor from remainder. - // Trial digit n too low. - // n is 1 too low about 5% of the time, and very rarely 2 too low. - while ( compare( yc, rem, yL, remL ) < 1 ) { - n++; - - // Subtract divisor from remainder. - subtract( rem, yL < remL ? yz : yc, remL, base ); - remL = rem.length; - } - } - } else if ( cmp === 0 ) { - n++; - rem = [0]; - } // else cmp === 1 and n will be 0 - - // Add the next digit, n, to the result array. - qc[i++] = n; - - // Update the remainder. - if ( rem[0] ) { - rem[remL++] = xc[xi] || 0; - } else { - rem = [ xc[xi] ]; - remL = 1; - } - } while ( ( xi++ < xL || rem[0] != null ) && s-- ); - - more = rem[0] != null; - - // Leading zero? - if ( !qc[0] ) qc.splice(0, 1); - } - - if ( base == BASE ) { - - // To calculate q.e, first get the number of digits of qc[0]. - for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ ); - round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more ); - - // Caller is convertBase. - } else { - q.e = e; - q.r = +more; - } - - return q; - }; - })(); - - - /* - * Return a string representing the value of BigNumber n in fixed-point or exponential - * notation rounded to the specified decimal places or significant digits. - * - * n is a BigNumber. - * i is the index of the last digit required (i.e. the digit that may be rounded up). - * rm is the rounding mode. - * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24. - */ - function format( n, i, rm, caller ) { - var c0, e, ne, len, str; - - rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode ) - ? rm | 0 : ROUNDING_MODE; - - if ( !n.c ) return n.toString(); - c0 = n.c[0]; - ne = n.e; - - if ( i == null ) { - str = coeffToString( n.c ); - str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG - ? toExponential( str, ne ) - : toFixedPoint( str, ne ); - } else { - n = round( new BigNumber(n), i, rm ); - - // n.e may have changed if the value was rounded up. - e = n.e; - - str = coeffToString( n.c ); - len = str.length; - - // toPrecision returns exponential notation if the number of significant digits - // specified is less than the number of digits necessary to represent the integer - // part of the value in fixed-point notation. - - // Exponential notation. - if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) { - - // Append zeros? - for ( ; len < i; str += '0', len++ ); - str = toExponential( str, e ); - - // Fixed-point notation. - } else { - i -= ne; - str = toFixedPoint( str, e ); - - // Append zeros? - if ( e + 1 > len ) { - if ( --i > 0 ) for ( str += '.'; i--; str += '0' ); - } else { - i += e - len; - if ( i > 0 ) { - if ( e + 1 == len ) str += '.'; - for ( ; i--; str += '0' ); - } - } - } - } - - return n.s < 0 && c0 ? '-' + str : str; - } - - - // Handle BigNumber.max and BigNumber.min. - function maxOrMin( args, method ) { - var m, n, - i = 0; - - if ( isArray( args[0] ) ) args = args[0]; - m = new BigNumber( args[0] ); - - for ( ; ++i < args.length; ) { - n = new BigNumber( args[i] ); - - // If any number is NaN, return NaN. - if ( !n.s ) { - m = n; - break; - } else if ( method.call( m, n ) ) { - m = n; - } - } - - return m; - } - - - /* - * Return true if n is an integer in range, otherwise throw. - * Use for argument validation when ERRORS is true. - */ - function intValidatorWithErrors( n, min, max, caller, name ) { - if ( n < min || n > max || n != truncate(n) ) { - raise( caller, ( name || 'decimal places' ) + - ( n < min || n > max ? ' out of range' : ' not an integer' ), n ); - } - - return true; - } - - - /* - * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP. - * Called by minus, plus and times. - */ - function normalise( n, c, e ) { - var i = 1, - j = c.length; - - // Remove trailing zeros. - for ( ; !c[--j]; c.pop() ); - - // Calculate the base 10 exponent. First get the number of digits of c[0]. - for ( j = c[0]; j >= 10; j /= 10, i++ ); - - // Overflow? - if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) { - - // Infinity. - n.c = n.e = null; - - // Underflow? - } else if ( e < MIN_EXP ) { - - // Zero. - n.c = [ n.e = 0 ]; - } else { - n.e = e; - n.c = c; - } - - return n; - } - - - // Handle values that fail the validity test in BigNumber. - parseNumeric = (function () { - var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, - dotAfter = /^([^.]+)\.$/, - dotBefore = /^\.([^.]+)$/, - isInfinityOrNaN = /^-?(Infinity|NaN)$/, - whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g; - - return function ( x, str, num, b ) { - var base, - s = num ? str : str.replace( whitespaceOrPlus, '' ); - - // No exception on ±Infinity or NaN. - if ( isInfinityOrNaN.test(s) ) { - x.s = isNaN(s) ? null : s < 0 ? -1 : 1; - } else { - if ( !num ) { - - // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i - s = s.replace( basePrefix, function ( m, p1, p2 ) { - base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8; - return !b || b == base ? p1 : m; - }); - - if (b) { - base = b; - - // E.g. '1.' to '1', '.1' to '0.1' - s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' ); - } - - if ( str != s ) return new BigNumber( s, base ); - } - - // 'new BigNumber() not a number: {n}' - // 'new BigNumber() not a base {b} number: {n}' - if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str ); - x.s = null; - } - - x.c = x.e = null; - id = 0; - } - })(); - - - // Throw a BigNumber Error. - function raise( caller, msg, val ) { - var error = new Error( [ - 'new BigNumber', // 0 - 'cmp', // 1 - 'config', // 2 - 'div', // 3 - 'divToInt', // 4 - 'eq', // 5 - 'gt', // 6 - 'gte', // 7 - 'lt', // 8 - 'lte', // 9 - 'minus', // 10 - 'mod', // 11 - 'plus', // 12 - 'precision', // 13 - 'random', // 14 - 'round', // 15 - 'shift', // 16 - 'times', // 17 - 'toDigits', // 18 - 'toExponential', // 19 - 'toFixed', // 20 - 'toFormat', // 21 - 'toFraction', // 22 - 'pow', // 23 - 'toPrecision', // 24 - 'toString', // 25 - 'BigNumber' // 26 - ][caller] + '() ' + msg + ': ' + val ); - - error.name = 'BigNumber Error'; - id = 0; - throw error; - } - - - /* - * Round x to sd significant digits using rounding mode rm. Check for over/under-flow. - * If r is truthy, it is known that there are more digits after the rounding digit. - */ - function round( x, sd, rm, r ) { - var d, i, j, k, n, ni, rd, - xc = x.c, - pows10 = POWS_TEN; - - // if x is not Infinity or NaN... - if (xc) { - - // rd is the rounding digit, i.e. the digit after the digit that may be rounded up. - // n is a base 1e14 number, the value of the element of array x.c containing rd. - // ni is the index of n within x.c. - // d is the number of digits of n. - // i is the index of rd within n including leading zeros. - // j is the actual index of rd within n (if < 0, rd is a leading zero). - out: { - - // Get the number of digits of the first element of xc. - for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ ); - i = sd - d; - - // If the rounding digit is in the first element of xc... - if ( i < 0 ) { - i += LOG_BASE; - j = sd; - n = xc[ ni = 0 ]; - - // Get the rounding digit at index j of n. - rd = n / pows10[ d - j - 1 ] % 10 | 0; - } else { - ni = mathceil( ( i + 1 ) / LOG_BASE ); - - if ( ni >= xc.length ) { - - if (r) { - - // Needed by sqrt. - for ( ; xc.length <= ni; xc.push(0) ); - n = rd = 0; - d = 1; - i %= LOG_BASE; - j = i - LOG_BASE + 1; - } else { - break out; - } - } else { - n = k = xc[ni]; - - // Get the number of digits of n. - for ( d = 1; k >= 10; k /= 10, d++ ); - - // Get the index of rd within n. - i %= LOG_BASE; - - // Get the index of rd within n, adjusted for leading zeros. - // The number of leading zeros of n is given by LOG_BASE - d. - j = i - LOG_BASE + d; - - // Get the rounding digit at index j of n. - rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0; - } - } - - r = r || sd < 0 || - - // Are there any non-zero digits after the rounding digit? - // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right - // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714. - xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] ); - - r = rm < 4 - ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) ) - : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 && - - // Check whether the digit to the left of the rounding digit is odd. - ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 || - rm == ( x.s < 0 ? 8 : 7 ) ); - - if ( sd < 1 || !xc[0] ) { - xc.length = 0; - - if (r) { - - // Convert sd to decimal places. - sd -= x.e + 1; - - // 1, 0.1, 0.01, 0.001, 0.0001 etc. - xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ]; - x.e = -sd || 0; - } else { - - // Zero. - xc[0] = x.e = 0; - } - - return x; - } - - // Remove excess digits. - if ( i == 0 ) { - xc.length = ni; - k = 1; - ni--; - } else { - xc.length = ni + 1; - k = pows10[ LOG_BASE - i ]; - - // E.g. 56700 becomes 56000 if 7 is the rounding digit. - // j > 0 means i > number of leading zeros of n. - xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0; - } - - // Round up? - if (r) { - - for ( ; ; ) { - - // If the digit to be rounded up is in the first element of xc... - if ( ni == 0 ) { - - // i will be the length of xc[0] before k is added. - for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ ); - j = xc[0] += k; - for ( k = 1; j >= 10; j /= 10, k++ ); - - // if i != k the length has increased. - if ( i != k ) { - x.e++; - if ( xc[0] == BASE ) xc[0] = 1; - } - - break; - } else { - xc[ni] += k; - if ( xc[ni] != BASE ) break; - xc[ni--] = 0; - k = 1; - } - } - } - - // Remove trailing zeros. - for ( i = xc.length; xc[--i] === 0; xc.pop() ); - } - - // Overflow? Infinity. - if ( x.e > MAX_EXP ) { - x.c = x.e = null; - - // Underflow? Zero. - } else if ( x.e < MIN_EXP ) { - x.c = [ x.e = 0 ]; - } - } - - return x; - } - - - // PROTOTYPE/INSTANCE METHODS - - - /* - * Return a new BigNumber whose value is the absolute value of this BigNumber. - */ - P.absoluteValue = P.abs = function () { - var x = new BigNumber(this); - if ( x.s < 0 ) x.s = 1; - return x; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole - * number in the direction of Infinity. - */ - P.ceil = function () { - return round( new BigNumber(this), this.e + 1, 2 ); - }; - - - /* - * Return - * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b), - * -1 if the value of this BigNumber is less than the value of BigNumber(y, b), - * 0 if they have the same value, - * or null if the value of either is NaN. - */ - P.comparedTo = P.cmp = function ( y, b ) { - id = 1; - return compare( this, new BigNumber( y, b ) ); - }; - - - /* - * Return the number of decimal places of the value of this BigNumber, or null if the value - * of this BigNumber is ±Infinity or NaN. - */ - P.decimalPlaces = P.dp = function () { - var n, v, - c = this.c; - - if ( !c ) return null; - n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE; - - // Subtract the number of trailing zeros of the last number. - if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- ); - if ( n < 0 ) n = 0; - - return n; - }; - - - /* - * n / 0 = I - * n / N = N - * n / I = 0 - * 0 / n = 0 - * 0 / 0 = N - * 0 / N = N - * 0 / I = 0 - * N / n = N - * N / 0 = N - * N / N = N - * N / I = N - * I / n = I - * I / 0 = I - * I / N = N - * I / I = N - * - * Return a new BigNumber whose value is the value of this BigNumber divided by the value of - * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE. - */ - P.dividedBy = P.div = function ( y, b ) { - id = 3; - return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE ); - }; - - - /* - * Return a new BigNumber whose value is the integer part of dividing the value of this - * BigNumber by the value of BigNumber(y, b). - */ - P.dividedToIntegerBy = P.divToInt = function ( y, b ) { - id = 4; - return div( this, new BigNumber( y, b ), 0, 1 ); - }; - - - /* - * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b), - * otherwise returns false. - */ - P.equals = P.eq = function ( y, b ) { - id = 5; - return compare( this, new BigNumber( y, b ) ) === 0; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole - * number in the direction of -Infinity. - */ - P.floor = function () { - return round( new BigNumber(this), this.e + 1, 3 ); - }; - - - /* - * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b), - * otherwise returns false. - */ - P.greaterThan = P.gt = function ( y, b ) { - id = 6; - return compare( this, new BigNumber( y, b ) ) > 0; - }; - - - /* - * Return true if the value of this BigNumber is greater than or equal to the value of - * BigNumber(y, b), otherwise returns false. - */ - P.greaterThanOrEqualTo = P.gte = function ( y, b ) { - id = 7; - return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0; - - }; - - - /* - * Return true if the value of this BigNumber is a finite number, otherwise returns false. - */ - P.isFinite = function () { - return !!this.c; - }; - - - /* - * Return true if the value of this BigNumber is an integer, otherwise return false. - */ - P.isInteger = P.isInt = function () { - return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2; - }; - - - /* - * Return true if the value of this BigNumber is NaN, otherwise returns false. - */ - P.isNaN = function () { - return !this.s; - }; - - - /* - * Return true if the value of this BigNumber is negative, otherwise returns false. - */ - P.isNegative = P.isNeg = function () { - return this.s < 0; - }; - - - /* - * Return true if the value of this BigNumber is 0 or -0, otherwise returns false. - */ - P.isZero = function () { - return !!this.c && this.c[0] == 0; - }; - - - /* - * Return true if the value of this BigNumber is less than the value of BigNumber(y, b), - * otherwise returns false. - */ - P.lessThan = P.lt = function ( y, b ) { - id = 8; - return compare( this, new BigNumber( y, b ) ) < 0; - }; - - - /* - * Return true if the value of this BigNumber is less than or equal to the value of - * BigNumber(y, b), otherwise returns false. - */ - P.lessThanOrEqualTo = P.lte = function ( y, b ) { - id = 9; - return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0; - }; - - - /* - * n - 0 = n - * n - N = N - * n - I = -I - * 0 - n = -n - * 0 - 0 = 0 - * 0 - N = N - * 0 - I = -I - * N - n = N - * N - 0 = N - * N - N = N - * N - I = N - * I - n = I - * I - 0 = I - * I - N = N - * I - I = N - * - * Return a new BigNumber whose value is the value of this BigNumber minus the value of - * BigNumber(y, b). - */ - P.minus = P.sub = function ( y, b ) { - var i, j, t, xLTy, - x = this, - a = x.s; - - id = 10; - y = new BigNumber( y, b ); - b = y.s; - - // Either NaN? - if ( !a || !b ) return new BigNumber(NaN); - - // Signs differ? - if ( a != b ) { - y.s = -b; - return x.plus(y); - } - - var xe = x.e / LOG_BASE, - ye = y.e / LOG_BASE, - xc = x.c, - yc = y.c; - - if ( !xe || !ye ) { - - // Either Infinity? - if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN ); - - // Either zero? - if ( !xc[0] || !yc[0] ) { - - // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. - return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x : - - // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity - ROUNDING_MODE == 3 ? -0 : 0 ); - } - } - - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - - // Determine which is the bigger number. - if ( a = xe - ye ) { - - if ( xLTy = a < 0 ) { - a = -a; - t = xc; - } else { - ye = xe; - t = yc; - } - - t.reverse(); - - // Prepend zeros to equalise exponents. - for ( b = a; b--; t.push(0) ); - t.reverse(); - } else { - - // Exponents equal. Check digit by digit. - j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b; - - for ( a = b = 0; b < j; b++ ) { - - if ( xc[b] != yc[b] ) { - xLTy = xc[b] < yc[b]; - break; - } - } - } - - // x < y? Point xc to the array of the bigger number. - if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s; - - b = ( j = yc.length ) - ( i = xc.length ); - - // Append zeros to xc if shorter. - // No need to add zeros to yc if shorter as subtract only needs to start at yc.length. - if ( b > 0 ) for ( ; b--; xc[i++] = 0 ); - b = BASE - 1; - - // Subtract yc from xc. - for ( ; j > a; ) { - - if ( xc[--j] < yc[j] ) { - for ( i = j; i && !xc[--i]; xc[i] = b ); - --xc[i]; - xc[j] += BASE; - } - - xc[j] -= yc[j]; - } - - // Remove leading zeros and adjust exponent accordingly. - for ( ; xc[0] == 0; xc.splice(0, 1), --ye ); - - // Zero? - if ( !xc[0] ) { - - // Following IEEE 754 (2008) 6.3, - // n - n = +0 but n - n = -0 when rounding towards -Infinity. - y.s = ROUNDING_MODE == 3 ? -1 : 1; - y.c = [ y.e = 0 ]; - return y; - } - - // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity - // for finite x and y. - return normalise( y, xc, ye ); - }; - - - /* - * n % 0 = N - * n % N = N - * n % I = n - * 0 % n = 0 - * -0 % n = -0 - * 0 % 0 = N - * 0 % N = N - * 0 % I = 0 - * N % n = N - * N % 0 = N - * N % N = N - * N % I = N - * I % n = N - * I % 0 = N - * I % N = N - * I % I = N - * - * Return a new BigNumber whose value is the value of this BigNumber modulo the value of - * BigNumber(y, b). The result depends on the value of MODULO_MODE. - */ - P.modulo = P.mod = function ( y, b ) { - var q, s, - x = this; - - id = 11; - y = new BigNumber( y, b ); - - // Return NaN if x is Infinity or NaN, or y is NaN or zero. - if ( !x.c || !y.s || y.c && !y.c[0] ) { - return new BigNumber(NaN); - - // Return x if y is Infinity or x is zero. - } else if ( !y.c || x.c && !x.c[0] ) { - return new BigNumber(x); - } - - if ( MODULO_MODE == 9 ) { - - // Euclidian division: q = sign(y) * floor(x / abs(y)) - // r = x - qy where 0 <= r < abs(y) - s = y.s; - y.s = 1; - q = div( x, y, 0, 3 ); - y.s = s; - q.s *= s; - } else { - q = div( x, y, 0, MODULO_MODE ); - } - - return x.minus( q.times(y) ); - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber negated, - * i.e. multiplied by -1. - */ - P.negated = P.neg = function () { - var x = new BigNumber(this); - x.s = -x.s || null; - return x; - }; - - - /* - * n + 0 = n - * n + N = N - * n + I = I - * 0 + n = n - * 0 + 0 = 0 - * 0 + N = N - * 0 + I = I - * N + n = N - * N + 0 = N - * N + N = N - * N + I = N - * I + n = I - * I + 0 = I - * I + N = N - * I + I = I - * - * Return a new BigNumber whose value is the value of this BigNumber plus the value of - * BigNumber(y, b). - */ - P.plus = P.add = function ( y, b ) { - var t, - x = this, - a = x.s; - - id = 12; - y = new BigNumber( y, b ); - b = y.s; - - // Either NaN? - if ( !a || !b ) return new BigNumber(NaN); - - // Signs differ? - if ( a != b ) { - y.s = -b; - return x.minus(y); - } - - var xe = x.e / LOG_BASE, - ye = y.e / LOG_BASE, - xc = x.c, - yc = y.c; - - if ( !xe || !ye ) { - - // Return ±Infinity if either ±Infinity. - if ( !xc || !yc ) return new BigNumber( a / 0 ); - - // Either zero? - // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. - if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 ); - } - - xe = bitFloor(xe); - ye = bitFloor(ye); - xc = xc.slice(); - - // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts. - if ( a = xe - ye ) { - if ( a > 0 ) { - ye = xe; - t = yc; - } else { - a = -a; - t = xc; - } - - t.reverse(); - for ( ; a--; t.push(0) ); - t.reverse(); - } - - a = xc.length; - b = yc.length; - - // Point xc to the longer array, and b to the shorter length. - if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a; - - // Only start adding at yc.length - 1 as the further digits of xc can be ignored. - for ( a = 0; b; ) { - a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0; - xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE; - } - - if (a) { - xc = [a].concat(xc); - ++ye; - } - - // No need to check for zero, as +x + +y != 0 && -x + -y != 0 - // ye = MAX_EXP + 1 possible - return normalise( y, xc, ye ); - }; - - - /* - * Return the number of significant digits of the value of this BigNumber. - * - * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0. - */ - P.precision = P.sd = function (z) { - var n, v, - x = this, - c = x.c; - - // 'precision() argument not a boolean or binary digit: {z}' - if ( z != null && z !== !!z && z !== 1 && z !== 0 ) { - if (ERRORS) raise( 13, 'argument' + notBool, z ); - if ( z != !!z ) z = null; - } - - if ( !c ) return null; - v = c.length - 1; - n = v * LOG_BASE + 1; - - if ( v = c[v] ) { - - // Subtract the number of trailing zeros of the last element. - for ( ; v % 10 == 0; v /= 10, n-- ); - - // Add the number of digits of the first element. - for ( v = c[0]; v >= 10; v /= 10, n++ ); - } - - if ( z && x.e + 1 > n ) n = x.e + 1; - - return n; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of - * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if - * omitted. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'round() decimal places out of range: {dp}' - * 'round() decimal places not an integer: {dp}' - * 'round() rounding mode not an integer: {rm}' - * 'round() rounding mode out of range: {rm}' - */ - P.round = function ( dp, rm ) { - var n = new BigNumber(this); - - if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) { - round( n, ~~dp + this.e + 1, rm == null || - !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 ); - } - - return n; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber shifted by k places - * (powers of 10). Shift to the right if n > 0, and to the left if n < 0. - * - * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive. - * - * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity - * otherwise. - * - * 'shift() argument not an integer: {k}' - * 'shift() argument out of range: {k}' - */ - P.shift = function (k) { - var n = this; - return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' ) - - // k < 1e+21, or truncate(k) will produce exponential notation. - ? n.times( '1e' + truncate(k) ) - : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER ) - ? n.s * ( k < 0 ? 0 : 1 / 0 ) - : n ); - }; - - - /* - * sqrt(-n) = N - * sqrt( N) = N - * sqrt(-I) = N - * sqrt( I) = I - * sqrt( 0) = 0 - * sqrt(-0) = -0 - * - * Return a new BigNumber whose value is the square root of the value of this BigNumber, - * rounded according to DECIMAL_PLACES and ROUNDING_MODE. - */ - P.squareRoot = P.sqrt = function () { - var m, n, r, rep, t, - x = this, - c = x.c, - s = x.s, - e = x.e, - dp = DECIMAL_PLACES + 4, - half = new BigNumber('0.5'); - - // Negative/NaN/Infinity/zero? - if ( s !== 1 || !c || !c[0] ) { - return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 ); - } - - // Initial estimate. - s = Math.sqrt( +x ); - - // Math.sqrt underflow/overflow? - // Pass x to Math.sqrt as integer, then adjust the exponent of the result. - if ( s == 0 || s == 1 / 0 ) { - n = coeffToString(c); - if ( ( n.length + e ) % 2 == 0 ) n += '0'; - s = Math.sqrt(n); - e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 ); - - if ( s == 1 / 0 ) { - n = '1e' + e; - } else { - n = s.toExponential(); - n = n.slice( 0, n.indexOf('e') + 1 ) + e; - } - - r = new BigNumber(n); - } else { - r = new BigNumber( s + '' ); - } - - // Check for zero. - // r could be zero if MIN_EXP is changed after the this value was created. - // This would cause a division by zero (x/t) and hence Infinity below, which would cause - // coeffToString to throw. - if ( r.c[0] ) { - e = r.e; - s = e + dp; - if ( s < 3 ) s = 0; - - // Newton-Raphson iteration. - for ( ; ; ) { - t = r; - r = half.times( t.plus( div( x, t, dp, 1 ) ) ); - - if ( coeffToString( t.c ).slice( 0, s ) === ( n = - coeffToString( r.c ) ).slice( 0, s ) ) { - - // The exponent of r may here be one less than the final result exponent, - // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits - // are indexed correctly. - if ( r.e < e ) --s; - n = n.slice( s - 3, s + 1 ); - - // The 4th rounding digit may be in error by -1 so if the 4 rounding digits - // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the - // iteration. - if ( n == '9999' || !rep && n == '4999' ) { - - // On the first iteration only, check to see if rounding up gives the - // exact result as the nines may infinitely repeat. - if ( !rep ) { - round( t, t.e + DECIMAL_PLACES + 2, 0 ); - - if ( t.times(t).eq(x) ) { - r = t; - break; - } - } - - dp += 4; - s += 4; - rep = 1; - } else { - - // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact - // result. If not, then there are further digits and m will be truthy. - if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) { - - // Truncate to the first rounding digit. - round( r, r.e + DECIMAL_PLACES + 2, 1 ); - m = !r.times(r).eq(x); - } - - break; - } - } - } - } - - return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m ); - }; - - - /* - * n * 0 = 0 - * n * N = N - * n * I = I - * 0 * n = 0 - * 0 * 0 = 0 - * 0 * N = N - * 0 * I = N - * N * n = N - * N * 0 = N - * N * N = N - * N * I = N - * I * n = I - * I * 0 = N - * I * N = N - * I * I = I - * - * Return a new BigNumber whose value is the value of this BigNumber times the value of - * BigNumber(y, b). - */ - P.times = P.mul = function ( y, b ) { - var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, - base, sqrtBase, - x = this, - xc = x.c, - yc = ( id = 17, y = new BigNumber( y, b ) ).c; - - // Either NaN, ±Infinity or ±0? - if ( !xc || !yc || !xc[0] || !yc[0] ) { - - // Return NaN if either is NaN, or one is 0 and the other is Infinity. - if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) { - y.c = y.e = y.s = null; - } else { - y.s *= x.s; - - // Return ±Infinity if either is ±Infinity. - if ( !xc || !yc ) { - y.c = y.e = null; - - // Return ±0 if either is ±0. - } else { - y.c = [0]; - y.e = 0; - } - } - - return y; - } - - e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE ); - y.s *= x.s; - xcL = xc.length; - ycL = yc.length; - - // Ensure xc points to longer array and xcL to its length. - if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i; - - // Initialise the result array with zeros. - for ( i = xcL + ycL, zc = []; i--; zc.push(0) ); - - base = BASE; - sqrtBase = SQRT_BASE; - - for ( i = ycL; --i >= 0; ) { - c = 0; - ylo = yc[i] % sqrtBase; - yhi = yc[i] / sqrtBase | 0; - - for ( k = xcL, j = i + k; j > i; ) { - xlo = xc[--k] % sqrtBase; - xhi = xc[k] / sqrtBase | 0; - m = yhi * xlo + xhi * ylo; - xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c; - c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi; - zc[j--] = xlo % base; - } - - zc[j] = c; - } - - if (c) { - ++e; - } else { - zc.splice(0, 1); - } - - return normalise( y, zc, e ); - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of - * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted. - * - * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toDigits() precision out of range: {sd}' - * 'toDigits() precision not an integer: {sd}' - * 'toDigits() rounding mode not an integer: {rm}' - * 'toDigits() rounding mode out of range: {rm}' - */ - P.toDigits = function ( sd, rm ) { - var n = new BigNumber(this); - sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0; - rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0; - return sd ? round( n, sd, rm ) : n; - }; - - - /* - * Return a string representing the value of this BigNumber in exponential notation and - * rounded using ROUNDING_MODE to dp fixed decimal places. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toExponential() decimal places not an integer: {dp}' - * 'toExponential() decimal places out of range: {dp}' - * 'toExponential() rounding mode not an integer: {rm}' - * 'toExponential() rounding mode out of range: {rm}' - */ - P.toExponential = function ( dp, rm ) { - return format( this, - dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 ); - }; - - - /* - * Return a string representing the value of this BigNumber in fixed-point notation rounding - * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted. - * - * Note: as with JavaScript's number type, (-0).toFixed(0) is '0', - * but e.g. (-0.00001).toFixed(0) is '-0'. - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toFixed() decimal places not an integer: {dp}' - * 'toFixed() decimal places out of range: {dp}' - * 'toFixed() rounding mode not an integer: {rm}' - * 'toFixed() rounding mode out of range: {rm}' - */ - P.toFixed = function ( dp, rm ) { - return format( this, dp != null && isValidInt( dp, 0, MAX, 20 ) - ? ~~dp + this.e + 1 : null, rm, 20 ); - }; - - - /* - * Return a string representing the value of this BigNumber in fixed-point notation rounded - * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties - * of the FORMAT object (see BigNumber.config). - * - * FORMAT = { - * decimalSeparator : '.', - * groupSeparator : ',', - * groupSize : 3, - * secondaryGroupSize : 0, - * fractionGroupSeparator : '\xA0', // non-breaking space - * fractionGroupSize : 0 - * }; - * - * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toFormat() decimal places not an integer: {dp}' - * 'toFormat() decimal places out of range: {dp}' - * 'toFormat() rounding mode not an integer: {rm}' - * 'toFormat() rounding mode out of range: {rm}' - */ - P.toFormat = function ( dp, rm ) { - var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 ) - ? ~~dp + this.e + 1 : null, rm, 21 ); - - if ( this.c ) { - var i, - arr = str.split('.'), - g1 = +FORMAT.groupSize, - g2 = +FORMAT.secondaryGroupSize, - groupSeparator = FORMAT.groupSeparator, - intPart = arr[0], - fractionPart = arr[1], - isNeg = this.s < 0, - intDigits = isNeg ? intPart.slice(1) : intPart, - len = intDigits.length; - - if (g2) i = g1, g1 = g2, g2 = i, len -= i; - - if ( g1 > 0 && len > 0 ) { - i = len % g1 || g1; - intPart = intDigits.substr( 0, i ); - - for ( ; i < len; i += g1 ) { - intPart += groupSeparator + intDigits.substr( i, g1 ); - } - - if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i); - if (isNeg) intPart = '-' + intPart; - } - - str = fractionPart - ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize ) - ? fractionPart.replace( new RegExp( '\\d{' + g2 + '}\\B', 'g' ), - '$&' + FORMAT.fractionGroupSeparator ) - : fractionPart ) - : intPart; - } - - return str; - }; - - - /* - * Return a string array representing the value of this BigNumber as a simple fraction with - * an integer numerator and an integer denominator. The denominator will be a positive - * non-zero value less than or equal to the specified maximum denominator. If a maximum - * denominator is not specified, the denominator will be the lowest value necessary to - * represent the number exactly. - * - * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator. - * - * 'toFraction() max denominator not an integer: {md}' - * 'toFraction() max denominator out of range: {md}' - */ - P.toFraction = function (md) { - var arr, d0, d2, e, exp, n, n0, q, s, - k = ERRORS, - x = this, - xc = x.c, - d = new BigNumber(ONE), - n1 = d0 = new BigNumber(ONE), - d1 = n0 = new BigNumber(ONE); - - if ( md != null ) { - ERRORS = false; - n = new BigNumber(md); - ERRORS = k; - - if ( !( k = n.isInt() ) || n.lt(ONE) ) { - - if (ERRORS) { - raise( 22, - 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md ); - } - - // ERRORS is false: - // If md is a finite non-integer >= 1, round it to an integer and use it. - md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null; - } - } - - if ( !xc ) return x.toString(); - s = coeffToString(xc); - - // Determine initial denominator. - // d is a power of 10 and the minimum max denominator that specifies the value exactly. - e = d.e = s.length - x.e - 1; - d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ]; - md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n; - - exp = MAX_EXP; - MAX_EXP = 1 / 0; - n = new BigNumber(s); - - // n0 = d1 = 0 - n0.c[0] = 0; - - for ( ; ; ) { - q = div( n, d, 0, 1 ); - d2 = d0.plus( q.times(d1) ); - if ( d2.cmp(md) == 1 ) break; - d0 = d1; - d1 = d2; - n1 = n0.plus( q.times( d2 = n1 ) ); - n0 = d2; - d = n.minus( q.times( d2 = d ) ); - n = d2; - } - - d2 = div( md.minus(d0), d1, 0, 1 ); - n0 = n0.plus( d2.times(n1) ); - d0 = d0.plus( d2.times(d1) ); - n0.s = n1.s = x.s; - e *= 2; - - // Determine which fraction is closer to x, n0/d0 or n1/d1 - arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp( - div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1 - ? [ n1.toString(), d1.toString() ] - : [ n0.toString(), d0.toString() ]; - - MAX_EXP = exp; - return arr; - }; - - - /* - * Return the value of this BigNumber converted to a number primitive. - */ - P.toNumber = function () { - return +this; - }; - - - /* - * Return a BigNumber whose value is the value of this BigNumber raised to the power n. - * If m is present, return the result modulo m. - * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE. - * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using - * ROUNDING_MODE. - * - * The modular power operation works efficiently when x, n, and m are positive integers, - * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0). - * - * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive. - * [m] {number|string|BigNumber} The modulus. - * - * 'pow() exponent not an integer: {n}' - * 'pow() exponent out of range: {n}' - * - * Performs 54 loop iterations for n of 9007199254740991. - */ - P.toPower = P.pow = function ( n, m ) { - var k, y, z, - i = mathfloor( n < 0 ? -n : +n ), - x = this; - - if ( m != null ) { - id = 23; - m = new BigNumber(m); - } - - // Pass ±Infinity to Math.pow if exponent is out of range. - if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) && - ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) || - parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) { - k = Math.pow( +x, n ); - return new BigNumber( m ? k % m : k ); - } - - if (m) { - if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) { - x = x.mod(m); - } else { - z = m; - - // Nullify m so only a single mod operation is performed at the end. - m = null; - } - } else if (POW_PRECISION) { - - // Truncating each coefficient array to a length of k after each multiplication - // equates to truncating significant digits to POW_PRECISION + [28, 41], - // i.e. there will be a minimum of 28 guard digits retained. - // (Using + 1.5 would give [9, 21] guard digits.) - k = mathceil( POW_PRECISION / LOG_BASE + 2 ); - } - - y = new BigNumber(ONE); - - for ( ; ; ) { - if ( i % 2 ) { - y = y.times(x); - if ( !y.c ) break; - if (k) { - if ( y.c.length > k ) y.c.length = k; - } else if (m) { - y = y.mod(m); - } - } - - i = mathfloor( i / 2 ); - if ( !i ) break; - x = x.times(x); - if (k) { - if ( x.c && x.c.length > k ) x.c.length = k; - } else if (m) { - x = x.mod(m); - } - } - - if (m) return y; - if ( n < 0 ) y = ONE.div(y); - - return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y; - }; - - - /* - * Return a string representing the value of this BigNumber rounded to sd significant digits - * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits - * necessary to represent the integer part of the value in fixed-point notation, then use - * exponential notation. - * - * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. - * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. - * - * 'toPrecision() precision not an integer: {sd}' - * 'toPrecision() precision out of range: {sd}' - * 'toPrecision() rounding mode not an integer: {rm}' - * 'toPrecision() rounding mode out of range: {rm}' - */ - P.toPrecision = function ( sd, rm ) { - return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' ) - ? sd | 0 : null, rm, 24 ); - }; - - - /* - * Return a string representing the value of this BigNumber in base b, or base 10 if b is - * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and - * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent - * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than - * TO_EXP_NEG, return exponential notation. - * - * [b] {number} Integer, 2 to 64 inclusive. - * - * 'toString() base not an integer: {b}' - * 'toString() base out of range: {b}' - */ - P.toString = function (b) { - var str, - n = this, - s = n.s, - e = n.e; - - // Infinity or NaN? - if ( e === null ) { - - if (s) { - str = 'Infinity'; - if ( s < 0 ) str = '-' + str; - } else { - str = 'NaN'; - } - } else { - str = coeffToString( n.c ); - - if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) { - str = e <= TO_EXP_NEG || e >= TO_EXP_POS - ? toExponential( str, e ) - : toFixedPoint( str, e ); - } else { - str = convertBase( toFixedPoint( str, e ), b | 0, 10, s ); - } - - if ( s < 0 && n.c[0] ) str = '-' + str; - } - - return str; - }; - - - /* - * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole - * number. - */ - P.truncated = P.trunc = function () { - return round( new BigNumber(this), this.e + 1, 1 ); - }; - - - /* - * Return as toString, but do not accept a base argument, and include the minus sign for - * negative zero. - */ - P.valueOf = P.toJSON = function () { - var str, - n = this, - e = n.e; - - if ( e === null ) return n.toString(); - - str = coeffToString( n.c ); - - str = e <= TO_EXP_NEG || e >= TO_EXP_POS - ? toExponential( str, e ) - : toFixedPoint( str, e ); - - return n.s < 0 ? '-' + str : str; - }; - - - P.isBigNumber = true; - - if ( config != null ) BigNumber.config(config); - - return BigNumber; - } - - - // PRIVATE HELPER FUNCTIONS - - - function bitFloor(n) { - var i = n | 0; - return n > 0 || n === i ? i : i - 1; - } - - - // Return a coefficient array as a string of base 10 digits. - function coeffToString(a) { - var s, z, - i = 1, - j = a.length, - r = a[0] + ''; - - for ( ; i < j; ) { - s = a[i++] + ''; - z = LOG_BASE - s.length; - for ( ; z--; s = '0' + s ); - r += s; - } - - // Determine trailing zeros. - for ( j = r.length; r.charCodeAt(--j) === 48; ); - return r.slice( 0, j + 1 || 1 ); - } - - - // Compare the value of BigNumbers x and y. - function compare( x, y ) { - var a, b, - xc = x.c, - yc = y.c, - i = x.s, - j = y.s, - k = x.e, - l = y.e; - - // Either NaN? - if ( !i || !j ) return null; - - a = xc && !xc[0]; - b = yc && !yc[0]; - - // Either zero? - if ( a || b ) return a ? b ? 0 : -j : i; - - // Signs differ? - if ( i != j ) return i; - - a = i < 0; - b = k == l; - - // Either Infinity? - if ( !xc || !yc ) return b ? 0 : !xc ^ a ? 1 : -1; - - // Compare exponents. - if ( !b ) return k > l ^ a ? 1 : -1; - - j = ( k = xc.length ) < ( l = yc.length ) ? k : l; - - // Compare digit by digit. - for ( i = 0; i < j; i++ ) if ( xc[i] != yc[i] ) return xc[i] > yc[i] ^ a ? 1 : -1; - - // Compare lengths. - return k == l ? 0 : k > l ^ a ? 1 : -1; - } - - - /* - * Return true if n is a valid number in range, otherwise false. - * Use for argument validation when ERRORS is false. - * Note: parseInt('1e+1') == 1 but parseFloat('1e+1') == 10. - */ - function intValidatorNoErrors( n, min, max ) { - return ( n = truncate(n) ) >= min && n <= max; - } - - - function isArray(obj) { - return Object.prototype.toString.call(obj) == '[object Array]'; - } - - - /* - * Convert string of baseIn to an array of numbers of baseOut. - * Eg. convertBase('255', 10, 16) returns [15, 15]. - * Eg. convertBase('ff', 16, 10) returns [2, 5, 5]. - */ - function toBaseOut( str, baseIn, baseOut ) { - var j, - arr = [0], - arrL, - i = 0, - len = str.length; - - for ( ; i < len; ) { - for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn ); - arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) ); - - for ( ; j < arr.length; j++ ) { - - if ( arr[j] > baseOut - 1 ) { - if ( arr[j + 1] == null ) arr[j + 1] = 0; - arr[j + 1] += arr[j] / baseOut | 0; - arr[j] %= baseOut; - } - } - } - - return arr.reverse(); - } - - - function toExponential( str, e ) { - return ( str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str ) + - ( e < 0 ? 'e' : 'e+' ) + e; - } - - - function toFixedPoint( str, e ) { - var len, z; - - // Negative exponent? - if ( e < 0 ) { - - // Prepend zeros. - for ( z = '0.'; ++e; z += '0' ); - str = z + str; - - // Positive exponent - } else { - len = str.length; - - // Append zeros. - if ( ++e > len ) { - for ( z = '0', e -= len; --e; z += '0' ); - str += z; - } else if ( e < len ) { - str = str.slice( 0, e ) + '.' + str.slice(e); - } - } - - return str; - } - - - function truncate(n) { - n = parseFloat(n); - return n < 0 ? mathceil(n) : mathfloor(n); - } - - - // EXPORT - - - BigNumber = constructorFactory(); - BigNumber['default'] = BigNumber.BigNumber = BigNumber; - - - // AMD. - if ( typeof define == 'function' && define.amd ) { - define( function () { return BigNumber; } ); - - // Node.js and other environments that support module.exports. - } else if ( typeof module != 'undefined' && module.exports ) { - module.exports = BigNumber; - - // Browser. - } else { - if ( !globalObj ) globalObj = typeof self != 'undefined' ? self : Function('return this')(); - globalObj.BigNumber = BigNumber; - } -})(this); +/*! bignumber.js v4.0.4 https://github.com/MikeMcl/bignumber.js/LICENCE */ + +;(function (globalObj) { + 'use strict'; + + /* + bignumber.js v4.0.4 + A JavaScript library for arbitrary-precision arithmetic. + https://github.com/MikeMcl/bignumber.js + Copyright (c) 2017 Michael Mclaughlin + MIT Expat Licence + */ + + + var BigNumber, + isNumeric = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, + mathceil = Math.ceil, + mathfloor = Math.floor, + notBool = ' not a boolean or binary digit', + roundingMode = 'rounding mode', + tooManyDigits = 'number type has more than 15 significant digits', + ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_', + BASE = 1e14, + LOG_BASE = 14, + MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1 + // MAX_INT32 = 0x7fffffff, // 2^31 - 1 + POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], + SQRT_BASE = 1e7, + + /* + * The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and + * the arguments to toExponential, toFixed, toFormat, and toPrecision, beyond which an + * exception is thrown (if ERRORS is true). + */ + MAX = 1E9; // 0 to MAX_INT32 + + + /* + * Create and return a BigNumber constructor. + */ + function constructorFactory(config) { + var div, parseNumeric, + + // id tracks the caller function, so its name can be included in error messages. + id = 0, + P = BigNumber.prototype, + ONE = new BigNumber(1), + + + /********************************* EDITABLE DEFAULTS **********************************/ + + + /* + * The default values below must be integers within the inclusive ranges stated. + * The values can also be changed at run-time using BigNumber.config. + */ + + // The maximum number of decimal places for operations involving division. + DECIMAL_PLACES = 20, // 0 to MAX + + /* + * The rounding mode used when rounding to the above decimal places, and when using + * toExponential, toFixed, toFormat and toPrecision, and round (default value). + * UP 0 Away from zero. + * DOWN 1 Towards zero. + * CEIL 2 Towards +Infinity. + * FLOOR 3 Towards -Infinity. + * HALF_UP 4 Towards nearest neighbour. If equidistant, up. + * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. + * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. + * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. + * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. + */ + ROUNDING_MODE = 4, // 0 to 8 + + // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS] + + // The exponent value at and beneath which toString returns exponential notation. + // Number type: -7 + TO_EXP_NEG = -7, // 0 to -MAX + + // The exponent value at and above which toString returns exponential notation. + // Number type: 21 + TO_EXP_POS = 21, // 0 to MAX + + // RANGE : [MIN_EXP, MAX_EXP] + + // The minimum exponent value, beneath which underflow to zero occurs. + // Number type: -324 (5e-324) + MIN_EXP = -1e7, // -1 to -MAX + + // The maximum exponent value, above which overflow to Infinity occurs. + // Number type: 308 (1.7976931348623157e+308) + // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow. + MAX_EXP = 1e7, // 1 to MAX + + // Whether BigNumber Errors are ever thrown. + ERRORS = true, // true or false + + // Change to intValidatorNoErrors if ERRORS is false. + isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors + + // Whether to use cryptographically-secure random number generation, if available. + CRYPTO = false, // true or false + + /* + * The modulo mode used when calculating the modulus: a mod n. + * The quotient (q = a / n) is calculated according to the corresponding rounding mode. + * The remainder (r) is calculated as: r = a - n * q. + * + * UP 0 The remainder is positive if the dividend is negative, else is negative. + * DOWN 1 The remainder has the same sign as the dividend. + * This modulo mode is commonly known as 'truncated division' and is + * equivalent to (a % n) in JavaScript. + * FLOOR 3 The remainder has the same sign as the divisor (Python %). + * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function. + * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). + * The remainder is always positive. + * + * The truncated division, floored division, Euclidian division and IEEE 754 remainder + * modes are commonly used for the modulus operation. + * Although the other rounding modes can also be used, they may not give useful results. + */ + MODULO_MODE = 1, // 0 to 9 + + // The maximum number of significant digits of the result of the toPower operation. + // If POW_PRECISION is 0, there will be unlimited significant digits. + POW_PRECISION = 0, // 0 to MAX + + // The format specification used by the BigNumber.prototype.toFormat method. + FORMAT = { + decimalSeparator: '.', + groupSeparator: ',', + groupSize: 3, + secondaryGroupSize: 0, + fractionGroupSeparator: '\xA0', // non-breaking space + fractionGroupSize: 0 + }; + + + /******************************************************************************************/ + + + // CONSTRUCTOR + + + /* + * The BigNumber constructor and exported function. + * Create and return a new instance of a BigNumber object. + * + * n {number|string|BigNumber} A numeric value. + * [b] {number} The base of n. Integer, 2 to 64 inclusive. + */ + function BigNumber( n, b ) { + var c, e, i, num, len, str, + x = this; + + // Enable constructor usage without new. + if ( !( x instanceof BigNumber ) ) { + + // 'BigNumber() constructor call without new: {n}' + if (ERRORS) raise( 26, 'constructor call without new', n ); + return new BigNumber( n, b ); + } + + // 'new BigNumber() base not an integer: {b}' + // 'new BigNumber() base out of range: {b}' + if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) { + + // Duplicate. + if ( n instanceof BigNumber ) { + x.s = n.s; + x.e = n.e; + x.c = ( n = n.c ) ? n.slice() : n; + id = 0; + return; + } + + if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) { + x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1; + + // Fast path for integers. + if ( n === ~~n ) { + for ( e = 0, i = n; i >= 10; i /= 10, e++ ); + x.e = e; + x.c = [n]; + id = 0; + return; + } + + str = n + ''; + } else { + if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num ); + x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1; + } + } else { + b = b | 0; + str = n + ''; + + // Ensure return value is rounded to DECIMAL_PLACES as with other bases. + // Allow exponential notation to be used with base 10 argument. + if ( b == 10 ) { + x = new BigNumber( n instanceof BigNumber ? n : str ); + return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE ); + } + + // Avoid potential interpretation of Infinity and NaN as base 44+ values. + // Any number in exponential form will fail due to the [Ee][+-]. + if ( ( num = typeof n == 'number' ) && n * 0 != 0 || + !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) + + '(?:\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) { + return parseNumeric( x, str, num, b ); + } + + if (num) { + x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1; + + if ( ERRORS && str.replace( /^0\.0*|\./, '' ).length > 15 ) { + + // 'new BigNumber() number type has more than 15 significant digits: {n}' + raise( id, tooManyDigits, n ); + } + + // Prevent later check for length on converted number. + num = false; + } else { + x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1; + } + + str = convertBase( str, 10, b, x.s ); + } + + // Decimal point? + if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' ); + + // Exponential form? + if ( ( i = str.search( /e/i ) ) > 0 ) { + + // Determine exponent. + if ( e < 0 ) e = i; + e += +str.slice( i + 1 ); + str = str.substring( 0, i ); + } else if ( e < 0 ) { + + // Integer. + e = str.length; + } + + // Determine leading zeros. + for ( i = 0; str.charCodeAt(i) === 48; i++ ); + + // Determine trailing zeros. + for ( len = str.length; str.charCodeAt(--len) === 48; ); + str = str.slice( i, len + 1 ); + + if (str) { + len = str.length; + + // Disallow numbers with over 15 significant digits if number type. + // 'new BigNumber() number type has more than 15 significant digits: {n}' + if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) { + raise( id, tooManyDigits, x.s * n ); + } + + e = e - i - 1; + + // Overflow? + if ( e > MAX_EXP ) { + + // Infinity. + x.c = x.e = null; + + // Underflow? + } else if ( e < MIN_EXP ) { + + // Zero. + x.c = [ x.e = 0 ]; + } else { + x.e = e; + x.c = []; + + // Transform base + + // e is the base 10 exponent. + // i is where to slice str to get the first element of the coefficient array. + i = ( e + 1 ) % LOG_BASE; + if ( e < 0 ) i += LOG_BASE; + + if ( i < len ) { + if (i) x.c.push( +str.slice( 0, i ) ); + + for ( len -= LOG_BASE; i < len; ) { + x.c.push( +str.slice( i, i += LOG_BASE ) ); + } + + str = str.slice(i); + i = LOG_BASE - str.length; + } else { + i -= len; + } + + for ( ; i--; str += '0' ); + x.c.push( +str ); + } + } else { + + // Zero. + x.c = [ x.e = 0 ]; + } + + id = 0; + } + + + // CONSTRUCTOR PROPERTIES + + + BigNumber.another = constructorFactory; + + BigNumber.ROUND_UP = 0; + BigNumber.ROUND_DOWN = 1; + BigNumber.ROUND_CEIL = 2; + BigNumber.ROUND_FLOOR = 3; + BigNumber.ROUND_HALF_UP = 4; + BigNumber.ROUND_HALF_DOWN = 5; + BigNumber.ROUND_HALF_EVEN = 6; + BigNumber.ROUND_HALF_CEIL = 7; + BigNumber.ROUND_HALF_FLOOR = 8; + BigNumber.EUCLID = 9; + + + /* + * Configure infrequently-changing library-wide settings. + * + * Accept an object or an argument list, with one or many of the following properties or + * parameters respectively: + * + * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive + * ROUNDING_MODE {number} Integer, 0 to 8 inclusive + * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or + * [integer -MAX to 0 incl., 0 to MAX incl.] + * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or + * [integer -MAX to -1 incl., integer 1 to MAX incl.] + * ERRORS {boolean|number} true, false, 1 or 0 + * CRYPTO {boolean|number} true, false, 1 or 0 + * MODULO_MODE {number} 0 to 9 inclusive + * POW_PRECISION {number} 0 to MAX inclusive + * FORMAT {object} See BigNumber.prototype.toFormat + * decimalSeparator {string} + * groupSeparator {string} + * groupSize {number} + * secondaryGroupSize {number} + * fractionGroupSeparator {string} + * fractionGroupSize {number} + * + * (The values assigned to the above FORMAT object properties are not checked for validity.) + * + * E.g. + * BigNumber.config(20, 4) is equivalent to + * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 }) + * + * Ignore properties/parameters set to null or undefined. + * Return an object with the properties current values. + */ + BigNumber.config = BigNumber.set = function () { + var v, p, + i = 0, + r = {}, + a = arguments, + o = a[0], + has = o && typeof o == 'object' + ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; } + : function () { if ( a.length > i ) return ( v = a[i++] ) != null; }; + + // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive. + // 'config() DECIMAL_PLACES not an integer: {v}' + // 'config() DECIMAL_PLACES out of range: {v}' + if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) { + DECIMAL_PLACES = v | 0; + } + r[p] = DECIMAL_PLACES; + + // ROUNDING_MODE {number} Integer, 0 to 8 inclusive. + // 'config() ROUNDING_MODE not an integer: {v}' + // 'config() ROUNDING_MODE out of range: {v}' + if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) { + ROUNDING_MODE = v | 0; + } + r[p] = ROUNDING_MODE; + + // EXPONENTIAL_AT {number|number[]} + // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive]. + // 'config() EXPONENTIAL_AT not an integer: {v}' + // 'config() EXPONENTIAL_AT out of range: {v}' + if ( has( p = 'EXPONENTIAL_AT' ) ) { + + if ( isArray(v) ) { + if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) { + TO_EXP_NEG = v[0] | 0; + TO_EXP_POS = v[1] | 0; + } + } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) { + TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 ); + } + } + r[p] = [ TO_EXP_NEG, TO_EXP_POS ]; + + // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or + // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive]. + // 'config() RANGE not an integer: {v}' + // 'config() RANGE cannot be zero: {v}' + // 'config() RANGE out of range: {v}' + if ( has( p = 'RANGE' ) ) { + + if ( isArray(v) ) { + if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) { + MIN_EXP = v[0] | 0; + MAX_EXP = v[1] | 0; + } + } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) { + if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 ); + else if (ERRORS) raise( 2, p + ' cannot be zero', v ); + } + } + r[p] = [ MIN_EXP, MAX_EXP ]; + + // ERRORS {boolean|number} true, false, 1 or 0. + // 'config() ERRORS not a boolean or binary digit: {v}' + if ( has( p = 'ERRORS' ) ) { + + if ( v === !!v || v === 1 || v === 0 ) { + id = 0; + isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors; + } else if (ERRORS) { + raise( 2, p + notBool, v ); + } + } + r[p] = ERRORS; + + // CRYPTO {boolean|number} true, false, 1 or 0. + // 'config() CRYPTO not a boolean or binary digit: {v}' + // 'config() crypto unavailable: {crypto}' + if ( has( p = 'CRYPTO' ) ) { + + if ( v === true || v === false || v === 1 || v === 0 ) { + if (v) { + v = typeof crypto == 'undefined'; + if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) { + CRYPTO = true; + } else if (ERRORS) { + raise( 2, 'crypto unavailable', v ? void 0 : crypto ); + } else { + CRYPTO = false; + } + } else { + CRYPTO = false; + } + } else if (ERRORS) { + raise( 2, p + notBool, v ); + } + } + r[p] = CRYPTO; + + // MODULO_MODE {number} Integer, 0 to 9 inclusive. + // 'config() MODULO_MODE not an integer: {v}' + // 'config() MODULO_MODE out of range: {v}' + if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) { + MODULO_MODE = v | 0; + } + r[p] = MODULO_MODE; + + // POW_PRECISION {number} Integer, 0 to MAX inclusive. + // 'config() POW_PRECISION not an integer: {v}' + // 'config() POW_PRECISION out of range: {v}' + if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) { + POW_PRECISION = v | 0; + } + r[p] = POW_PRECISION; + + // FORMAT {object} + // 'config() FORMAT not an object: {v}' + if ( has( p = 'FORMAT' ) ) { + + if ( typeof v == 'object' ) { + FORMAT = v; + } else if (ERRORS) { + raise( 2, p + ' not an object', v ); + } + } + r[p] = FORMAT; + + return r; + }; + + + /* + * Return a new BigNumber whose value is the maximum of the arguments. + * + * arguments {number|string|BigNumber} + */ + BigNumber.max = function () { return maxOrMin( arguments, P.lt ); }; + + + /* + * Return a new BigNumber whose value is the minimum of the arguments. + * + * arguments {number|string|BigNumber} + */ + BigNumber.min = function () { return maxOrMin( arguments, P.gt ); }; + + + /* + * Return a new BigNumber with a random value equal to or greater than 0 and less than 1, + * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing + * zeros are produced). + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * + * 'random() decimal places not an integer: {dp}' + * 'random() decimal places out of range: {dp}' + * 'random() crypto unavailable: {crypto}' + */ + BigNumber.random = (function () { + var pow2_53 = 0x20000000000000; + + // Return a 53 bit integer n, where 0 <= n < 9007199254740992. + // Check if Math.random() produces more than 32 bits of randomness. + // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits. + // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1. + var random53bitInt = (Math.random() * pow2_53) & 0x1fffff + ? function () { return mathfloor( Math.random() * pow2_53 ); } + : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) + + (Math.random() * 0x800000 | 0); }; + + return function (dp) { + var a, b, e, k, v, + i = 0, + c = [], + rand = new BigNumber(ONE); + + dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0; + k = mathceil( dp / LOG_BASE ); + + if (CRYPTO) { + + // Browsers supporting crypto.getRandomValues. + if (crypto.getRandomValues) { + + a = crypto.getRandomValues( new Uint32Array( k *= 2 ) ); + + for ( ; i < k; ) { + + // 53 bits: + // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2) + // 11111 11111111 11111111 11111111 11100000 00000000 00000000 + // ((Math.pow(2, 32) - 1) >>> 11).toString(2) + // 11111 11111111 11111111 + // 0x20000 is 2^21. + v = a[i] * 0x20000 + (a[i + 1] >>> 11); + + // Rejection sampling: + // 0 <= v < 9007199254740992 + // Probability that v >= 9e15, is + // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251 + if ( v >= 9e15 ) { + b = crypto.getRandomValues( new Uint32Array(2) ); + a[i] = b[0]; + a[i + 1] = b[1]; + } else { + + // 0 <= v <= 8999999999999999 + // 0 <= (v % 1e14) <= 99999999999999 + c.push( v % 1e14 ); + i += 2; + } + } + i = k / 2; + + // Node.js supporting crypto.randomBytes. + } else if (crypto.randomBytes) { + + // buffer + a = crypto.randomBytes( k *= 7 ); + + for ( ; i < k; ) { + + // 0x1000000000000 is 2^48, 0x10000000000 is 2^40 + // 0x100000000 is 2^32, 0x1000000 is 2^24 + // 11111 11111111 11111111 11111111 11111111 11111111 11111111 + // 0 <= v < 9007199254740992 + v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) + + ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) + + ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6]; + + if ( v >= 9e15 ) { + crypto.randomBytes(7).copy( a, i ); + } else { + + // 0 <= (v % 1e14) <= 99999999999999 + c.push( v % 1e14 ); + i += 7; + } + } + i = k / 7; + } else { + CRYPTO = false; + if (ERRORS) raise( 14, 'crypto unavailable', crypto ); + } + } + + // Use Math.random. + if (!CRYPTO) { + + for ( ; i < k; ) { + v = random53bitInt(); + if ( v < 9e15 ) c[i++] = v % 1e14; + } + } + + k = c[--i]; + dp %= LOG_BASE; + + // Convert trailing digits to zeros according to dp. + if ( k && dp ) { + v = POWS_TEN[LOG_BASE - dp]; + c[i] = mathfloor( k / v ) * v; + } + + // Remove trailing elements which are zero. + for ( ; c[i] === 0; c.pop(), i-- ); + + // Zero? + if ( i < 0 ) { + c = [ e = 0 ]; + } else { + + // Remove leading elements which are zero and adjust exponent accordingly. + for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE); + + // Count the digits of the first element of c to determine leading zeros, and... + for ( i = 1, v = c[0]; v >= 10; v /= 10, i++); + + // adjust the exponent accordingly. + if ( i < LOG_BASE ) e -= LOG_BASE - i; + } + + rand.e = e; + rand.c = c; + return rand; + }; + })(); + + + // PRIVATE FUNCTIONS + + + // Convert a numeric string of baseIn to a numeric string of baseOut. + function convertBase( str, baseOut, baseIn, sign ) { + var d, e, k, r, x, xc, y, + i = str.indexOf( '.' ), + dp = DECIMAL_PLACES, + rm = ROUNDING_MODE; + + if ( baseIn < 37 ) str = str.toLowerCase(); + + // Non-integer. + if ( i >= 0 ) { + k = POW_PRECISION; + + // Unlimited precision. + POW_PRECISION = 0; + str = str.replace( '.', '' ); + y = new BigNumber(baseIn); + x = y.pow( str.length - i ); + POW_PRECISION = k; + + // Convert str as if an integer, then restore the fraction part by dividing the + // result by its base raised to a power. + y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut ); + y.e = y.c.length; + } + + // Convert the number as integer. + xc = toBaseOut( str, baseIn, baseOut ); + e = k = xc.length; + + // Remove trailing zeros. + for ( ; xc[--k] == 0; xc.pop() ); + if ( !xc[0] ) return '0'; + + if ( i < 0 ) { + --e; + } else { + x.c = xc; + x.e = e; + + // sign is needed for correct rounding. + x.s = sign; + x = div( x, y, dp, rm, baseOut ); + xc = x.c; + r = x.r; + e = x.e; + } + + d = e + dp + 1; + + // The rounding digit, i.e. the digit to the right of the digit that may be rounded up. + i = xc[d]; + k = baseOut / 2; + r = r || d < 0 || xc[d + 1] != null; + + r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) ) + : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 || + rm == ( x.s < 0 ? 8 : 7 ) ); + + if ( d < 1 || !xc[0] ) { + + // 1^-dp or 0. + str = r ? toFixedPoint( '1', -dp ) : '0'; + } else { + xc.length = d; + + if (r) { + + // Rounding up may mean the previous digit has to be rounded up and so on. + for ( --baseOut; ++xc[--d] > baseOut; ) { + xc[d] = 0; + + if ( !d ) { + ++e; + xc = [1].concat(xc); + } + } + } + + // Determine trailing zeros. + for ( k = xc.length; !xc[--k]; ); + + // E.g. [4, 11, 15] becomes 4bf. + for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) ); + str = toFixedPoint( str, e ); + } + + // The caller will add the sign. + return str; + } + + + // Perform division in the specified base. Called by div and convertBase. + div = (function () { + + // Assume non-zero x and k. + function multiply( x, k, base ) { + var m, temp, xlo, xhi, + carry = 0, + i = x.length, + klo = k % SQRT_BASE, + khi = k / SQRT_BASE | 0; + + for ( x = x.slice(); i--; ) { + xlo = x[i] % SQRT_BASE; + xhi = x[i] / SQRT_BASE | 0; + m = khi * xlo + xhi * klo; + temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry; + carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi; + x[i] = temp % base; + } + + if (carry) x = [carry].concat(x); + + return x; + } + + function compare( a, b, aL, bL ) { + var i, cmp; + + if ( aL != bL ) { + cmp = aL > bL ? 1 : -1; + } else { + + for ( i = cmp = 0; i < aL; i++ ) { + + if ( a[i] != b[i] ) { + cmp = a[i] > b[i] ? 1 : -1; + break; + } + } + } + return cmp; + } + + function subtract( a, b, aL, base ) { + var i = 0; + + // Subtract b from a. + for ( ; aL--; ) { + a[aL] -= i; + i = a[aL] < b[aL] ? 1 : 0; + a[aL] = i * base + a[aL] - b[aL]; + } + + // Remove leading zeros. + for ( ; !a[0] && a.length > 1; a.splice(0, 1) ); + } + + // x: dividend, y: divisor. + return function ( x, y, dp, rm, base ) { + var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, + yL, yz, + s = x.s == y.s ? 1 : -1, + xc = x.c, + yc = y.c; + + // Either NaN, Infinity or 0? + if ( !xc || !xc[0] || !yc || !yc[0] ) { + + return new BigNumber( + + // Return NaN if either NaN, or both Infinity or 0. + !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN : + + // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0. + xc && xc[0] == 0 || !yc ? s * 0 : s / 0 + ); + } + + q = new BigNumber(s); + qc = q.c = []; + e = x.e - y.e; + s = dp + e + 1; + + if ( !base ) { + base = BASE; + e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE ); + s = s / LOG_BASE | 0; + } + + // Result exponent may be one less then the current value of e. + // The coefficients of the BigNumbers from convertBase may have trailing zeros. + for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ ); + if ( yc[i] > ( xc[i] || 0 ) ) e--; + + if ( s < 0 ) { + qc.push(1); + more = true; + } else { + xL = xc.length; + yL = yc.length; + i = 0; + s += 2; + + // Normalise xc and yc so highest order digit of yc is >= base / 2. + + n = mathfloor( base / ( yc[0] + 1 ) ); + + // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1. + // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) { + if ( n > 1 ) { + yc = multiply( yc, n, base ); + xc = multiply( xc, n, base ); + yL = yc.length; + xL = xc.length; + } + + xi = yL; + rem = xc.slice( 0, yL ); + remL = rem.length; + + // Add zeros to make remainder as long as divisor. + for ( ; remL < yL; rem[remL++] = 0 ); + yz = yc.slice(); + yz = [0].concat(yz); + yc0 = yc[0]; + if ( yc[1] >= base / 2 ) yc0++; + // Not necessary, but to prevent trial digit n > base, when using base 3. + // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15; + + do { + n = 0; + + // Compare divisor and remainder. + cmp = compare( yc, rem, yL, remL ); + + // If divisor < remainder. + if ( cmp < 0 ) { + + // Calculate trial digit, n. + + rem0 = rem[0]; + if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 ); + + // n is how many times the divisor goes into the current remainder. + n = mathfloor( rem0 / yc0 ); + + // Algorithm: + // 1. product = divisor * trial digit (n) + // 2. if product > remainder: product -= divisor, n-- + // 3. remainder -= product + // 4. if product was < remainder at 2: + // 5. compare new remainder and divisor + // 6. If remainder > divisor: remainder -= divisor, n++ + + if ( n > 1 ) { + + // n may be > base only when base is 3. + if (n >= base) n = base - 1; + + // product = divisor * trial digit. + prod = multiply( yc, n, base ); + prodL = prod.length; + remL = rem.length; + + // Compare product and remainder. + // If product > remainder. + // Trial digit n too high. + // n is 1 too high about 5% of the time, and is not known to have + // ever been more than 1 too high. + while ( compare( prod, rem, prodL, remL ) == 1 ) { + n--; + + // Subtract divisor from product. + subtract( prod, yL < prodL ? yz : yc, prodL, base ); + prodL = prod.length; + cmp = 1; + } + } else { + + // n is 0 or 1, cmp is -1. + // If n is 0, there is no need to compare yc and rem again below, + // so change cmp to 1 to avoid it. + // If n is 1, leave cmp as -1, so yc and rem are compared again. + if ( n == 0 ) { + + // divisor < remainder, so n must be at least 1. + cmp = n = 1; + } + + // product = divisor + prod = yc.slice(); + prodL = prod.length; + } + + if ( prodL < remL ) prod = [0].concat(prod); + + // Subtract product from remainder. + subtract( rem, prod, remL, base ); + remL = rem.length; + + // If product was < remainder. + if ( cmp == -1 ) { + + // Compare divisor and new remainder. + // If divisor < new remainder, subtract divisor from remainder. + // Trial digit n too low. + // n is 1 too low about 5% of the time, and very rarely 2 too low. + while ( compare( yc, rem, yL, remL ) < 1 ) { + n++; + + // Subtract divisor from remainder. + subtract( rem, yL < remL ? yz : yc, remL, base ); + remL = rem.length; + } + } + } else if ( cmp === 0 ) { + n++; + rem = [0]; + } // else cmp === 1 and n will be 0 + + // Add the next digit, n, to the result array. + qc[i++] = n; + + // Update the remainder. + if ( rem[0] ) { + rem[remL++] = xc[xi] || 0; + } else { + rem = [ xc[xi] ]; + remL = 1; + } + } while ( ( xi++ < xL || rem[0] != null ) && s-- ); + + more = rem[0] != null; + + // Leading zero? + if ( !qc[0] ) qc.splice(0, 1); + } + + if ( base == BASE ) { + + // To calculate q.e, first get the number of digits of qc[0]. + for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ ); + round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more ); + + // Caller is convertBase. + } else { + q.e = e; + q.r = +more; + } + + return q; + }; + })(); + + + /* + * Return a string representing the value of BigNumber n in fixed-point or exponential + * notation rounded to the specified decimal places or significant digits. + * + * n is a BigNumber. + * i is the index of the last digit required (i.e. the digit that may be rounded up). + * rm is the rounding mode. + * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24. + */ + function format( n, i, rm, caller ) { + var c0, e, ne, len, str; + + rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode ) + ? rm | 0 : ROUNDING_MODE; + + if ( !n.c ) return n.toString(); + c0 = n.c[0]; + ne = n.e; + + if ( i == null ) { + str = coeffToString( n.c ); + str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG + ? toExponential( str, ne ) + : toFixedPoint( str, ne ); + } else { + n = round( new BigNumber(n), i, rm ); + + // n.e may have changed if the value was rounded up. + e = n.e; + + str = coeffToString( n.c ); + len = str.length; + + // toPrecision returns exponential notation if the number of significant digits + // specified is less than the number of digits necessary to represent the integer + // part of the value in fixed-point notation. + + // Exponential notation. + if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) { + + // Append zeros? + for ( ; len < i; str += '0', len++ ); + str = toExponential( str, e ); + + // Fixed-point notation. + } else { + i -= ne; + str = toFixedPoint( str, e ); + + // Append zeros? + if ( e + 1 > len ) { + if ( --i > 0 ) for ( str += '.'; i--; str += '0' ); + } else { + i += e - len; + if ( i > 0 ) { + if ( e + 1 == len ) str += '.'; + for ( ; i--; str += '0' ); + } + } + } + } + + return n.s < 0 && c0 ? '-' + str : str; + } + + + // Handle BigNumber.max and BigNumber.min. + function maxOrMin( args, method ) { + var m, n, + i = 0; + + if ( isArray( args[0] ) ) args = args[0]; + m = new BigNumber( args[0] ); + + for ( ; ++i < args.length; ) { + n = new BigNumber( args[i] ); + + // If any number is NaN, return NaN. + if ( !n.s ) { + m = n; + break; + } else if ( method.call( m, n ) ) { + m = n; + } + } + + return m; + } + + + /* + * Return true if n is an integer in range, otherwise throw. + * Use for argument validation when ERRORS is true. + */ + function intValidatorWithErrors( n, min, max, caller, name ) { + if ( n < min || n > max || n != truncate(n) ) { + raise( caller, ( name || 'decimal places' ) + + ( n < min || n > max ? ' out of range' : ' not an integer' ), n ); + } + + return true; + } + + + /* + * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP. + * Called by minus, plus and times. + */ + function normalise( n, c, e ) { + var i = 1, + j = c.length; + + // Remove trailing zeros. + for ( ; !c[--j]; c.pop() ); + + // Calculate the base 10 exponent. First get the number of digits of c[0]. + for ( j = c[0]; j >= 10; j /= 10, i++ ); + + // Overflow? + if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) { + + // Infinity. + n.c = n.e = null; + + // Underflow? + } else if ( e < MIN_EXP ) { + + // Zero. + n.c = [ n.e = 0 ]; + } else { + n.e = e; + n.c = c; + } + + return n; + } + + + // Handle values that fail the validity test in BigNumber. + parseNumeric = (function () { + var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, + dotAfter = /^([^.]+)\.$/, + dotBefore = /^\.([^.]+)$/, + isInfinityOrNaN = /^-?(Infinity|NaN)$/, + whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g; + + return function ( x, str, num, b ) { + var base, + s = num ? str : str.replace( whitespaceOrPlus, '' ); + + // No exception on ±Infinity or NaN. + if ( isInfinityOrNaN.test(s) ) { + x.s = isNaN(s) ? null : s < 0 ? -1 : 1; + } else { + if ( !num ) { + + // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i + s = s.replace( basePrefix, function ( m, p1, p2 ) { + base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8; + return !b || b == base ? p1 : m; + }); + + if (b) { + base = b; + + // E.g. '1.' to '1', '.1' to '0.1' + s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' ); + } + + if ( str != s ) return new BigNumber( s, base ); + } + + // 'new BigNumber() not a number: {n}' + // 'new BigNumber() not a base {b} number: {n}' + if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str ); + x.s = null; + } + + x.c = x.e = null; + id = 0; + } + })(); + + + // Throw a BigNumber Error. + function raise( caller, msg, val ) { + var error = new Error( [ + 'new BigNumber', // 0 + 'cmp', // 1 + 'config', // 2 + 'div', // 3 + 'divToInt', // 4 + 'eq', // 5 + 'gt', // 6 + 'gte', // 7 + 'lt', // 8 + 'lte', // 9 + 'minus', // 10 + 'mod', // 11 + 'plus', // 12 + 'precision', // 13 + 'random', // 14 + 'round', // 15 + 'shift', // 16 + 'times', // 17 + 'toDigits', // 18 + 'toExponential', // 19 + 'toFixed', // 20 + 'toFormat', // 21 + 'toFraction', // 22 + 'pow', // 23 + 'toPrecision', // 24 + 'toString', // 25 + 'BigNumber' // 26 + ][caller] + '() ' + msg + ': ' + val ); + + error.name = 'BigNumber Error'; + id = 0; + throw error; + } + + + /* + * Round x to sd significant digits using rounding mode rm. Check for over/under-flow. + * If r is truthy, it is known that there are more digits after the rounding digit. + */ + function round( x, sd, rm, r ) { + var d, i, j, k, n, ni, rd, + xc = x.c, + pows10 = POWS_TEN; + + // if x is not Infinity or NaN... + if (xc) { + + // rd is the rounding digit, i.e. the digit after the digit that may be rounded up. + // n is a base 1e14 number, the value of the element of array x.c containing rd. + // ni is the index of n within x.c. + // d is the number of digits of n. + // i is the index of rd within n including leading zeros. + // j is the actual index of rd within n (if < 0, rd is a leading zero). + out: { + + // Get the number of digits of the first element of xc. + for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ ); + i = sd - d; + + // If the rounding digit is in the first element of xc... + if ( i < 0 ) { + i += LOG_BASE; + j = sd; + n = xc[ ni = 0 ]; + + // Get the rounding digit at index j of n. + rd = n / pows10[ d - j - 1 ] % 10 | 0; + } else { + ni = mathceil( ( i + 1 ) / LOG_BASE ); + + if ( ni >= xc.length ) { + + if (r) { + + // Needed by sqrt. + for ( ; xc.length <= ni; xc.push(0) ); + n = rd = 0; + d = 1; + i %= LOG_BASE; + j = i - LOG_BASE + 1; + } else { + break out; + } + } else { + n = k = xc[ni]; + + // Get the number of digits of n. + for ( d = 1; k >= 10; k /= 10, d++ ); + + // Get the index of rd within n. + i %= LOG_BASE; + + // Get the index of rd within n, adjusted for leading zeros. + // The number of leading zeros of n is given by LOG_BASE - d. + j = i - LOG_BASE + d; + + // Get the rounding digit at index j of n. + rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0; + } + } + + r = r || sd < 0 || + + // Are there any non-zero digits after the rounding digit? + // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right + // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714. + xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] ); + + r = rm < 4 + ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) ) + : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 && + + // Check whether the digit to the left of the rounding digit is odd. + ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 || + rm == ( x.s < 0 ? 8 : 7 ) ); + + if ( sd < 1 || !xc[0] ) { + xc.length = 0; + + if (r) { + + // Convert sd to decimal places. + sd -= x.e + 1; + + // 1, 0.1, 0.01, 0.001, 0.0001 etc. + xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ]; + x.e = -sd || 0; + } else { + + // Zero. + xc[0] = x.e = 0; + } + + return x; + } + + // Remove excess digits. + if ( i == 0 ) { + xc.length = ni; + k = 1; + ni--; + } else { + xc.length = ni + 1; + k = pows10[ LOG_BASE - i ]; + + // E.g. 56700 becomes 56000 if 7 is the rounding digit. + // j > 0 means i > number of leading zeros of n. + xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0; + } + + // Round up? + if (r) { + + for ( ; ; ) { + + // If the digit to be rounded up is in the first element of xc... + if ( ni == 0 ) { + + // i will be the length of xc[0] before k is added. + for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ ); + j = xc[0] += k; + for ( k = 1; j >= 10; j /= 10, k++ ); + + // if i != k the length has increased. + if ( i != k ) { + x.e++; + if ( xc[0] == BASE ) xc[0] = 1; + } + + break; + } else { + xc[ni] += k; + if ( xc[ni] != BASE ) break; + xc[ni--] = 0; + k = 1; + } + } + } + + // Remove trailing zeros. + for ( i = xc.length; xc[--i] === 0; xc.pop() ); + } + + // Overflow? Infinity. + if ( x.e > MAX_EXP ) { + x.c = x.e = null; + + // Underflow? Zero. + } else if ( x.e < MIN_EXP ) { + x.c = [ x.e = 0 ]; + } + } + + return x; + } + + + // PROTOTYPE/INSTANCE METHODS + + + /* + * Return a new BigNumber whose value is the absolute value of this BigNumber. + */ + P.absoluteValue = P.abs = function () { + var x = new BigNumber(this); + if ( x.s < 0 ) x.s = 1; + return x; + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole + * number in the direction of Infinity. + */ + P.ceil = function () { + return round( new BigNumber(this), this.e + 1, 2 ); + }; + + + /* + * Return + * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b), + * -1 if the value of this BigNumber is less than the value of BigNumber(y, b), + * 0 if they have the same value, + * or null if the value of either is NaN. + */ + P.comparedTo = P.cmp = function ( y, b ) { + id = 1; + return compare( this, new BigNumber( y, b ) ); + }; + + + /* + * Return the number of decimal places of the value of this BigNumber, or null if the value + * of this BigNumber is ±Infinity or NaN. + */ + P.decimalPlaces = P.dp = function () { + var n, v, + c = this.c; + + if ( !c ) return null; + n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE; + + // Subtract the number of trailing zeros of the last number. + if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- ); + if ( n < 0 ) n = 0; + + return n; + }; + + + /* + * n / 0 = I + * n / N = N + * n / I = 0 + * 0 / n = 0 + * 0 / 0 = N + * 0 / N = N + * 0 / I = 0 + * N / n = N + * N / 0 = N + * N / N = N + * N / I = N + * I / n = I + * I / 0 = I + * I / N = N + * I / I = N + * + * Return a new BigNumber whose value is the value of this BigNumber divided by the value of + * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE. + */ + P.dividedBy = P.div = function ( y, b ) { + id = 3; + return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE ); + }; + + + /* + * Return a new BigNumber whose value is the integer part of dividing the value of this + * BigNumber by the value of BigNumber(y, b). + */ + P.dividedToIntegerBy = P.divToInt = function ( y, b ) { + id = 4; + return div( this, new BigNumber( y, b ), 0, 1 ); + }; + + + /* + * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b), + * otherwise returns false. + */ + P.equals = P.eq = function ( y, b ) { + id = 5; + return compare( this, new BigNumber( y, b ) ) === 0; + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole + * number in the direction of -Infinity. + */ + P.floor = function () { + return round( new BigNumber(this), this.e + 1, 3 ); + }; + + + /* + * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b), + * otherwise returns false. + */ + P.greaterThan = P.gt = function ( y, b ) { + id = 6; + return compare( this, new BigNumber( y, b ) ) > 0; + }; + + + /* + * Return true if the value of this BigNumber is greater than or equal to the value of + * BigNumber(y, b), otherwise returns false. + */ + P.greaterThanOrEqualTo = P.gte = function ( y, b ) { + id = 7; + return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0; + + }; + + + /* + * Return true if the value of this BigNumber is a finite number, otherwise returns false. + */ + P.isFinite = function () { + return !!this.c; + }; + + + /* + * Return true if the value of this BigNumber is an integer, otherwise return false. + */ + P.isInteger = P.isInt = function () { + return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2; + }; + + + /* + * Return true if the value of this BigNumber is NaN, otherwise returns false. + */ + P.isNaN = function () { + return !this.s; + }; + + + /* + * Return true if the value of this BigNumber is negative, otherwise returns false. + */ + P.isNegative = P.isNeg = function () { + return this.s < 0; + }; + + + /* + * Return true if the value of this BigNumber is 0 or -0, otherwise returns false. + */ + P.isZero = function () { + return !!this.c && this.c[0] == 0; + }; + + + /* + * Return true if the value of this BigNumber is less than the value of BigNumber(y, b), + * otherwise returns false. + */ + P.lessThan = P.lt = function ( y, b ) { + id = 8; + return compare( this, new BigNumber( y, b ) ) < 0; + }; + + + /* + * Return true if the value of this BigNumber is less than or equal to the value of + * BigNumber(y, b), otherwise returns false. + */ + P.lessThanOrEqualTo = P.lte = function ( y, b ) { + id = 9; + return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0; + }; + + + /* + * n - 0 = n + * n - N = N + * n - I = -I + * 0 - n = -n + * 0 - 0 = 0 + * 0 - N = N + * 0 - I = -I + * N - n = N + * N - 0 = N + * N - N = N + * N - I = N + * I - n = I + * I - 0 = I + * I - N = N + * I - I = N + * + * Return a new BigNumber whose value is the value of this BigNumber minus the value of + * BigNumber(y, b). + */ + P.minus = P.sub = function ( y, b ) { + var i, j, t, xLTy, + x = this, + a = x.s; + + id = 10; + y = new BigNumber( y, b ); + b = y.s; + + // Either NaN? + if ( !a || !b ) return new BigNumber(NaN); + + // Signs differ? + if ( a != b ) { + y.s = -b; + return x.plus(y); + } + + var xe = x.e / LOG_BASE, + ye = y.e / LOG_BASE, + xc = x.c, + yc = y.c; + + if ( !xe || !ye ) { + + // Either Infinity? + if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN ); + + // Either zero? + if ( !xc[0] || !yc[0] ) { + + // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. + return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x : + + // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity + ROUNDING_MODE == 3 ? -0 : 0 ); + } + } + + xe = bitFloor(xe); + ye = bitFloor(ye); + xc = xc.slice(); + + // Determine which is the bigger number. + if ( a = xe - ye ) { + + if ( xLTy = a < 0 ) { + a = -a; + t = xc; + } else { + ye = xe; + t = yc; + } + + t.reverse(); + + // Prepend zeros to equalise exponents. + for ( b = a; b--; t.push(0) ); + t.reverse(); + } else { + + // Exponents equal. Check digit by digit. + j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b; + + for ( a = b = 0; b < j; b++ ) { + + if ( xc[b] != yc[b] ) { + xLTy = xc[b] < yc[b]; + break; + } + } + } + + // x < y? Point xc to the array of the bigger number. + if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s; + + b = ( j = yc.length ) - ( i = xc.length ); + + // Append zeros to xc if shorter. + // No need to add zeros to yc if shorter as subtract only needs to start at yc.length. + if ( b > 0 ) for ( ; b--; xc[i++] = 0 ); + b = BASE - 1; + + // Subtract yc from xc. + for ( ; j > a; ) { + + if ( xc[--j] < yc[j] ) { + for ( i = j; i && !xc[--i]; xc[i] = b ); + --xc[i]; + xc[j] += BASE; + } + + xc[j] -= yc[j]; + } + + // Remove leading zeros and adjust exponent accordingly. + for ( ; xc[0] == 0; xc.splice(0, 1), --ye ); + + // Zero? + if ( !xc[0] ) { + + // Following IEEE 754 (2008) 6.3, + // n - n = +0 but n - n = -0 when rounding towards -Infinity. + y.s = ROUNDING_MODE == 3 ? -1 : 1; + y.c = [ y.e = 0 ]; + return y; + } + + // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity + // for finite x and y. + return normalise( y, xc, ye ); + }; + + + /* + * n % 0 = N + * n % N = N + * n % I = n + * 0 % n = 0 + * -0 % n = -0 + * 0 % 0 = N + * 0 % N = N + * 0 % I = 0 + * N % n = N + * N % 0 = N + * N % N = N + * N % I = N + * I % n = N + * I % 0 = N + * I % N = N + * I % I = N + * + * Return a new BigNumber whose value is the value of this BigNumber modulo the value of + * BigNumber(y, b). The result depends on the value of MODULO_MODE. + */ + P.modulo = P.mod = function ( y, b ) { + var q, s, + x = this; + + id = 11; + y = new BigNumber( y, b ); + + // Return NaN if x is Infinity or NaN, or y is NaN or zero. + if ( !x.c || !y.s || y.c && !y.c[0] ) { + return new BigNumber(NaN); + + // Return x if y is Infinity or x is zero. + } else if ( !y.c || x.c && !x.c[0] ) { + return new BigNumber(x); + } + + if ( MODULO_MODE == 9 ) { + + // Euclidian division: q = sign(y) * floor(x / abs(y)) + // r = x - qy where 0 <= r < abs(y) + s = y.s; + y.s = 1; + q = div( x, y, 0, 3 ); + y.s = s; + q.s *= s; + } else { + q = div( x, y, 0, MODULO_MODE ); + } + + return x.minus( q.times(y) ); + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber negated, + * i.e. multiplied by -1. + */ + P.negated = P.neg = function () { + var x = new BigNumber(this); + x.s = -x.s || null; + return x; + }; + + + /* + * n + 0 = n + * n + N = N + * n + I = I + * 0 + n = n + * 0 + 0 = 0 + * 0 + N = N + * 0 + I = I + * N + n = N + * N + 0 = N + * N + N = N + * N + I = N + * I + n = I + * I + 0 = I + * I + N = N + * I + I = I + * + * Return a new BigNumber whose value is the value of this BigNumber plus the value of + * BigNumber(y, b). + */ + P.plus = P.add = function ( y, b ) { + var t, + x = this, + a = x.s; + + id = 12; + y = new BigNumber( y, b ); + b = y.s; + + // Either NaN? + if ( !a || !b ) return new BigNumber(NaN); + + // Signs differ? + if ( a != b ) { + y.s = -b; + return x.minus(y); + } + + var xe = x.e / LOG_BASE, + ye = y.e / LOG_BASE, + xc = x.c, + yc = y.c; + + if ( !xe || !ye ) { + + // Return ±Infinity if either ±Infinity. + if ( !xc || !yc ) return new BigNumber( a / 0 ); + + // Either zero? + // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. + if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 ); + } + + xe = bitFloor(xe); + ye = bitFloor(ye); + xc = xc.slice(); + + // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts. + if ( a = xe - ye ) { + if ( a > 0 ) { + ye = xe; + t = yc; + } else { + a = -a; + t = xc; + } + + t.reverse(); + for ( ; a--; t.push(0) ); + t.reverse(); + } + + a = xc.length; + b = yc.length; + + // Point xc to the longer array, and b to the shorter length. + if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a; + + // Only start adding at yc.length - 1 as the further digits of xc can be ignored. + for ( a = 0; b; ) { + a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0; + xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE; + } + + if (a) { + xc = [a].concat(xc); + ++ye; + } + + // No need to check for zero, as +x + +y != 0 && -x + -y != 0 + // ye = MAX_EXP + 1 possible + return normalise( y, xc, ye ); + }; + + + /* + * Return the number of significant digits of the value of this BigNumber. + * + * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0. + */ + P.precision = P.sd = function (z) { + var n, v, + x = this, + c = x.c; + + // 'precision() argument not a boolean or binary digit: {z}' + if ( z != null && z !== !!z && z !== 1 && z !== 0 ) { + if (ERRORS) raise( 13, 'argument' + notBool, z ); + if ( z != !!z ) z = null; + } + + if ( !c ) return null; + v = c.length - 1; + n = v * LOG_BASE + 1; + + if ( v = c[v] ) { + + // Subtract the number of trailing zeros of the last element. + for ( ; v % 10 == 0; v /= 10, n-- ); + + // Add the number of digits of the first element. + for ( v = c[0]; v >= 10; v /= 10, n++ ); + } + + if ( z && x.e + 1 > n ) n = x.e + 1; + + return n; + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of + * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if + * omitted. + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'round() decimal places out of range: {dp}' + * 'round() decimal places not an integer: {dp}' + * 'round() rounding mode not an integer: {rm}' + * 'round() rounding mode out of range: {rm}' + */ + P.round = function ( dp, rm ) { + var n = new BigNumber(this); + + if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) { + round( n, ~~dp + this.e + 1, rm == null || + !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 ); + } + + return n; + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber shifted by k places + * (powers of 10). Shift to the right if n > 0, and to the left if n < 0. + * + * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive. + * + * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity + * otherwise. + * + * 'shift() argument not an integer: {k}' + * 'shift() argument out of range: {k}' + */ + P.shift = function (k) { + var n = this; + return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' ) + + // k < 1e+21, or truncate(k) will produce exponential notation. + ? n.times( '1e' + truncate(k) ) + : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER ) + ? n.s * ( k < 0 ? 0 : 1 / 0 ) + : n ); + }; + + + /* + * sqrt(-n) = N + * sqrt( N) = N + * sqrt(-I) = N + * sqrt( I) = I + * sqrt( 0) = 0 + * sqrt(-0) = -0 + * + * Return a new BigNumber whose value is the square root of the value of this BigNumber, + * rounded according to DECIMAL_PLACES and ROUNDING_MODE. + */ + P.squareRoot = P.sqrt = function () { + var m, n, r, rep, t, + x = this, + c = x.c, + s = x.s, + e = x.e, + dp = DECIMAL_PLACES + 4, + half = new BigNumber('0.5'); + + // Negative/NaN/Infinity/zero? + if ( s !== 1 || !c || !c[0] ) { + return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 ); + } + + // Initial estimate. + s = Math.sqrt( +x ); + + // Math.sqrt underflow/overflow? + // Pass x to Math.sqrt as integer, then adjust the exponent of the result. + if ( s == 0 || s == 1 / 0 ) { + n = coeffToString(c); + if ( ( n.length + e ) % 2 == 0 ) n += '0'; + s = Math.sqrt(n); + e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 ); + + if ( s == 1 / 0 ) { + n = '1e' + e; + } else { + n = s.toExponential(); + n = n.slice( 0, n.indexOf('e') + 1 ) + e; + } + + r = new BigNumber(n); + } else { + r = new BigNumber( s + '' ); + } + + // Check for zero. + // r could be zero if MIN_EXP is changed after the this value was created. + // This would cause a division by zero (x/t) and hence Infinity below, which would cause + // coeffToString to throw. + if ( r.c[0] ) { + e = r.e; + s = e + dp; + if ( s < 3 ) s = 0; + + // Newton-Raphson iteration. + for ( ; ; ) { + t = r; + r = half.times( t.plus( div( x, t, dp, 1 ) ) ); + + if ( coeffToString( t.c ).slice( 0, s ) === ( n = + coeffToString( r.c ) ).slice( 0, s ) ) { + + // The exponent of r may here be one less than the final result exponent, + // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits + // are indexed correctly. + if ( r.e < e ) --s; + n = n.slice( s - 3, s + 1 ); + + // The 4th rounding digit may be in error by -1 so if the 4 rounding digits + // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the + // iteration. + if ( n == '9999' || !rep && n == '4999' ) { + + // On the first iteration only, check to see if rounding up gives the + // exact result as the nines may infinitely repeat. + if ( !rep ) { + round( t, t.e + DECIMAL_PLACES + 2, 0 ); + + if ( t.times(t).eq(x) ) { + r = t; + break; + } + } + + dp += 4; + s += 4; + rep = 1; + } else { + + // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact + // result. If not, then there are further digits and m will be truthy. + if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) { + + // Truncate to the first rounding digit. + round( r, r.e + DECIMAL_PLACES + 2, 1 ); + m = !r.times(r).eq(x); + } + + break; + } + } + } + } + + return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m ); + }; + + + /* + * n * 0 = 0 + * n * N = N + * n * I = I + * 0 * n = 0 + * 0 * 0 = 0 + * 0 * N = N + * 0 * I = N + * N * n = N + * N * 0 = N + * N * N = N + * N * I = N + * I * n = I + * I * 0 = N + * I * N = N + * I * I = I + * + * Return a new BigNumber whose value is the value of this BigNumber times the value of + * BigNumber(y, b). + */ + P.times = P.mul = function ( y, b ) { + var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, + base, sqrtBase, + x = this, + xc = x.c, + yc = ( id = 17, y = new BigNumber( y, b ) ).c; + + // Either NaN, ±Infinity or ±0? + if ( !xc || !yc || !xc[0] || !yc[0] ) { + + // Return NaN if either is NaN, or one is 0 and the other is Infinity. + if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) { + y.c = y.e = y.s = null; + } else { + y.s *= x.s; + + // Return ±Infinity if either is ±Infinity. + if ( !xc || !yc ) { + y.c = y.e = null; + + // Return ±0 if either is ±0. + } else { + y.c = [0]; + y.e = 0; + } + } + + return y; + } + + e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE ); + y.s *= x.s; + xcL = xc.length; + ycL = yc.length; + + // Ensure xc points to longer array and xcL to its length. + if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i; + + // Initialise the result array with zeros. + for ( i = xcL + ycL, zc = []; i--; zc.push(0) ); + + base = BASE; + sqrtBase = SQRT_BASE; + + for ( i = ycL; --i >= 0; ) { + c = 0; + ylo = yc[i] % sqrtBase; + yhi = yc[i] / sqrtBase | 0; + + for ( k = xcL, j = i + k; j > i; ) { + xlo = xc[--k] % sqrtBase; + xhi = xc[k] / sqrtBase | 0; + m = yhi * xlo + xhi * ylo; + xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c; + c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi; + zc[j--] = xlo % base; + } + + zc[j] = c; + } + + if (c) { + ++e; + } else { + zc.splice(0, 1); + } + + return normalise( y, zc, e ); + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of + * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted. + * + * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'toDigits() precision out of range: {sd}' + * 'toDigits() precision not an integer: {sd}' + * 'toDigits() rounding mode not an integer: {rm}' + * 'toDigits() rounding mode out of range: {rm}' + */ + P.toDigits = function ( sd, rm ) { + var n = new BigNumber(this); + sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0; + rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0; + return sd ? round( n, sd, rm ) : n; + }; + + + /* + * Return a string representing the value of this BigNumber in exponential notation and + * rounded using ROUNDING_MODE to dp fixed decimal places. + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'toExponential() decimal places not an integer: {dp}' + * 'toExponential() decimal places out of range: {dp}' + * 'toExponential() rounding mode not an integer: {rm}' + * 'toExponential() rounding mode out of range: {rm}' + */ + P.toExponential = function ( dp, rm ) { + return format( this, + dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 ); + }; + + + /* + * Return a string representing the value of this BigNumber in fixed-point notation rounding + * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted. + * + * Note: as with JavaScript's number type, (-0).toFixed(0) is '0', + * but e.g. (-0.00001).toFixed(0) is '-0'. + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'toFixed() decimal places not an integer: {dp}' + * 'toFixed() decimal places out of range: {dp}' + * 'toFixed() rounding mode not an integer: {rm}' + * 'toFixed() rounding mode out of range: {rm}' + */ + P.toFixed = function ( dp, rm ) { + return format( this, dp != null && isValidInt( dp, 0, MAX, 20 ) + ? ~~dp + this.e + 1 : null, rm, 20 ); + }; + + + /* + * Return a string representing the value of this BigNumber in fixed-point notation rounded + * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties + * of the FORMAT object (see BigNumber.config). + * + * FORMAT = { + * decimalSeparator : '.', + * groupSeparator : ',', + * groupSize : 3, + * secondaryGroupSize : 0, + * fractionGroupSeparator : '\xA0', // non-breaking space + * fractionGroupSize : 0 + * }; + * + * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'toFormat() decimal places not an integer: {dp}' + * 'toFormat() decimal places out of range: {dp}' + * 'toFormat() rounding mode not an integer: {rm}' + * 'toFormat() rounding mode out of range: {rm}' + */ + P.toFormat = function ( dp, rm ) { + var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 ) + ? ~~dp + this.e + 1 : null, rm, 21 ); + + if ( this.c ) { + var i, + arr = str.split('.'), + g1 = +FORMAT.groupSize, + g2 = +FORMAT.secondaryGroupSize, + groupSeparator = FORMAT.groupSeparator, + intPart = arr[0], + fractionPart = arr[1], + isNeg = this.s < 0, + intDigits = isNeg ? intPart.slice(1) : intPart, + len = intDigits.length; + + if (g2) i = g1, g1 = g2, g2 = i, len -= i; + + if ( g1 > 0 && len > 0 ) { + i = len % g1 || g1; + intPart = intDigits.substr( 0, i ); + + for ( ; i < len; i += g1 ) { + intPart += groupSeparator + intDigits.substr( i, g1 ); + } + + if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i); + if (isNeg) intPart = '-' + intPart; + } + + str = fractionPart + ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize ) + ? fractionPart.replace( new RegExp( '\\d{' + g2 + '}\\B', 'g' ), + '$&' + FORMAT.fractionGroupSeparator ) + : fractionPart ) + : intPart; + } + + return str; + }; + + + /* + * Return a string array representing the value of this BigNumber as a simple fraction with + * an integer numerator and an integer denominator. The denominator will be a positive + * non-zero value less than or equal to the specified maximum denominator. If a maximum + * denominator is not specified, the denominator will be the lowest value necessary to + * represent the number exactly. + * + * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator. + * + * 'toFraction() max denominator not an integer: {md}' + * 'toFraction() max denominator out of range: {md}' + */ + P.toFraction = function (md) { + var arr, d0, d2, e, exp, n, n0, q, s, + k = ERRORS, + x = this, + xc = x.c, + d = new BigNumber(ONE), + n1 = d0 = new BigNumber(ONE), + d1 = n0 = new BigNumber(ONE); + + if ( md != null ) { + ERRORS = false; + n = new BigNumber(md); + ERRORS = k; + + if ( !( k = n.isInt() ) || n.lt(ONE) ) { + + if (ERRORS) { + raise( 22, + 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md ); + } + + // ERRORS is false: + // If md is a finite non-integer >= 1, round it to an integer and use it. + md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null; + } + } + + if ( !xc ) return x.toString(); + s = coeffToString(xc); + + // Determine initial denominator. + // d is a power of 10 and the minimum max denominator that specifies the value exactly. + e = d.e = s.length - x.e - 1; + d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ]; + md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n; + + exp = MAX_EXP; + MAX_EXP = 1 / 0; + n = new BigNumber(s); + + // n0 = d1 = 0 + n0.c[0] = 0; + + for ( ; ; ) { + q = div( n, d, 0, 1 ); + d2 = d0.plus( q.times(d1) ); + if ( d2.cmp(md) == 1 ) break; + d0 = d1; + d1 = d2; + n1 = n0.plus( q.times( d2 = n1 ) ); + n0 = d2; + d = n.minus( q.times( d2 = d ) ); + n = d2; + } + + d2 = div( md.minus(d0), d1, 0, 1 ); + n0 = n0.plus( d2.times(n1) ); + d0 = d0.plus( d2.times(d1) ); + n0.s = n1.s = x.s; + e *= 2; + + // Determine which fraction is closer to x, n0/d0 or n1/d1 + arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp( + div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1 + ? [ n1.toString(), d1.toString() ] + : [ n0.toString(), d0.toString() ]; + + MAX_EXP = exp; + return arr; + }; + + + /* + * Return the value of this BigNumber converted to a number primitive. + */ + P.toNumber = function () { + return +this; + }; + + + /* + * Return a BigNumber whose value is the value of this BigNumber raised to the power n. + * If m is present, return the result modulo m. + * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE. + * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using + * ROUNDING_MODE. + * + * The modular power operation works efficiently when x, n, and m are positive integers, + * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0). + * + * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive. + * [m] {number|string|BigNumber} The modulus. + * + * 'pow() exponent not an integer: {n}' + * 'pow() exponent out of range: {n}' + * + * Performs 54 loop iterations for n of 9007199254740991. + */ + P.toPower = P.pow = function ( n, m ) { + var k, y, z, + i = mathfloor( n < 0 ? -n : +n ), + x = this; + + if ( m != null ) { + id = 23; + m = new BigNumber(m); + } + + // Pass ±Infinity to Math.pow if exponent is out of range. + if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) && + ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) || + parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) { + k = Math.pow( +x, n ); + return new BigNumber( m ? k % m : k ); + } + + if (m) { + if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) { + x = x.mod(m); + } else { + z = m; + + // Nullify m so only a single mod operation is performed at the end. + m = null; + } + } else if (POW_PRECISION) { + + // Truncating each coefficient array to a length of k after each multiplication + // equates to truncating significant digits to POW_PRECISION + [28, 41], + // i.e. there will be a minimum of 28 guard digits retained. + // (Using + 1.5 would give [9, 21] guard digits.) + k = mathceil( POW_PRECISION / LOG_BASE + 2 ); + } + + y = new BigNumber(ONE); + + for ( ; ; ) { + if ( i % 2 ) { + y = y.times(x); + if ( !y.c ) break; + if (k) { + if ( y.c.length > k ) y.c.length = k; + } else if (m) { + y = y.mod(m); + } + } + + i = mathfloor( i / 2 ); + if ( !i ) break; + x = x.times(x); + if (k) { + if ( x.c && x.c.length > k ) x.c.length = k; + } else if (m) { + x = x.mod(m); + } + } + + if (m) return y; + if ( n < 0 ) y = ONE.div(y); + + return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y; + }; + + + /* + * Return a string representing the value of this BigNumber rounded to sd significant digits + * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits + * necessary to represent the integer part of the value in fixed-point notation, then use + * exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'toPrecision() precision not an integer: {sd}' + * 'toPrecision() precision out of range: {sd}' + * 'toPrecision() rounding mode not an integer: {rm}' + * 'toPrecision() rounding mode out of range: {rm}' + */ + P.toPrecision = function ( sd, rm ) { + return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' ) + ? sd | 0 : null, rm, 24 ); + }; + + + /* + * Return a string representing the value of this BigNumber in base b, or base 10 if b is + * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and + * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent + * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than + * TO_EXP_NEG, return exponential notation. + * + * [b] {number} Integer, 2 to 64 inclusive. + * + * 'toString() base not an integer: {b}' + * 'toString() base out of range: {b}' + */ + P.toString = function (b) { + var str, + n = this, + s = n.s, + e = n.e; + + // Infinity or NaN? + if ( e === null ) { + + if (s) { + str = 'Infinity'; + if ( s < 0 ) str = '-' + str; + } else { + str = 'NaN'; + } + } else { + str = coeffToString( n.c ); + + if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) { + str = e <= TO_EXP_NEG || e >= TO_EXP_POS + ? toExponential( str, e ) + : toFixedPoint( str, e ); + } else { + str = convertBase( toFixedPoint( str, e ), b | 0, 10, s ); + } + + if ( s < 0 && n.c[0] ) str = '-' + str; + } + + return str; + }; + + + /* + * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole + * number. + */ + P.truncated = P.trunc = function () { + return round( new BigNumber(this), this.e + 1, 1 ); + }; + + + /* + * Return as toString, but do not accept a base argument, and include the minus sign for + * negative zero. + */ + P.valueOf = P.toJSON = function () { + var str, + n = this, + e = n.e; + + if ( e === null ) return n.toString(); + + str = coeffToString( n.c ); + + str = e <= TO_EXP_NEG || e >= TO_EXP_POS + ? toExponential( str, e ) + : toFixedPoint( str, e ); + + return n.s < 0 ? '-' + str : str; + }; + + + P.isBigNumber = true; + + if ( config != null ) BigNumber.config(config); + + return BigNumber; + } + + + // PRIVATE HELPER FUNCTIONS + + + function bitFloor(n) { + var i = n | 0; + return n > 0 || n === i ? i : i - 1; + } + + + // Return a coefficient array as a string of base 10 digits. + function coeffToString(a) { + var s, z, + i = 1, + j = a.length, + r = a[0] + ''; + + for ( ; i < j; ) { + s = a[i++] + ''; + z = LOG_BASE - s.length; + for ( ; z--; s = '0' + s ); + r += s; + } + + // Determine trailing zeros. + for ( j = r.length; r.charCodeAt(--j) === 48; ); + return r.slice( 0, j + 1 || 1 ); + } + + + // Compare the value of BigNumbers x and y. + function compare( x, y ) { + var a, b, + xc = x.c, + yc = y.c, + i = x.s, + j = y.s, + k = x.e, + l = y.e; + + // Either NaN? + if ( !i || !j ) return null; + + a = xc && !xc[0]; + b = yc && !yc[0]; + + // Either zero? + if ( a || b ) return a ? b ? 0 : -j : i; + + // Signs differ? + if ( i != j ) return i; + + a = i < 0; + b = k == l; + + // Either Infinity? + if ( !xc || !yc ) return b ? 0 : !xc ^ a ? 1 : -1; + + // Compare exponents. + if ( !b ) return k > l ^ a ? 1 : -1; + + j = ( k = xc.length ) < ( l = yc.length ) ? k : l; + + // Compare digit by digit. + for ( i = 0; i < j; i++ ) if ( xc[i] != yc[i] ) return xc[i] > yc[i] ^ a ? 1 : -1; + + // Compare lengths. + return k == l ? 0 : k > l ^ a ? 1 : -1; + } + + + /* + * Return true if n is a valid number in range, otherwise false. + * Use for argument validation when ERRORS is false. + * Note: parseInt('1e+1') == 1 but parseFloat('1e+1') == 10. + */ + function intValidatorNoErrors( n, min, max ) { + return ( n = truncate(n) ) >= min && n <= max; + } + + + function isArray(obj) { + return Object.prototype.toString.call(obj) == '[object Array]'; + } + + + /* + * Convert string of baseIn to an array of numbers of baseOut. + * Eg. convertBase('255', 10, 16) returns [15, 15]. + * Eg. convertBase('ff', 16, 10) returns [2, 5, 5]. + */ + function toBaseOut( str, baseIn, baseOut ) { + var j, + arr = [0], + arrL, + i = 0, + len = str.length; + + for ( ; i < len; ) { + for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn ); + arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) ); + + for ( ; j < arr.length; j++ ) { + + if ( arr[j] > baseOut - 1 ) { + if ( arr[j + 1] == null ) arr[j + 1] = 0; + arr[j + 1] += arr[j] / baseOut | 0; + arr[j] %= baseOut; + } + } + } + + return arr.reverse(); + } + + + function toExponential( str, e ) { + return ( str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str ) + + ( e < 0 ? 'e' : 'e+' ) + e; + } + + + function toFixedPoint( str, e ) { + var len, z; + + // Negative exponent? + if ( e < 0 ) { + + // Prepend zeros. + for ( z = '0.'; ++e; z += '0' ); + str = z + str; + + // Positive exponent + } else { + len = str.length; + + // Append zeros. + if ( ++e > len ) { + for ( z = '0', e -= len; --e; z += '0' ); + str += z; + } else if ( e < len ) { + str = str.slice( 0, e ) + '.' + str.slice(e); + } + } + + return str; + } + + + function truncate(n) { + n = parseFloat(n); + return n < 0 ? mathceil(n) : mathfloor(n); + } + + + // EXPORT + + + BigNumber = constructorFactory(); + BigNumber['default'] = BigNumber.BigNumber = BigNumber; + + + // AMD. + if ( typeof define == 'function' && define.amd ) { + define( function () { return BigNumber; } ); + + // Node.js and other environments that support module.exports. + } else if ( typeof module != 'undefined' && module.exports ) { + module.exports = BigNumber; + + // Browser. + } else { + if ( !globalObj ) globalObj = typeof self != 'undefined' ? self : Function('return this')(); + globalObj.BigNumber = BigNumber; + } +})(this); diff --git a/node_modules/bignumber.js/bower.json b/node_modules/bignumber.js/bower.json index bff7d78..d0e2d14 100644 --- a/node_modules/bignumber.js/bower.json +++ b/node_modules/bignumber.js/bower.json @@ -1,36 +1,36 @@ -{ - "name": "bignumber.js", - "main": "bignumber.js", - "version": "4.0.4", - "homepage": "https://github.com/MikeMcl/bignumber.js", - "authors": [ - "Michael Mclaughlin " - ], - "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", - "moduleType": [ - "amd", - "globals", - "node" - ], - "keywords": [ - "arbitrary", - "precision", - "arithmetic", - "big", - "number", - "decimal", - "float", - "biginteger", - "bigdecimal", - "bignumber", - "bigint", - "bignum" - ], - "license": "MIT", - "ignore": [ - ".*", - "*.json", - "test" - ] -} - +{ + "name": "bignumber.js", + "main": "bignumber.js", + "version": "4.0.4", + "homepage": "https://github.com/MikeMcl/bignumber.js", + "authors": [ + "Michael Mclaughlin " + ], + "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "arbitrary", + "precision", + "arithmetic", + "big", + "number", + "decimal", + "float", + "biginteger", + "bigdecimal", + "bignumber", + "bigint", + "bignum" + ], + "license": "MIT", + "ignore": [ + ".*", + "*.json", + "test" + ] +} + diff --git a/node_modules/bignumber.js/doc/API.html b/node_modules/bignumber.js/doc/API.html index a34605e..c8df246 100644 --- a/node_modules/bignumber.js/doc/API.html +++ b/node_modules/bignumber.js/doc/API.html @@ -1,2197 +1,2197 @@ - - - - - - -bignumber.js API - - - - - - -
- -

bignumber.js

- -

A JavaScript library for arbitrary-precision arithmetic.

-

Hosted on GitHub.

- -

API

- -

- See the README on GitHub for a - quick-start introduction. -

-

- In all examples below, var and semicolons are not shown, and if a commented-out - value is in quotes it means toString has been called on the preceding expression. -

- - -

CONSTRUCTOR

- -
- BigNumberBigNumber(value [, base]) ⇒ BigNumber -
-
-
value
-
- number|string|BigNumber: see RANGE for - range. -
-
- A numeric value. -
-
- Legitimate values include ±0, ±Infinity and - NaN. -
-
- Values of type number with more than 15 significant digits are - considered invalid (if ERRORS is true) as calling - toString or valueOf on - such numbers may not result in the intended value. -
console.log( 823456789123456.3 );    // 823456789123456.2
-
-
- There is no limit to the number of digits of a value of type string (other than - that of JavaScript's maximum array size). -
-
- Decimal string values may be in exponential, as well as normal (fixed-point) notation. - Non-decimal values must be in normal notation. -
-
- String values in hexadecimal literal form, e.g. '0xff', are valid, as are - string values with the octal and binary prefixs '0o' and '0b'. - String values in octal literal form without the prefix will be interpreted as - decimals, e.g. '011' is interpreted as 11, not 9. -
-
Values in any base may have fraction digits.
-
- For bases from 10 to 36, lower and/or upper case letters can be - used to represent values from 10 to 35. -
-
- For bases above 36, a-z represents values from 10 to - 35, A-Z from 36 to 61, and - $ and _ represent 62 and 63 respectively - (this can be changed by editing the ALPHABET variable near the top of the - source file). -
-
-
-
base
-
- number: integer, 2 to 64 inclusive -
-
The base of value.
-
- If base is omitted, or is null or undefined, base - 10 is assumed. -
-
-
-

Returns a new instance of a BigNumber object.

-

- If a base is specified, the value is rounded according to - the current DECIMAL_PLACES and - ROUNDING_MODE configuration. -

-

- See Errors for the treatment of an invalid value or - base. -

-
-x = new BigNumber(9)                       // '9'
-y = new BigNumber(x)                       // '9'
-
-// 'new' is optional if ERRORS is false
-BigNumber(435.345)                         // '435.345'
-
-new BigNumber('5032485723458348569331745.33434346346912144534543')
-new BigNumber('4.321e+4')                  // '43210'
-new BigNumber('-735.0918e-430')            // '-7.350918e-428'
-new BigNumber(Infinity)                    // 'Infinity'
-new BigNumber(NaN)                         // 'NaN'
-new BigNumber('.5')                        // '0.5'
-new BigNumber('+2')                        // '2'
-new BigNumber(-10110100.1, 2)              // '-180.5'
-new BigNumber(-0b10110100.1)               // '-180.5'
-new BigNumber('123412421.234324', 5)       // '607236.557696'
-new BigNumber('ff.8', 16)                  // '255.5'
-new BigNumber('0xff.8')                    // '255.5'
-

- The following throws 'not a base 2 number' if - ERRORS is true, otherwise it returns a BigNumber with value - NaN. -

-
new BigNumber(9, 2)
-

- The following throws 'number type has more than 15 significant digits' if - ERRORS is true, otherwise it returns a BigNumber with value - 96517860459076820. -

-
new BigNumber(96517860459076817.4395)
-

- The following throws 'not a number' if ERRORS - is true, otherwise it returns a BigNumber with value NaN. -

-
new BigNumber('blurgh')
-

- A value is only rounded by the constructor if a base is specified. -

-
BigNumber.config({ DECIMAL_PLACES: 5 })
-new BigNumber(1.23456789)                  // '1.23456789'
-new BigNumber(1.23456789, 10)              // '1.23457'
- - - -

Methods

-

The static methods of a BigNumber constructor.

- - - - -
- another.another([obj]) ⇒ BigNumber constructor -
-

obj: object

-

- Returns a new independent BigNumber constructor with configuration as described by - obj (see config), or with the default - configuration if obj is null or undefined. -

-
BigNumber.config({ DECIMAL_PLACES: 5 })
-BN = BigNumber.another({ DECIMAL_PLACES: 9 })
-
-x = new BigNumber(1)
-y = new BN(1)
-
-x.div(3)                        // 0.33333
-y.div(3)                        // 0.333333333
-
-// BN = BigNumber.another({ DECIMAL_PLACES: 9 }) is equivalent to:
-BN = BigNumber.another()
-BN.config({ DECIMAL_PLACES: 9 })
- - - -
configset([obj]) ⇒ object
-

- obj: object: an object that contains some or all of the following - properties. -

-

Configures the settings for this particular BigNumber constructor.

-

Note: the configuration can also be supplied as an argument list, see below.

-
-
DECIMAL_PLACES
-
- number: integer, 0 to 1e+9 inclusive
- Default value: 20 -
-
- The maximum number of decimal places of the results of operations involving - division, i.e. division, square root and base conversion operations, and power - operations with negative exponents.
-
-
-
BigNumber.config({ DECIMAL_PLACES: 5 })
-BigNumber.set({ DECIMAL_PLACES: 5 })    // equivalent
-BigNumber.config(5)    // equivalent
-
- - - -
ROUNDING_MODE
-
- number: integer, 0 to 8 inclusive
- Default value: 4 (ROUND_HALF_UP) -
-
- The rounding mode used in the above operations and the default rounding mode of - round, - toExponential, - toFixed, - toFormat and - toPrecision. -
-
The modes are available as enumerated properties of the BigNumber constructor.
-
-
BigNumber.config({ ROUNDING_MODE: 0 })
-BigNumber.config(null, BigNumber.ROUND_UP)    // equivalent
-
- - - -
EXPONENTIAL_AT
-
- number: integer, magnitude 0 to 1e+9 inclusive, or -
- number[]: [ integer -1e+9 to 0 inclusive, integer - 0 to 1e+9 inclusive ]
- Default value: [-7, 20] -
-
- The exponent value(s) at which toString returns exponential notation. -
-
- If a single number is assigned, the value is the exponent magnitude.
- If an array of two numbers is assigned then the first number is the negative exponent - value at and beneath which exponential notation is used, and the second number is the - positive exponent value at and above which the same. -
-
- For example, to emulate JavaScript numbers in terms of the exponent values at which they - begin to use exponential notation, use [-7, 20]. -
-
-
BigNumber.config({ EXPONENTIAL_AT: 2 })
-new BigNumber(12.3)         // '12.3'        e is only 1
-new BigNumber(123)          // '1.23e+2'
-new BigNumber(0.123)        // '0.123'       e is only -1
-new BigNumber(0.0123)       // '1.23e-2'
-
-BigNumber.config({ EXPONENTIAL_AT: [-7, 20] })
-new BigNumber(123456789)    // '123456789'   e is only 8
-new BigNumber(0.000000123)  // '1.23e-7'
-
-// Almost never return exponential notation:
-BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
-
-// Always return exponential notation:
-BigNumber.config({ EXPONENTIAL_AT: 0 })
-
-
- Regardless of the value of EXPONENTIAL_AT, the toFixed method - will always return a value in normal notation and the toExponential method - will always return a value in exponential form. -
-
- Calling toString with a base argument, e.g. toString(10), will - also always return normal notation. -
- - - -
RANGE
-
- number: integer, magnitude 1 to 1e+9 inclusive, or -
- number[]: [ integer -1e+9 to -1 inclusive, integer - 1 to 1e+9 inclusive ]
- Default value: [-1e+9, 1e+9] -
-
- The exponent value(s) beyond which overflow to Infinity and underflow to - zero occurs. -
-
- If a single number is assigned, it is the maximum exponent magnitude: values wth a - positive exponent of greater magnitude become Infinity and those with a - negative exponent of greater magnitude become zero. -
- If an array of two numbers is assigned then the first number is the negative exponent - limit and the second number is the positive exponent limit. -
-
- For example, to emulate JavaScript numbers in terms of the exponent values at which they - become zero and Infinity, use [-324, 308]. -
-
-
BigNumber.config({ RANGE: 500 })
-BigNumber.config().RANGE     // [ -500, 500 ]
-new BigNumber('9.999e499')   // '9.999e+499'
-new BigNumber('1e500')       // 'Infinity'
-new BigNumber('1e-499')      // '1e-499'
-new BigNumber('1e-500')      // '0'
-
-BigNumber.config({ RANGE: [-3, 4] })
-new BigNumber(99999)         // '99999'      e is only 4
-new BigNumber(100000)        // 'Infinity'   e is 5
-new BigNumber(0.001)         // '0.01'       e is only -3
-new BigNumber(0.0001)        // '0'          e is -4
-
-
- The largest possible magnitude of a finite BigNumber is - 9.999...e+1000000000.
- The smallest possible magnitude of a non-zero BigNumber is 1e-1000000000. -
- - - -
ERRORS
-
- boolean|number: true, false, 0 or - 1.
- Default value: true -
-
- The value that determines whether BigNumber Errors are thrown.
- If ERRORS is false, no errors will be thrown. -
-
See Errors.
-
BigNumber.config({ ERRORS: false })
- - - -
CRYPTO
-
- boolean|number: true, false, 0 or - 1.
- Default value: false -
-
- The value that determines whether cryptographically-secure pseudo-random number - generation is used. -
-
- If CRYPTO is set to true then the - random method will generate random digits using - crypto.getRandomValues in browsers that support it, or - crypto.randomBytes if using a version of Node.js that supports it. -
-
- If neither function is supported by the host environment then attempting to set - CRYPTO to true will fail, and if ERRORS - is true an exception will be thrown. -
-
- If CRYPTO is false then the source of randomness used will be - Math.random (which is assumed to generate at least 30 bits of - randomness). -
-
See random.
-
-
BigNumber.config({ CRYPTO: true })
-BigNumber.config().CRYPTO       // true
-BigNumber.random()              // 0.54340758610486147524
-
- - - -
MODULO_MODE
-
- number: integer, 0 to 9 inclusive
- Default value: 1 (ROUND_DOWN) -
-
The modulo mode used when calculating the modulus: a mod n.
-
- The quotient, q = a / n, is calculated according to the - ROUNDING_MODE that corresponds to the chosen - MODULO_MODE. -
-
The remainder, r, is calculated as: r = a - n * q.
-
- The modes that are most commonly used for the modulus/remainder operation are shown in - the following table. Although the other rounding modes can be used, they may not give - useful results. -
-
- - - - - - - - - - - - - - - - - - - - - - -
PropertyValueDescription
ROUND_UP0 - The remainder is positive if the dividend is negative, otherwise it is negative. -
ROUND_DOWN1 - The remainder has the same sign as the dividend.
- This uses 'truncating division' and matches the behaviour of JavaScript's - remainder operator %. -
ROUND_FLOOR3 - The remainder has the same sign as the divisor.
- This matches Python's % operator. -
ROUND_HALF_EVEN6The IEEE 754 remainder function.
EUCLID9 - The remainder is always positive. Euclidian division:
- q = sign(n) * floor(a / abs(n)) -
-
-
- The rounding/modulo modes are available as enumerated properties of the BigNumber - constructor. -
-
See modulo.
-
-
BigNumber.config({ MODULO_MODE: BigNumber.EUCLID })
-BigNumber.config({ MODULO_MODE: 9 })          // equivalent
-
- - - -
POW_PRECISION
-
- number: integer, 0 to 1e+9 inclusive.
- Default value: 0 -
-
- The maximum number of significant digits of the result of the power operation - (unless a modulus is specified). -
-
If set to 0, the number of signifcant digits will not be limited.
-
See toPower.
-
BigNumber.config({ POW_PRECISION: 100 })
- - - -
FORMAT
-
object
-
- The FORMAT object configures the format of the string returned by the - toFormat method. -
-
- The example below shows the properties of the FORMAT object that are - recognised, and their default values. -
-
- Unlike the other configuration properties, the values of the properties of the - FORMAT object will not be checked for validity. The existing - FORMAT object will simply be replaced by the object that is passed in. - Note that all the properties shown below do not have to be included. -
-
See toFormat for examples of usage.
-
-
-BigNumber.config({
-    FORMAT: {
-        // the decimal separator
-        decimalSeparator: '.',
-        // the grouping separator of the integer part
-        groupSeparator: ',',
-        // the primary grouping size of the integer part
-        groupSize: 3,
-        // the secondary grouping size of the integer part
-        secondaryGroupSize: 0,
-        // the grouping separator of the fraction part
-        fractionGroupSeparator: ' ',
-        // the grouping size of the fraction part
-        fractionGroupSize: 0
-    }
-});
-
-
-
-

Returns an object with the above properties and their current values.

-

- If the value to be assigned to any of the above properties is null or - undefined it is ignored. -

-

See Errors for the treatment of invalid values.

-
-BigNumber.config({
-    DECIMAL_PLACES: 40,
-    ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL,
-    EXPONENTIAL_AT: [-10, 20],
-    RANGE: [-500, 500],
-    ERRORS: true,
-    CRYPTO: true,
-    MODULO_MODE: BigNumber.ROUND_FLOOR,
-    POW_PRECISION: 80,
-    FORMAT: {
-        groupSize: 3,
-        groupSeparator: ' ',
-        decimalSeparator: ','
-    }
-});
-
-// Alternatively but equivalently (excluding FORMAT):
-BigNumber.config( 40, 7, [-10, 20], 500, 1, 1, 3, 80 )
-
-obj = BigNumber.config();
-obj.ERRORS       // true
-obj.RANGE        // [-500, 500]
- - - -
- max.max([arg1 [, arg2, ...]]) ⇒ BigNumber -
-

- arg1, arg2, ...: number|string|BigNumber
- See BigNumber for further parameter details. -

-

- Returns a BigNumber whose value is the maximum of arg1, - arg2,... . -

-

The argument to this method can also be an array of values.

-

The return value is always exact and unrounded.

-
x = new BigNumber('3257869345.0378653')
-BigNumber.max(4e9, x, '123456789.9')          // '4000000000'
-
-arr = [12, '13', new BigNumber(14)]
-BigNumber.max(arr)                            // '14'
- - - -
- min.min([arg1 [, arg2, ...]]) ⇒ BigNumber -
-

- arg1, arg2, ...: number|string|BigNumber
- See BigNumber for further parameter details. -

-

- Returns a BigNumber whose value is the minimum of arg1, - arg2,... . -

-

The argument to this method can also be an array of values.

-

The return value is always exact and unrounded.

-
x = new BigNumber('3257869345.0378653')
-BigNumber.min(4e9, x, '123456789.9')          // '123456789.9'
-
-arr = [2, new BigNumber(-14), '-15.9999', -12]
-BigNumber.min(arr)                            // '-15.9999'
- - - -
- random.random([dp]) ⇒ BigNumber -
-

dp: number: integer, 0 to 1e+9 inclusive

-

- Returns a new BigNumber with a pseudo-random value equal to or greater than 0 and - less than 1. -

-

- The return value will have dp decimal places (or less if trailing zeros are - produced).
- If dp is omitted then the number of decimal places will default to the current - DECIMAL_PLACES setting. -

-

- Depending on the value of this BigNumber constructor's - CRYPTO setting and the support for the - crypto object in the host environment, the random digits of the return value are - generated by either Math.random (fastest), crypto.getRandomValues - (Web Cryptography API in recent browsers) or crypto.randomBytes (Node.js). -

-

- If CRYPTO is true, i.e. one of the - crypto methods is to be used, the value of a returned BigNumber should be - cryptographically-secure and statistically indistinguishable from a random value. -

-
BigNumber.config({ DECIMAL_PLACES: 10 })
-BigNumber.random()              // '0.4117936847'
-BigNumber.random(20)            // '0.78193327636914089009'
- - - -

Properties

-

- The library's enumerated rounding modes are stored as properties of the constructor.
- (They are not referenced internally by the library itself.) -

-

- Rounding modes 0 to 6 (inclusive) are the same as those of Java's - BigDecimal class. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyValueDescription
ROUND_UP0Rounds away from zero
ROUND_DOWN1Rounds towards zero
ROUND_CEIL2Rounds towards Infinity
ROUND_FLOOR3Rounds towards -Infinity
ROUND_HALF_UP4 - Rounds towards nearest neighbour.
- If equidistant, rounds away from zero -
ROUND_HALF_DOWN5 - Rounds towards nearest neighbour.
- If equidistant, rounds towards zero -
ROUND_HALF_EVEN6 - Rounds towards nearest neighbour.
- If equidistant, rounds towards even neighbour -
ROUND_HALF_CEIL7 - Rounds towards nearest neighbour.
- If equidistant, rounds towards Infinity -
ROUND_HALF_FLOOR8 - Rounds towards nearest neighbour.
- If equidistant, rounds towards -Infinity -
-
-BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_CEIL })
-BigNumber.config({ ROUNDING_MODE: 2 })     // equivalent
- - -

INSTANCE

- -

Methods

-

The methods inherited by a BigNumber instance from its constructor's prototype object.

-

A BigNumber is immutable in the sense that it is not changed by its methods.

-

- The treatment of ±0, ±Infinity and NaN is - consistent with how JavaScript treats these values. -

-

- Many method names have a shorter alias.
- (Internally, the library always uses the shorter method names.) -

- - - -
absoluteValue.abs() ⇒ BigNumber
-

- Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of - this BigNumber. -

-

The return value is always exact and unrounded.

-
-x = new BigNumber(-0.8)
-y = x.absoluteValue()           // '0.8'
-z = y.abs()                     // '0.8'
- - - -
ceil.ceil() ⇒ BigNumber
-

- Returns a BigNumber whose value is the value of this BigNumber rounded to - a whole number in the direction of positive Infinity. -

-
-x = new BigNumber(1.3)
-x.ceil()                        // '2'
-y = new BigNumber(-1.8)
-y.ceil()                        // '-1'
- - - -
comparedTo.cmp(n [, base]) ⇒ number
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

- - - - - - - - - - - - - - - - - - -
Returns 
1If the value of this BigNumber is greater than the value of n
-1If the value of this BigNumber is less than the value of n
0If this BigNumber and n have the same value
nullIf the value of either this BigNumber or n is NaN
-
-x = new BigNumber(Infinity)
-y = new BigNumber(5)
-x.comparedTo(y)                 // 1
-x.comparedTo(x.minus(1))        // 0
-y.cmp(NaN)                      // null
-y.cmp('110', 2)                 // -1
- - - -
decimalPlaces.dp() ⇒ number
-

- Return the number of decimal places of the value of this BigNumber, or null if - the value of this BigNumber is ±Infinity or NaN. -

-
-x = new BigNumber(123.45)
-x.decimalPlaces()               // 2
-y = new BigNumber('9.9e-101')
-y.dp()                          // 102
- - - -
dividedBy.div(n [, base]) ⇒ BigNumber -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns a BigNumber whose value is the value of this BigNumber divided by - n, rounded according to the current - DECIMAL_PLACES and - ROUNDING_MODE configuration. -

-
-x = new BigNumber(355)
-y = new BigNumber(113)
-x.dividedBy(y)                  // '3.14159292035398230088'
-x.div(5)                        // '71'
-x.div(47, 16)                   // '5'
- - - -
- dividedToIntegerBy.divToInt(n [, base]) ⇒ - BigNumber -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Return a BigNumber whose value is the integer part of dividing the value of this BigNumber by - n. -

-
-x = new BigNumber(5)
-y = new BigNumber(3)
-x.dividedToIntegerBy(y)         // '1'
-x.divToInt(0.7)                 // '7'
-x.divToInt('0.f', 16)           // '5'
- - - -
equals.eq(n [, base]) ⇒ boolean
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns true if the value of this BigNumber equals the value of n, - otherwise returns false.
- As with JavaScript, NaN does not equal NaN. -

-

Note: This method uses the comparedTo method internally.

-
-0 === 1e-324                    // true
-x = new BigNumber(0)
-x.equals('1e-324')              // false
-BigNumber(-0).eq(x)             // true  ( -0 === 0 )
-BigNumber(255).eq('ff', 16)     // true
-
-y = new BigNumber(NaN)
-y.equals(NaN)                   // false
- - - -
floor.floor() ⇒ BigNumber
-

- Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in - the direction of negative Infinity. -

-
-x = new BigNumber(1.8)
-x.floor()                       // '1'
-y = new BigNumber(-1.3)
-y.floor()                       // '-2'
- - - -
greaterThan.gt(n [, base]) ⇒ boolean
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns true if the value of this BigNumber is greater than the value of - n, otherwise returns false. -

-

Note: This method uses the comparedTo method internally.

-
-0.1 > (0.3 - 0.2)                           // true
-x = new BigNumber(0.1)
-x.greaterThan(BigNumber(0.3).minus(0.2))    // false
-BigNumber(0).gt(x)                          // false
-BigNumber(11, 3).gt(11.1, 2)                // true
- - - -
- greaterThanOrEqualTo.gte(n [, base]) ⇒ boolean -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns true if the value of this BigNumber is greater than or equal to the value - of n, otherwise returns false. -

-

Note: This method uses the comparedTo method internally.

-
-(0.3 - 0.2) >= 0.1                   // false
-x = new BigNumber(0.3).minus(0.2)
-x.greaterThanOrEqualTo(0.1)          // true
-BigNumber(1).gte(x)                  // true
-BigNumber(10, 18).gte('i', 36)       // true
- - - -
isFinite.isFinite() ⇒ boolean
-

- Returns true if the value of this BigNumber is a finite number, otherwise - returns false. -

-

- The only possible non-finite values of a BigNumber are NaN, Infinity - and -Infinity. -

-
-x = new BigNumber(1)
-x.isFinite()                    // true
-y = new BigNumber(Infinity)
-y.isFinite()                    // false
-

- Note: The native method isFinite() can be used if - n <= Number.MAX_VALUE. -

- - - -
isInteger.isInt() ⇒ boolean
-

- Returns true if the value of this BigNumber is a whole number, otherwise returns - false. -

-
-x = new BigNumber(1)
-x.isInteger()                   // true
-y = new BigNumber(123.456)
-y.isInt()                       // false
- - - -
isNaN.isNaN() ⇒ boolean
-

- Returns true if the value of this BigNumber is NaN, otherwise - returns false. -

-
-x = new BigNumber(NaN)
-x.isNaN()                       // true
-y = new BigNumber('Infinity')
-y.isNaN()                       // false
-

Note: The native method isNaN() can also be used.

- - - -
isNegative.isNeg() ⇒ boolean
-

- Returns true if the value of this BigNumber is negative, otherwise returns - false. -

-
-x = new BigNumber(-0)
-x.isNegative()                  // true
-y = new BigNumber(2)
-y.isNeg()                       // false
-

Note: n < 0 can be used if n <= -Number.MIN_VALUE.

- - - -
isZero.isZero() ⇒ boolean
-

- Returns true if the value of this BigNumber is zero or minus zero, otherwise - returns false. -

-
-x = new BigNumber(-0)
-x.isZero() && x.isNeg()         // true
-y = new BigNumber(Infinity)
-y.isZero()                      // false
-

Note: n == 0 can be used if n >= Number.MIN_VALUE.

- - - -
lessThan.lt(n [, base]) ⇒ boolean
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns true if the value of this BigNumber is less than the value of - n, otherwise returns false. -

-

Note: This method uses the comparedTo method internally.

-
-(0.3 - 0.2) < 0.1                     // true
-x = new BigNumber(0.3).minus(0.2)
-x.lessThan(0.1)                       // false
-BigNumber(0).lt(x)                    // true
-BigNumber(11.1, 2).lt(11, 3)          // true
- - - -
- lessThanOrEqualTo.lte(n [, base]) ⇒ boolean -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns true if the value of this BigNumber is less than or equal to the value of - n, otherwise returns false. -

-

Note: This method uses the comparedTo method internally.

-
-0.1 <= (0.3 - 0.2)                                // false
-x = new BigNumber(0.1)
-x.lessThanOrEqualTo(BigNumber(0.3).minus(0.2))    // true
-BigNumber(-1).lte(x)                              // true
-BigNumber(10, 18).lte('i', 36)                    // true
- - - -
- minus.minus(n [, base]) ⇒ BigNumber -
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

Returns a BigNumber whose value is the value of this BigNumber minus n.

-

The return value is always exact and unrounded.

-
-0.3 - 0.1                       // 0.19999999999999998
-x = new BigNumber(0.3)
-x.minus(0.1)                    // '0.2'
-x.minus(0.6, 20)                // '0'
- - - -
modulo.mod(n [, base]) ⇒ BigNumber
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

- Returns a BigNumber whose value is the value of this BigNumber modulo n, i.e. - the integer remainder of dividing this BigNumber by n. -

-

- The value returned, and in particular its sign, is dependent on the value of the - MODULO_MODE setting of this BigNumber constructor. - If it is 1 (default value), the result will have the same sign as this BigNumber, - and it will match that of Javascript's % operator (within the limits of double - precision) and BigDecimal's remainder method. -

-

The return value is always exact and unrounded.

-

- See MODULO_MODE for a description of the other - modulo modes. -

-
-1 % 0.9                         // 0.09999999999999998
-x = new BigNumber(1)
-x.modulo(0.9)                   // '0.1'
-y = new BigNumber(33)
-y.mod('a', 33)                  // '3'
- - - -
negated.neg() ⇒ BigNumber
-

- Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by - -1. -

-
-x = new BigNumber(1.8)
-x.negated()                     // '-1.8'
-y = new BigNumber(-1.3)
-y.neg()                         // '1.3'
- - - -
plus.plus(n [, base]) ⇒ BigNumber
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

Returns a BigNumber whose value is the value of this BigNumber plus n.

-

The return value is always exact and unrounded.

-
-0.1 + 0.2                       // 0.30000000000000004
-x = new BigNumber(0.1)
-y = x.plus(0.2)                 // '0.3'
-BigNumber(0.7).plus(x).plus(y)  // '1'
-x.plus('0.1', 8)                // '0.225'
- - - -
precision.sd([z]) ⇒ number
-

- z: boolean|number: true, false, 0 - or 1 -

-

Returns the number of significant digits of the value of this BigNumber.

-

- If z is true or 1 then any trailing zeros of the - integer part of a number are counted as significant digits, otherwise they are not. -

-
-x = new BigNumber(1.234)
-x.precision()                   // 4
-y = new BigNumber(987000)
-y.sd()                          // 3
-y.sd(true)                      // 6
- - - -
round.round([dp [, rm]]) ⇒ BigNumber
-

- dp: number: integer, 0 to 1e+9 inclusive
- rm: number: integer, 0 to 8 inclusive -

-

- Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode - rm to a maximum of dp decimal places. -

-

- if dp is omitted, or is null or undefined, the - return value is n rounded to a whole number.
- if rm is omitted, or is null or undefined, - ROUNDING_MODE is used. -

-

- See Errors for the treatment of other non-integer or out of range - dp or rm values. -

-
-x = 1234.56
-Math.round(x)                             // 1235
-
-y = new BigNumber(x)
-y.round()                                 // '1235'
-y.round(1)                                // '1234.6'
-y.round(2)                                // '1234.56'
-y.round(10)                               // '1234.56'
-y.round(0, 1)                             // '1234'
-y.round(0, 6)                             // '1235'
-y.round(1, 1)                             // '1234.5'
-y.round(1, BigNumber.ROUND_HALF_EVEN)     // '1234.6'
-y                                         // '1234.56'
- - - -
shift.shift(n) ⇒ BigNumber
-

- n: number: integer, - -9007199254740991 to 9007199254740991 inclusive -

-

- Returns a BigNumber whose value is the value of this BigNumber shifted n places. -

- The shift is of the decimal point, i.e. of powers of ten, and is to the left if n - is negative or to the right if n is positive. -

-

The return value is always exact and unrounded.

-
-x = new BigNumber(1.23)
-x.shift(3)                      // '1230'
-x.shift(-3)                     // '0.00123'
- - - -
squareRoot.sqrt() ⇒ BigNumber
-

- Returns a BigNumber whose value is the square root of the value of this BigNumber, - rounded according to the current - DECIMAL_PLACES and - ROUNDING_MODE configuration. -

-

- The return value will be correctly rounded, i.e. rounded as if the result was first calculated - to an infinite number of correct digits before rounding. -

-
-x = new BigNumber(16)
-x.squareRoot()                  // '4'
-y = new BigNumber(3)
-y.sqrt()                        // '1.73205080756887729353'
- - - -
times.times(n [, base]) ⇒ BigNumber
-

- n: number|string|BigNumber
- base: number
- See BigNumber for further parameter details. -

-

Returns a BigNumber whose value is the value of this BigNumber times n.

-

The return value is always exact and unrounded.

-
-0.6 * 3                         // 1.7999999999999998
-x = new BigNumber(0.6)
-y = x.times(3)                  // '1.8'
-BigNumber('7e+500').times(y)    // '1.26e+501'
-x.times('-a', 16)               // '-6'
- - - -
- toDigits.toDigits([sd [, rm]]) ⇒ BigNumber -
-

- sd: number: integer, 1 to 1e+9 inclusive.
- rm: number: integer, 0 to 8 inclusive. -

-

- Returns a BigNumber whose value is the value of this BigNumber rounded to sd - significant digits using rounding mode rm. -

-

- If sd is omitted or is null or undefined, the return - value will not be rounded.
- If rm is omitted or is null or undefined, - ROUNDING_MODE will be used. -

-

- See Errors for the treatment of other non-integer or out of range - sd or rm values. -

-
-BigNumber.config({ precision: 5, rounding: 4 })
-x = new BigNumber(9876.54321)
-
-x.toDigits()                          // '9876.5'
-x.toDigits(6)                         // '9876.54'
-x.toDigits(6, BigNumber.ROUND_UP)     // '9876.55'
-x.toDigits(2)                         // '9900'
-x.toDigits(2, 1)                      // '9800'
-x                                     // '9876.54321'
- - - -
- toExponential.toExponential([dp [, rm]]) ⇒ string -
-

- dp: number: integer, 0 to 1e+9 inclusive
- rm: number: integer, 0 to 8 inclusive -

-

- Returns a string representing the value of this BigNumber in exponential notation rounded - using rounding mode rm to dp decimal places, i.e with one digit - before the decimal point and dp digits after it. -

-

- If the value of this BigNumber in exponential notation has fewer than dp fraction - digits, the return value will be appended with zeros accordingly. -

-

- If dp is omitted, or is null or undefined, the number - of digits after the decimal point defaults to the minimum number of digits necessary to - represent the value exactly.
- If rm is omitted or is null or undefined, - ROUNDING_MODE is used. -

-

- See Errors for the treatment of other non-integer or out of range - dp or rm values. -

-
-x = 45.6
-y = new BigNumber(x)
-x.toExponential()               // '4.56e+1'
-y.toExponential()               // '4.56e+1'
-x.toExponential(0)              // '5e+1'
-y.toExponential(0)              // '5e+1'
-x.toExponential(1)              // '4.6e+1'
-y.toExponential(1)              // '4.6e+1'
-y.toExponential(1, 1)           // '4.5e+1'  (ROUND_DOWN)
-x.toExponential(3)              // '4.560e+1'
-y.toExponential(3)              // '4.560e+1'
- - - -
- toFixed.toFixed([dp [, rm]]) ⇒ string -
-

- dp: number: integer, 0 to 1e+9 inclusive
- rm: number: integer, 0 to 8 inclusive -

-

- Returns a string representing the value of this BigNumber in normal (fixed-point) notation - rounded to dp decimal places using rounding mode rm. -

-

- If the value of this BigNumber in normal notation has fewer than dp fraction - digits, the return value will be appended with zeros accordingly. -

-

- Unlike Number.prototype.toFixed, which returns exponential notation if a number - is greater or equal to 1021, this method will always return normal - notation. -

-

- If dp is omitted or is null or undefined, the return - value will be unrounded and in normal notation. This is also unlike - Number.prototype.toFixed, which returns the value to zero decimal places.
- It is useful when fixed-point notation is required and the current - EXPONENTIAL_AT setting causes - toString to return exponential notation.
- If rm is omitted or is null or undefined, - ROUNDING_MODE is used. -

-

- See Errors for the treatment of other non-integer or out of range - dp or rm values. -

-
-x = 3.456
-y = new BigNumber(x)
-x.toFixed()                     // '3'
-y.toFixed()                     // '3.456'
-y.toFixed(0)                    // '3'
-x.toFixed(2)                    // '3.46'
-y.toFixed(2)                    // '3.46'
-y.toFixed(2, 1)                 // '3.45'  (ROUND_DOWN)
-x.toFixed(5)                    // '3.45600'
-y.toFixed(5)                    // '3.45600'
- - - -
- toFormat.toFormat([dp [, rm]]) ⇒ string -
-

- dp: number: integer, 0 to 1e+9 inclusive
- rm: number: integer, 0 to 8 inclusive -

-

-

- Returns a string representing the value of this BigNumber in normal (fixed-point) notation - rounded to dp decimal places using rounding mode rm, and formatted - according to the properties of the FORMAT object. -

-

- See the examples below for the properties of the - FORMAT object, their types and their usage. -

-

- If dp is omitted or is null or undefined, then the - return value is not rounded to a fixed number of decimal places.
- If rm is omitted or is null or undefined, - ROUNDING_MODE is used. -

-

- See Errors for the treatment of other non-integer or out of range - dp or rm values. -

-
-format = {
-    decimalSeparator: '.',
-    groupSeparator: ',',
-    groupSize: 3,
-    secondaryGroupSize: 0,
-    fractionGroupSeparator: ' ',
-    fractionGroupSize: 0
-}
-BigNumber.config({ FORMAT: format })
-
-x = new BigNumber('123456789.123456789')
-x.toFormat()                    // '123,456,789.123456789'
-x.toFormat(1)                   // '123,456,789.1'
-
-// If a reference to the object assigned to FORMAT has been retained,
-// the format properties can be changed directly
-format.groupSeparator = ' '
-format.fractionGroupSize = 5
-x.toFormat()                    // '123 456 789.12345 6789'
-
-BigNumber.config({
-    FORMAT: {
-        decimalSeparator: ',',
-        groupSeparator: '.',
-        groupSize: 3,
-        secondaryGroupSize: 2
-    }
-})
-
-x.toFormat(6)                   // '12.34.56.789,123'
- - - -
- toFraction.toFraction([max]) ⇒ [string, string] -
-

- max: number|string|BigNumber: integer >= 1 and < - Infinity -

-

- Returns a string array representing the value of this BigNumber as a simple fraction with an - integer numerator and an integer denominator. The denominator will be a positive non-zero - value less than or equal to max. -

-

- If a maximum denominator, max, is not specified, or is null or - undefined, the denominator will be the lowest value necessary to represent the - number exactly. -

-

- See Errors for the treatment of other non-integer or out of range - max values. -

-
-x = new BigNumber(1.75)
-x.toFraction()                  // '7, 4'
-
-pi = new BigNumber('3.14159265358')
-pi.toFraction()                 // '157079632679,50000000000'
-pi.toFraction(100000)           // '312689, 99532'
-pi.toFraction(10000)            // '355, 113'
-pi.toFraction(100)              // '311, 99'
-pi.toFraction(10)               // '22, 7'
-pi.toFraction(1)                // '3, 1'
- - - -
toJSON.toJSON() ⇒ string
-

As valueOf.

-
-x = new BigNumber('177.7e+457')
-y = new BigNumber(235.4325)
-z = new BigNumber('0.0098074')
-
-// Serialize an array of three BigNumbers
-str = JSON.stringify( [x, y, z] )
-// "["1.777e+459","235.4325","0.0098074"]"
-
-// Return an array of three BigNumbers
-JSON.parse(str, function (key, val) {
-    return key === '' ? val : new BigNumber(val)
-})
- - - -
toNumber.toNumber() ⇒ number
-

Returns the value of this BigNumber as a JavaScript number primitive.

-

- Type coercion with, for example, the unary plus operator will also work, except that a - BigNumber with the value minus zero will be converted to positive zero. -

-
-x = new BigNumber(456.789)
-x.toNumber()                    // 456.789
-+x                              // 456.789
-
-y = new BigNumber('45987349857634085409857349856430985')
-y.toNumber()                    // 4.598734985763409e+34
-
-z = new BigNumber(-0)
-1 / +z                          // Infinity
-1 / z.toNumber()                // -Infinity
- - - -
toPower.pow(n [, m]) ⇒ BigNumber
-

- n: number: integer, - -9007199254740991 to 9007199254740991 inclusive
- m: number|string|BigNumber -

-

- Returns a BigNumber whose value is the value of this BigNumber raised to the power - n, and optionally modulo a modulus m. -

-

- If n is negative the result is rounded according to the current - DECIMAL_PLACES and - ROUNDING_MODE configuration. -

-

- If n is not an integer or is out of range: -

-

- If ERRORS is true a BigNumber Error is thrown,
- else if n is greater than 9007199254740991, it is interpreted as - Infinity;
- else if n is less than -9007199254740991, it is interpreted as - -Infinity;
- else if n is otherwise a number, it is truncated to an integer;
- else it is interpreted as NaN. -

-

- As the number of digits of the result of the power operation can grow so large so quickly, - e.g. 123.45610000 has over 50000 digits, the number of significant - digits calculated is limited to the value of the - POW_PRECISION setting (unless a modulus - m is specified). -

-

- By default POW_PRECISION is set to 0. - This means that an unlimited number of significant digits will be calculated, and that the - method's performance will decrease dramatically for larger exponents. -

-

- Negative exponents will be calculated to the number of decimal places specified by - DECIMAL_PLACES (but not to more than - POW_PRECISION significant digits). -

-

- If m is specified and the value of m, n and this - BigNumber are positive integers, then a fast modular exponentiation algorithm is used, - otherwise if any of the values is not a positive integer the operation will simply be - performed as x.toPower(n).modulo(m) with a - POW_PRECISION of 0. -

-
-Math.pow(0.7, 2)                // 0.48999999999999994
-x = new BigNumber(0.7)
-x.toPower(2)                    // '0.49'
-BigNumber(3).pow(-2)            // '0.11111111111111111111'
- - - -
- toPrecision.toPrecision([sd [, rm]]) ⇒ string -
-

- sd: number: integer, 1 to 1e+9 inclusive
- rm: number: integer, 0 to 8 inclusive -

-

- Returns a string representing the value of this BigNumber rounded to sd - significant digits using rounding mode rm. -

-

- If sd is less than the number of digits necessary to represent the integer part - of the value in normal (fixed-point) notation, then exponential notation is used. -

-

- If sd is omitted, or is null or undefined, then the - return value is the same as n.toString().
- If rm is omitted or is null or undefined, - ROUNDING_MODE is used. -

-

- See Errors for the treatment of other non-integer or out of range - sd or rm values. -

-
-x = 45.6
-y = new BigNumber(x)
-x.toPrecision()                 // '45.6'
-y.toPrecision()                 // '45.6'
-x.toPrecision(1)                // '5e+1'
-y.toPrecision(1)                // '5e+1'
-y.toPrecision(2, 0)             // '4.6e+1'  (ROUND_UP)
-y.toPrecision(2, 1)             // '4.5e+1'  (ROUND_DOWN)
-x.toPrecision(5)                // '45.600'
-y.toPrecision(5)                // '45.600'
- - - -
toString.toString([base]) ⇒ string
-

base: number: integer, 2 to 64 inclusive

-

- Returns a string representing the value of this BigNumber in the specified base, or base - 10 if base is omitted or is null or - undefined. -

-

- For bases above 10, values from 10 to 35 are - represented by a-z (as with Number.prototype.toString), - 36 to 61 by A-Z, and 62 and - 63 by $ and _ respectively. -

-

- If a base is specified the value is rounded according to the current - DECIMAL_PLACES - and ROUNDING_MODE configuration. -

-

- If a base is not specified, and this BigNumber has a positive - exponent that is equal to or greater than the positive component of the - current EXPONENTIAL_AT setting, - or a negative exponent equal to or less than the negative component of the - setting, then exponential notation is returned. -

-

If base is null or undefined it is ignored.

-

- See Errors for the treatment of other non-integer or out of range - base values. -

-
-x = new BigNumber(750000)
-x.toString()                    // '750000'
-BigNumber.config({ EXPONENTIAL_AT: 5 })
-x.toString()                    // '7.5e+5'
-
-y = new BigNumber(362.875)
-y.toString(2)                   // '101101010.111'
-y.toString(9)                   // '442.77777777777777777778'
-y.toString(32)                  // 'ba.s'
-
-BigNumber.config({ DECIMAL_PLACES: 4 });
-z = new BigNumber('1.23456789')
-z.toString()                    // '1.23456789'
-z.toString(10)                  // '1.2346'
- - - -
truncated.trunc() ⇒ BigNumber
-

- Returns a BigNumber whose value is the value of this BigNumber truncated to a whole number. -

-
-x = new BigNumber(123.456)
-x.truncated()                   // '123'
-y = new BigNumber(-12.3)
-y.trunc()                       // '-12'
- - - -
valueOf.valueOf() ⇒ string
-

- As toString, but does not accept a base argument and includes the minus sign - for negative zero. -

-
-x = new BigNumber('-0')
-x.toString()                    // '0'
-x.valueOf()                     // '-0'
-y = new BigNumber('1.777e+457')
-y.valueOf()                     // '1.777e+457'
- - - -

Properties

-

The properties of a BigNumber instance:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionTypeValue
ccoefficient*number[] Array of base 1e14 numbers
eexponentnumberInteger, -1000000000 to 1000000000 inclusive
ssignnumber-1 or 1
isBigNumbertype identifierbooleantrue
-

*significand

-

- The value of any of the c, e and s properties may also - be null. -

-

- From v2.0.0 of this library, the value of the coefficient of a BigNumber is stored in a - normalised base 100000000000000 floating point format, as opposed to the base - 10 format used in v1.x.x -

-

- This change means the properties of a BigNumber are now best considered to be read-only. - Previously it was acceptable to change the exponent of a BigNumber by writing to its exponent - property directly, but this is no longer recommended as the number of digits in the first - element of the coefficient array is dependent on the exponent, so the coefficient would also - need to be altered. -

-

- Note that, as with JavaScript numbers, the original exponent and fractional trailing zeros are - not necessarily preserved. -

-
x = new BigNumber(0.123)              // '0.123'
-x.toExponential()                     // '1.23e-1'
-x.c                                   // '1,2,3'
-x.e                                   // -1
-x.s                                   // 1
-
-y = new Number(-123.4567000e+2)       // '-12345.67'
-y.toExponential()                     // '-1.234567e+4'
-z = new BigNumber('-123.4567000e+2')  // '-12345.67'
-z.toExponential()                     // '-1.234567e+4'
-z.c                                   // '1,2,3,4,5,6,7'
-z.e                                   // 4
-z.s                                   // -1
-

Checking if a value is a BigNumber instance:

-
-x = new BigNumber(3)
-x instanceof BigNumber     // true
-x.isBigNumber              // true
-
-BN = BigNumber.another();
-
-y = new BN(3)
-y instanceof BigNumber     // false
-y.isBigNumber              // true
- - - - -

Zero, NaN and Infinity

-

- The table below shows how ±0, NaN and - ±Infinity are stored. -

- - - - - - - - - - - - - - - - - - - - - - - - - -
ces
±0[0]0±1
NaNnullnullnull
±Infinitynullnull±1
-
-x = new Number(-0)              // 0
-1 / x == -Infinity              // true
-
-y = new BigNumber(-0)           // '0'
-y.c                             // '0' ( [0].toString() )
-y.e                             // 0
-y.s                             // -1
- - - -

Errors

-

- The errors that are thrown are generic Error objects with name - BigNumber Error. -

-

- The table below shows the errors that may be thrown if ERRORS is - true, and the action taken if ERRORS is false. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Method(s)ERRORS: true
Throw BigNumber Error
ERRORS: false
Action on invalid argument
- - BigNumber
- comparedTo
- dividedBy
- dividedToIntegerBy
- equals
- greaterThan
- greaterThanOrEqualTo
- lessThan
- lessThanOrEqualTo
- minus
- modulo
- plus
- times -
number type has more than
15 significant digits
Accept.
not a base... numberSubstitute NaN.
base not an integerTruncate to integer.
Ignore if not a number.
base out of rangeIgnore.
not a number*Substitute NaN.
anothernot an objectIgnore.
configDECIMAL_PLACES not an integerTruncate to integer.
Ignore if not a number.
DECIMAL_PLACES out of rangeIgnore.
ROUNDING_MODE not an integerTruncate to integer.
Ignore if not a number.
ROUNDING_MODE out of rangeIgnore.
EXPONENTIAL_AT not an integer
or not [integer, integer]
Truncate to integer(s).
Ignore if not number(s).
EXPONENTIAL_AT out of range
or not [negative, positive]
Ignore.
RANGE not an integer
or not [integer, integer]
Truncate to integer(s).
Ignore if not number(s).
RANGE cannot be zeroIgnore.
RANGE out of range
or not [negative, positive]
Ignore.
ERRORS not a boolean
or binary digit
Ignore.
CRYPTO not a boolean
or binary digit
Ignore.
CRYPTO crypto unavailableIgnore.
MODULO_MODE not an integerTruncate to integer.
Ignore if not a number.
MODULO_MODE out of rangeIgnore.
POW_PRECISION not an integerTruncate to integer.
Ignore if not a number.
POW_PRECISION out of rangeIgnore.
FORMAT not an objectIgnore.
precisionargument not a boolean
or binary digit
Ignore.
rounddecimal places not an integerTruncate to integer.
Ignore if not a number.
decimal places out of rangeIgnore.
rounding mode not an integerTruncate to integer.
Ignore if not a number.
rounding mode out of rangeIgnore.
shiftargument not an integerTruncate to integer.
Ignore if not a number.
argument out of rangeSubstitute ±Infinity. -
- toExponential
- toFixed
- toFormat -
decimal places not an integerTruncate to integer.
Ignore if not a number.
decimal places out of rangeIgnore.
rounding mode not an integerTruncate to integer.
Ignore if not a number.
rounding mode out of rangeIgnore.
toFractionmax denominator not an integerTruncate to integer.
Ignore if not a number.
max denominator out of rangeIgnore.
- toDigits
- toPrecision -
precision not an integerTruncate to integer.
Ignore if not a number.
precision out of rangeIgnore.
rounding mode not an integerTruncate to integer.
Ignore if not a number.
rounding mode out of rangeIgnore.
toPowerexponent not an integerTruncate to integer.
Substitute NaN if not a number.
exponent out of rangeSubstitute ±Infinity. -
toStringbase not an integerTruncate to integer.
Ignore if not a number.
base out of rangeIgnore.
-

*No error is thrown if the value is NaN or 'NaN'.

-

- The message of a BigNumber Error will also contain the name of the method from which - the error originated. -

-

To determine if an exception is a BigNumber Error:

-
-try {
-    // ...
-} catch (e) {
-    if ( e instanceof Error && e.name == 'BigNumber Error' ) {
-        // ...
-    }
-}
- - - -

FAQ

- -
Why are trailing fractional zeros removed from BigNumbers?
-

- Some arbitrary-precision libraries retain trailing fractional zeros as they can indicate the - precision of a value. This can be useful but the results of arithmetic operations can be - misleading. -

-
-x = new BigDecimal("1.0")
-y = new BigDecimal("1.1000")
-z = x.add(y)                      // 2.1000
-
-x = new BigDecimal("1.20")
-y = new BigDecimal("3.45000")
-z = x.multiply(y)                 // 4.1400000
-

- To specify the precision of a value is to specify that the value lies - within a certain range. -

-

- In the first example, x has a value of 1.0. The trailing zero shows - the precision of the value, implying that it is in the range 0.95 to - 1.05. Similarly, the precision indicated by the trailing zeros of y - indicates that the value is in the range 1.09995 to 1.10005. -

-

- If we add the two lowest values in the ranges we have, 0.95 + 1.09995 = 2.04995, - and if we add the two highest values we have, 1.05 + 1.10005 = 2.15005, so the - range of the result of the addition implied by the precision of its operands is - 2.04995 to 2.15005. -

-

- The result given by BigDecimal of 2.1000 however, indicates that the value is in - the range 2.09995 to 2.10005 and therefore the precision implied by - its trailing zeros may be misleading. -

-

- In the second example, the true range is 4.122744 to 4.157256 yet - the BigDecimal answer of 4.1400000 indicates a range of 4.13999995 - to 4.14000005. Again, the precision implied by the trailing zeros may be - misleading. -

-

- This library, like binary floating point and most calculators, does not retain trailing - fractional zeros. Instead, the toExponential, toFixed and - toPrecision methods enable trailing zeros to be added if and when required.
-

-
- - - + + + + + + +bignumber.js API + + + + + + +
+ +

bignumber.js

+ +

A JavaScript library for arbitrary-precision arithmetic.

+

Hosted on GitHub.

+ +

API

+ +

+ See the README on GitHub for a + quick-start introduction. +

+

+ In all examples below, var and semicolons are not shown, and if a commented-out + value is in quotes it means toString has been called on the preceding expression. +

+ + +

CONSTRUCTOR

+ +
+ BigNumberBigNumber(value [, base]) ⇒ BigNumber +
+
+
value
+
+ number|string|BigNumber: see RANGE for + range. +
+
+ A numeric value. +
+
+ Legitimate values include ±0, ±Infinity and + NaN. +
+
+ Values of type number with more than 15 significant digits are + considered invalid (if ERRORS is true) as calling + toString or valueOf on + such numbers may not result in the intended value. +
console.log( 823456789123456.3 );    // 823456789123456.2
+
+
+ There is no limit to the number of digits of a value of type string (other than + that of JavaScript's maximum array size). +
+
+ Decimal string values may be in exponential, as well as normal (fixed-point) notation. + Non-decimal values must be in normal notation. +
+
+ String values in hexadecimal literal form, e.g. '0xff', are valid, as are + string values with the octal and binary prefixs '0o' and '0b'. + String values in octal literal form without the prefix will be interpreted as + decimals, e.g. '011' is interpreted as 11, not 9. +
+
Values in any base may have fraction digits.
+
+ For bases from 10 to 36, lower and/or upper case letters can be + used to represent values from 10 to 35. +
+
+ For bases above 36, a-z represents values from 10 to + 35, A-Z from 36 to 61, and + $ and _ represent 62 and 63 respectively + (this can be changed by editing the ALPHABET variable near the top of the + source file). +
+
+
+
base
+
+ number: integer, 2 to 64 inclusive +
+
The base of value.
+
+ If base is omitted, or is null or undefined, base + 10 is assumed. +
+
+
+

Returns a new instance of a BigNumber object.

+

+ If a base is specified, the value is rounded according to + the current DECIMAL_PLACES and + ROUNDING_MODE configuration. +

+

+ See Errors for the treatment of an invalid value or + base. +

+
+x = new BigNumber(9)                       // '9'
+y = new BigNumber(x)                       // '9'
+
+// 'new' is optional if ERRORS is false
+BigNumber(435.345)                         // '435.345'
+
+new BigNumber('5032485723458348569331745.33434346346912144534543')
+new BigNumber('4.321e+4')                  // '43210'
+new BigNumber('-735.0918e-430')            // '-7.350918e-428'
+new BigNumber(Infinity)                    // 'Infinity'
+new BigNumber(NaN)                         // 'NaN'
+new BigNumber('.5')                        // '0.5'
+new BigNumber('+2')                        // '2'
+new BigNumber(-10110100.1, 2)              // '-180.5'
+new BigNumber(-0b10110100.1)               // '-180.5'
+new BigNumber('123412421.234324', 5)       // '607236.557696'
+new BigNumber('ff.8', 16)                  // '255.5'
+new BigNumber('0xff.8')                    // '255.5'
+

+ The following throws 'not a base 2 number' if + ERRORS is true, otherwise it returns a BigNumber with value + NaN. +

+
new BigNumber(9, 2)
+

+ The following throws 'number type has more than 15 significant digits' if + ERRORS is true, otherwise it returns a BigNumber with value + 96517860459076820. +

+
new BigNumber(96517860459076817.4395)
+

+ The following throws 'not a number' if ERRORS + is true, otherwise it returns a BigNumber with value NaN. +

+
new BigNumber('blurgh')
+

+ A value is only rounded by the constructor if a base is specified. +

+
BigNumber.config({ DECIMAL_PLACES: 5 })
+new BigNumber(1.23456789)                  // '1.23456789'
+new BigNumber(1.23456789, 10)              // '1.23457'
+ + + +

Methods

+

The static methods of a BigNumber constructor.

+ + + + +
+ another.another([obj]) ⇒ BigNumber constructor +
+

obj: object

+

+ Returns a new independent BigNumber constructor with configuration as described by + obj (see config), or with the default + configuration if obj is null or undefined. +

+
BigNumber.config({ DECIMAL_PLACES: 5 })
+BN = BigNumber.another({ DECIMAL_PLACES: 9 })
+
+x = new BigNumber(1)
+y = new BN(1)
+
+x.div(3)                        // 0.33333
+y.div(3)                        // 0.333333333
+
+// BN = BigNumber.another({ DECIMAL_PLACES: 9 }) is equivalent to:
+BN = BigNumber.another()
+BN.config({ DECIMAL_PLACES: 9 })
+ + + +
configset([obj]) ⇒ object
+

+ obj: object: an object that contains some or all of the following + properties. +

+

Configures the settings for this particular BigNumber constructor.

+

Note: the configuration can also be supplied as an argument list, see below.

+
+
DECIMAL_PLACES
+
+ number: integer, 0 to 1e+9 inclusive
+ Default value: 20 +
+
+ The maximum number of decimal places of the results of operations involving + division, i.e. division, square root and base conversion operations, and power + operations with negative exponents.
+
+
+
BigNumber.config({ DECIMAL_PLACES: 5 })
+BigNumber.set({ DECIMAL_PLACES: 5 })    // equivalent
+BigNumber.config(5)    // equivalent
+
+ + + +
ROUNDING_MODE
+
+ number: integer, 0 to 8 inclusive
+ Default value: 4 (ROUND_HALF_UP) +
+
+ The rounding mode used in the above operations and the default rounding mode of + round, + toExponential, + toFixed, + toFormat and + toPrecision. +
+
The modes are available as enumerated properties of the BigNumber constructor.
+
+
BigNumber.config({ ROUNDING_MODE: 0 })
+BigNumber.config(null, BigNumber.ROUND_UP)    // equivalent
+
+ + + +
EXPONENTIAL_AT
+
+ number: integer, magnitude 0 to 1e+9 inclusive, or +
+ number[]: [ integer -1e+9 to 0 inclusive, integer + 0 to 1e+9 inclusive ]
+ Default value: [-7, 20] +
+
+ The exponent value(s) at which toString returns exponential notation. +
+
+ If a single number is assigned, the value is the exponent magnitude.
+ If an array of two numbers is assigned then the first number is the negative exponent + value at and beneath which exponential notation is used, and the second number is the + positive exponent value at and above which the same. +
+
+ For example, to emulate JavaScript numbers in terms of the exponent values at which they + begin to use exponential notation, use [-7, 20]. +
+
+
BigNumber.config({ EXPONENTIAL_AT: 2 })
+new BigNumber(12.3)         // '12.3'        e is only 1
+new BigNumber(123)          // '1.23e+2'
+new BigNumber(0.123)        // '0.123'       e is only -1
+new BigNumber(0.0123)       // '1.23e-2'
+
+BigNumber.config({ EXPONENTIAL_AT: [-7, 20] })
+new BigNumber(123456789)    // '123456789'   e is only 8
+new BigNumber(0.000000123)  // '1.23e-7'
+
+// Almost never return exponential notation:
+BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
+
+// Always return exponential notation:
+BigNumber.config({ EXPONENTIAL_AT: 0 })
+
+
+ Regardless of the value of EXPONENTIAL_AT, the toFixed method + will always return a value in normal notation and the toExponential method + will always return a value in exponential form. +
+
+ Calling toString with a base argument, e.g. toString(10), will + also always return normal notation. +
+ + + +
RANGE
+
+ number: integer, magnitude 1 to 1e+9 inclusive, or +
+ number[]: [ integer -1e+9 to -1 inclusive, integer + 1 to 1e+9 inclusive ]
+ Default value: [-1e+9, 1e+9] +
+
+ The exponent value(s) beyond which overflow to Infinity and underflow to + zero occurs. +
+
+ If a single number is assigned, it is the maximum exponent magnitude: values wth a + positive exponent of greater magnitude become Infinity and those with a + negative exponent of greater magnitude become zero. +
+ If an array of two numbers is assigned then the first number is the negative exponent + limit and the second number is the positive exponent limit. +
+
+ For example, to emulate JavaScript numbers in terms of the exponent values at which they + become zero and Infinity, use [-324, 308]. +
+
+
BigNumber.config({ RANGE: 500 })
+BigNumber.config().RANGE     // [ -500, 500 ]
+new BigNumber('9.999e499')   // '9.999e+499'
+new BigNumber('1e500')       // 'Infinity'
+new BigNumber('1e-499')      // '1e-499'
+new BigNumber('1e-500')      // '0'
+
+BigNumber.config({ RANGE: [-3, 4] })
+new BigNumber(99999)         // '99999'      e is only 4
+new BigNumber(100000)        // 'Infinity'   e is 5
+new BigNumber(0.001)         // '0.01'       e is only -3
+new BigNumber(0.0001)        // '0'          e is -4
+
+
+ The largest possible magnitude of a finite BigNumber is + 9.999...e+1000000000.
+ The smallest possible magnitude of a non-zero BigNumber is 1e-1000000000. +
+ + + +
ERRORS
+
+ boolean|number: true, false, 0 or + 1.
+ Default value: true +
+
+ The value that determines whether BigNumber Errors are thrown.
+ If ERRORS is false, no errors will be thrown. +
+
See Errors.
+
BigNumber.config({ ERRORS: false })
+ + + +
CRYPTO
+
+ boolean|number: true, false, 0 or + 1.
+ Default value: false +
+
+ The value that determines whether cryptographically-secure pseudo-random number + generation is used. +
+
+ If CRYPTO is set to true then the + random method will generate random digits using + crypto.getRandomValues in browsers that support it, or + crypto.randomBytes if using a version of Node.js that supports it. +
+
+ If neither function is supported by the host environment then attempting to set + CRYPTO to true will fail, and if ERRORS + is true an exception will be thrown. +
+
+ If CRYPTO is false then the source of randomness used will be + Math.random (which is assumed to generate at least 30 bits of + randomness). +
+
See random.
+
+
BigNumber.config({ CRYPTO: true })
+BigNumber.config().CRYPTO       // true
+BigNumber.random()              // 0.54340758610486147524
+
+ + + +
MODULO_MODE
+
+ number: integer, 0 to 9 inclusive
+ Default value: 1 (ROUND_DOWN) +
+
The modulo mode used when calculating the modulus: a mod n.
+
+ The quotient, q = a / n, is calculated according to the + ROUNDING_MODE that corresponds to the chosen + MODULO_MODE. +
+
The remainder, r, is calculated as: r = a - n * q.
+
+ The modes that are most commonly used for the modulus/remainder operation are shown in + the following table. Although the other rounding modes can be used, they may not give + useful results. +
+
+ + + + + + + + + + + + + + + + + + + + + + +
PropertyValueDescription
ROUND_UP0 + The remainder is positive if the dividend is negative, otherwise it is negative. +
ROUND_DOWN1 + The remainder has the same sign as the dividend.
+ This uses 'truncating division' and matches the behaviour of JavaScript's + remainder operator %. +
ROUND_FLOOR3 + The remainder has the same sign as the divisor.
+ This matches Python's % operator. +
ROUND_HALF_EVEN6The IEEE 754 remainder function.
EUCLID9 + The remainder is always positive. Euclidian division:
+ q = sign(n) * floor(a / abs(n)) +
+
+
+ The rounding/modulo modes are available as enumerated properties of the BigNumber + constructor. +
+
See modulo.
+
+
BigNumber.config({ MODULO_MODE: BigNumber.EUCLID })
+BigNumber.config({ MODULO_MODE: 9 })          // equivalent
+
+ + + +
POW_PRECISION
+
+ number: integer, 0 to 1e+9 inclusive.
+ Default value: 0 +
+
+ The maximum number of significant digits of the result of the power operation + (unless a modulus is specified). +
+
If set to 0, the number of signifcant digits will not be limited.
+
See toPower.
+
BigNumber.config({ POW_PRECISION: 100 })
+ + + +
FORMAT
+
object
+
+ The FORMAT object configures the format of the string returned by the + toFormat method. +
+
+ The example below shows the properties of the FORMAT object that are + recognised, and their default values. +
+
+ Unlike the other configuration properties, the values of the properties of the + FORMAT object will not be checked for validity. The existing + FORMAT object will simply be replaced by the object that is passed in. + Note that all the properties shown below do not have to be included. +
+
See toFormat for examples of usage.
+
+
+BigNumber.config({
+    FORMAT: {
+        // the decimal separator
+        decimalSeparator: '.',
+        // the grouping separator of the integer part
+        groupSeparator: ',',
+        // the primary grouping size of the integer part
+        groupSize: 3,
+        // the secondary grouping size of the integer part
+        secondaryGroupSize: 0,
+        // the grouping separator of the fraction part
+        fractionGroupSeparator: ' ',
+        // the grouping size of the fraction part
+        fractionGroupSize: 0
+    }
+});
+
+
+
+

Returns an object with the above properties and their current values.

+

+ If the value to be assigned to any of the above properties is null or + undefined it is ignored. +

+

See Errors for the treatment of invalid values.

+
+BigNumber.config({
+    DECIMAL_PLACES: 40,
+    ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL,
+    EXPONENTIAL_AT: [-10, 20],
+    RANGE: [-500, 500],
+    ERRORS: true,
+    CRYPTO: true,
+    MODULO_MODE: BigNumber.ROUND_FLOOR,
+    POW_PRECISION: 80,
+    FORMAT: {
+        groupSize: 3,
+        groupSeparator: ' ',
+        decimalSeparator: ','
+    }
+});
+
+// Alternatively but equivalently (excluding FORMAT):
+BigNumber.config( 40, 7, [-10, 20], 500, 1, 1, 3, 80 )
+
+obj = BigNumber.config();
+obj.ERRORS       // true
+obj.RANGE        // [-500, 500]
+ + + +
+ max.max([arg1 [, arg2, ...]]) ⇒ BigNumber +
+

+ arg1, arg2, ...: number|string|BigNumber
+ See BigNumber for further parameter details. +

+

+ Returns a BigNumber whose value is the maximum of arg1, + arg2,... . +

+

The argument to this method can also be an array of values.

+

The return value is always exact and unrounded.

+
x = new BigNumber('3257869345.0378653')
+BigNumber.max(4e9, x, '123456789.9')          // '4000000000'
+
+arr = [12, '13', new BigNumber(14)]
+BigNumber.max(arr)                            // '14'
+ + + +
+ min.min([arg1 [, arg2, ...]]) ⇒ BigNumber +
+

+ arg1, arg2, ...: number|string|BigNumber
+ See BigNumber for further parameter details. +

+

+ Returns a BigNumber whose value is the minimum of arg1, + arg2,... . +

+

The argument to this method can also be an array of values.

+

The return value is always exact and unrounded.

+
x = new BigNumber('3257869345.0378653')
+BigNumber.min(4e9, x, '123456789.9')          // '123456789.9'
+
+arr = [2, new BigNumber(-14), '-15.9999', -12]
+BigNumber.min(arr)                            // '-15.9999'
+ + + +
+ random.random([dp]) ⇒ BigNumber +
+

dp: number: integer, 0 to 1e+9 inclusive

+

+ Returns a new BigNumber with a pseudo-random value equal to or greater than 0 and + less than 1. +

+

+ The return value will have dp decimal places (or less if trailing zeros are + produced).
+ If dp is omitted then the number of decimal places will default to the current + DECIMAL_PLACES setting. +

+

+ Depending on the value of this BigNumber constructor's + CRYPTO setting and the support for the + crypto object in the host environment, the random digits of the return value are + generated by either Math.random (fastest), crypto.getRandomValues + (Web Cryptography API in recent browsers) or crypto.randomBytes (Node.js). +

+

+ If CRYPTO is true, i.e. one of the + crypto methods is to be used, the value of a returned BigNumber should be + cryptographically-secure and statistically indistinguishable from a random value. +

+
BigNumber.config({ DECIMAL_PLACES: 10 })
+BigNumber.random()              // '0.4117936847'
+BigNumber.random(20)            // '0.78193327636914089009'
+ + + +

Properties

+

+ The library's enumerated rounding modes are stored as properties of the constructor.
+ (They are not referenced internally by the library itself.) +

+

+ Rounding modes 0 to 6 (inclusive) are the same as those of Java's + BigDecimal class. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyValueDescription
ROUND_UP0Rounds away from zero
ROUND_DOWN1Rounds towards zero
ROUND_CEIL2Rounds towards Infinity
ROUND_FLOOR3Rounds towards -Infinity
ROUND_HALF_UP4 + Rounds towards nearest neighbour.
+ If equidistant, rounds away from zero +
ROUND_HALF_DOWN5 + Rounds towards nearest neighbour.
+ If equidistant, rounds towards zero +
ROUND_HALF_EVEN6 + Rounds towards nearest neighbour.
+ If equidistant, rounds towards even neighbour +
ROUND_HALF_CEIL7 + Rounds towards nearest neighbour.
+ If equidistant, rounds towards Infinity +
ROUND_HALF_FLOOR8 + Rounds towards nearest neighbour.
+ If equidistant, rounds towards -Infinity +
+
+BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_CEIL })
+BigNumber.config({ ROUNDING_MODE: 2 })     // equivalent
+ + +

INSTANCE

+ +

Methods

+

The methods inherited by a BigNumber instance from its constructor's prototype object.

+

A BigNumber is immutable in the sense that it is not changed by its methods.

+

+ The treatment of ±0, ±Infinity and NaN is + consistent with how JavaScript treats these values. +

+

+ Many method names have a shorter alias.
+ (Internally, the library always uses the shorter method names.) +

+ + + +
absoluteValue.abs() ⇒ BigNumber
+

+ Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of + this BigNumber. +

+

The return value is always exact and unrounded.

+
+x = new BigNumber(-0.8)
+y = x.absoluteValue()           // '0.8'
+z = y.abs()                     // '0.8'
+ + + +
ceil.ceil() ⇒ BigNumber
+

+ Returns a BigNumber whose value is the value of this BigNumber rounded to + a whole number in the direction of positive Infinity. +

+
+x = new BigNumber(1.3)
+x.ceil()                        // '2'
+y = new BigNumber(-1.8)
+y.ceil()                        // '-1'
+ + + +
comparedTo.cmp(n [, base]) ⇒ number
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+ + + + + + + + + + + + + + + + + + +
Returns 
1If the value of this BigNumber is greater than the value of n
-1If the value of this BigNumber is less than the value of n
0If this BigNumber and n have the same value
nullIf the value of either this BigNumber or n is NaN
+
+x = new BigNumber(Infinity)
+y = new BigNumber(5)
+x.comparedTo(y)                 // 1
+x.comparedTo(x.minus(1))        // 0
+y.cmp(NaN)                      // null
+y.cmp('110', 2)                 // -1
+ + + +
decimalPlaces.dp() ⇒ number
+

+ Return the number of decimal places of the value of this BigNumber, or null if + the value of this BigNumber is ±Infinity or NaN. +

+
+x = new BigNumber(123.45)
+x.decimalPlaces()               // 2
+y = new BigNumber('9.9e-101')
+y.dp()                          // 102
+ + + +
dividedBy.div(n [, base]) ⇒ BigNumber +
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+

+ Returns a BigNumber whose value is the value of this BigNumber divided by + n, rounded according to the current + DECIMAL_PLACES and + ROUNDING_MODE configuration. +

+
+x = new BigNumber(355)
+y = new BigNumber(113)
+x.dividedBy(y)                  // '3.14159292035398230088'
+x.div(5)                        // '71'
+x.div(47, 16)                   // '5'
+ + + +
+ dividedToIntegerBy.divToInt(n [, base]) ⇒ + BigNumber +
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+

+ Return a BigNumber whose value is the integer part of dividing the value of this BigNumber by + n. +

+
+x = new BigNumber(5)
+y = new BigNumber(3)
+x.dividedToIntegerBy(y)         // '1'
+x.divToInt(0.7)                 // '7'
+x.divToInt('0.f', 16)           // '5'
+ + + +
equals.eq(n [, base]) ⇒ boolean
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+

+ Returns true if the value of this BigNumber equals the value of n, + otherwise returns false.
+ As with JavaScript, NaN does not equal NaN. +

+

Note: This method uses the comparedTo method internally.

+
+0 === 1e-324                    // true
+x = new BigNumber(0)
+x.equals('1e-324')              // false
+BigNumber(-0).eq(x)             // true  ( -0 === 0 )
+BigNumber(255).eq('ff', 16)     // true
+
+y = new BigNumber(NaN)
+y.equals(NaN)                   // false
+ + + +
floor.floor() ⇒ BigNumber
+

+ Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in + the direction of negative Infinity. +

+
+x = new BigNumber(1.8)
+x.floor()                       // '1'
+y = new BigNumber(-1.3)
+y.floor()                       // '-2'
+ + + +
greaterThan.gt(n [, base]) ⇒ boolean
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+

+ Returns true if the value of this BigNumber is greater than the value of + n, otherwise returns false. +

+

Note: This method uses the comparedTo method internally.

+
+0.1 > (0.3 - 0.2)                           // true
+x = new BigNumber(0.1)
+x.greaterThan(BigNumber(0.3).minus(0.2))    // false
+BigNumber(0).gt(x)                          // false
+BigNumber(11, 3).gt(11.1, 2)                // true
+ + + +
+ greaterThanOrEqualTo.gte(n [, base]) ⇒ boolean +
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+

+ Returns true if the value of this BigNumber is greater than or equal to the value + of n, otherwise returns false. +

+

Note: This method uses the comparedTo method internally.

+
+(0.3 - 0.2) >= 0.1                   // false
+x = new BigNumber(0.3).minus(0.2)
+x.greaterThanOrEqualTo(0.1)          // true
+BigNumber(1).gte(x)                  // true
+BigNumber(10, 18).gte('i', 36)       // true
+ + + +
isFinite.isFinite() ⇒ boolean
+

+ Returns true if the value of this BigNumber is a finite number, otherwise + returns false. +

+

+ The only possible non-finite values of a BigNumber are NaN, Infinity + and -Infinity. +

+
+x = new BigNumber(1)
+x.isFinite()                    // true
+y = new BigNumber(Infinity)
+y.isFinite()                    // false
+

+ Note: The native method isFinite() can be used if + n <= Number.MAX_VALUE. +

+ + + +
isInteger.isInt() ⇒ boolean
+

+ Returns true if the value of this BigNumber is a whole number, otherwise returns + false. +

+
+x = new BigNumber(1)
+x.isInteger()                   // true
+y = new BigNumber(123.456)
+y.isInt()                       // false
+ + + +
isNaN.isNaN() ⇒ boolean
+

+ Returns true if the value of this BigNumber is NaN, otherwise + returns false. +

+
+x = new BigNumber(NaN)
+x.isNaN()                       // true
+y = new BigNumber('Infinity')
+y.isNaN()                       // false
+

Note: The native method isNaN() can also be used.

+ + + +
isNegative.isNeg() ⇒ boolean
+

+ Returns true if the value of this BigNumber is negative, otherwise returns + false. +

+
+x = new BigNumber(-0)
+x.isNegative()                  // true
+y = new BigNumber(2)
+y.isNeg()                       // false
+

Note: n < 0 can be used if n <= -Number.MIN_VALUE.

+ + + +
isZero.isZero() ⇒ boolean
+

+ Returns true if the value of this BigNumber is zero or minus zero, otherwise + returns false. +

+
+x = new BigNumber(-0)
+x.isZero() && x.isNeg()         // true
+y = new BigNumber(Infinity)
+y.isZero()                      // false
+

Note: n == 0 can be used if n >= Number.MIN_VALUE.

+ + + +
lessThan.lt(n [, base]) ⇒ boolean
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+

+ Returns true if the value of this BigNumber is less than the value of + n, otherwise returns false. +

+

Note: This method uses the comparedTo method internally.

+
+(0.3 - 0.2) < 0.1                     // true
+x = new BigNumber(0.3).minus(0.2)
+x.lessThan(0.1)                       // false
+BigNumber(0).lt(x)                    // true
+BigNumber(11.1, 2).lt(11, 3)          // true
+ + + +
+ lessThanOrEqualTo.lte(n [, base]) ⇒ boolean +
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+

+ Returns true if the value of this BigNumber is less than or equal to the value of + n, otherwise returns false. +

+

Note: This method uses the comparedTo method internally.

+
+0.1 <= (0.3 - 0.2)                                // false
+x = new BigNumber(0.1)
+x.lessThanOrEqualTo(BigNumber(0.3).minus(0.2))    // true
+BigNumber(-1).lte(x)                              // true
+BigNumber(10, 18).lte('i', 36)                    // true
+ + + +
+ minus.minus(n [, base]) ⇒ BigNumber +
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+

Returns a BigNumber whose value is the value of this BigNumber minus n.

+

The return value is always exact and unrounded.

+
+0.3 - 0.1                       // 0.19999999999999998
+x = new BigNumber(0.3)
+x.minus(0.1)                    // '0.2'
+x.minus(0.6, 20)                // '0'
+ + + +
modulo.mod(n [, base]) ⇒ BigNumber
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+

+ Returns a BigNumber whose value is the value of this BigNumber modulo n, i.e. + the integer remainder of dividing this BigNumber by n. +

+

+ The value returned, and in particular its sign, is dependent on the value of the + MODULO_MODE setting of this BigNumber constructor. + If it is 1 (default value), the result will have the same sign as this BigNumber, + and it will match that of Javascript's % operator (within the limits of double + precision) and BigDecimal's remainder method. +

+

The return value is always exact and unrounded.

+

+ See MODULO_MODE for a description of the other + modulo modes. +

+
+1 % 0.9                         // 0.09999999999999998
+x = new BigNumber(1)
+x.modulo(0.9)                   // '0.1'
+y = new BigNumber(33)
+y.mod('a', 33)                  // '3'
+ + + +
negated.neg() ⇒ BigNumber
+

+ Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by + -1. +

+
+x = new BigNumber(1.8)
+x.negated()                     // '-1.8'
+y = new BigNumber(-1.3)
+y.neg()                         // '1.3'
+ + + +
plus.plus(n [, base]) ⇒ BigNumber
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+

Returns a BigNumber whose value is the value of this BigNumber plus n.

+

The return value is always exact and unrounded.

+
+0.1 + 0.2                       // 0.30000000000000004
+x = new BigNumber(0.1)
+y = x.plus(0.2)                 // '0.3'
+BigNumber(0.7).plus(x).plus(y)  // '1'
+x.plus('0.1', 8)                // '0.225'
+ + + +
precision.sd([z]) ⇒ number
+

+ z: boolean|number: true, false, 0 + or 1 +

+

Returns the number of significant digits of the value of this BigNumber.

+

+ If z is true or 1 then any trailing zeros of the + integer part of a number are counted as significant digits, otherwise they are not. +

+
+x = new BigNumber(1.234)
+x.precision()                   // 4
+y = new BigNumber(987000)
+y.sd()                          // 3
+y.sd(true)                      // 6
+ + + +
round.round([dp [, rm]]) ⇒ BigNumber
+

+ dp: number: integer, 0 to 1e+9 inclusive
+ rm: number: integer, 0 to 8 inclusive +

+

+ Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode + rm to a maximum of dp decimal places. +

+

+ if dp is omitted, or is null or undefined, the + return value is n rounded to a whole number.
+ if rm is omitted, or is null or undefined, + ROUNDING_MODE is used. +

+

+ See Errors for the treatment of other non-integer or out of range + dp or rm values. +

+
+x = 1234.56
+Math.round(x)                             // 1235
+
+y = new BigNumber(x)
+y.round()                                 // '1235'
+y.round(1)                                // '1234.6'
+y.round(2)                                // '1234.56'
+y.round(10)                               // '1234.56'
+y.round(0, 1)                             // '1234'
+y.round(0, 6)                             // '1235'
+y.round(1, 1)                             // '1234.5'
+y.round(1, BigNumber.ROUND_HALF_EVEN)     // '1234.6'
+y                                         // '1234.56'
+ + + +
shift.shift(n) ⇒ BigNumber
+

+ n: number: integer, + -9007199254740991 to 9007199254740991 inclusive +

+

+ Returns a BigNumber whose value is the value of this BigNumber shifted n places. +

+ The shift is of the decimal point, i.e. of powers of ten, and is to the left if n + is negative or to the right if n is positive. +

+

The return value is always exact and unrounded.

+
+x = new BigNumber(1.23)
+x.shift(3)                      // '1230'
+x.shift(-3)                     // '0.00123'
+ + + +
squareRoot.sqrt() ⇒ BigNumber
+

+ Returns a BigNumber whose value is the square root of the value of this BigNumber, + rounded according to the current + DECIMAL_PLACES and + ROUNDING_MODE configuration. +

+

+ The return value will be correctly rounded, i.e. rounded as if the result was first calculated + to an infinite number of correct digits before rounding. +

+
+x = new BigNumber(16)
+x.squareRoot()                  // '4'
+y = new BigNumber(3)
+y.sqrt()                        // '1.73205080756887729353'
+ + + +
times.times(n [, base]) ⇒ BigNumber
+

+ n: number|string|BigNumber
+ base: number
+ See BigNumber for further parameter details. +

+

Returns a BigNumber whose value is the value of this BigNumber times n.

+

The return value is always exact and unrounded.

+
+0.6 * 3                         // 1.7999999999999998
+x = new BigNumber(0.6)
+y = x.times(3)                  // '1.8'
+BigNumber('7e+500').times(y)    // '1.26e+501'
+x.times('-a', 16)               // '-6'
+ + + +
+ toDigits.toDigits([sd [, rm]]) ⇒ BigNumber +
+

+ sd: number: integer, 1 to 1e+9 inclusive.
+ rm: number: integer, 0 to 8 inclusive. +

+

+ Returns a BigNumber whose value is the value of this BigNumber rounded to sd + significant digits using rounding mode rm. +

+

+ If sd is omitted or is null or undefined, the return + value will not be rounded.
+ If rm is omitted or is null or undefined, + ROUNDING_MODE will be used. +

+

+ See Errors for the treatment of other non-integer or out of range + sd or rm values. +

+
+BigNumber.config({ precision: 5, rounding: 4 })
+x = new BigNumber(9876.54321)
+
+x.toDigits()                          // '9876.5'
+x.toDigits(6)                         // '9876.54'
+x.toDigits(6, BigNumber.ROUND_UP)     // '9876.55'
+x.toDigits(2)                         // '9900'
+x.toDigits(2, 1)                      // '9800'
+x                                     // '9876.54321'
+ + + +
+ toExponential.toExponential([dp [, rm]]) ⇒ string +
+

+ dp: number: integer, 0 to 1e+9 inclusive
+ rm: number: integer, 0 to 8 inclusive +

+

+ Returns a string representing the value of this BigNumber in exponential notation rounded + using rounding mode rm to dp decimal places, i.e with one digit + before the decimal point and dp digits after it. +

+

+ If the value of this BigNumber in exponential notation has fewer than dp fraction + digits, the return value will be appended with zeros accordingly. +

+

+ If dp is omitted, or is null or undefined, the number + of digits after the decimal point defaults to the minimum number of digits necessary to + represent the value exactly.
+ If rm is omitted or is null or undefined, + ROUNDING_MODE is used. +

+

+ See Errors for the treatment of other non-integer or out of range + dp or rm values. +

+
+x = 45.6
+y = new BigNumber(x)
+x.toExponential()               // '4.56e+1'
+y.toExponential()               // '4.56e+1'
+x.toExponential(0)              // '5e+1'
+y.toExponential(0)              // '5e+1'
+x.toExponential(1)              // '4.6e+1'
+y.toExponential(1)              // '4.6e+1'
+y.toExponential(1, 1)           // '4.5e+1'  (ROUND_DOWN)
+x.toExponential(3)              // '4.560e+1'
+y.toExponential(3)              // '4.560e+1'
+ + + +
+ toFixed.toFixed([dp [, rm]]) ⇒ string +
+

+ dp: number: integer, 0 to 1e+9 inclusive
+ rm: number: integer, 0 to 8 inclusive +

+

+ Returns a string representing the value of this BigNumber in normal (fixed-point) notation + rounded to dp decimal places using rounding mode rm. +

+

+ If the value of this BigNumber in normal notation has fewer than dp fraction + digits, the return value will be appended with zeros accordingly. +

+

+ Unlike Number.prototype.toFixed, which returns exponential notation if a number + is greater or equal to 1021, this method will always return normal + notation. +

+

+ If dp is omitted or is null or undefined, the return + value will be unrounded and in normal notation. This is also unlike + Number.prototype.toFixed, which returns the value to zero decimal places.
+ It is useful when fixed-point notation is required and the current + EXPONENTIAL_AT setting causes + toString to return exponential notation.
+ If rm is omitted or is null or undefined, + ROUNDING_MODE is used. +

+

+ See Errors for the treatment of other non-integer or out of range + dp or rm values. +

+
+x = 3.456
+y = new BigNumber(x)
+x.toFixed()                     // '3'
+y.toFixed()                     // '3.456'
+y.toFixed(0)                    // '3'
+x.toFixed(2)                    // '3.46'
+y.toFixed(2)                    // '3.46'
+y.toFixed(2, 1)                 // '3.45'  (ROUND_DOWN)
+x.toFixed(5)                    // '3.45600'
+y.toFixed(5)                    // '3.45600'
+ + + +
+ toFormat.toFormat([dp [, rm]]) ⇒ string +
+

+ dp: number: integer, 0 to 1e+9 inclusive
+ rm: number: integer, 0 to 8 inclusive +

+

+

+ Returns a string representing the value of this BigNumber in normal (fixed-point) notation + rounded to dp decimal places using rounding mode rm, and formatted + according to the properties of the FORMAT object. +

+

+ See the examples below for the properties of the + FORMAT object, their types and their usage. +

+

+ If dp is omitted or is null or undefined, then the + return value is not rounded to a fixed number of decimal places.
+ If rm is omitted or is null or undefined, + ROUNDING_MODE is used. +

+

+ See Errors for the treatment of other non-integer or out of range + dp or rm values. +

+
+format = {
+    decimalSeparator: '.',
+    groupSeparator: ',',
+    groupSize: 3,
+    secondaryGroupSize: 0,
+    fractionGroupSeparator: ' ',
+    fractionGroupSize: 0
+}
+BigNumber.config({ FORMAT: format })
+
+x = new BigNumber('123456789.123456789')
+x.toFormat()                    // '123,456,789.123456789'
+x.toFormat(1)                   // '123,456,789.1'
+
+// If a reference to the object assigned to FORMAT has been retained,
+// the format properties can be changed directly
+format.groupSeparator = ' '
+format.fractionGroupSize = 5
+x.toFormat()                    // '123 456 789.12345 6789'
+
+BigNumber.config({
+    FORMAT: {
+        decimalSeparator: ',',
+        groupSeparator: '.',
+        groupSize: 3,
+        secondaryGroupSize: 2
+    }
+})
+
+x.toFormat(6)                   // '12.34.56.789,123'
+ + + +
+ toFraction.toFraction([max]) ⇒ [string, string] +
+

+ max: number|string|BigNumber: integer >= 1 and < + Infinity +

+

+ Returns a string array representing the value of this BigNumber as a simple fraction with an + integer numerator and an integer denominator. The denominator will be a positive non-zero + value less than or equal to max. +

+

+ If a maximum denominator, max, is not specified, or is null or + undefined, the denominator will be the lowest value necessary to represent the + number exactly. +

+

+ See Errors for the treatment of other non-integer or out of range + max values. +

+
+x = new BigNumber(1.75)
+x.toFraction()                  // '7, 4'
+
+pi = new BigNumber('3.14159265358')
+pi.toFraction()                 // '157079632679,50000000000'
+pi.toFraction(100000)           // '312689, 99532'
+pi.toFraction(10000)            // '355, 113'
+pi.toFraction(100)              // '311, 99'
+pi.toFraction(10)               // '22, 7'
+pi.toFraction(1)                // '3, 1'
+ + + +
toJSON.toJSON() ⇒ string
+

As valueOf.

+
+x = new BigNumber('177.7e+457')
+y = new BigNumber(235.4325)
+z = new BigNumber('0.0098074')
+
+// Serialize an array of three BigNumbers
+str = JSON.stringify( [x, y, z] )
+// "["1.777e+459","235.4325","0.0098074"]"
+
+// Return an array of three BigNumbers
+JSON.parse(str, function (key, val) {
+    return key === '' ? val : new BigNumber(val)
+})
+ + + +
toNumber.toNumber() ⇒ number
+

Returns the value of this BigNumber as a JavaScript number primitive.

+

+ Type coercion with, for example, the unary plus operator will also work, except that a + BigNumber with the value minus zero will be converted to positive zero. +

+
+x = new BigNumber(456.789)
+x.toNumber()                    // 456.789
++x                              // 456.789
+
+y = new BigNumber('45987349857634085409857349856430985')
+y.toNumber()                    // 4.598734985763409e+34
+
+z = new BigNumber(-0)
+1 / +z                          // Infinity
+1 / z.toNumber()                // -Infinity
+ + + +
toPower.pow(n [, m]) ⇒ BigNumber
+

+ n: number: integer, + -9007199254740991 to 9007199254740991 inclusive
+ m: number|string|BigNumber +

+

+ Returns a BigNumber whose value is the value of this BigNumber raised to the power + n, and optionally modulo a modulus m. +

+

+ If n is negative the result is rounded according to the current + DECIMAL_PLACES and + ROUNDING_MODE configuration. +

+

+ If n is not an integer or is out of range: +

+

+ If ERRORS is true a BigNumber Error is thrown,
+ else if n is greater than 9007199254740991, it is interpreted as + Infinity;
+ else if n is less than -9007199254740991, it is interpreted as + -Infinity;
+ else if n is otherwise a number, it is truncated to an integer;
+ else it is interpreted as NaN. +

+

+ As the number of digits of the result of the power operation can grow so large so quickly, + e.g. 123.45610000 has over 50000 digits, the number of significant + digits calculated is limited to the value of the + POW_PRECISION setting (unless a modulus + m is specified). +

+

+ By default POW_PRECISION is set to 0. + This means that an unlimited number of significant digits will be calculated, and that the + method's performance will decrease dramatically for larger exponents. +

+

+ Negative exponents will be calculated to the number of decimal places specified by + DECIMAL_PLACES (but not to more than + POW_PRECISION significant digits). +

+

+ If m is specified and the value of m, n and this + BigNumber are positive integers, then a fast modular exponentiation algorithm is used, + otherwise if any of the values is not a positive integer the operation will simply be + performed as x.toPower(n).modulo(m) with a + POW_PRECISION of 0. +

+
+Math.pow(0.7, 2)                // 0.48999999999999994
+x = new BigNumber(0.7)
+x.toPower(2)                    // '0.49'
+BigNumber(3).pow(-2)            // '0.11111111111111111111'
+ + + +
+ toPrecision.toPrecision([sd [, rm]]) ⇒ string +
+

+ sd: number: integer, 1 to 1e+9 inclusive
+ rm: number: integer, 0 to 8 inclusive +

+

+ Returns a string representing the value of this BigNumber rounded to sd + significant digits using rounding mode rm. +

+

+ If sd is less than the number of digits necessary to represent the integer part + of the value in normal (fixed-point) notation, then exponential notation is used. +

+

+ If sd is omitted, or is null or undefined, then the + return value is the same as n.toString().
+ If rm is omitted or is null or undefined, + ROUNDING_MODE is used. +

+

+ See Errors for the treatment of other non-integer or out of range + sd or rm values. +

+
+x = 45.6
+y = new BigNumber(x)
+x.toPrecision()                 // '45.6'
+y.toPrecision()                 // '45.6'
+x.toPrecision(1)                // '5e+1'
+y.toPrecision(1)                // '5e+1'
+y.toPrecision(2, 0)             // '4.6e+1'  (ROUND_UP)
+y.toPrecision(2, 1)             // '4.5e+1'  (ROUND_DOWN)
+x.toPrecision(5)                // '45.600'
+y.toPrecision(5)                // '45.600'
+ + + +
toString.toString([base]) ⇒ string
+

base: number: integer, 2 to 64 inclusive

+

+ Returns a string representing the value of this BigNumber in the specified base, or base + 10 if base is omitted or is null or + undefined. +

+

+ For bases above 10, values from 10 to 35 are + represented by a-z (as with Number.prototype.toString), + 36 to 61 by A-Z, and 62 and + 63 by $ and _ respectively. +

+

+ If a base is specified the value is rounded according to the current + DECIMAL_PLACES + and ROUNDING_MODE configuration. +

+

+ If a base is not specified, and this BigNumber has a positive + exponent that is equal to or greater than the positive component of the + current EXPONENTIAL_AT setting, + or a negative exponent equal to or less than the negative component of the + setting, then exponential notation is returned. +

+

If base is null or undefined it is ignored.

+

+ See Errors for the treatment of other non-integer or out of range + base values. +

+
+x = new BigNumber(750000)
+x.toString()                    // '750000'
+BigNumber.config({ EXPONENTIAL_AT: 5 })
+x.toString()                    // '7.5e+5'
+
+y = new BigNumber(362.875)
+y.toString(2)                   // '101101010.111'
+y.toString(9)                   // '442.77777777777777777778'
+y.toString(32)                  // 'ba.s'
+
+BigNumber.config({ DECIMAL_PLACES: 4 });
+z = new BigNumber('1.23456789')
+z.toString()                    // '1.23456789'
+z.toString(10)                  // '1.2346'
+ + + +
truncated.trunc() ⇒ BigNumber
+

+ Returns a BigNumber whose value is the value of this BigNumber truncated to a whole number. +

+
+x = new BigNumber(123.456)
+x.truncated()                   // '123'
+y = new BigNumber(-12.3)
+y.trunc()                       // '-12'
+ + + +
valueOf.valueOf() ⇒ string
+

+ As toString, but does not accept a base argument and includes the minus sign + for negative zero. +

+
+x = new BigNumber('-0')
+x.toString()                    // '0'
+x.valueOf()                     // '-0'
+y = new BigNumber('1.777e+457')
+y.valueOf()                     // '1.777e+457'
+ + + +

Properties

+

The properties of a BigNumber instance:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyDescriptionTypeValue
ccoefficient*number[] Array of base 1e14 numbers
eexponentnumberInteger, -1000000000 to 1000000000 inclusive
ssignnumber-1 or 1
isBigNumbertype identifierbooleantrue
+

*significand

+

+ The value of any of the c, e and s properties may also + be null. +

+

+ From v2.0.0 of this library, the value of the coefficient of a BigNumber is stored in a + normalised base 100000000000000 floating point format, as opposed to the base + 10 format used in v1.x.x +

+

+ This change means the properties of a BigNumber are now best considered to be read-only. + Previously it was acceptable to change the exponent of a BigNumber by writing to its exponent + property directly, but this is no longer recommended as the number of digits in the first + element of the coefficient array is dependent on the exponent, so the coefficient would also + need to be altered. +

+

+ Note that, as with JavaScript numbers, the original exponent and fractional trailing zeros are + not necessarily preserved. +

+
x = new BigNumber(0.123)              // '0.123'
+x.toExponential()                     // '1.23e-1'
+x.c                                   // '1,2,3'
+x.e                                   // -1
+x.s                                   // 1
+
+y = new Number(-123.4567000e+2)       // '-12345.67'
+y.toExponential()                     // '-1.234567e+4'
+z = new BigNumber('-123.4567000e+2')  // '-12345.67'
+z.toExponential()                     // '-1.234567e+4'
+z.c                                   // '1,2,3,4,5,6,7'
+z.e                                   // 4
+z.s                                   // -1
+

Checking if a value is a BigNumber instance:

+
+x = new BigNumber(3)
+x instanceof BigNumber     // true
+x.isBigNumber              // true
+
+BN = BigNumber.another();
+
+y = new BN(3)
+y instanceof BigNumber     // false
+y.isBigNumber              // true
+ + + + +

Zero, NaN and Infinity

+

+ The table below shows how ±0, NaN and + ±Infinity are stored. +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
ces
±0[0]0±1
NaNnullnullnull
±Infinitynullnull±1
+
+x = new Number(-0)              // 0
+1 / x == -Infinity              // true
+
+y = new BigNumber(-0)           // '0'
+y.c                             // '0' ( [0].toString() )
+y.e                             // 0
+y.s                             // -1
+ + + +

Errors

+

+ The errors that are thrown are generic Error objects with name + BigNumber Error. +

+

+ The table below shows the errors that may be thrown if ERRORS is + true, and the action taken if ERRORS is false. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Method(s)ERRORS: true
Throw BigNumber Error
ERRORS: false
Action on invalid argument
+ + BigNumber
+ comparedTo
+ dividedBy
+ dividedToIntegerBy
+ equals
+ greaterThan
+ greaterThanOrEqualTo
+ lessThan
+ lessThanOrEqualTo
+ minus
+ modulo
+ plus
+ times +
number type has more than
15 significant digits
Accept.
not a base... numberSubstitute NaN.
base not an integerTruncate to integer.
Ignore if not a number.
base out of rangeIgnore.
not a number*Substitute NaN.
anothernot an objectIgnore.
configDECIMAL_PLACES not an integerTruncate to integer.
Ignore if not a number.
DECIMAL_PLACES out of rangeIgnore.
ROUNDING_MODE not an integerTruncate to integer.
Ignore if not a number.
ROUNDING_MODE out of rangeIgnore.
EXPONENTIAL_AT not an integer
or not [integer, integer]
Truncate to integer(s).
Ignore if not number(s).
EXPONENTIAL_AT out of range
or not [negative, positive]
Ignore.
RANGE not an integer
or not [integer, integer]
Truncate to integer(s).
Ignore if not number(s).
RANGE cannot be zeroIgnore.
RANGE out of range
or not [negative, positive]
Ignore.
ERRORS not a boolean
or binary digit
Ignore.
CRYPTO not a boolean
or binary digit
Ignore.
CRYPTO crypto unavailableIgnore.
MODULO_MODE not an integerTruncate to integer.
Ignore if not a number.
MODULO_MODE out of rangeIgnore.
POW_PRECISION not an integerTruncate to integer.
Ignore if not a number.
POW_PRECISION out of rangeIgnore.
FORMAT not an objectIgnore.
precisionargument not a boolean
or binary digit
Ignore.
rounddecimal places not an integerTruncate to integer.
Ignore if not a number.
decimal places out of rangeIgnore.
rounding mode not an integerTruncate to integer.
Ignore if not a number.
rounding mode out of rangeIgnore.
shiftargument not an integerTruncate to integer.
Ignore if not a number.
argument out of rangeSubstitute ±Infinity. +
+ toExponential
+ toFixed
+ toFormat +
decimal places not an integerTruncate to integer.
Ignore if not a number.
decimal places out of rangeIgnore.
rounding mode not an integerTruncate to integer.
Ignore if not a number.
rounding mode out of rangeIgnore.
toFractionmax denominator not an integerTruncate to integer.
Ignore if not a number.
max denominator out of rangeIgnore.
+ toDigits
+ toPrecision +
precision not an integerTruncate to integer.
Ignore if not a number.
precision out of rangeIgnore.
rounding mode not an integerTruncate to integer.
Ignore if not a number.
rounding mode out of rangeIgnore.
toPowerexponent not an integerTruncate to integer.
Substitute NaN if not a number.
exponent out of rangeSubstitute ±Infinity. +
toStringbase not an integerTruncate to integer.
Ignore if not a number.
base out of rangeIgnore.
+

*No error is thrown if the value is NaN or 'NaN'.

+

+ The message of a BigNumber Error will also contain the name of the method from which + the error originated. +

+

To determine if an exception is a BigNumber Error:

+
+try {
+    // ...
+} catch (e) {
+    if ( e instanceof Error && e.name == 'BigNumber Error' ) {
+        // ...
+    }
+}
+ + + +

FAQ

+ +
Why are trailing fractional zeros removed from BigNumbers?
+

+ Some arbitrary-precision libraries retain trailing fractional zeros as they can indicate the + precision of a value. This can be useful but the results of arithmetic operations can be + misleading. +

+
+x = new BigDecimal("1.0")
+y = new BigDecimal("1.1000")
+z = x.add(y)                      // 2.1000
+
+x = new BigDecimal("1.20")
+y = new BigDecimal("3.45000")
+z = x.multiply(y)                 // 4.1400000
+

+ To specify the precision of a value is to specify that the value lies + within a certain range. +

+

+ In the first example, x has a value of 1.0. The trailing zero shows + the precision of the value, implying that it is in the range 0.95 to + 1.05. Similarly, the precision indicated by the trailing zeros of y + indicates that the value is in the range 1.09995 to 1.10005. +

+

+ If we add the two lowest values in the ranges we have, 0.95 + 1.09995 = 2.04995, + and if we add the two highest values we have, 1.05 + 1.10005 = 2.15005, so the + range of the result of the addition implied by the precision of its operands is + 2.04995 to 2.15005. +

+

+ The result given by BigDecimal of 2.1000 however, indicates that the value is in + the range 2.09995 to 2.10005 and therefore the precision implied by + its trailing zeros may be misleading. +

+

+ In the second example, the true range is 4.122744 to 4.157256 yet + the BigDecimal answer of 4.1400000 indicates a range of 4.13999995 + to 4.14000005. Again, the precision implied by the trailing zeros may be + misleading. +

+

+ This library, like binary floating point and most calculators, does not retain trailing + fractional zeros. Instead, the toExponential, toFixed and + toPrecision methods enable trailing zeros to be added if and when required.
+

+
+ + + diff --git a/node_modules/bignumber.js/package.json b/node_modules/bignumber.js/package.json index 282440a..566b30f 100644 --- a/node_modules/bignumber.js/package.json +++ b/node_modules/bignumber.js/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "bignumber.js@4.0.4", + "/var/www/backend/minis-data" + ] + ], "_from": "bignumber.js@4.0.4", "_id": "bignumber.js@4.0.4", "_inBundle": false, @@ -19,9 +25,8 @@ "/mysql" ], "_resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-4.0.4.tgz", - "_shasum": "7c40f5abcd2d6623ab7b99682ee7db81b11889a4", - "_spec": "bignumber.js@4.0.4", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\mysql", + "_spec": "4.0.4", + "_where": "/var/www/backend/minis-data", "author": { "name": "Michael Mclaughlin", "email": "M8ch88l@gmail.com" @@ -29,8 +34,6 @@ "bugs": { "url": "https://github.com/MikeMcl/bignumber.js/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", "engines": { "node": "*" diff --git a/node_modules/body-parser/node_modules/depd/package.json b/node_modules/body-parser/node_modules/depd/package.json index 88e159c..4308767 100644 --- a/node_modules/body-parser/node_modules/depd/package.json +++ b/node_modules/body-parser/node_modules/depd/package.json @@ -1,28 +1,33 @@ { - "_from": "depd@~1.1.2", + "_args": [ + [ + "depd@1.1.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "depd@1.1.2", "_id": "depd@1.1.2", "_inBundle": false, "_integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", "_location": "/body-parser/depd", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "depd@~1.1.2", + "raw": "depd@1.1.2", "name": "depd", "escapedName": "depd", - "rawSpec": "~1.1.2", + "rawSpec": "1.1.2", "saveSpec": null, - "fetchSpec": "~1.1.2" + "fetchSpec": "1.1.2" }, "_requiredBy": [ "/body-parser", "/body-parser/http-errors" ], "_resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "_shasum": "9bcd52e14c097763e749b274c4346ed2e560b5a9", - "_spec": "depd@~1.1.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\body-parser", + "_spec": "1.1.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -31,8 +36,6 @@ "bugs": { "url": "https://github.com/dougwilson/nodejs-depd/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Deprecate all the things", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/body-parser/node_modules/http-errors/package.json b/node_modules/body-parser/node_modules/http-errors/package.json index accce3c..ef8399c 100644 --- a/node_modules/body-parser/node_modules/http-errors/package.json +++ b/node_modules/body-parser/node_modules/http-errors/package.json @@ -1,27 +1,32 @@ { - "_from": "http-errors@~1.6.3", + "_args": [ + [ + "http-errors@1.6.3", + "/var/www/backend/minis-data" + ] + ], + "_from": "http-errors@1.6.3", "_id": "http-errors@1.6.3", "_inBundle": false, "_integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "_location": "/body-parser/http-errors", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "http-errors@~1.6.3", + "raw": "http-errors@1.6.3", "name": "http-errors", "escapedName": "http-errors", - "rawSpec": "~1.6.3", + "rawSpec": "1.6.3", "saveSpec": null, - "fetchSpec": "~1.6.3" + "fetchSpec": "1.6.3" }, "_requiredBy": [ "/body-parser" ], "_resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "_shasum": "8b55680bb4be283a0b5bf4ea2e38580be1d9320d", - "_spec": "http-errors@~1.6.3", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\body-parser", + "_spec": "1.6.3", + "_where": "/var/www/backend/minis-data", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/jshttp/http-errors/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Alan Plum", @@ -47,7 +51,6 @@ "setprototypeof": "1.1.0", "statuses": ">= 1.4.0 < 2" }, - "deprecated": false, "description": "Create HTTP error objects", "devDependencies": { "eslint": "4.18.1", diff --git a/node_modules/body-parser/node_modules/mime-db/package.json b/node_modules/body-parser/node_modules/mime-db/package.json index 523cb32..089bfa7 100644 --- a/node_modules/body-parser/node_modules/mime-db/package.json +++ b/node_modules/body-parser/node_modules/mime-db/package.json @@ -1,31 +1,35 @@ { - "_from": "mime-db@~1.35.0", + "_args": [ + [ + "mime-db@1.35.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "mime-db@1.35.0", "_id": "mime-db@1.35.0", "_inBundle": false, "_integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", "_location": "/body-parser/mime-db", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "mime-db@~1.35.0", + "raw": "mime-db@1.35.0", "name": "mime-db", "escapedName": "mime-db", - "rawSpec": "~1.35.0", + "rawSpec": "1.35.0", "saveSpec": null, - "fetchSpec": "~1.35.0" + "fetchSpec": "1.35.0" }, "_requiredBy": [ "/body-parser/mime-types" ], "_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", - "_shasum": "0569d657466491283709663ad379a99b90d9ab47", - "_spec": "mime-db@~1.35.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\body-parser\\node_modules\\mime-types", + "_spec": "1.35.0", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/mime-db/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -42,7 +46,6 @@ "url": "http://github.com/broofa" } ], - "deprecated": false, "description": "Media Type Database", "devDependencies": { "bluebird": "3.5.1", diff --git a/node_modules/body-parser/node_modules/mime-types/package.json b/node_modules/body-parser/node_modules/mime-types/package.json index 62dc731..5aa6df7 100644 --- a/node_modules/body-parser/node_modules/mime-types/package.json +++ b/node_modules/body-parser/node_modules/mime-types/package.json @@ -1,31 +1,35 @@ { - "_from": "mime-types@~2.1.18", + "_args": [ + [ + "mime-types@2.1.19", + "/var/www/backend/minis-data" + ] + ], + "_from": "mime-types@2.1.19", "_id": "mime-types@2.1.19", "_inBundle": false, "_integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", "_location": "/body-parser/mime-types", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "mime-types@~2.1.18", + "raw": "mime-types@2.1.19", "name": "mime-types", "escapedName": "mime-types", - "rawSpec": "~2.1.18", + "rawSpec": "2.1.19", "saveSpec": null, - "fetchSpec": "~2.1.18" + "fetchSpec": "2.1.19" }, "_requiredBy": [ "/body-parser/type-is" ], "_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", - "_shasum": "71e464537a7ef81c15f2db9d97e913fc0ff606f0", - "_spec": "mime-types@~2.1.18", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\body-parser\\node_modules\\type-is", + "_spec": "2.1.19", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/mime-types/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -45,7 +49,6 @@ "dependencies": { "mime-db": "~1.35.0" }, - "deprecated": false, "description": "The ultimate javascript content-type utility.", "devDependencies": { "eslint": "4.19.1", diff --git a/node_modules/body-parser/node_modules/qs/package.json b/node_modules/body-parser/node_modules/qs/package.json index 9bde044..4b75f81 100644 --- a/node_modules/body-parser/node_modules/qs/package.json +++ b/node_modules/body-parser/node_modules/qs/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "qs@6.5.2", + "/var/www/backend/minis-data" + ] + ], "_from": "qs@6.5.2", "_id": "qs@6.5.2", "_inBundle": false, @@ -19,13 +25,11 @@ "/body-parser" ], "_resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "_shasum": "cb3ae806e8740444584ef154ce8ee98d403f3e36", - "_spec": "qs@6.5.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\body-parser", + "_spec": "6.5.2", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/ljharb/qs/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Jordan Harband", @@ -34,7 +38,6 @@ } ], "dependencies": {}, - "deprecated": false, "description": "A querystring parser that supports nesting and arrays, with a depth limit", "devDependencies": { "@ljharb/eslint-config": "^12.2.1", diff --git a/node_modules/body-parser/node_modules/statuses/package.json b/node_modules/body-parser/node_modules/statuses/package.json index 306b517..4769d7e 100644 --- a/node_modules/body-parser/node_modules/statuses/package.json +++ b/node_modules/body-parser/node_modules/statuses/package.json @@ -1,31 +1,35 @@ { - "_from": "statuses@>= 1.4.0 < 2", + "_args": [ + [ + "statuses@1.5.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "statuses@1.5.0", "_id": "statuses@1.5.0", "_inBundle": false, "_integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", "_location": "/body-parser/statuses", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "statuses@>= 1.4.0 < 2", + "raw": "statuses@1.5.0", "name": "statuses", "escapedName": "statuses", - "rawSpec": ">= 1.4.0 < 2", + "rawSpec": "1.5.0", "saveSpec": null, - "fetchSpec": ">= 1.4.0 < 2" + "fetchSpec": "1.5.0" }, "_requiredBy": [ "/body-parser/http-errors" ], "_resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "_shasum": "161c7dac177659fd9811f43771fa99381478628c", - "_spec": "statuses@>= 1.4.0 < 2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\body-parser\\node_modules\\http-errors", + "_spec": "1.5.0", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/statuses/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -37,7 +41,6 @@ "url": "http://jongleberry.com" } ], - "deprecated": false, "description": "HTTP status utility", "devDependencies": { "csv-parse": "1.2.4", diff --git a/node_modules/body-parser/node_modules/type-is/package.json b/node_modules/body-parser/node_modules/type-is/package.json index b4dc507..263e8fa 100644 --- a/node_modules/body-parser/node_modules/type-is/package.json +++ b/node_modules/body-parser/node_modules/type-is/package.json @@ -1,31 +1,35 @@ { - "_from": "type-is@~1.6.16", + "_args": [ + [ + "type-is@1.6.16", + "/var/www/backend/minis-data" + ] + ], + "_from": "type-is@1.6.16", "_id": "type-is@1.6.16", "_inBundle": false, "_integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", "_location": "/body-parser/type-is", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "type-is@~1.6.16", + "raw": "type-is@1.6.16", "name": "type-is", "escapedName": "type-is", - "rawSpec": "~1.6.16", + "rawSpec": "1.6.16", "saveSpec": null, - "fetchSpec": "~1.6.16" + "fetchSpec": "1.6.16" }, "_requiredBy": [ "/body-parser" ], "_resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "_shasum": "f89ce341541c672b25ee7ae3c73dee3b2be50194", - "_spec": "type-is@~1.6.16", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\body-parser", + "_spec": "1.6.16", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/type-is/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -41,7 +45,6 @@ "media-typer": "0.3.0", "mime-types": "~2.1.18" }, - "deprecated": false, "description": "Infer the content-type of a request.", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/body-parser/package.json b/node_modules/body-parser/package.json index 5d05ac2..50154af 100644 --- a/node_modules/body-parser/package.json +++ b/node_modules/body-parser/package.json @@ -1,5 +1,11 @@ { - "_from": "body-parser", + "_args": [ + [ + "body-parser@1.18.3", + "/var/www/backend/minis-data" + ] + ], + "_from": "body-parser@1.18.3", "_id": "body-parser@1.18.3", "_inBundle": false, "_integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", @@ -10,27 +16,24 @@ "setprototypeof": "1.1.0" }, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "body-parser", + "raw": "body-parser@1.18.3", "name": "body-parser", "escapedName": "body-parser", - "rawSpec": "", + "rawSpec": "1.18.3", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "1.18.3" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", - "_shasum": "5b292198ffdd553b3a0f20ded0592b956955c8b4", - "_spec": "body-parser", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI", + "_spec": "1.18.3", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/expressjs/body-parser/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -54,7 +57,6 @@ "raw-body": "2.3.3", "type-is": "~1.6.16" }, - "deprecated": false, "description": "Node.js body parsing middleware", "devDependencies": { "eslint": "4.19.1", diff --git a/node_modules/bytes/package.json b/node_modules/bytes/package.json index 30864b8..2702ddb 100644 --- a/node_modules/bytes/package.json +++ b/node_modules/bytes/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "bytes@3.0.0", + "/var/www/backend/minis-data" + ] + ], "_from": "bytes@3.0.0", "_id": "bytes@3.0.0", "_inBundle": false, @@ -17,12 +23,13 @@ }, "_requiredBy": [ "/body-parser", + "/express/body-parser", + "/express/raw-body", "/raw-body" ], "_resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "_shasum": "d32815404d689699f85a4ea4fa8755dd13a96048", - "_spec": "bytes@3.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\body-parser", + "_spec": "3.0.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca", @@ -31,7 +38,6 @@ "bugs": { "url": "https://github.com/visionmedia/bytes.js/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Jed Watson", @@ -42,7 +48,6 @@ "email": "theo.fidry@gmail.com" } ], - "deprecated": false, "description": "Utility to parse a string bytes to bytes and vice-versa", "devDependencies": { "mocha": "2.5.3", diff --git a/node_modules/content-disposition/package.json b/node_modules/content-disposition/package.json index ed66642..ea455e3 100644 --- a/node_modules/content-disposition/package.json +++ b/node_modules/content-disposition/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "content-disposition@0.5.2", + "/var/www/backend/minis-data" + ] + ], "_from": "content-disposition@0.5.2", "_id": "content-disposition@0.5.2", "_inBundle": false, @@ -19,20 +25,17 @@ "/express" ], "_resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "_shasum": "0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4", - "_spec": "content-disposition@0.5.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "0.5.2", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/content-disposition/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], - "deprecated": false, "description": "Create and parse Content-Disposition header", "devDependencies": { "eslint": "3.11.1", diff --git a/node_modules/content-type/package.json b/node_modules/content-type/package.json index e672b4f..16880a7 100644 --- a/node_modules/content-type/package.json +++ b/node_modules/content-type/package.json @@ -1,28 +1,34 @@ { - "_from": "content-type@~1.0.4", + "_args": [ + [ + "content-type@1.0.4", + "/var/www/backend/minis-data" + ] + ], + "_from": "content-type@1.0.4", "_id": "content-type@1.0.4", "_inBundle": false, "_integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", "_location": "/content-type", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "content-type@~1.0.4", + "raw": "content-type@1.0.4", "name": "content-type", "escapedName": "content-type", - "rawSpec": "~1.0.4", + "rawSpec": "1.0.4", "saveSpec": null, - "fetchSpec": "~1.0.4" + "fetchSpec": "1.0.4" }, "_requiredBy": [ "/body-parser", - "/express" + "/express", + "/express/body-parser" ], "_resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "_shasum": "e138cc75e040c727b1966fe5e5f8c9aee256fe3b", - "_spec": "content-type@~1.0.4", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.0.4", + "_where": "/var/www/backend/minis-data", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -30,8 +36,6 @@ "bugs": { "url": "https://github.com/jshttp/content-type/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Create and parse HTTP Content-Type header", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/cookie-parser/package.json b/node_modules/cookie-parser/package.json index ea6fce3..18eb73a 100644 --- a/node_modules/cookie-parser/package.json +++ b/node_modules/cookie-parser/package.json @@ -1,28 +1,32 @@ { - "_from": "cookie-parser", + "_args": [ + [ + "cookie-parser@1.4.3", + "/var/www/backend/minis-data" + ] + ], + "_from": "cookie-parser@1.4.3", "_id": "cookie-parser@1.4.3", "_inBundle": false, "_integrity": "sha1-D+MfoZ0AC5X0qt8fU/3CuKIDuqU=", "_location": "/cookie-parser", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "cookie-parser", + "raw": "cookie-parser@1.4.3", "name": "cookie-parser", "escapedName": "cookie-parser", - "rawSpec": "", + "rawSpec": "1.4.3", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "1.4.3" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.3.tgz", - "_shasum": "0fe31fa19d000b95f4aadf1f53fdc2b8a203baa5", - "_spec": "cookie-parser", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI", + "_spec": "1.4.3", + "_where": "/var/www/backend/minis-data", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca", @@ -31,7 +35,6 @@ "bugs": { "url": "https://github.com/expressjs/cookie-parser/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -42,7 +45,6 @@ "cookie": "0.3.1", "cookie-signature": "1.0.6" }, - "deprecated": false, "description": "cookie parsing with signatures", "devDependencies": { "istanbul": "0.4.3", diff --git a/node_modules/cookie-signature/package.json b/node_modules/cookie-signature/package.json index 4b2c214..2c28578 100644 --- a/node_modules/cookie-signature/package.json +++ b/node_modules/cookie-signature/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "cookie-signature@1.0.6", + "/var/www/backend/minis-data" + ] + ], "_from": "cookie-signature@1.0.6", "_id": "cookie-signature@1.0.6", "_inBundle": false, @@ -16,12 +22,12 @@ "fetchSpec": "1.0.6" }, "_requiredBy": [ + "/cookie-parser", "/express" ], "_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "_shasum": "e303a882b342cc3ee8ca513a79999734dab3ae2c", - "_spec": "cookie-signature@1.0.6", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.0.6", + "_where": "/var/www/backend/minis-data", "author": { "name": "TJ Holowaychuk", "email": "tj@learnboost.com" @@ -29,9 +35,7 @@ "bugs": { "url": "https://github.com/visionmedia/node-cookie-signature/issues" }, - "bundleDependencies": false, "dependencies": {}, - "deprecated": false, "description": "Sign and unsign cookies", "devDependencies": { "mocha": "*", diff --git a/node_modules/cookie/package.json b/node_modules/cookie/package.json index 3b04c3e..617d1cf 100644 --- a/node_modules/cookie/package.json +++ b/node_modules/cookie/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "cookie@0.3.1", + "/var/www/backend/minis-data" + ] + ], "_from": "cookie@0.3.1", "_id": "cookie@0.3.1", "_inBundle": false, @@ -16,12 +22,12 @@ "fetchSpec": "0.3.1" }, "_requiredBy": [ + "/cookie-parser", "/express" ], "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "_shasum": "e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb", - "_spec": "cookie@0.3.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "0.3.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "Roman Shtylman", "email": "shtylman@gmail.com" @@ -29,14 +35,12 @@ "bugs": { "url": "https://github.com/jshttp/cookie/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], - "deprecated": false, "description": "HTTP server cookie parsing and serialization", "devDependencies": { "istanbul": "0.4.3", diff --git a/node_modules/core-util-is/package.json b/node_modules/core-util-is/package.json index 7b58628..72b0360 100644 --- a/node_modules/core-util-is/package.json +++ b/node_modules/core-util-is/package.json @@ -1,27 +1,32 @@ { - "_from": "core-util-is@~1.0.0", + "_args": [ + [ + "core-util-is@1.0.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "core-util-is@1.0.2", "_id": "core-util-is@1.0.2", "_inBundle": false, "_integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "_location": "/core-util-is", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "core-util-is@~1.0.0", + "raw": "core-util-is@1.0.2", "name": "core-util-is", "escapedName": "core-util-is", - "rawSpec": "~1.0.0", + "rawSpec": "1.0.2", "saveSpec": null, - "fetchSpec": "~1.0.0" + "fetchSpec": "1.0.2" }, "_requiredBy": [ "/readable-stream" ], "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "_shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7", - "_spec": "core-util-is@~1.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\readable-stream", + "_spec": "1.0.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -30,8 +35,6 @@ "bugs": { "url": "https://github.com/isaacs/core-util-is/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "The `util.is*` functions introduced in Node v0.12.", "devDependencies": { "tap": "^2.3.0" diff --git a/node_modules/cors/package.json b/node_modules/cors/package.json index 4c61507..8a9caa9 100644 --- a/node_modules/cors/package.json +++ b/node_modules/cors/package.json @@ -1,28 +1,32 @@ { - "_from": "cors", + "_args": [ + [ + "cors@2.8.4", + "/var/www/backend/minis-data" + ] + ], + "_from": "cors@2.8.4", "_id": "cors@2.8.4", "_inBundle": false, "_integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", "_location": "/cors", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "cors", + "raw": "cors@2.8.4", "name": "cors", "escapedName": "cors", - "rawSpec": "", + "rawSpec": "2.8.4", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "2.8.4" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", - "_shasum": "2bd381f2eb201020105cd50ea59da63090694686", - "_spec": "cors", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI", + "_spec": "2.8.4", + "_where": "/var/www/backend/minis-data", "author": { "name": "Troy Goode", "email": "troygoode@gmail.com", @@ -31,12 +35,10 @@ "bugs": { "url": "https://github.com/expressjs/cors/issues" }, - "bundleDependencies": false, "dependencies": { "object-assign": "^4", "vary": "^1" }, - "deprecated": false, "description": "Node.js CORS middleware", "devDependencies": { "basic-auth-connect": "^1.0.0", diff --git a/node_modules/debug/package.json b/node_modules/debug/package.json index ea42f78..83fa792 100644 --- a/node_modules/debug/package.json +++ b/node_modules/debug/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "debug@2.6.9", + "/var/www/backend/minis-data" + ] + ], "_from": "debug@2.6.9", "_id": "debug@2.6.9", "_inBundle": false, @@ -18,13 +24,13 @@ "_requiredBy": [ "/body-parser", "/express", + "/express/body-parser", "/finalhandler", "/send" ], "_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "_shasum": "5d128515df134ff327e90a4c93f4e077a536341f", - "_spec": "debug@2.6.9", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "2.6.9", + "_where": "/var/www/backend/minis-data", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" @@ -33,7 +39,6 @@ "bugs": { "url": "https://github.com/visionmedia/debug/issues" }, - "bundleDependencies": false, "component": { "scripts": { "debug/index.js": "browser.js", @@ -54,7 +59,6 @@ "dependencies": { "ms": "2.0.0" }, - "deprecated": false, "description": "small debugging utility", "devDependencies": { "browserify": "9.0.3", diff --git a/node_modules/depd/package.json b/node_modules/depd/package.json index 86e15a7..aeb1f4d 100644 --- a/node_modules/depd/package.json +++ b/node_modules/depd/package.json @@ -1,30 +1,35 @@ { - "_from": "depd@~1.1.1", + "_args": [ + [ + "depd@1.1.1", + "/var/www/backend/minis-data" + ] + ], + "_from": "depd@1.1.1", "_id": "depd@1.1.1", "_inBundle": false, "_integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=", "_location": "/depd", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "depd@~1.1.1", + "raw": "depd@1.1.1", "name": "depd", "escapedName": "depd", - "rawSpec": "~1.1.1", + "rawSpec": "1.1.1", "saveSpec": null, - "fetchSpec": "~1.1.1" + "fetchSpec": "1.1.1" }, "_requiredBy": [ - "/body-parser", "/express", + "/express/body-parser", "/http-errors", "/send" ], "_resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "_shasum": "5783b4e1c459f06fa5ca27f991f3d06e7a310359", - "_spec": "depd@~1.1.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.1.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -33,8 +38,6 @@ "bugs": { "url": "https://github.com/dougwilson/nodejs-depd/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Deprecate all the things", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/destroy/package.json b/node_modules/destroy/package.json index c88e7a0..f48a253 100644 --- a/node_modules/destroy/package.json +++ b/node_modules/destroy/package.json @@ -1,27 +1,32 @@ { - "_from": "destroy@~1.0.4", + "_args": [ + [ + "destroy@1.0.4", + "/var/www/backend/minis-data" + ] + ], + "_from": "destroy@1.0.4", "_id": "destroy@1.0.4", "_inBundle": false, "_integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", "_location": "/destroy", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "destroy@~1.0.4", + "raw": "destroy@1.0.4", "name": "destroy", "escapedName": "destroy", - "rawSpec": "~1.0.4", + "rawSpec": "1.0.4", "saveSpec": null, - "fetchSpec": "~1.0.4" + "fetchSpec": "1.0.4" }, "_requiredBy": [ "/send" ], "_resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "_shasum": "978857442c44749e4206613e37946205826abd80", - "_spec": "destroy@~1.0.4", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\send", + "_spec": "1.0.4", + "_where": "/var/www/backend/minis-data", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -30,14 +35,12 @@ "bugs": { "url": "https://github.com/stream-utils/destroy/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], - "deprecated": false, "description": "destroy a stream if possible", "devDependencies": { "istanbul": "0.4.2", diff --git a/node_modules/ee-first/package.json b/node_modules/ee-first/package.json index f48b900..c10e0fb 100644 --- a/node_modules/ee-first/package.json +++ b/node_modules/ee-first/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "ee-first@1.1.1", + "/var/www/backend/minis-data" + ] + ], "_from": "ee-first@1.1.1", "_id": "ee-first@1.1.1", "_inBundle": false, @@ -19,9 +25,8 @@ "/on-finished" ], "_resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "_shasum": "590c61156b0ae2f4f0255732a158b266bc56b21d", - "_spec": "ee-first@1.1.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\on-finished", + "_spec": "1.1.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -30,14 +35,12 @@ "bugs": { "url": "https://github.com/jonathanong/ee-first/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], - "deprecated": false, "description": "return the first event in a set of ee/event pairs", "devDependencies": { "istanbul": "0.3.9", diff --git a/node_modules/encodeurl/package.json b/node_modules/encodeurl/package.json index a81684f..f997b12 100644 --- a/node_modules/encodeurl/package.json +++ b/node_modules/encodeurl/package.json @@ -1,19 +1,25 @@ { - "_from": "encodeurl@~1.0.1", + "_args": [ + [ + "encodeurl@1.0.1", + "/var/www/backend/minis-data" + ] + ], + "_from": "encodeurl@1.0.1", "_id": "encodeurl@1.0.1", "_inBundle": false, "_integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=", "_location": "/encodeurl", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "encodeurl@~1.0.1", + "raw": "encodeurl@1.0.1", "name": "encodeurl", "escapedName": "encodeurl", - "rawSpec": "~1.0.1", + "rawSpec": "1.0.1", "saveSpec": null, - "fetchSpec": "~1.0.1" + "fetchSpec": "1.0.1" }, "_requiredBy": [ "/express", @@ -22,20 +28,17 @@ "/serve-static" ], "_resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz", - "_shasum": "79e3d58655346909fe6f0f45a5de68103b294d20", - "_spec": "encodeurl@~1.0.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.0.1", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/pillarjs/encodeurl/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], - "deprecated": false, "description": "Encode a URL to a percent-encoded form, excluding already-encoded sequences", "devDependencies": { "eslint": "2.11.1", diff --git a/node_modules/errorhandler/package.json b/node_modules/errorhandler/package.json index 6fd5a21..4b6bcbc 100644 --- a/node_modules/errorhandler/package.json +++ b/node_modules/errorhandler/package.json @@ -1,32 +1,35 @@ { - "_from": "errorhandler", + "_args": [ + [ + "errorhandler@1.5.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "errorhandler@1.5.0", "_id": "errorhandler@1.5.0", "_inBundle": false, "_integrity": "sha1-6rpkyl1UKjEayUX1gt78M2Fl2fQ=", "_location": "/errorhandler", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "errorhandler", + "raw": "errorhandler@1.5.0", "name": "errorhandler", "escapedName": "errorhandler", - "rawSpec": "", + "rawSpec": "1.5.0", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "1.5.0" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/errorhandler/-/errorhandler-1.5.0.tgz", - "_shasum": "eaba64ca5d542a311ac945f582defc336165d9f4", - "_spec": "errorhandler", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI", + "_spec": "1.5.0", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/expressjs/errorhandler/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -42,7 +45,6 @@ "accepts": "~1.3.3", "escape-html": "~1.0.3" }, - "deprecated": false, "description": "Development-only error handler middleware", "devDependencies": { "after": "0.8.2", diff --git a/node_modules/escape-html/package.json b/node_modules/escape-html/package.json index d385316..9ee72c2 100644 --- a/node_modules/escape-html/package.json +++ b/node_modules/escape-html/package.json @@ -1,35 +1,39 @@ { - "_from": "escape-html@~1.0.3", + "_args": [ + [ + "escape-html@1.0.3", + "/var/www/backend/minis-data" + ] + ], + "_from": "escape-html@1.0.3", "_id": "escape-html@1.0.3", "_inBundle": false, "_integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", "_location": "/escape-html", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "escape-html@~1.0.3", + "raw": "escape-html@1.0.3", "name": "escape-html", "escapedName": "escape-html", - "rawSpec": "~1.0.3", + "rawSpec": "1.0.3", "saveSpec": null, - "fetchSpec": "~1.0.3" + "fetchSpec": "1.0.3" }, "_requiredBy": [ + "/errorhandler", "/express", "/finalhandler", "/send", "/serve-static" ], "_resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "_shasum": "0258eae4d3d0c0974de1c169188ef0051d1d1988", - "_spec": "escape-html@~1.0.3", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.0.3", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/component/escape-html/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Escape string for use in HTML", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/etag/package.json b/node_modules/etag/package.json index bc9fcc5..cfc5396 100644 --- a/node_modules/etag/package.json +++ b/node_modules/etag/package.json @@ -1,32 +1,36 @@ { - "_from": "etag@~1.8.1", + "_args": [ + [ + "etag@1.8.1", + "/var/www/backend/minis-data" + ] + ], + "_from": "etag@1.8.1", "_id": "etag@1.8.1", "_inBundle": false, "_integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", "_location": "/etag", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "etag@~1.8.1", + "raw": "etag@1.8.1", "name": "etag", "escapedName": "etag", - "rawSpec": "~1.8.1", + "rawSpec": "1.8.1", "saveSpec": null, - "fetchSpec": "~1.8.1" + "fetchSpec": "1.8.1" }, "_requiredBy": [ "/express", "/send" ], "_resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "_shasum": "41ae2eeb65efa62268aebfea83ac7d79299b0887", - "_spec": "etag@~1.8.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.8.1", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/etag/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -37,7 +41,6 @@ "email": "david.bjorklund@gmail.com" } ], - "deprecated": false, "description": "Create simple HTTP ETags", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/express-force-ssl/package.json b/node_modules/express-force-ssl/package.json index 1d5eef6..9feb872 100644 --- a/node_modules/express-force-ssl/package.json +++ b/node_modules/express-force-ssl/package.json @@ -1,28 +1,32 @@ { - "_from": "express-force-ssl@^0.3.2", + "_args": [ + [ + "express-force-ssl@0.3.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "express-force-ssl@0.3.2", "_id": "express-force-ssl@0.3.2", "_inBundle": false, "_integrity": "sha1-AbK0mK5v0uQRUrIrV6Phc3c69n4=", "_location": "/express-force-ssl", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "express-force-ssl@^0.3.2", + "raw": "express-force-ssl@0.3.2", "name": "express-force-ssl", "escapedName": "express-force-ssl", - "rawSpec": "^0.3.2", + "rawSpec": "0.3.2", "saveSpec": null, - "fetchSpec": "^0.3.2" + "fetchSpec": "0.3.2" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/express-force-ssl/-/express-force-ssl-0.3.2.tgz", - "_shasum": "01b2b498ae6fd2e41152b22b57a3e173773af67e", - "_spec": "express-force-ssl@^0.3.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI", + "_spec": "0.3.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "Jeremy Battle", "email": "@complexcarb", @@ -31,7 +35,6 @@ "bugs": { "url": "http://github.com/battlejj/express-force-ssl/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Jeremy Battle", @@ -41,7 +44,6 @@ "dependencies": { "lodash.assign": "^3.2.0" }, - "deprecated": false, "description": "Force SSL on particular/all pages in Express", "devDependencies": { "body-parser": "^1.9.0", diff --git a/node_modules/express/node_modules/body-parser/package.json b/node_modules/express/node_modules/body-parser/package.json index 71949d5..235500b 100644 --- a/node_modules/express/node_modules/body-parser/package.json +++ b/node_modules/express/node_modules/body-parser/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "body-parser@1.18.2", + "/var/www/backend/minis-data" + ] + ], "_from": "body-parser@1.18.2", "_id": "body-parser@1.18.2", "_inBundle": false, @@ -19,13 +25,11 @@ "/express" ], "_resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "_shasum": "87678a19d84b47d859b83199bd59bce222b10454", - "_spec": "body-parser@1.18.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.18.2", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/expressjs/body-parser/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -49,7 +53,6 @@ "raw-body": "2.3.2", "type-is": "~1.6.15" }, - "deprecated": false, "description": "Node.js body parsing middleware", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/express/node_modules/iconv-lite/package.json b/node_modules/express/node_modules/iconv-lite/package.json index a500fd3..fbd7cf5 100644 --- a/node_modules/express/node_modules/iconv-lite/package.json +++ b/node_modules/express/node_modules/iconv-lite/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "iconv-lite@0.4.19", + "/var/www/backend/minis-data" + ] + ], "_from": "iconv-lite@0.4.19", "_id": "iconv-lite@0.4.19", "_inBundle": false, @@ -20,9 +26,8 @@ "/express/raw-body" ], "_resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "_shasum": "f7468f60135f5e5dad3399c0a81be9a1603a082b", - "_spec": "iconv-lite@0.4.19", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express\\node_modules\\body-parser", + "_spec": "0.4.19", + "_where": "/var/www/backend/minis-data", "author": { "name": "Alexander Shtuchkin", "email": "ashtuchkin@gmail.com" @@ -34,7 +39,6 @@ "bugs": { "url": "https://github.com/ashtuchkin/iconv-lite/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Jinwu Zhan", @@ -85,7 +89,6 @@ "url": "https://github.com/nleush" } ], - "deprecated": false, "description": "Convert character encodings in pure javascript.", "devDependencies": { "async": "*", diff --git a/node_modules/express/node_modules/raw-body/package.json b/node_modules/express/node_modules/raw-body/package.json index e23ee09..2e65924 100644 --- a/node_modules/express/node_modules/raw-body/package.json +++ b/node_modules/express/node_modules/raw-body/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "raw-body@2.3.2", + "/var/www/backend/minis-data" + ] + ], "_from": "raw-body@2.3.2", "_id": "raw-body@2.3.2", "_inBundle": false, @@ -19,9 +25,8 @@ "/express/body-parser" ], "_resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "_shasum": "bcd60c77d3eb93cde0050295c3f379389bc88f89", - "_spec": "raw-body@2.3.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express\\node_modules\\body-parser", + "_spec": "2.3.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/stream-utils/raw-body/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -47,7 +51,6 @@ "iconv-lite": "0.4.19", "unpipe": "1.0.0" }, - "deprecated": false, "description": "Get and validate the raw body of a readable stream.", "devDependencies": { "bluebird": "3.5.0", diff --git a/node_modules/express/package.json b/node_modules/express/package.json index c2fe521..15a1aff 100644 --- a/node_modules/express/package.json +++ b/node_modules/express/package.json @@ -1,28 +1,42 @@ { - "_from": "express", + "_args": [ + [ + "express@4.16.1", + "/var/www/backend/minis-data" + ] + ], + "_from": "express@4.16.1", "_id": "express@4.16.1", "_inBundle": false, "_integrity": "sha512-STB7LZ4N0L+81FJHGla2oboUHTk4PaN1RsOkoRh9OSeEKylvF5hwKYVX1xCLFaCT7MD0BNG/gX2WFMLqY6EMBw==", "_location": "/express", - "_phantomChildren": {}, + "_phantomChildren": { + "bytes": "3.0.0", + "content-type": "1.0.4", + "debug": "2.6.9", + "depd": "1.1.1", + "http-errors": "1.6.2", + "on-finished": "2.3.0", + "qs": "6.5.1", + "type-is": "1.6.15", + "unpipe": "1.0.0" + }, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "express", + "raw": "express@4.16.1", "name": "express", "escapedName": "express", - "rawSpec": "", + "rawSpec": "4.16.1", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "4.16.1" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/express/-/express-4.16.1.tgz", - "_shasum": "6b33b560183c9b253b7b62144df33a4654ac9ed0", - "_spec": "express", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI", + "_spec": "4.16.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" @@ -30,7 +44,6 @@ "bugs": { "url": "https://github.com/expressjs/express/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Aaron Heckmann", @@ -93,7 +106,6 @@ "utils-merge": "1.0.1", "vary": "~1.1.2" }, - "deprecated": false, "description": "Fast, unopinionated, minimalist web framework", "devDependencies": { "after": "0.8.2", diff --git a/node_modules/finalhandler/package.json b/node_modules/finalhandler/package.json index 361892a..cda672a 100644 --- a/node_modules/finalhandler/package.json +++ b/node_modules/finalhandler/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "finalhandler@1.1.0", + "/var/www/backend/minis-data" + ] + ], "_from": "finalhandler@1.1.0", "_id": "finalhandler@1.1.0", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz", - "_shasum": "ce0b6855b45853e791b2fcc680046d88253dd7f5", - "_spec": "finalhandler@1.1.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.1.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,7 +34,6 @@ "bugs": { "url": "https://github.com/pillarjs/finalhandler/issues" }, - "bundleDependencies": false, "dependencies": { "debug": "2.6.9", "encodeurl": "~1.0.1", @@ -39,7 +43,6 @@ "statuses": "~1.3.1", "unpipe": "~1.0.0" }, - "deprecated": false, "description": "Node.js final http responder", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/forwarded/package.json b/node_modules/forwarded/package.json index 2d2a6a0..17e03b2 100644 --- a/node_modules/forwarded/package.json +++ b/node_modules/forwarded/package.json @@ -1,38 +1,41 @@ { - "_from": "forwarded@~0.1.2", + "_args": [ + [ + "forwarded@0.1.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "forwarded@0.1.2", "_id": "forwarded@0.1.2", "_inBundle": false, "_integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", "_location": "/forwarded", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "forwarded@~0.1.2", + "raw": "forwarded@0.1.2", "name": "forwarded", "escapedName": "forwarded", - "rawSpec": "~0.1.2", + "rawSpec": "0.1.2", "saveSpec": null, - "fetchSpec": "~0.1.2" + "fetchSpec": "0.1.2" }, "_requiredBy": [ "/proxy-addr" ], "_resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "_shasum": "98c23dab1175657b8c0573e8ceccd91b0ff18c84", - "_spec": "forwarded@~0.1.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\proxy-addr", + "_spec": "0.1.2", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/forwarded/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], - "deprecated": false, "description": "Parse HTTP X-Forwarded-For header", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/fresh/package.json b/node_modules/fresh/package.json index 54ef240..0ee7888 100644 --- a/node_modules/fresh/package.json +++ b/node_modules/fresh/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "fresh@0.5.2", + "/var/www/backend/minis-data" + ] + ], "_from": "fresh@0.5.2", "_id": "fresh@0.5.2", "_inBundle": false, @@ -20,9 +26,8 @@ "/send" ], "_resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "_shasum": "3d8cadd90d976569fa835ab1f8e4b23a105605a7", - "_spec": "fresh@0.5.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "0.5.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca", @@ -31,7 +36,6 @@ "bugs": { "url": "https://github.com/jshttp/fresh/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -43,7 +47,6 @@ "url": "http://jongleberry.com" } ], - "deprecated": false, "description": "HTTP response freshness testing", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/hashmap/.jshintrc b/node_modules/hashmap/.jshintrc index 13acf76..e223ed9 100644 --- a/node_modules/hashmap/.jshintrc +++ b/node_modules/hashmap/.jshintrc @@ -1,28 +1,28 @@ -{ - "shadow": "inner", - "indent": 1, - - "camelcase": false, - "eqeqeq": true, - "eqnull": true, - "freeze": true, - "funcscope": true, - "newcap": true, - "noarg": true, - "noempty": true, - "nonbsp": true, - "unused": "vars", - "undef": true, - "scripturl": true, - "loopfunc": true, - "strict": "implied", - "validthis": true, - - "esnext": true, - "globals": {}, - "browser": true, - "devel": true, - "mocha": true, - "node": true, - "jquery": true -} +{ + "shadow": "inner", + "indent": 1, + + "camelcase": false, + "eqeqeq": true, + "eqnull": true, + "freeze": true, + "funcscope": true, + "newcap": true, + "noarg": true, + "noempty": true, + "nonbsp": true, + "unused": "vars", + "undef": true, + "scripturl": true, + "loopfunc": true, + "strict": "implied", + "validthis": true, + + "esnext": true, + "globals": {}, + "browser": true, + "devel": true, + "mocha": true, + "node": true, + "jquery": true +} diff --git a/node_modules/hashmap/Readme.md b/node_modules/hashmap/Readme.md index e291f48..e56f668 100644 --- a/node_modules/hashmap/Readme.md +++ b/node_modules/hashmap/Readme.md @@ -1,170 +1,170 @@ -# HashMap Class for JavaScript - -## Installation - -[![NPM](https://nodei.co/npm/hashmap.png?compact=true)](https://npmjs.org/package/hashmap) - -Using [npm](https://npmjs.org/package/hashmap): - - $ npm install hashmap - -Using bower: - - $ bower install hashmap - -You can download the last stable version from the [releases page](https://github.com/flesler/hashmap/releases). - -If you like risk, you can download the [latest master version](https://raw.github.com/flesler/hashmap/master/hashmap.js), it's usually stable. - -To run the tests: - - $ npm test - -## Description - -This project provides a `HashMap` class that works both on __Node.js__ and the __browser__. -HashMap instances __store key/value pairs__ allowing __keys of any type__. - -Unlike regular objects, __keys will not be stringified__. For example numbers and strings won't be mixed, you can pass `Date`'s, `RegExp`'s, DOM Elements, anything! (even `null` and `undefined`) - -## HashMap constructor overloads -- `new HashMap()` creates an empty hashmap -- `new HashMap(map:HashMap)` creates a hashmap with the key-value pairs of `map` -- `new HashMap(arr:Array)` creates a hashmap from the 2D key-value array `arr`, e.g. `[['key1','val1'], ['key2','val2']]` -- `new HashMap(key:*, value:*, key2:*, value2:*, ...)` creates a hashmap with several key-value pairs - -## HashMap methods - -- `get(key:*) : *` returns the value stored for that key. -- `set(key:*, value:*) : HashMap` stores a key-value pair -- `multi(key:*, value:*, key2:*, value2:*, ...) : HashMap` stores several key-value pairs -- `copy(other:HashMap) : HashMap` copies all key-value pairs from other to this instance -- `has(key:*) : Boolean` returns whether a key is set on the hashmap -- `search(value:*) : *` returns key under which given value is stored (`null` if not found) -- `delete(key:*) : HashMap` deletes a key-value pair by key -- `remove(key:*) : HashMap` Alias for `delete(key:*)` *(deprecated)* -- `type(key:*) : String` returns the data type of the provided key (used internally) -- `keys() : Array<*>` returns an array with all the registered keys -- `values() : Array<*>` returns an array with all the values -- `entries() : Array<[*,*]>` returns an array with [key,value] pairs -- `size : Number` the amount of key-value pairs -- `count() : Number` returns the amount of key-value pairs *(deprecated)* -- `clear() : HashMap` deletes all the key-value pairs on the hashmap -- `clone() : HashMap` creates a new hashmap with all the key-value pairs of the original -- `hash(key:*) : String` returns the stringified version of a key (used internally) -- `forEach(function(value, key)) : HashMap` iterates the pairs and calls the function for each one - -### Method chaining - -All methods that don't return something, will return the HashMap instance to enable chaining. - -## Examples - -Assume this for all examples below - -```js -var map = new HashMap(); -``` - -If you're using this within Node, you first need to import the class - -```js -var HashMap = require('hashmap'); -``` - -### Basic use case - -```js -map.set("some_key", "some value"); -map.get("some_key"); // --> "some value" -``` - -### Map size / number of elements - -```js -var map = new HashMap(); -map.set("key1", "val1"); -map.set("key2", "val2"); -map.size; // -> 2 -``` - -### Deleting key-value pairs - -```js -map.set("some_key", "some value"); -map.delete("some_key"); -map.get("some_key"); // --> undefined -``` - -### No stringification - -```js -map.set("1", "string one"); -map.set(1, "number one"); -map.get("1"); // --> "string one" -``` - -A regular `Object` used as a map would yield `"number one"` - -### Objects as keys - -```js -var key = {}; -var key2 = {}; -map.set(key, 123); -map.set(key2, 321); -map.get(key); // --> 123 -``` -A regular `Object` used as a map would yield `321` - -### Iterating - -```js -map.set(1, "test 1"); -map.set(2, "test 2"); -map.set(3, "test 3"); - -map.forEach(function(value, key) { - console.log(key + " : " + value); -}); -``` - -### Method chaining - -```js -map - .set(1, "test 1") - .set(2, "test 2") - .set(3, "test 3") - .forEach(function(value, key) { - console.log(key + " : " + value); - }); -``` - -## LICENSE - -The MIT License (MIT) - -Copyright (c) 2012 Ariel Flesler - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF - -## To-Do - -* (?) Allow extending the hashing function in a AOP way or by passing a service -* Make tests work on the browser +# HashMap Class for JavaScript + +## Installation + +[![NPM](https://nodei.co/npm/hashmap.png?compact=true)](https://npmjs.org/package/hashmap) + +Using [npm](https://npmjs.org/package/hashmap): + + $ npm install hashmap + +Using bower: + + $ bower install hashmap + +You can download the last stable version from the [releases page](https://github.com/flesler/hashmap/releases). + +If you like risk, you can download the [latest master version](https://raw.github.com/flesler/hashmap/master/hashmap.js), it's usually stable. + +To run the tests: + + $ npm test + +## Description + +This project provides a `HashMap` class that works both on __Node.js__ and the __browser__. +HashMap instances __store key/value pairs__ allowing __keys of any type__. + +Unlike regular objects, __keys will not be stringified__. For example numbers and strings won't be mixed, you can pass `Date`'s, `RegExp`'s, DOM Elements, anything! (even `null` and `undefined`) + +## HashMap constructor overloads +- `new HashMap()` creates an empty hashmap +- `new HashMap(map:HashMap)` creates a hashmap with the key-value pairs of `map` +- `new HashMap(arr:Array)` creates a hashmap from the 2D key-value array `arr`, e.g. `[['key1','val1'], ['key2','val2']]` +- `new HashMap(key:*, value:*, key2:*, value2:*, ...)` creates a hashmap with several key-value pairs + +## HashMap methods + +- `get(key:*) : *` returns the value stored for that key. +- `set(key:*, value:*) : HashMap` stores a key-value pair +- `multi(key:*, value:*, key2:*, value2:*, ...) : HashMap` stores several key-value pairs +- `copy(other:HashMap) : HashMap` copies all key-value pairs from other to this instance +- `has(key:*) : Boolean` returns whether a key is set on the hashmap +- `search(value:*) : *` returns key under which given value is stored (`null` if not found) +- `delete(key:*) : HashMap` deletes a key-value pair by key +- `remove(key:*) : HashMap` Alias for `delete(key:*)` *(deprecated)* +- `type(key:*) : String` returns the data type of the provided key (used internally) +- `keys() : Array<*>` returns an array with all the registered keys +- `values() : Array<*>` returns an array with all the values +- `entries() : Array<[*,*]>` returns an array with [key,value] pairs +- `size : Number` the amount of key-value pairs +- `count() : Number` returns the amount of key-value pairs *(deprecated)* +- `clear() : HashMap` deletes all the key-value pairs on the hashmap +- `clone() : HashMap` creates a new hashmap with all the key-value pairs of the original +- `hash(key:*) : String` returns the stringified version of a key (used internally) +- `forEach(function(value, key)) : HashMap` iterates the pairs and calls the function for each one + +### Method chaining + +All methods that don't return something, will return the HashMap instance to enable chaining. + +## Examples + +Assume this for all examples below + +```js +var map = new HashMap(); +``` + +If you're using this within Node, you first need to import the class + +```js +var HashMap = require('hashmap'); +``` + +### Basic use case + +```js +map.set("some_key", "some value"); +map.get("some_key"); // --> "some value" +``` + +### Map size / number of elements + +```js +var map = new HashMap(); +map.set("key1", "val1"); +map.set("key2", "val2"); +map.size; // -> 2 +``` + +### Deleting key-value pairs + +```js +map.set("some_key", "some value"); +map.delete("some_key"); +map.get("some_key"); // --> undefined +``` + +### No stringification + +```js +map.set("1", "string one"); +map.set(1, "number one"); +map.get("1"); // --> "string one" +``` + +A regular `Object` used as a map would yield `"number one"` + +### Objects as keys + +```js +var key = {}; +var key2 = {}; +map.set(key, 123); +map.set(key2, 321); +map.get(key); // --> 123 +``` +A regular `Object` used as a map would yield `321` + +### Iterating + +```js +map.set(1, "test 1"); +map.set(2, "test 2"); +map.set(3, "test 3"); + +map.forEach(function(value, key) { + console.log(key + " : " + value); +}); +``` + +### Method chaining + +```js +map + .set(1, "test 1") + .set(2, "test 2") + .set(3, "test 3") + .forEach(function(value, key) { + console.log(key + " : " + value); + }); +``` + +## LICENSE + +The MIT License (MIT) + +Copyright (c) 2012 Ariel Flesler + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF + +## To-Do + +* (?) Allow extending the hashing function in a AOP way or by passing a service +* Make tests work on the browser diff --git a/node_modules/hashmap/hashmap.js b/node_modules/hashmap/hashmap.js index 811056f..a9c3120 100644 --- a/node_modules/hashmap/hashmap.js +++ b/node_modules/hashmap/hashmap.js @@ -1,210 +1,210 @@ -/** - * HashMap - HashMap Class for JavaScript - * @author Ariel Flesler - * @version 2.0.6 - * Homepage: https://github.com/flesler/hashmap - */ - -(function(factory) { - /* global define */ - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define([], factory); - } else if (typeof module === 'object') { - // Node js environment - var HashMap = module.exports = factory(); - // Keep it backwards compatible - HashMap.HashMap = HashMap; - } else { - // Browser globals (this is window) - this.HashMap = factory(); - } -}(function() { - - function HashMap(other) { - this.clear(); - switch (arguments.length) { - case 0: break; - case 1: { - if ('length' in other) { - // Flatten 2D array to alternating key-value array - multi(this, Array.prototype.concat.apply([], other)); - } else { // Assumed to be a HashMap instance - this.copy(other); - } - break; - } - default: multi(this, arguments); break; - } - } - - var proto = HashMap.prototype = { - constructor:HashMap, - - get:function(key) { - var data = this._data[this.hash(key)]; - return data && data[1]; - }, - - set:function(key, value) { - // Store original key as well (for iteration) - var hash = this.hash(key); - if ( !(hash in this._data) ) { - this.size++; - } - this._data[hash] = [key, value]; - }, - - multi:function() { - multi(this, arguments); - }, - - copy:function(other) { - for (var hash in other._data) { - if ( !(hash in this._data) ) { - this.size++; - } - this._data[hash] = other._data[hash]; - } - }, - - has:function(key) { - return this.hash(key) in this._data; - }, - - search:function(value) { - for (var key in this._data) { - if (this._data[key][1] === value) { - return this._data[key][0]; - } - } - - return null; - }, - - delete:function(key) { - var hash = this.hash(key); - if ( hash in this._data ) { - this.size--; - delete this._data[hash]; - } - }, - - type:function(key) { - var str = Object.prototype.toString.call(key); - var type = str.slice(8, -1).toLowerCase(); - // Some browsers yield DOMWindow or Window for null and undefined, works fine on Node - if (!key && (type === 'domwindow' || type === 'window')) { - return key + ''; - } - return type; - }, - - keys:function() { - var keys = []; - this.forEach(function(_, key) { keys.push(key); }); - return keys; - }, - - values:function() { - var values = []; - this.forEach(function(value) { values.push(value); }); - return values; - }, - - entries:function() { - var entries = []; - this.forEach(function(value, key) { entries.push([key, value]); }); - return entries; - }, - - // TODO: This is deprecated and will be deleted in a future version - count:function() { - return this.size; - }, - - clear:function() { - // TODO: Would Object.create(null) make any difference - this._data = {}; - this.size = 0; - }, - - clone:function() { - return new HashMap(this); - }, - - hash:function(key) { - switch (this.type(key)) { - case 'undefined': - case 'null': - case 'boolean': - case 'number': - case 'regexp': - return key + ''; - - case 'date': - return '♣' + key.getTime(); - - case 'string': - return '♠' + key; - - case 'array': - var hashes = []; - for (var i = 0; i < key.length; i++) { - hashes[i] = this.hash(key[i]); - } - return '♥' + hashes.join('⁞'); - - default: - // TODO: Don't use expandos when Object.defineProperty is not available? - if (!key.hasOwnProperty('_hmuid_')) { - key._hmuid_ = ++HashMap.uid; - hide(key, '_hmuid_'); - } - - return '♦' + key._hmuid_; - } - }, - - forEach:function(func, ctx) { - for (var key in this._data) { - var data = this._data[key]; - func.call(ctx || this, data[1], data[0]); - } - } - }; - - HashMap.uid = 0; - - //- Add chaining to all methods that don't return something - - ['set','multi','copy','delete','clear','forEach'].forEach(function(method) { - var fn = proto[method]; - proto[method] = function() { - fn.apply(this, arguments); - return this; - }; - }); - - //- Backwards compatibility - - // TODO: remove() is deprecated and will be deleted in a future version - HashMap.prototype.remove = HashMap.prototype.delete; - - //- Utils - - function multi(map, args) { - for (var i = 0; i < args.length; i += 2) { - map.set(args[i], args[i+1]); - } - } - - function hide(obj, prop) { - // Make non iterable if supported - if (Object.defineProperty) { - Object.defineProperty(obj, prop, {enumerable:false}); - } - } - - return HashMap; -})); +/** + * HashMap - HashMap Class for JavaScript + * @author Ariel Flesler + * @version 2.0.6 + * Homepage: https://github.com/flesler/hashmap + */ + +(function(factory) { + /* global define */ + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define([], factory); + } else if (typeof module === 'object') { + // Node js environment + var HashMap = module.exports = factory(); + // Keep it backwards compatible + HashMap.HashMap = HashMap; + } else { + // Browser globals (this is window) + this.HashMap = factory(); + } +}(function() { + + function HashMap(other) { + this.clear(); + switch (arguments.length) { + case 0: break; + case 1: { + if ('length' in other) { + // Flatten 2D array to alternating key-value array + multi(this, Array.prototype.concat.apply([], other)); + } else { // Assumed to be a HashMap instance + this.copy(other); + } + break; + } + default: multi(this, arguments); break; + } + } + + var proto = HashMap.prototype = { + constructor:HashMap, + + get:function(key) { + var data = this._data[this.hash(key)]; + return data && data[1]; + }, + + set:function(key, value) { + // Store original key as well (for iteration) + var hash = this.hash(key); + if ( !(hash in this._data) ) { + this.size++; + } + this._data[hash] = [key, value]; + }, + + multi:function() { + multi(this, arguments); + }, + + copy:function(other) { + for (var hash in other._data) { + if ( !(hash in this._data) ) { + this.size++; + } + this._data[hash] = other._data[hash]; + } + }, + + has:function(key) { + return this.hash(key) in this._data; + }, + + search:function(value) { + for (var key in this._data) { + if (this._data[key][1] === value) { + return this._data[key][0]; + } + } + + return null; + }, + + delete:function(key) { + var hash = this.hash(key); + if ( hash in this._data ) { + this.size--; + delete this._data[hash]; + } + }, + + type:function(key) { + var str = Object.prototype.toString.call(key); + var type = str.slice(8, -1).toLowerCase(); + // Some browsers yield DOMWindow or Window for null and undefined, works fine on Node + if (!key && (type === 'domwindow' || type === 'window')) { + return key + ''; + } + return type; + }, + + keys:function() { + var keys = []; + this.forEach(function(_, key) { keys.push(key); }); + return keys; + }, + + values:function() { + var values = []; + this.forEach(function(value) { values.push(value); }); + return values; + }, + + entries:function() { + var entries = []; + this.forEach(function(value, key) { entries.push([key, value]); }); + return entries; + }, + + // TODO: This is deprecated and will be deleted in a future version + count:function() { + return this.size; + }, + + clear:function() { + // TODO: Would Object.create(null) make any difference + this._data = {}; + this.size = 0; + }, + + clone:function() { + return new HashMap(this); + }, + + hash:function(key) { + switch (this.type(key)) { + case 'undefined': + case 'null': + case 'boolean': + case 'number': + case 'regexp': + return key + ''; + + case 'date': + return '♣' + key.getTime(); + + case 'string': + return '♠' + key; + + case 'array': + var hashes = []; + for (var i = 0; i < key.length; i++) { + hashes[i] = this.hash(key[i]); + } + return '♥' + hashes.join('⁞'); + + default: + // TODO: Don't use expandos when Object.defineProperty is not available? + if (!key.hasOwnProperty('_hmuid_')) { + key._hmuid_ = ++HashMap.uid; + hide(key, '_hmuid_'); + } + + return '♦' + key._hmuid_; + } + }, + + forEach:function(func, ctx) { + for (var key in this._data) { + var data = this._data[key]; + func.call(ctx || this, data[1], data[0]); + } + } + }; + + HashMap.uid = 0; + + //- Add chaining to all methods that don't return something + + ['set','multi','copy','delete','clear','forEach'].forEach(function(method) { + var fn = proto[method]; + proto[method] = function() { + fn.apply(this, arguments); + return this; + }; + }); + + //- Backwards compatibility + + // TODO: remove() is deprecated and will be deleted in a future version + HashMap.prototype.remove = HashMap.prototype.delete; + + //- Utils + + function multi(map, args) { + for (var i = 0; i < args.length; i += 2) { + map.set(args[i], args[i+1]); + } + } + + function hide(obj, prop) { + // Make non iterable if supported + if (Object.defineProperty) { + Object.defineProperty(obj, prop, {enumerable:false}); + } + } + + return HashMap; +})); diff --git a/node_modules/hashmap/package.json b/node_modules/hashmap/package.json index 33a647f..f95b319 100644 --- a/node_modules/hashmap/package.json +++ b/node_modules/hashmap/package.json @@ -1,28 +1,32 @@ { - "_from": "hashmap", + "_args": [ + [ + "hashmap@2.3.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "hashmap@2.3.0", "_id": "hashmap@2.3.0", "_inBundle": false, "_integrity": "sha1-sT+2XafIul49uPwbjFuh0ASdryI=", "_location": "/hashmap", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "hashmap", + "raw": "hashmap@2.3.0", "name": "hashmap", "escapedName": "hashmap", - "rawSpec": "", + "rawSpec": "2.3.0", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "2.3.0" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/hashmap/-/hashmap-2.3.0.tgz", - "_shasum": "b13fb65da7c8ba5e3db8fc1b8c5ba1d0049daf22", - "_spec": "hashmap", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI", + "_spec": "2.3.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "Ariel Flesler", "url": "https://github.com/flesler" @@ -30,9 +34,7 @@ "bugs": { "url": "https://github.com/flesler/hashmap/issues" }, - "bundleDependencies": false, "dependencies": {}, - "deprecated": false, "description": "HashMap Class for JavaScript", "devDependencies": { "chai": "4.1.1", diff --git a/node_modules/http-errors/node_modules/setprototypeof/package.json b/node_modules/http-errors/node_modules/setprototypeof/package.json index 237b1aa..0266b18 100644 --- a/node_modules/http-errors/node_modules/setprototypeof/package.json +++ b/node_modules/http-errors/node_modules/setprototypeof/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "setprototypeof@1.0.3", + "/var/www/backend/minis-data" + ] + ], "_from": "setprototypeof@1.0.3", "_id": "setprototypeof@1.0.3", "_inBundle": false, @@ -19,17 +25,14 @@ "/http-errors" ], "_resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "_shasum": "66567e37043eeb4f04d91bd658c0cbefb55b8e04", - "_spec": "setprototypeof@1.0.3", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\http-errors", + "_spec": "1.0.3", + "_where": "/var/www/backend/minis-data", "author": { "name": "Wes Todd" }, "bugs": { "url": "https://github.com/wesleytodd/setprototypeof/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "A small polyfill for Object.setprototypeof", "homepage": "https://github.com/wesleytodd/setprototypeof", "keywords": [ diff --git a/node_modules/http-errors/package.json b/node_modules/http-errors/package.json index 80e6ff8..5fac922 100644 --- a/node_modules/http-errors/package.json +++ b/node_modules/http-errors/package.json @@ -1,29 +1,34 @@ { - "_from": "http-errors@~1.6.2", + "_args": [ + [ + "http-errors@1.6.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "http-errors@1.6.2", "_id": "http-errors@1.6.2", "_inBundle": false, "_integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", "_location": "/http-errors", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "http-errors@~1.6.2", + "raw": "http-errors@1.6.2", "name": "http-errors", "escapedName": "http-errors", - "rawSpec": "~1.6.2", + "rawSpec": "1.6.2", "saveSpec": null, - "fetchSpec": "~1.6.2" + "fetchSpec": "1.6.2" }, "_requiredBy": [ - "/body-parser", - "/raw-body", + "/express/body-parser", + "/express/raw-body", "/send" ], "_resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "_shasum": "0a002cc85707192a7e7946ceedc11155f60ec736", - "_spec": "http-errors@~1.6.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\body-parser", + "_spec": "1.6.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -32,7 +37,6 @@ "bugs": { "url": "https://github.com/jshttp/http-errors/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Alan Plum", @@ -49,7 +53,6 @@ "setprototypeof": "1.0.3", "statuses": ">= 1.3.1 < 2" }, - "deprecated": false, "description": "Create HTTP error objects", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/iconv-lite/package.json b/node_modules/iconv-lite/package.json index 1fccf25..2dbf2f3 100644 --- a/node_modules/iconv-lite/package.json +++ b/node_modules/iconv-lite/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "iconv-lite@0.4.23", + "/var/www/backend/minis-data" + ] + ], "_from": "iconv-lite@0.4.23", "_id": "iconv-lite@0.4.23", "_inBundle": false, @@ -20,9 +26,8 @@ "/raw-body" ], "_resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "_shasum": "297871f63be507adcfbfca715d0cd0eed84e9a63", - "_spec": "iconv-lite@0.4.23", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\body-parser", + "_spec": "0.4.23", + "_where": "/var/www/backend/minis-data", "author": { "name": "Alexander Shtuchkin", "email": "ashtuchkin@gmail.com" @@ -34,11 +39,9 @@ "bugs": { "url": "https://github.com/ashtuchkin/iconv-lite/issues" }, - "bundleDependencies": false, "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, - "deprecated": false, "description": "Convert character encodings in pure javascript.", "devDependencies": { "async": "*", diff --git a/node_modules/inherits/package.json b/node_modules/inherits/package.json index 611a173..bdab969 100644 --- a/node_modules/inherits/package.json +++ b/node_modules/inherits/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "inherits@2.0.3", + "/var/www/backend/minis-data" + ] + ], "_from": "inherits@2.0.3", "_id": "inherits@2.0.3", "_inBundle": false, @@ -16,18 +22,18 @@ "fetchSpec": "2.0.3" }, "_requiredBy": [ - "/http-errors" + "/body-parser/http-errors", + "/http-errors", + "/raw-body/http-errors", + "/readable-stream" ], "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "_shasum": "633c2c83e3da42a502f52466022480f4208261de", - "_spec": "inherits@2.0.3", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\http-errors", + "_spec": "2.0.3", + "_where": "/var/www/backend/minis-data", "browser": "./inherits_browser.js", "bugs": { "url": "https://github.com/isaacs/inherits/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", "devDependencies": { "tap": "^7.1.0" diff --git a/node_modules/ipaddr.js/package.json b/node_modules/ipaddr.js/package.json index 609f391..e8fda83 100644 --- a/node_modules/ipaddr.js/package.json +++ b/node_modules/ipaddr.js/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "ipaddr.js@1.5.2", + "/var/www/backend/minis-data" + ] + ], "_from": "ipaddr.js@1.5.2", "_id": "ipaddr.js@1.5.2", "_inBundle": false, @@ -19,9 +25,8 @@ "/proxy-addr" ], "_resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.5.2.tgz", - "_shasum": "d4b505bde9946987ccf0fc58d9010ff9607e3fa0", - "_spec": "ipaddr.js@1.5.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\proxy-addr", + "_spec": "1.5.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "whitequark", "email": "whitequark@whitequark.org" @@ -29,9 +34,7 @@ "bugs": { "url": "https://github.com/whitequark/ipaddr.js/issues" }, - "bundleDependencies": false, "dependencies": {}, - "deprecated": false, "description": "A library for manipulating IPv4 and IPv6 addresses in JavaScript.", "devDependencies": { "coffee-script": "~1.12.6", diff --git a/node_modules/isarray/package.json b/node_modules/isarray/package.json index b148e27..259f9ae 100644 --- a/node_modules/isarray/package.json +++ b/node_modules/isarray/package.json @@ -1,27 +1,32 @@ { - "_from": "isarray@~1.0.0", + "_args": [ + [ + "isarray@1.0.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "isarray@1.0.0", "_id": "isarray@1.0.0", "_inBundle": false, "_integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "_location": "/isarray", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "isarray@~1.0.0", + "raw": "isarray@1.0.0", "name": "isarray", "escapedName": "isarray", - "rawSpec": "~1.0.0", + "rawSpec": "1.0.0", "saveSpec": null, - "fetchSpec": "~1.0.0" + "fetchSpec": "1.0.0" }, "_requiredBy": [ "/readable-stream" ], "_resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "_shasum": "bb935d48582cba168c06834957a54a3e07124f11", - "_spec": "isarray@~1.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\readable-stream", + "_spec": "1.0.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "Julian Gruber", "email": "mail@juliangruber.com", @@ -30,9 +35,7 @@ "bugs": { "url": "https://github.com/juliangruber/isarray/issues" }, - "bundleDependencies": false, "dependencies": {}, - "deprecated": false, "description": "Array#isArray for older browsers", "devDependencies": { "tape": "~2.13.4" diff --git a/node_modules/lodash._baseassign/package.json b/node_modules/lodash._baseassign/package.json index 82b5ce3..8487a70 100644 --- a/node_modules/lodash._baseassign/package.json +++ b/node_modules/lodash._baseassign/package.json @@ -1,27 +1,32 @@ { - "_from": "lodash._baseassign@^3.0.0", + "_args": [ + [ + "lodash._baseassign@3.2.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "lodash._baseassign@3.2.0", "_id": "lodash._baseassign@3.2.0", "_inBundle": false, "_integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", "_location": "/lodash._baseassign", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lodash._baseassign@^3.0.0", + "raw": "lodash._baseassign@3.2.0", "name": "lodash._baseassign", "escapedName": "lodash._baseassign", - "rawSpec": "^3.0.0", + "rawSpec": "3.2.0", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "3.2.0" }, "_requiredBy": [ "/lodash.assign" ], "_resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "_shasum": "8c38a099500f215ad09e59f1722fd0c52bfe0a4e", - "_spec": "lodash._baseassign@^3.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\lodash.assign", + "_spec": "3.2.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/lodash/lodash/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "John-David Dalton", @@ -62,7 +66,6 @@ "lodash._basecopy": "^3.0.0", "lodash.keys": "^3.0.0" }, - "deprecated": false, "description": "The modern build of lodash’s internal `baseAssign` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/node_modules/lodash._basecopy/package.json b/node_modules/lodash._basecopy/package.json index 69729a9..0886ec2 100644 --- a/node_modules/lodash._basecopy/package.json +++ b/node_modules/lodash._basecopy/package.json @@ -1,27 +1,32 @@ { - "_from": "lodash._basecopy@^3.0.0", + "_args": [ + [ + "lodash._basecopy@3.0.1", + "/var/www/backend/minis-data" + ] + ], + "_from": "lodash._basecopy@3.0.1", "_id": "lodash._basecopy@3.0.1", "_inBundle": false, "_integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", "_location": "/lodash._basecopy", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lodash._basecopy@^3.0.0", + "raw": "lodash._basecopy@3.0.1", "name": "lodash._basecopy", "escapedName": "lodash._basecopy", - "rawSpec": "^3.0.0", + "rawSpec": "3.0.1", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "3.0.1" }, "_requiredBy": [ "/lodash._baseassign" ], "_resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "_shasum": "8da0e6a876cf344c0ad8a54882111dd3c5c7ca36", - "_spec": "lodash._basecopy@^3.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\lodash._baseassign", + "_spec": "3.0.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/lodash/lodash/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "John-David Dalton", @@ -58,7 +62,6 @@ "url": "https://mathiasbynens.be/" } ], - "deprecated": false, "description": "The modern build of lodash’s internal `baseCopy` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/node_modules/lodash._bindcallback/package.json b/node_modules/lodash._bindcallback/package.json index 77c1de0..d699cec 100644 --- a/node_modules/lodash._bindcallback/package.json +++ b/node_modules/lodash._bindcallback/package.json @@ -1,27 +1,32 @@ { - "_from": "lodash._bindcallback@^3.0.0", + "_args": [ + [ + "lodash._bindcallback@3.0.1", + "/var/www/backend/minis-data" + ] + ], + "_from": "lodash._bindcallback@3.0.1", "_id": "lodash._bindcallback@3.0.1", "_inBundle": false, "_integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4=", "_location": "/lodash._bindcallback", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lodash._bindcallback@^3.0.0", + "raw": "lodash._bindcallback@3.0.1", "name": "lodash._bindcallback", "escapedName": "lodash._bindcallback", - "rawSpec": "^3.0.0", + "rawSpec": "3.0.1", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "3.0.1" }, "_requiredBy": [ "/lodash._createassigner" ], "_resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz", - "_shasum": "e531c27644cf8b57a99e17ed95b35c748789392e", - "_spec": "lodash._bindcallback@^3.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\lodash._createassigner", + "_spec": "3.0.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/lodash/lodash/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "John-David Dalton", @@ -58,7 +62,6 @@ "url": "https://mathiasbynens.be/" } ], - "deprecated": false, "description": "The modern build of lodash’s internal `bindCallback` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/node_modules/lodash._createassigner/package.json b/node_modules/lodash._createassigner/package.json index f27a886..a6a1b9f 100644 --- a/node_modules/lodash._createassigner/package.json +++ b/node_modules/lodash._createassigner/package.json @@ -1,27 +1,32 @@ { - "_from": "lodash._createassigner@^3.0.0", + "_args": [ + [ + "lodash._createassigner@3.1.1", + "/var/www/backend/minis-data" + ] + ], + "_from": "lodash._createassigner@3.1.1", "_id": "lodash._createassigner@3.1.1", "_inBundle": false, "_integrity": "sha1-g4pbri/aymOsIt7o4Z+k5taXCxE=", "_location": "/lodash._createassigner", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lodash._createassigner@^3.0.0", + "raw": "lodash._createassigner@3.1.1", "name": "lodash._createassigner", "escapedName": "lodash._createassigner", - "rawSpec": "^3.0.0", + "rawSpec": "3.1.1", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "3.1.1" }, "_requiredBy": [ "/lodash.assign" ], "_resolved": "https://registry.npmjs.org/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz", - "_shasum": "838a5bae2fdaca63ac22dee8e19fa4e6d6970b11", - "_spec": "lodash._createassigner@^3.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\lodash.assign", + "_spec": "3.1.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/lodash/lodash/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "John-David Dalton", @@ -63,7 +67,6 @@ "lodash._isiterateecall": "^3.0.0", "lodash.restparam": "^3.0.0" }, - "deprecated": false, "description": "The modern build of lodash’s internal `createAssigner` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/node_modules/lodash._getnative/package.json b/node_modules/lodash._getnative/package.json index 456921e..fafd92e 100644 --- a/node_modules/lodash._getnative/package.json +++ b/node_modules/lodash._getnative/package.json @@ -1,27 +1,32 @@ { - "_from": "lodash._getnative@^3.0.0", + "_args": [ + [ + "lodash._getnative@3.9.1", + "/var/www/backend/minis-data" + ] + ], + "_from": "lodash._getnative@3.9.1", "_id": "lodash._getnative@3.9.1", "_inBundle": false, "_integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", "_location": "/lodash._getnative", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lodash._getnative@^3.0.0", + "raw": "lodash._getnative@3.9.1", "name": "lodash._getnative", "escapedName": "lodash._getnative", - "rawSpec": "^3.0.0", + "rawSpec": "3.9.1", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "3.9.1" }, "_requiredBy": [ "/lodash.keys" ], "_resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "_shasum": "570bc7dede46d61cdcde687d65d3eecbaa3aaff5", - "_spec": "lodash._getnative@^3.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\lodash.keys", + "_spec": "3.9.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/lodash/lodash/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "John-David Dalton", @@ -58,7 +62,6 @@ "url": "https://mathiasbynens.be/" } ], - "deprecated": false, "description": "The modern build of lodash’s internal `getNative` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/node_modules/lodash._isiterateecall/package.json b/node_modules/lodash._isiterateecall/package.json index 1095f5d..d0bc9c5 100644 --- a/node_modules/lodash._isiterateecall/package.json +++ b/node_modules/lodash._isiterateecall/package.json @@ -1,27 +1,32 @@ { - "_from": "lodash._isiterateecall@^3.0.0", + "_args": [ + [ + "lodash._isiterateecall@3.0.9", + "/var/www/backend/minis-data" + ] + ], + "_from": "lodash._isiterateecall@3.0.9", "_id": "lodash._isiterateecall@3.0.9", "_inBundle": false, "_integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", "_location": "/lodash._isiterateecall", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lodash._isiterateecall@^3.0.0", + "raw": "lodash._isiterateecall@3.0.9", "name": "lodash._isiterateecall", "escapedName": "lodash._isiterateecall", - "rawSpec": "^3.0.0", + "rawSpec": "3.0.9", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "3.0.9" }, "_requiredBy": [ "/lodash._createassigner" ], "_resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "_shasum": "5203ad7ba425fae842460e696db9cf3e6aac057c", - "_spec": "lodash._isiterateecall@^3.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\lodash._createassigner", + "_spec": "3.0.9", + "_where": "/var/www/backend/minis-data", "author": { "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/lodash/lodash/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "John-David Dalton", @@ -58,7 +62,6 @@ "url": "https://mathiasbynens.be/" } ], - "deprecated": false, "description": "The modern build of lodash’s internal `isIterateeCall` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/node_modules/lodash.assign/package.json b/node_modules/lodash.assign/package.json index af40f8b..799d52a 100644 --- a/node_modules/lodash.assign/package.json +++ b/node_modules/lodash.assign/package.json @@ -1,27 +1,32 @@ { - "_from": "lodash.assign@^3.2.0", + "_args": [ + [ + "lodash.assign@3.2.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "lodash.assign@3.2.0", "_id": "lodash.assign@3.2.0", "_inBundle": false, "_integrity": "sha1-POnwI0tLIiPilrj6CsH+6OvKZPo=", "_location": "/lodash.assign", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lodash.assign@^3.2.0", + "raw": "lodash.assign@3.2.0", "name": "lodash.assign", "escapedName": "lodash.assign", - "rawSpec": "^3.2.0", + "rawSpec": "3.2.0", "saveSpec": null, - "fetchSpec": "^3.2.0" + "fetchSpec": "3.2.0" }, "_requiredBy": [ "/express-force-ssl" ], "_resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-3.2.0.tgz", - "_shasum": "3ce9f0234b4b2223e296b8fa0ac1fee8ebca64fa", - "_spec": "lodash.assign@^3.2.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express-force-ssl", + "_spec": "3.2.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/lodash/lodash/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "John-David Dalton", @@ -63,7 +67,6 @@ "lodash._createassigner": "^3.0.0", "lodash.keys": "^3.0.0" }, - "deprecated": false, "description": "The modern build of lodash’s `_.assign` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/node_modules/lodash.isarguments/package.json b/node_modules/lodash.isarguments/package.json index 0f85769..0c08531 100644 --- a/node_modules/lodash.isarguments/package.json +++ b/node_modules/lodash.isarguments/package.json @@ -1,27 +1,32 @@ { - "_from": "lodash.isarguments@^3.0.0", + "_args": [ + [ + "lodash.isarguments@3.1.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "lodash.isarguments@3.1.0", "_id": "lodash.isarguments@3.1.0", "_inBundle": false, "_integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", "_location": "/lodash.isarguments", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lodash.isarguments@^3.0.0", + "raw": "lodash.isarguments@3.1.0", "name": "lodash.isarguments", "escapedName": "lodash.isarguments", - "rawSpec": "^3.0.0", + "rawSpec": "3.1.0", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "3.1.0" }, "_requiredBy": [ "/lodash.keys" ], "_resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "_shasum": "2f573d85c6a24289ff00663b491c1d338ff3458a", - "_spec": "lodash.isarguments@^3.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\lodash.keys", + "_spec": "3.1.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/lodash/lodash/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "John-David Dalton", @@ -48,7 +52,6 @@ "url": "https://mathiasbynens.be/" } ], - "deprecated": false, "description": "The lodash method `_.isArguments` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/node_modules/lodash.isarray/package.json b/node_modules/lodash.isarray/package.json index 04e5e58..34d7ce7 100644 --- a/node_modules/lodash.isarray/package.json +++ b/node_modules/lodash.isarray/package.json @@ -1,27 +1,32 @@ { - "_from": "lodash.isarray@^3.0.0", + "_args": [ + [ + "lodash.isarray@3.0.4", + "/var/www/backend/minis-data" + ] + ], + "_from": "lodash.isarray@3.0.4", "_id": "lodash.isarray@3.0.4", "_inBundle": false, "_integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", "_location": "/lodash.isarray", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lodash.isarray@^3.0.0", + "raw": "lodash.isarray@3.0.4", "name": "lodash.isarray", "escapedName": "lodash.isarray", - "rawSpec": "^3.0.0", + "rawSpec": "3.0.4", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "3.0.4" }, "_requiredBy": [ "/lodash.keys" ], "_resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "_shasum": "79e4eb88c36a8122af86f844aa9bcd851b5fbb55", - "_spec": "lodash.isarray@^3.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\lodash.keys", + "_spec": "3.0.4", + "_where": "/var/www/backend/minis-data", "author": { "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/lodash/lodash/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "John-David Dalton", @@ -58,7 +62,6 @@ "url": "https://mathiasbynens.be/" } ], - "deprecated": false, "description": "The modern build of lodash’s `_.isArray` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/node_modules/lodash.keys/package.json b/node_modules/lodash.keys/package.json index 9052ec5..5a4041b 100644 --- a/node_modules/lodash.keys/package.json +++ b/node_modules/lodash.keys/package.json @@ -1,28 +1,33 @@ { - "_from": "lodash.keys@^3.0.0", + "_args": [ + [ + "lodash.keys@3.1.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "lodash.keys@3.1.2", "_id": "lodash.keys@3.1.2", "_inBundle": false, "_integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "_location": "/lodash.keys", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lodash.keys@^3.0.0", + "raw": "lodash.keys@3.1.2", "name": "lodash.keys", "escapedName": "lodash.keys", - "rawSpec": "^3.0.0", + "rawSpec": "3.1.2", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "3.1.2" }, "_requiredBy": [ "/lodash._baseassign", "/lodash.assign" ], "_resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "_shasum": "4dbc0472b156be50a0b286855d1bd0b0c656098a", - "_spec": "lodash.keys@^3.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\lodash.assign", + "_spec": "3.1.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", @@ -31,7 +36,6 @@ "bugs": { "url": "https://github.com/lodash/lodash/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "John-David Dalton", @@ -64,7 +68,6 @@ "lodash.isarguments": "^3.0.0", "lodash.isarray": "^3.0.0" }, - "deprecated": false, "description": "The modern build of lodash’s `_.keys` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/node_modules/lodash.restparam/package.json b/node_modules/lodash.restparam/package.json index ed3930d..da4e00e 100644 --- a/node_modules/lodash.restparam/package.json +++ b/node_modules/lodash.restparam/package.json @@ -1,27 +1,32 @@ { - "_from": "lodash.restparam@^3.0.0", + "_args": [ + [ + "lodash.restparam@3.6.1", + "/var/www/backend/minis-data" + ] + ], + "_from": "lodash.restparam@3.6.1", "_id": "lodash.restparam@3.6.1", "_inBundle": false, "_integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", "_location": "/lodash.restparam", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "lodash.restparam@^3.0.0", + "raw": "lodash.restparam@3.6.1", "name": "lodash.restparam", "escapedName": "lodash.restparam", - "rawSpec": "^3.0.0", + "rawSpec": "3.6.1", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "3.6.1" }, "_requiredBy": [ "/lodash._createassigner" ], "_resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", - "_shasum": "936a4e309ef330a7645ed4145986c85ae5b20805", - "_spec": "lodash.restparam@^3.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\lodash._createassigner", + "_spec": "3.6.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/lodash/lodash/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "John-David Dalton", @@ -58,7 +62,6 @@ "url": "https://mathiasbynens.be/" } ], - "deprecated": false, "description": "The modern build of lodash’s `_.restParam` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/node_modules/media-typer/package.json b/node_modules/media-typer/package.json index f72b71b..729bb90 100644 --- a/node_modules/media-typer/package.json +++ b/node_modules/media-typer/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "media-typer@0.3.0", + "/var/www/backend/minis-data" + ] + ], "_from": "media-typer@0.3.0", "_id": "media-typer@0.3.0", "_inBundle": false, @@ -16,12 +22,12 @@ "fetchSpec": "0.3.0" }, "_requiredBy": [ + "/body-parser/type-is", "/type-is" ], "_resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "_shasum": "8710d7af0aa626f8fffa1ce00168545263255748", - "_spec": "media-typer@0.3.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\type-is", + "_spec": "0.3.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,8 +35,6 @@ "bugs": { "url": "https://github.com/jshttp/media-typer/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Simple RFC 6838 media type parser and formatter", "devDependencies": { "istanbul": "0.3.2", diff --git a/node_modules/merge-descriptors/package.json b/node_modules/merge-descriptors/package.json index df865e8..7440a45 100644 --- a/node_modules/merge-descriptors/package.json +++ b/node_modules/merge-descriptors/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "merge-descriptors@1.0.1", + "/var/www/backend/minis-data" + ] + ], "_from": "merge-descriptors@1.0.1", "_id": "merge-descriptors@1.0.1", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "_shasum": "b00aaa556dd8b44568150ec9d1b953f3f90cbb61", - "_spec": "merge-descriptors@1.0.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.0.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/component/merge-descriptors/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -41,7 +45,6 @@ "email": "grabbou@gmail.com" } ], - "deprecated": false, "description": "Merge objects using descriptors", "devDependencies": { "istanbul": "0.4.1", diff --git a/node_modules/methods/package.json b/node_modules/methods/package.json index bfd1752..f0f772c 100644 --- a/node_modules/methods/package.json +++ b/node_modules/methods/package.json @@ -1,34 +1,38 @@ { - "_from": "methods@~1.1.2", + "_args": [ + [ + "methods@1.1.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "methods@1.1.2", "_id": "methods@1.1.2", "_inBundle": false, "_integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", "_location": "/methods", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "methods@~1.1.2", + "raw": "methods@1.1.2", "name": "methods", "escapedName": "methods", - "rawSpec": "~1.1.2", + "rawSpec": "1.1.2", "saveSpec": null, - "fetchSpec": "~1.1.2" + "fetchSpec": "1.1.2" }, "_requiredBy": [ "/express" ], "_resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "_shasum": "5529a4d67654134edcc5266656835b0f851afcee", - "_spec": "methods@~1.1.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.1.2", + "_where": "/var/www/backend/minis-data", "browser": { "http": false }, "bugs": { "url": "https://github.com/jshttp/methods/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -45,7 +49,6 @@ "url": "http://tjholowaychuk.com" } ], - "deprecated": false, "description": "HTTP methods that node supports", "devDependencies": { "istanbul": "0.4.1", diff --git a/node_modules/mime-db/package.json b/node_modules/mime-db/package.json index 1eebbc2..8492977 100644 --- a/node_modules/mime-db/package.json +++ b/node_modules/mime-db/package.json @@ -1,31 +1,35 @@ { - "_from": "mime-db@~1.30.0", + "_args": [ + [ + "mime-db@1.30.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "mime-db@1.30.0", "_id": "mime-db@1.30.0", "_inBundle": false, "_integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", "_location": "/mime-db", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "mime-db@~1.30.0", + "raw": "mime-db@1.30.0", "name": "mime-db", "escapedName": "mime-db", - "rawSpec": "~1.30.0", + "rawSpec": "1.30.0", "saveSpec": null, - "fetchSpec": "~1.30.0" + "fetchSpec": "1.30.0" }, "_requiredBy": [ "/mime-types" ], "_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", - "_shasum": "74c643da2dd9d6a45399963465b26d5ca7d71f01", - "_spec": "mime-db@~1.30.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\mime-types", + "_spec": "1.30.0", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/mime-db/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -42,7 +46,6 @@ "url": "http://github.com/broofa" } ], - "deprecated": false, "description": "Media Type Database", "devDependencies": { "bluebird": "3.5.0", diff --git a/node_modules/mime-types/package.json b/node_modules/mime-types/package.json index ca80bbd..daf232f 100644 --- a/node_modules/mime-types/package.json +++ b/node_modules/mime-types/package.json @@ -1,32 +1,36 @@ { - "_from": "mime-types@~2.1.16", + "_args": [ + [ + "mime-types@2.1.17", + "/var/www/backend/minis-data" + ] + ], + "_from": "mime-types@2.1.17", "_id": "mime-types@2.1.17", "_inBundle": false, "_integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", "_location": "/mime-types", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "mime-types@~2.1.16", + "raw": "mime-types@2.1.17", "name": "mime-types", "escapedName": "mime-types", - "rawSpec": "~2.1.16", + "rawSpec": "2.1.17", "saveSpec": null, - "fetchSpec": "~2.1.16" + "fetchSpec": "2.1.17" }, "_requiredBy": [ "/accepts", "/type-is" ], "_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", - "_shasum": "09d7a393f03e995a79f8af857b70a9e0ab16557a", - "_spec": "mime-types@~2.1.16", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\accepts", + "_spec": "2.1.17", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/mime-types/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -46,7 +50,6 @@ "dependencies": { "mime-db": "~1.30.0" }, - "deprecated": false, "description": "The ultimate javascript content-type utility.", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/mime/cli.js b/node_modules/mime/cli.js old mode 100644 new mode 100755 diff --git a/node_modules/mime/package.json b/node_modules/mime/package.json index b8219ad..b924448 100644 --- a/node_modules/mime/package.json +++ b/node_modules/mime/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "mime@1.4.1", + "/var/www/backend/minis-data" + ] + ], "_from": "mime@1.4.1", "_id": "mime@1.4.1", "_inBundle": false, @@ -19,9 +25,8 @@ "/send" ], "_resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "_shasum": "121f9ebc49e3766f311a76e1fa1c8003c4b03aa6", - "_spec": "mime@1.4.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\send", + "_spec": "1.4.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "Robert Kieffer", "email": "robert@broofa.com", @@ -33,7 +38,6 @@ "bugs": { "url": "https://github.com/broofa/node-mime/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Benjamin Thomas", @@ -42,7 +46,6 @@ } ], "dependencies": {}, - "deprecated": false, "description": "A comprehensive library for mime-type mapping", "devDependencies": { "mime-db": "1.30.0" diff --git a/node_modules/ms/package.json b/node_modules/ms/package.json index 9fe87b5..08aa9f2 100644 --- a/node_modules/ms/package.json +++ b/node_modules/ms/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "ms@2.0.0", + "/var/www/backend/minis-data" + ] + ], "_from": "ms@2.0.0", "_id": "ms@2.0.0", "_inBundle": false, @@ -20,14 +26,11 @@ "/send" ], "_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8", - "_spec": "ms@2.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\debug", + "_spec": "2.0.0", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/zeit/ms/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Tiny milisecond conversion utility", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/mysql/package.json b/node_modules/mysql/package.json index 8c2dc2e..4a00260 100644 --- a/node_modules/mysql/package.json +++ b/node_modules/mysql/package.json @@ -1,28 +1,32 @@ { - "_from": "mysql@^2.15.0", + "_args": [ + [ + "mysql@2.15.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "mysql@2.15.0", "_id": "mysql@2.15.0", "_inBundle": false, "_integrity": "sha512-C7tjzWtbN5nzkLIV+E8Crnl9bFyc7d3XJcBAvHKEVkjrYjogz3llo22q6s/hw+UcsE4/844pDob9ac+3dVjQSA==", "_location": "/mysql", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "mysql@^2.15.0", + "raw": "mysql@2.15.0", "name": "mysql", "escapedName": "mysql", - "rawSpec": "^2.15.0", + "rawSpec": "2.15.0", "saveSpec": null, - "fetchSpec": "^2.15.0" + "fetchSpec": "2.15.0" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/mysql/-/mysql-2.15.0.tgz", - "_shasum": "ea16841156343e8f2e47fc8985ec41cdd9573b5c", - "_spec": "mysql@^2.15.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI", + "_spec": "2.15.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "Felix Geisendörfer", "email": "felix@debuggable.com", @@ -31,7 +35,6 @@ "bugs": { "url": "https://github.com/mysqljs/mysql/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Andrey Sidorov", @@ -60,7 +63,6 @@ "safe-buffer": "5.1.1", "sqlstring": "2.3.0" }, - "deprecated": false, "description": "A node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed.", "devDependencies": { "after": "0.8.2", diff --git a/node_modules/negotiator/package.json b/node_modules/negotiator/package.json index cf591ce..0d7e27b 100644 --- a/node_modules/negotiator/package.json +++ b/node_modules/negotiator/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "negotiator@0.6.1", + "/var/www/backend/minis-data" + ] + ], "_from": "negotiator@0.6.1", "_id": "negotiator@0.6.1", "_inBundle": false, @@ -19,13 +25,11 @@ "/accepts" ], "_resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "_shasum": "2b327184e8992101177b28563fb5e7102acd0ca9", - "_spec": "negotiator@0.6.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\accepts", + "_spec": "0.6.1", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/negotiator/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -41,7 +45,6 @@ "url": "http://blog.izs.me/" } ], - "deprecated": false, "description": "HTTP content negotiation", "devDependencies": { "istanbul": "0.4.3", diff --git a/node_modules/object-assign/package.json b/node_modules/object-assign/package.json index 50b6803..a43af9e 100644 --- a/node_modules/object-assign/package.json +++ b/node_modules/object-assign/package.json @@ -1,27 +1,32 @@ { - "_from": "object-assign@^4", + "_args": [ + [ + "object-assign@4.1.1", + "/var/www/backend/minis-data" + ] + ], + "_from": "object-assign@4.1.1", "_id": "object-assign@4.1.1", "_inBundle": false, "_integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "_location": "/object-assign", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "object-assign@^4", + "raw": "object-assign@4.1.1", "name": "object-assign", "escapedName": "object-assign", - "rawSpec": "^4", + "rawSpec": "4.1.1", "saveSpec": null, - "fetchSpec": "^4" + "fetchSpec": "4.1.1" }, "_requiredBy": [ "/cors" ], "_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "_shasum": "2109adc7965887cfc05cbbd442cac8bfbb360863", - "_spec": "object-assign@^4", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\cors", + "_spec": "4.1.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -30,8 +35,6 @@ "bugs": { "url": "https://github.com/sindresorhus/object-assign/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "ES2015 `Object.assign()` ponyfill", "devDependencies": { "ava": "^0.16.0", diff --git a/node_modules/on-finished/package.json b/node_modules/on-finished/package.json index f70066e..3ce1119 100644 --- a/node_modules/on-finished/package.json +++ b/node_modules/on-finished/package.json @@ -1,34 +1,39 @@ { - "_from": "on-finished@~2.3.0", + "_args": [ + [ + "on-finished@2.3.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "on-finished@2.3.0", "_id": "on-finished@2.3.0", "_inBundle": false, "_integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", "_location": "/on-finished", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "on-finished@~2.3.0", + "raw": "on-finished@2.3.0", "name": "on-finished", "escapedName": "on-finished", - "rawSpec": "~2.3.0", + "rawSpec": "2.3.0", "saveSpec": null, - "fetchSpec": "~2.3.0" + "fetchSpec": "2.3.0" }, "_requiredBy": [ "/body-parser", "/express", + "/express/body-parser", "/finalhandler", "/send" ], "_resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "_shasum": "20f1336481b083cd75337992a16971aa2d906947", - "_spec": "on-finished@~2.3.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "2.3.0", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/on-finished/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -43,7 +48,6 @@ "dependencies": { "ee-first": "1.1.1" }, - "deprecated": false, "description": "Execute a callback when a request closes, finishes, or errors", "devDependencies": { "istanbul": "0.3.9", diff --git a/node_modules/parseurl/package.json b/node_modules/parseurl/package.json index d166167..b9a0b23 100644 --- a/node_modules/parseurl/package.json +++ b/node_modules/parseurl/package.json @@ -1,19 +1,25 @@ { - "_from": "parseurl@~1.3.2", + "_args": [ + [ + "parseurl@1.3.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "parseurl@1.3.2", "_id": "parseurl@1.3.2", "_inBundle": false, "_integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=", "_location": "/parseurl", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "parseurl@~1.3.2", + "raw": "parseurl@1.3.2", "name": "parseurl", "escapedName": "parseurl", - "rawSpec": "~1.3.2", + "rawSpec": "1.3.2", "saveSpec": null, - "fetchSpec": "~1.3.2" + "fetchSpec": "1.3.2" }, "_requiredBy": [ "/express", @@ -21,13 +27,11 @@ "/serve-static" ], "_resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "_shasum": "fc289d4ed8993119460c156253262cdc8de65bf3", - "_spec": "parseurl@~1.3.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.3.2", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/pillarjs/parseurl/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -39,7 +43,6 @@ "url": "http://jongleberry.com" } ], - "deprecated": false, "description": "parse a url with memoization", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/path-to-regexp/package.json b/node_modules/path-to-regexp/package.json index a957289..436e6b4 100644 --- a/node_modules/path-to-regexp/package.json +++ b/node_modules/path-to-regexp/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "path-to-regexp@0.1.7", + "/var/www/backend/minis-data" + ] + ], "_from": "path-to-regexp@0.1.7", "_id": "path-to-regexp@0.1.7", "_inBundle": false, @@ -19,19 +25,16 @@ "/express" ], "_resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "_shasum": "df604178005f522f15eb4490e7247a1bfaa67f8c", - "_spec": "path-to-regexp@0.1.7", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "0.1.7", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/component/path-to-regexp/issues" }, - "bundleDependencies": false, "component": { "scripts": { "path-to-regexp": "index.js" } }, - "deprecated": false, "description": "Express style path to RegExp utility", "devDependencies": { "istanbul": "^0.2.6", diff --git a/node_modules/path/LICENSE b/node_modules/path/LICENSE index e3d4e69..a7e984d 100644 --- a/node_modules/path/LICENSE +++ b/node_modules/path/LICENSE @@ -1,18 +1,18 @@ -Copyright Joyent, Inc. and other Node contributors. All rights reserved. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/node_modules/path/README.md b/node_modules/path/README.md index f5227af..6e7d668 100644 --- a/node_modules/path/README.md +++ b/node_modules/path/README.md @@ -1,15 +1,15 @@ -# path - -This is an exact copy of the NodeJS ’path’ module published to the NPM registry. - -[Documentation](http://nodejs.org/docs/latest/api/path.html) - -## Install - -```sh -$ npm install --save path -``` - -## License - -MIT +# path + +This is an exact copy of the NodeJS ’path’ module published to the NPM registry. + +[Documentation](http://nodejs.org/docs/latest/api/path.html) + +## Install + +```sh +$ npm install --save path +``` + +## License + +MIT diff --git a/node_modules/path/package.json b/node_modules/path/package.json index 983db00..7a278a5 100644 --- a/node_modules/path/package.json +++ b/node_modules/path/package.json @@ -1,28 +1,32 @@ { - "_from": "path", + "_args": [ + [ + "path@0.12.7", + "/var/www/backend/minis-data" + ] + ], + "_from": "path@0.12.7", "_id": "path@0.12.7", "_inBundle": false, "_integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", "_location": "/path", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "path", + "raw": "path@0.12.7", "name": "path", "escapedName": "path", - "rawSpec": "", + "rawSpec": "0.12.7", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "0.12.7" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", - "_shasum": "d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f", - "_spec": "path", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI", + "_spec": "0.12.7", + "_where": "/var/www/backend/minis-data", "author": { "name": "Joyent", "url": "http://www.joyent.com" @@ -30,12 +34,10 @@ "bugs": { "url": "https://github.com/jinder/path/issues" }, - "bundleDependencies": false, "dependencies": { "process": "^0.11.1", "util": "^0.10.3" }, - "deprecated": false, "description": "Node.JS path module", "homepage": "http://nodejs.org/docs/latest/api/path.html", "keywords": [ diff --git a/node_modules/path/path.js b/node_modules/path/path.js index 937bc79..87b8ee4 100644 --- a/node_modules/path/path.js +++ b/node_modules/path/path.js @@ -1,628 +1,628 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - - -var isWindows = process.platform === 'win32'; -var util = require('util'); - - -// resolves . and .. elements in a path array with directory names there -// must be no slashes or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts, allowAboveRoot) { - var res = []; - for (var i = 0; i < parts.length; i++) { - var p = parts[i]; - - // ignore empty parts - if (!p || p === '.') - continue; - - if (p === '..') { - if (res.length && res[res.length - 1] !== '..') { - res.pop(); - } else if (allowAboveRoot) { - res.push('..'); - } - } else { - res.push(p); - } - } - - return res; -} - -// returns an array with empty elements removed from either end of the input -// array or the original array if no elements need to be removed -function trimArray(arr) { - var lastIndex = arr.length - 1; - var start = 0; - for (; start <= lastIndex; start++) { - if (arr[start]) - break; - } - - var end = lastIndex; - for (; end >= 0; end--) { - if (arr[end]) - break; - } - - if (start === 0 && end === lastIndex) - return arr; - if (start > end) - return []; - return arr.slice(start, end + 1); -} - -// Regex to split a windows path into three parts: [*, device, slash, -// tail] windows-only -var splitDeviceRe = - /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; - -// Regex to split the tail part of the above into [*, dir, basename, ext] -var splitTailRe = - /^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/; - -var win32 = {}; - -// Function to split a filename into [root, dir, basename, ext] -function win32SplitPath(filename) { - // Separate device+slash from tail - var result = splitDeviceRe.exec(filename), - device = (result[1] || '') + (result[2] || ''), - tail = result[3] || ''; - // Split the tail into dir, basename and extension - var result2 = splitTailRe.exec(tail), - dir = result2[1], - basename = result2[2], - ext = result2[3]; - return [device, dir, basename, ext]; -} - -function win32StatPath(path) { - var result = splitDeviceRe.exec(path), - device = result[1] || '', - isUnc = !!device && device[1] !== ':'; - return { - device: device, - isUnc: isUnc, - isAbsolute: isUnc || !!result[2], // UNC paths are always absolute - tail: result[3] - }; -} - -function normalizeUNCRoot(device) { - return '\\\\' + device.replace(/^[\\\/]+/, '').replace(/[\\\/]+/g, '\\'); -} - -// path.resolve([from ...], to) -win32.resolve = function() { - var resolvedDevice = '', - resolvedTail = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1; i--) { - var path; - if (i >= 0) { - path = arguments[i]; - } else if (!resolvedDevice) { - path = process.cwd(); - } else { - // Windows has the concept of drive-specific current working - // directories. If we've resolved a drive letter but not yet an - // absolute path, get cwd for that drive. We're sure the device is not - // an unc path at this points, because unc paths are always absolute. - path = process.env['=' + resolvedDevice]; - // Verify that a drive-local cwd was found and that it actually points - // to our drive. If not, default to the drive's root. - if (!path || path.substr(0, 3).toLowerCase() !== - resolvedDevice.toLowerCase() + '\\') { - path = resolvedDevice + '\\'; - } - } - - // Skip empty and invalid entries - if (!util.isString(path)) { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - var result = win32StatPath(path), - device = result.device, - isUnc = result.isUnc, - isAbsolute = result.isAbsolute, - tail = result.tail; - - if (device && - resolvedDevice && - device.toLowerCase() !== resolvedDevice.toLowerCase()) { - // This path points to another device so it is not applicable - continue; - } - - if (!resolvedDevice) { - resolvedDevice = device; - } - if (!resolvedAbsolute) { - resolvedTail = tail + '\\' + resolvedTail; - resolvedAbsolute = isAbsolute; - } - - if (resolvedDevice && resolvedAbsolute) { - break; - } - } - - // Convert slashes to backslashes when `resolvedDevice` points to an UNC - // root. Also squash multiple slashes into a single one where appropriate. - if (isUnc) { - resolvedDevice = normalizeUNCRoot(resolvedDevice); - } - - // At this point the path should be resolved to a full absolute path, - // but handle relative paths to be safe (might happen when process.cwd() - // fails) - - // Normalize the tail path - resolvedTail = normalizeArray(resolvedTail.split(/[\\\/]+/), - !resolvedAbsolute).join('\\'); - - return (resolvedDevice + (resolvedAbsolute ? '\\' : '') + resolvedTail) || - '.'; -}; - - -win32.normalize = function(path) { - var result = win32StatPath(path), - device = result.device, - isUnc = result.isUnc, - isAbsolute = result.isAbsolute, - tail = result.tail, - trailingSlash = /[\\\/]$/.test(tail); - - // Normalize the tail path - tail = normalizeArray(tail.split(/[\\\/]+/), !isAbsolute).join('\\'); - - if (!tail && !isAbsolute) { - tail = '.'; - } - if (tail && trailingSlash) { - tail += '\\'; - } - - // Convert slashes to backslashes when `device` points to an UNC root. - // Also squash multiple slashes into a single one where appropriate. - if (isUnc) { - device = normalizeUNCRoot(device); - } - - return device + (isAbsolute ? '\\' : '') + tail; -}; - - -win32.isAbsolute = function(path) { - return win32StatPath(path).isAbsolute; -}; - -win32.join = function() { - var paths = []; - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - if (!util.isString(arg)) { - throw new TypeError('Arguments to path.join must be strings'); - } - if (arg) { - paths.push(arg); - } - } - - var joined = paths.join('\\'); - - // Make sure that the joined path doesn't start with two slashes, because - // normalize() will mistake it for an UNC path then. - // - // This step is skipped when it is very clear that the user actually - // intended to point at an UNC path. This is assumed when the first - // non-empty string arguments starts with exactly two slashes followed by - // at least one more non-slash character. - // - // Note that for normalize() to treat a path as an UNC path it needs to - // have at least 2 components, so we don't filter for that here. - // This means that the user can use join to construct UNC paths from - // a server name and a share name; for example: - // path.join('//server', 'share') -> '\\\\server\\share\') - if (!/^[\\\/]{2}[^\\\/]/.test(paths[0])) { - joined = joined.replace(/^[\\\/]{2,}/, '\\'); - } - - return win32.normalize(joined); -}; - - -// path.relative(from, to) -// it will solve the relative path from 'from' to 'to', for instance: -// from = 'C:\\orandea\\test\\aaa' -// to = 'C:\\orandea\\impl\\bbb' -// The output of the function should be: '..\\..\\impl\\bbb' -win32.relative = function(from, to) { - from = win32.resolve(from); - to = win32.resolve(to); - - // windows is not case sensitive - var lowerFrom = from.toLowerCase(); - var lowerTo = to.toLowerCase(); - - var toParts = trimArray(to.split('\\')); - - var lowerFromParts = trimArray(lowerFrom.split('\\')); - var lowerToParts = trimArray(lowerTo.split('\\')); - - var length = Math.min(lowerFromParts.length, lowerToParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (lowerFromParts[i] !== lowerToParts[i]) { - samePartsLength = i; - break; - } - } - - if (samePartsLength == 0) { - return to; - } - - var outputParts = []; - for (var i = samePartsLength; i < lowerFromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('\\'); -}; - - -win32._makeLong = function(path) { - // Note: this will *probably* throw somewhere. - if (!util.isString(path)) - return path; - - if (!path) { - return ''; - } - - var resolvedPath = win32.resolve(path); - - if (/^[a-zA-Z]\:\\/.test(resolvedPath)) { - // path is local filesystem path, which needs to be converted - // to long UNC path. - return '\\\\?\\' + resolvedPath; - } else if (/^\\\\[^?.]/.test(resolvedPath)) { - // path is network UNC path, which needs to be converted - // to long UNC path. - return '\\\\?\\UNC\\' + resolvedPath.substring(2); - } - - return path; -}; - - -win32.dirname = function(path) { - var result = win32SplitPath(path), - root = result[0], - dir = result[1]; - - if (!root && !dir) { - // No dirname whatsoever - return '.'; - } - - if (dir) { - // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); - } - - return root + dir; -}; - - -win32.basename = function(path, ext) { - var f = win32SplitPath(path)[2]; - // TODO: make this comparison case-insensitive on windows? - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; - - -win32.extname = function(path) { - return win32SplitPath(path)[3]; -}; - - -win32.format = function(pathObject) { - if (!util.isObject(pathObject)) { - throw new TypeError( - "Parameter 'pathObject' must be an object, not " + typeof pathObject - ); - } - - var root = pathObject.root || ''; - - if (!util.isString(root)) { - throw new TypeError( - "'pathObject.root' must be a string or undefined, not " + - typeof pathObject.root - ); - } - - var dir = pathObject.dir; - var base = pathObject.base || ''; - if (!dir) { - return base; - } - if (dir[dir.length - 1] === win32.sep) { - return dir + base; - } - return dir + win32.sep + base; -}; - - -win32.parse = function(pathString) { - if (!util.isString(pathString)) { - throw new TypeError( - "Parameter 'pathString' must be a string, not " + typeof pathString - ); - } - var allParts = win32SplitPath(pathString); - if (!allParts || allParts.length !== 4) { - throw new TypeError("Invalid path '" + pathString + "'"); - } - return { - root: allParts[0], - dir: allParts[0] + allParts[1].slice(0, -1), - base: allParts[2], - ext: allParts[3], - name: allParts[2].slice(0, allParts[2].length - allParts[3].length) - }; -}; - - -win32.sep = '\\'; -win32.delimiter = ';'; - - -// Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; -var posix = {}; - - -function posixSplitPath(filename) { - return splitPathRe.exec(filename).slice(1); -} - - -// path.resolve([from ...], to) -// posix version -posix.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); - - // Skip empty and invalid entries - if (!util.isString(path)) { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path[0] === '/'; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeArray(resolvedPath.split('/'), - !resolvedAbsolute).join('/'); - - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; - -// path.normalize(path) -// posix version -posix.normalize = function(path) { - var isAbsolute = posix.isAbsolute(path), - trailingSlash = path && path[path.length - 1] === '/'; - - // Normalize the path - path = normalizeArray(path.split('/'), !isAbsolute).join('/'); - - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } - - return (isAbsolute ? '/' : '') + path; -}; - -// posix version -posix.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; - -// posix version -posix.join = function() { - var path = ''; - for (var i = 0; i < arguments.length; i++) { - var segment = arguments[i]; - if (!util.isString(segment)) { - throw new TypeError('Arguments to path.join must be strings'); - } - if (segment) { - if (!path) { - path += segment; - } else { - path += '/' + segment; - } - } - } - return posix.normalize(path); -}; - - -// path.relative(from, to) -// posix version -posix.relative = function(from, to) { - from = posix.resolve(from).substr(1); - to = posix.resolve(to).substr(1); - - var fromParts = trimArray(from.split('/')); - var toParts = trimArray(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; - } - } - - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('/'); -}; - - -posix._makeLong = function(path) { - return path; -}; - - -posix.dirname = function(path) { - var result = posixSplitPath(path), - root = result[0], - dir = result[1]; - - if (!root && !dir) { - // No dirname whatsoever - return '.'; - } - - if (dir) { - // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); - } - - return root + dir; -}; - - -posix.basename = function(path, ext) { - var f = posixSplitPath(path)[2]; - // TODO: make this comparison case-insensitive on windows? - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; - - -posix.extname = function(path) { - return posixSplitPath(path)[3]; -}; - - -posix.format = function(pathObject) { - if (!util.isObject(pathObject)) { - throw new TypeError( - "Parameter 'pathObject' must be an object, not " + typeof pathObject - ); - } - - var root = pathObject.root || ''; - - if (!util.isString(root)) { - throw new TypeError( - "'pathObject.root' must be a string or undefined, not " + - typeof pathObject.root - ); - } - - var dir = pathObject.dir ? pathObject.dir + posix.sep : ''; - var base = pathObject.base || ''; - return dir + base; -}; - - -posix.parse = function(pathString) { - if (!util.isString(pathString)) { - throw new TypeError( - "Parameter 'pathString' must be a string, not " + typeof pathString - ); - } - var allParts = posixSplitPath(pathString); - if (!allParts || allParts.length !== 4) { - throw new TypeError("Invalid path '" + pathString + "'"); - } - allParts[1] = allParts[1] || ''; - allParts[2] = allParts[2] || ''; - allParts[3] = allParts[3] || ''; - - return { - root: allParts[0], - dir: allParts[0] + allParts[1].slice(0, -1), - base: allParts[2], - ext: allParts[3], - name: allParts[2].slice(0, allParts[2].length - allParts[3].length) - }; -}; - - -posix.sep = '/'; -posix.delimiter = ':'; - - -if (isWindows) - module.exports = win32; -else /* posix */ - module.exports = posix; - -module.exports.posix = posix; -module.exports.win32 = win32; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + + +var isWindows = process.platform === 'win32'; +var util = require('util'); + + +// resolves . and .. elements in a path array with directory names there +// must be no slashes or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + var res = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + + // ignore empty parts + if (!p || p === '.') + continue; + + if (p === '..') { + if (res.length && res[res.length - 1] !== '..') { + res.pop(); + } else if (allowAboveRoot) { + res.push('..'); + } + } else { + res.push(p); + } + } + + return res; +} + +// returns an array with empty elements removed from either end of the input +// array or the original array if no elements need to be removed +function trimArray(arr) { + var lastIndex = arr.length - 1; + var start = 0; + for (; start <= lastIndex; start++) { + if (arr[start]) + break; + } + + var end = lastIndex; + for (; end >= 0; end--) { + if (arr[end]) + break; + } + + if (start === 0 && end === lastIndex) + return arr; + if (start > end) + return []; + return arr.slice(start, end + 1); +} + +// Regex to split a windows path into three parts: [*, device, slash, +// tail] windows-only +var splitDeviceRe = + /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + +// Regex to split the tail part of the above into [*, dir, basename, ext] +var splitTailRe = + /^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/; + +var win32 = {}; + +// Function to split a filename into [root, dir, basename, ext] +function win32SplitPath(filename) { + // Separate device+slash from tail + var result = splitDeviceRe.exec(filename), + device = (result[1] || '') + (result[2] || ''), + tail = result[3] || ''; + // Split the tail into dir, basename and extension + var result2 = splitTailRe.exec(tail), + dir = result2[1], + basename = result2[2], + ext = result2[3]; + return [device, dir, basename, ext]; +} + +function win32StatPath(path) { + var result = splitDeviceRe.exec(path), + device = result[1] || '', + isUnc = !!device && device[1] !== ':'; + return { + device: device, + isUnc: isUnc, + isAbsolute: isUnc || !!result[2], // UNC paths are always absolute + tail: result[3] + }; +} + +function normalizeUNCRoot(device) { + return '\\\\' + device.replace(/^[\\\/]+/, '').replace(/[\\\/]+/g, '\\'); +} + +// path.resolve([from ...], to) +win32.resolve = function() { + var resolvedDevice = '', + resolvedTail = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1; i--) { + var path; + if (i >= 0) { + path = arguments[i]; + } else if (!resolvedDevice) { + path = process.cwd(); + } else { + // Windows has the concept of drive-specific current working + // directories. If we've resolved a drive letter but not yet an + // absolute path, get cwd for that drive. We're sure the device is not + // an unc path at this points, because unc paths are always absolute. + path = process.env['=' + resolvedDevice]; + // Verify that a drive-local cwd was found and that it actually points + // to our drive. If not, default to the drive's root. + if (!path || path.substr(0, 3).toLowerCase() !== + resolvedDevice.toLowerCase() + '\\') { + path = resolvedDevice + '\\'; + } + } + + // Skip empty and invalid entries + if (!util.isString(path)) { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + var result = win32StatPath(path), + device = result.device, + isUnc = result.isUnc, + isAbsolute = result.isAbsolute, + tail = result.tail; + + if (device && + resolvedDevice && + device.toLowerCase() !== resolvedDevice.toLowerCase()) { + // This path points to another device so it is not applicable + continue; + } + + if (!resolvedDevice) { + resolvedDevice = device; + } + if (!resolvedAbsolute) { + resolvedTail = tail + '\\' + resolvedTail; + resolvedAbsolute = isAbsolute; + } + + if (resolvedDevice && resolvedAbsolute) { + break; + } + } + + // Convert slashes to backslashes when `resolvedDevice` points to an UNC + // root. Also squash multiple slashes into a single one where appropriate. + if (isUnc) { + resolvedDevice = normalizeUNCRoot(resolvedDevice); + } + + // At this point the path should be resolved to a full absolute path, + // but handle relative paths to be safe (might happen when process.cwd() + // fails) + + // Normalize the tail path + resolvedTail = normalizeArray(resolvedTail.split(/[\\\/]+/), + !resolvedAbsolute).join('\\'); + + return (resolvedDevice + (resolvedAbsolute ? '\\' : '') + resolvedTail) || + '.'; +}; + + +win32.normalize = function(path) { + var result = win32StatPath(path), + device = result.device, + isUnc = result.isUnc, + isAbsolute = result.isAbsolute, + tail = result.tail, + trailingSlash = /[\\\/]$/.test(tail); + + // Normalize the tail path + tail = normalizeArray(tail.split(/[\\\/]+/), !isAbsolute).join('\\'); + + if (!tail && !isAbsolute) { + tail = '.'; + } + if (tail && trailingSlash) { + tail += '\\'; + } + + // Convert slashes to backslashes when `device` points to an UNC root. + // Also squash multiple slashes into a single one where appropriate. + if (isUnc) { + device = normalizeUNCRoot(device); + } + + return device + (isAbsolute ? '\\' : '') + tail; +}; + + +win32.isAbsolute = function(path) { + return win32StatPath(path).isAbsolute; +}; + +win32.join = function() { + var paths = []; + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + if (!util.isString(arg)) { + throw new TypeError('Arguments to path.join must be strings'); + } + if (arg) { + paths.push(arg); + } + } + + var joined = paths.join('\\'); + + // Make sure that the joined path doesn't start with two slashes, because + // normalize() will mistake it for an UNC path then. + // + // This step is skipped when it is very clear that the user actually + // intended to point at an UNC path. This is assumed when the first + // non-empty string arguments starts with exactly two slashes followed by + // at least one more non-slash character. + // + // Note that for normalize() to treat a path as an UNC path it needs to + // have at least 2 components, so we don't filter for that here. + // This means that the user can use join to construct UNC paths from + // a server name and a share name; for example: + // path.join('//server', 'share') -> '\\\\server\\share\') + if (!/^[\\\/]{2}[^\\\/]/.test(paths[0])) { + joined = joined.replace(/^[\\\/]{2,}/, '\\'); + } + + return win32.normalize(joined); +}; + + +// path.relative(from, to) +// it will solve the relative path from 'from' to 'to', for instance: +// from = 'C:\\orandea\\test\\aaa' +// to = 'C:\\orandea\\impl\\bbb' +// The output of the function should be: '..\\..\\impl\\bbb' +win32.relative = function(from, to) { + from = win32.resolve(from); + to = win32.resolve(to); + + // windows is not case sensitive + var lowerFrom = from.toLowerCase(); + var lowerTo = to.toLowerCase(); + + var toParts = trimArray(to.split('\\')); + + var lowerFromParts = trimArray(lowerFrom.split('\\')); + var lowerToParts = trimArray(lowerTo.split('\\')); + + var length = Math.min(lowerFromParts.length, lowerToParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (lowerFromParts[i] !== lowerToParts[i]) { + samePartsLength = i; + break; + } + } + + if (samePartsLength == 0) { + return to; + } + + var outputParts = []; + for (var i = samePartsLength; i < lowerFromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('\\'); +}; + + +win32._makeLong = function(path) { + // Note: this will *probably* throw somewhere. + if (!util.isString(path)) + return path; + + if (!path) { + return ''; + } + + var resolvedPath = win32.resolve(path); + + if (/^[a-zA-Z]\:\\/.test(resolvedPath)) { + // path is local filesystem path, which needs to be converted + // to long UNC path. + return '\\\\?\\' + resolvedPath; + } else if (/^\\\\[^?.]/.test(resolvedPath)) { + // path is network UNC path, which needs to be converted + // to long UNC path. + return '\\\\?\\UNC\\' + resolvedPath.substring(2); + } + + return path; +}; + + +win32.dirname = function(path) { + var result = win32SplitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +win32.basename = function(path, ext) { + var f = win32SplitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +win32.extname = function(path) { + return win32SplitPath(path)[3]; +}; + + +win32.format = function(pathObject) { + if (!util.isObject(pathObject)) { + throw new TypeError( + "Parameter 'pathObject' must be an object, not " + typeof pathObject + ); + } + + var root = pathObject.root || ''; + + if (!util.isString(root)) { + throw new TypeError( + "'pathObject.root' must be a string or undefined, not " + + typeof pathObject.root + ); + } + + var dir = pathObject.dir; + var base = pathObject.base || ''; + if (!dir) { + return base; + } + if (dir[dir.length - 1] === win32.sep) { + return dir + base; + } + return dir + win32.sep + base; +}; + + +win32.parse = function(pathString) { + if (!util.isString(pathString)) { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = win32SplitPath(pathString); + if (!allParts || allParts.length !== 4) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + return { + root: allParts[0], + dir: allParts[0] + allParts[1].slice(0, -1), + base: allParts[2], + ext: allParts[3], + name: allParts[2].slice(0, allParts[2].length - allParts[3].length) + }; +}; + + +win32.sep = '\\'; +win32.delimiter = ';'; + + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var posix = {}; + + +function posixSplitPath(filename) { + return splitPathRe.exec(filename).slice(1); +} + + +// path.resolve([from ...], to) +// posix version +posix.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (!util.isString(path)) { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path[0] === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(resolvedPath.split('/'), + !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; + +// path.normalize(path) +// posix version +posix.normalize = function(path) { + var isAbsolute = posix.isAbsolute(path), + trailingSlash = path && path[path.length - 1] === '/'; + + // Normalize the path + path = normalizeArray(path.split('/'), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; +}; + +// posix version +posix.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; + +// posix version +posix.join = function() { + var path = ''; + for (var i = 0; i < arguments.length; i++) { + var segment = arguments[i]; + if (!util.isString(segment)) { + throw new TypeError('Arguments to path.join must be strings'); + } + if (segment) { + if (!path) { + path += segment; + } else { + path += '/' + segment; + } + } + } + return posix.normalize(path); +}; + + +// path.relative(from, to) +// posix version +posix.relative = function(from, to) { + from = posix.resolve(from).substr(1); + to = posix.resolve(to).substr(1); + + var fromParts = trimArray(from.split('/')); + var toParts = trimArray(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); +}; + + +posix._makeLong = function(path) { + return path; +}; + + +posix.dirname = function(path) { + var result = posixSplitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +posix.basename = function(path, ext) { + var f = posixSplitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +posix.extname = function(path) { + return posixSplitPath(path)[3]; +}; + + +posix.format = function(pathObject) { + if (!util.isObject(pathObject)) { + throw new TypeError( + "Parameter 'pathObject' must be an object, not " + typeof pathObject + ); + } + + var root = pathObject.root || ''; + + if (!util.isString(root)) { + throw new TypeError( + "'pathObject.root' must be a string or undefined, not " + + typeof pathObject.root + ); + } + + var dir = pathObject.dir ? pathObject.dir + posix.sep : ''; + var base = pathObject.base || ''; + return dir + base; +}; + + +posix.parse = function(pathString) { + if (!util.isString(pathString)) { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = posixSplitPath(pathString); + if (!allParts || allParts.length !== 4) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + allParts[1] = allParts[1] || ''; + allParts[2] = allParts[2] || ''; + allParts[3] = allParts[3] || ''; + + return { + root: allParts[0], + dir: allParts[0] + allParts[1].slice(0, -1), + base: allParts[2], + ext: allParts[3], + name: allParts[2].slice(0, allParts[2].length - allParts[3].length) + }; +}; + + +posix.sep = '/'; +posix.delimiter = ':'; + + +if (isWindows) + module.exports = win32; +else /* posix */ + module.exports = posix; + +module.exports.posix = posix; +module.exports.win32 = win32; diff --git a/node_modules/process-nextick-args/package.json b/node_modules/process-nextick-args/package.json index 023fb4e..c621afb 100644 --- a/node_modules/process-nextick-args/package.json +++ b/node_modules/process-nextick-args/package.json @@ -1,33 +1,36 @@ { - "_from": "process-nextick-args@~1.0.6", + "_args": [ + [ + "process-nextick-args@1.0.7", + "/var/www/backend/minis-data" + ] + ], + "_from": "process-nextick-args@1.0.7", "_id": "process-nextick-args@1.0.7", "_inBundle": false, "_integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", "_location": "/process-nextick-args", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "process-nextick-args@~1.0.6", + "raw": "process-nextick-args@1.0.7", "name": "process-nextick-args", "escapedName": "process-nextick-args", - "rawSpec": "~1.0.6", + "rawSpec": "1.0.7", "saveSpec": null, - "fetchSpec": "~1.0.6" + "fetchSpec": "1.0.7" }, "_requiredBy": [ "/readable-stream" ], "_resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "_shasum": "150e20b756590ad3f91093f25a4f2ad8bff30ba3", - "_spec": "process-nextick-args@~1.0.6", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\readable-stream", + "_spec": "1.0.7", + "_where": "/var/www/backend/minis-data", "author": "", "bugs": { "url": "https://github.com/calvinmetcalf/process-nextick-args/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "process.nextTick but always with args", "devDependencies": { "tap": "~0.2.6" diff --git a/node_modules/process/package.json b/node_modules/process/package.json index 95cdae4..608618f 100644 --- a/node_modules/process/package.json +++ b/node_modules/process/package.json @@ -1,27 +1,32 @@ { - "_from": "process@^0.11.1", + "_args": [ + [ + "process@0.11.10", + "/var/www/backend/minis-data" + ] + ], + "_from": "process@0.11.10", "_id": "process@0.11.10", "_inBundle": false, "_integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", "_location": "/process", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "process@^0.11.1", + "raw": "process@0.11.10", "name": "process", "escapedName": "process", - "rawSpec": "^0.11.1", + "rawSpec": "0.11.10", "saveSpec": null, - "fetchSpec": "^0.11.1" + "fetchSpec": "0.11.10" }, "_requiredBy": [ "/path" ], "_resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "_shasum": "7332300e840161bda3e69a1d1d91a7d4bc16f182", - "_spec": "process@^0.11.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\path", + "_spec": "0.11.10", + "_where": "/var/www/backend/minis-data", "author": { "name": "Roman Shtylman", "email": "shtylman@gmail.com" @@ -30,8 +35,6 @@ "bugs": { "url": "https://github.com/shtylman/node-process/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "process information for node.js and browsers", "devDependencies": { "mocha": "2.2.1", diff --git a/node_modules/proxy-addr/package.json b/node_modules/proxy-addr/package.json index 9254426..6eddcb6 100644 --- a/node_modules/proxy-addr/package.json +++ b/node_modules/proxy-addr/package.json @@ -1,27 +1,32 @@ { - "_from": "proxy-addr@~2.0.2", + "_args": [ + [ + "proxy-addr@2.0.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "proxy-addr@2.0.2", "_id": "proxy-addr@2.0.2", "_inBundle": false, "_integrity": "sha1-ZXFQT0e7mI7IGAJT+F3X4UlSvew=", "_location": "/proxy-addr", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "proxy-addr@~2.0.2", + "raw": "proxy-addr@2.0.2", "name": "proxy-addr", "escapedName": "proxy-addr", - "rawSpec": "~2.0.2", + "rawSpec": "2.0.2", "saveSpec": null, - "fetchSpec": "~2.0.2" + "fetchSpec": "2.0.2" }, "_requiredBy": [ "/express" ], "_resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz", - "_shasum": "6571504f47bb988ec8180253f85dd7e14952bdec", - "_spec": "proxy-addr@~2.0.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "2.0.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,12 +34,10 @@ "bugs": { "url": "https://github.com/jshttp/proxy-addr/issues" }, - "bundleDependencies": false, "dependencies": { "forwarded": "~0.1.2", "ipaddr.js": "1.5.2" }, - "deprecated": false, "description": "Determine address of proxied request", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/qs/package.json b/node_modules/qs/package.json index fc8c9d4..3519a61 100644 --- a/node_modules/qs/package.json +++ b/node_modules/qs/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "qs@6.5.1", + "/var/www/backend/minis-data" + ] + ], "_from": "qs@6.5.1", "_id": "qs@6.5.1", "_inBundle": false, @@ -16,17 +22,15 @@ "fetchSpec": "6.5.1" }, "_requiredBy": [ - "/body-parser", - "/express" + "/express", + "/express/body-parser" ], "_resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "_shasum": "349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8", - "_spec": "qs@6.5.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "6.5.1", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/ljharb/qs/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Jordan Harband", @@ -35,7 +39,6 @@ } ], "dependencies": {}, - "deprecated": false, "description": "A querystring parser that supports nesting and arrays, with a depth limit", "devDependencies": { "@ljharb/eslint-config": "^12.2.1", diff --git a/node_modules/range-parser/package.json b/node_modules/range-parser/package.json index a91115c..178d2e6 100644 --- a/node_modules/range-parser/package.json +++ b/node_modules/range-parser/package.json @@ -1,28 +1,33 @@ { - "_from": "range-parser@~1.2.0", + "_args": [ + [ + "range-parser@1.2.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "range-parser@1.2.0", "_id": "range-parser@1.2.0", "_inBundle": false, "_integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=", "_location": "/range-parser", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "range-parser@~1.2.0", + "raw": "range-parser@1.2.0", "name": "range-parser", "escapedName": "range-parser", - "rawSpec": "~1.2.0", + "rawSpec": "1.2.0", "saveSpec": null, - "fetchSpec": "~1.2.0" + "fetchSpec": "1.2.0" }, "_requiredBy": [ "/express", "/send" ], "_resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "_shasum": "f49be6b487894ddc40dcc94a322f611092e00d5e", - "_spec": "range-parser@~1.2.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.2.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca", @@ -31,7 +36,6 @@ "bugs": { "url": "https://github.com/jshttp/range-parser/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -47,7 +51,6 @@ "url": "http://jongleberry.com" } ], - "deprecated": false, "description": "Range header field string parser", "devDependencies": { "eslint": "2.11.1", diff --git a/node_modules/raw-body/node_modules/depd/package.json b/node_modules/raw-body/node_modules/depd/package.json index 75db9f5..63a968b 100644 --- a/node_modules/raw-body/node_modules/depd/package.json +++ b/node_modules/raw-body/node_modules/depd/package.json @@ -1,27 +1,32 @@ { - "_from": "depd@~1.1.2", + "_args": [ + [ + "depd@1.1.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "depd@1.1.2", "_id": "depd@1.1.2", "_inBundle": false, "_integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", "_location": "/raw-body/depd", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "depd@~1.1.2", + "raw": "depd@1.1.2", "name": "depd", "escapedName": "depd", - "rawSpec": "~1.1.2", + "rawSpec": "1.1.2", "saveSpec": null, - "fetchSpec": "~1.1.2" + "fetchSpec": "1.1.2" }, "_requiredBy": [ "/raw-body/http-errors" ], "_resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "_shasum": "9bcd52e14c097763e749b274c4346ed2e560b5a9", - "_spec": "depd@~1.1.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\raw-body\\node_modules\\http-errors", + "_spec": "1.1.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -30,8 +35,6 @@ "bugs": { "url": "https://github.com/dougwilson/nodejs-depd/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Deprecate all the things", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/raw-body/node_modules/http-errors/package.json b/node_modules/raw-body/node_modules/http-errors/package.json index c5d48c4..ece583c 100644 --- a/node_modules/raw-body/node_modules/http-errors/package.json +++ b/node_modules/raw-body/node_modules/http-errors/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "http-errors@1.6.3", + "/var/www/backend/minis-data" + ] + ], "_from": "http-errors@1.6.3", "_id": "http-errors@1.6.3", "_inBundle": false, @@ -19,9 +25,8 @@ "/raw-body" ], "_resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "_shasum": "8b55680bb4be283a0b5bf4ea2e38580be1d9320d", - "_spec": "http-errors@1.6.3", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\raw-body", + "_spec": "1.6.3", + "_where": "/var/www/backend/minis-data", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/jshttp/http-errors/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Alan Plum", @@ -47,7 +51,6 @@ "setprototypeof": "1.1.0", "statuses": ">= 1.4.0 < 2" }, - "deprecated": false, "description": "Create HTTP error objects", "devDependencies": { "eslint": "4.18.1", diff --git a/node_modules/raw-body/node_modules/statuses/package.json b/node_modules/raw-body/node_modules/statuses/package.json index a692c1e..c62c125 100644 --- a/node_modules/raw-body/node_modules/statuses/package.json +++ b/node_modules/raw-body/node_modules/statuses/package.json @@ -1,31 +1,35 @@ { - "_from": "statuses@>= 1.4.0 < 2", + "_args": [ + [ + "statuses@1.5.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "statuses@1.5.0", "_id": "statuses@1.5.0", "_inBundle": false, "_integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", "_location": "/raw-body/statuses", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "statuses@>= 1.4.0 < 2", + "raw": "statuses@1.5.0", "name": "statuses", "escapedName": "statuses", - "rawSpec": ">= 1.4.0 < 2", + "rawSpec": "1.5.0", "saveSpec": null, - "fetchSpec": ">= 1.4.0 < 2" + "fetchSpec": "1.5.0" }, "_requiredBy": [ "/raw-body/http-errors" ], "_resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "_shasum": "161c7dac177659fd9811f43771fa99381478628c", - "_spec": "statuses@>= 1.4.0 < 2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\raw-body\\node_modules\\http-errors", + "_spec": "1.5.0", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/statuses/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -37,7 +41,6 @@ "url": "http://jongleberry.com" } ], - "deprecated": false, "description": "HTTP status utility", "devDependencies": { "csv-parse": "1.2.4", diff --git a/node_modules/raw-body/package.json b/node_modules/raw-body/package.json index ab155fd..77d835d 100644 --- a/node_modules/raw-body/package.json +++ b/node_modules/raw-body/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "raw-body@2.3.3", + "/var/www/backend/minis-data" + ] + ], "_from": "raw-body@2.3.3", "_id": "raw-body@2.3.3", "_inBundle": false, @@ -22,9 +28,8 @@ "/body-parser" ], "_resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", - "_shasum": "1b324ece6b5706e153855bc1148c65bb7f6ea0c3", - "_spec": "raw-body@2.3.3", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\body-parser", + "_spec": "2.3.3", + "_where": "/var/www/backend/minis-data", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -33,7 +38,6 @@ "bugs": { "url": "https://github.com/stream-utils/raw-body/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -50,7 +54,6 @@ "iconv-lite": "0.4.23", "unpipe": "1.0.0" }, - "deprecated": false, "description": "Get and validate the raw body of a readable stream.", "devDependencies": { "bluebird": "3.5.1", diff --git a/node_modules/readable-stream/package.json b/node_modules/readable-stream/package.json index 047f3ac..35bfb7f 100644 --- a/node_modules/readable-stream/package.json +++ b/node_modules/readable-stream/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "readable-stream@2.3.3", + "/var/www/backend/minis-data" + ] + ], "_from": "readable-stream@2.3.3", "_id": "readable-stream@2.3.3", "_inBundle": false, @@ -19,9 +25,8 @@ "/mysql" ], "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "_shasum": "368f2512d79f9d46fdfc71349ae7878bbc1eb95c", - "_spec": "readable-stream@2.3.3", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\mysql", + "_spec": "2.3.3", + "_where": "/var/www/backend/minis-data", "browser": { "util": false, "./readable.js": "./readable-browser.js", @@ -32,7 +37,6 @@ "bugs": { "url": "https://github.com/nodejs/readable-stream/issues" }, - "bundleDependencies": false, "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -42,7 +46,6 @@ "string_decoder": "~1.0.3", "util-deprecate": "~1.0.1" }, - "deprecated": false, "description": "Streams3, a user-land copy of the stream library from Node.js", "devDependencies": { "assert": "~1.4.0", diff --git a/node_modules/safe-buffer/package.json b/node_modules/safe-buffer/package.json index ab8b805..063f8c0 100644 --- a/node_modules/safe-buffer/package.json +++ b/node_modules/safe-buffer/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "safe-buffer@5.1.1", + "/var/www/backend/minis-data" + ] + ], "_from": "safe-buffer@5.1.1", "_id": "safe-buffer@5.1.1", "_inBundle": false, @@ -16,12 +22,14 @@ "fetchSpec": "5.1.1" }, "_requiredBy": [ - "/express" + "/express", + "/mysql", + "/readable-stream", + "/string_decoder" ], "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "_shasum": "893312af69b2123def71f57889001671eeb2c853", - "_spec": "safe-buffer@5.1.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "5.1.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "Feross Aboukhadijeh", "email": "feross@feross.org", @@ -30,8 +38,6 @@ "bugs": { "url": "https://github.com/feross/safe-buffer/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Safer Node.js Buffer API", "devDependencies": { "standard": "*", diff --git a/node_modules/safer-buffer/package.json b/node_modules/safer-buffer/package.json index fdba6d6..53928fa 100644 --- a/node_modules/safer-buffer/package.json +++ b/node_modules/safer-buffer/package.json @@ -1,27 +1,32 @@ { - "_from": "safer-buffer@>= 2.1.2 < 3", + "_args": [ + [ + "safer-buffer@2.1.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "safer-buffer@2.1.2", "_id": "safer-buffer@2.1.2", "_inBundle": false, "_integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "_location": "/safer-buffer", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "safer-buffer@>= 2.1.2 < 3", + "raw": "safer-buffer@2.1.2", "name": "safer-buffer", "escapedName": "safer-buffer", - "rawSpec": ">= 2.1.2 < 3", + "rawSpec": "2.1.2", "saveSpec": null, - "fetchSpec": ">= 2.1.2 < 3" + "fetchSpec": "2.1.2" }, "_requiredBy": [ "/iconv-lite" ], "_resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "_shasum": "44fa161b0187b9549dd84bb91802f9bd8385cd6a", - "_spec": "safer-buffer@>= 2.1.2 < 3", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\iconv-lite", + "_spec": "2.1.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "Nikita Skovoroda", "email": "chalkerx@gmail.com", @@ -30,8 +35,6 @@ "bugs": { "url": "https://github.com/ChALkeR/safer-buffer/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Modern Buffer API polyfill without footguns", "devDependencies": { "standard": "^11.0.1", diff --git a/node_modules/send/package.json b/node_modules/send/package.json index 3e5942b..f683c53 100644 --- a/node_modules/send/package.json +++ b/node_modules/send/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "send@0.16.1", + "/var/www/backend/minis-data" + ] + ], "_from": "send@0.16.1", "_id": "send@0.16.1", "_inBundle": false, @@ -20,9 +26,8 @@ "/serve-static" ], "_resolved": "https://registry.npmjs.org/send/-/send-0.16.1.tgz", - "_shasum": "a70e1ca21d1382c11d0d9f6231deb281080d7ab3", - "_spec": "send@0.16.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "0.16.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/pillarjs/send/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -60,7 +64,6 @@ "range-parser": "~1.2.0", "statuses": "~1.3.1" }, - "deprecated": false, "description": "Better streaming static file server with Range and conditional-GET support", "devDependencies": { "after": "0.8.2", diff --git a/node_modules/serve-static/package.json b/node_modules/serve-static/package.json index 8ff86ed..4346b32 100644 --- a/node_modules/serve-static/package.json +++ b/node_modules/serve-static/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "serve-static@1.13.1", + "/var/www/backend/minis-data" + ] + ], "_from": "serve-static@1.13.1", "_id": "serve-static@1.13.1", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.1.tgz", - "_shasum": "4c57d53404a761d8f2e7c1e8a18a47dbf278a719", - "_spec": "serve-static@1.13.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.13.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,14 +34,12 @@ "bugs": { "url": "https://github.com/expressjs/serve-static/issues" }, - "bundleDependencies": false, "dependencies": { "encodeurl": "~1.0.1", "escape-html": "~1.0.3", "parseurl": "~1.3.2", "send": "0.16.1" }, - "deprecated": false, "description": "Serve static files", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/setprototypeof/package.json b/node_modules/setprototypeof/package.json index 807592a..71dafaa 100644 --- a/node_modules/setprototypeof/package.json +++ b/node_modules/setprototypeof/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "setprototypeof@1.1.0", + "/var/www/backend/minis-data" + ] + ], "_from": "setprototypeof@1.1.0", "_id": "setprototypeof@1.1.0", "_inBundle": false, @@ -16,20 +22,19 @@ "fetchSpec": "1.1.0" }, "_requiredBy": [ - "/express" + "/body-parser/http-errors", + "/express", + "/raw-body/http-errors" ], "_resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "_shasum": "d0bd85536887b6fe7c0d818cb962d9d91c54e656", - "_spec": "setprototypeof@1.1.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.1.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "Wes Todd" }, "bugs": { "url": "https://github.com/wesleytodd/setprototypeof/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "A small polyfill for Object.setprototypeof", "homepage": "https://github.com/wesleytodd/setprototypeof", "keywords": [ diff --git a/node_modules/sqlstring/package.json b/node_modules/sqlstring/package.json index bdcc494..e298914 100644 --- a/node_modules/sqlstring/package.json +++ b/node_modules/sqlstring/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "sqlstring@2.3.0", + "/var/www/backend/minis-data" + ] + ], "_from": "sqlstring@2.3.0", "_id": "sqlstring@2.3.0", "_inBundle": false, @@ -19,13 +25,11 @@ "/mysql" ], "_resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.0.tgz", - "_shasum": "525b8a4fd26d6f71aa61e822a6caf976d31ad2a8", - "_spec": "sqlstring@2.3.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\mysql", + "_spec": "2.3.0", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/mysqljs/sqlstring/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Adri Van Houdt", @@ -53,7 +57,6 @@ "email": "seregpie@gmail.com" } ], - "deprecated": false, "description": "Simple SQL escape and format for MySQL", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/statuses/package.json b/node_modules/statuses/package.json index 2cb65ed..51a998a 100644 --- a/node_modules/statuses/package.json +++ b/node_modules/statuses/package.json @@ -1,19 +1,25 @@ { - "_from": "statuses@~1.3.1", + "_args": [ + [ + "statuses@1.3.1", + "/var/www/backend/minis-data" + ] + ], + "_from": "statuses@1.3.1", "_id": "statuses@1.3.1", "_inBundle": false, "_integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", "_location": "/statuses", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "statuses@~1.3.1", + "raw": "statuses@1.3.1", "name": "statuses", "escapedName": "statuses", - "rawSpec": "~1.3.1", + "rawSpec": "1.3.1", "saveSpec": null, - "fetchSpec": "~1.3.1" + "fetchSpec": "1.3.1" }, "_requiredBy": [ "/express", @@ -22,13 +28,11 @@ "/send" ], "_resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", - "_shasum": "faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e", - "_spec": "statuses@~1.3.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.3.1", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/statuses/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -40,7 +44,6 @@ "url": "http://jongleberry.com" } ], - "deprecated": false, "description": "HTTP status utility", "devDependencies": { "csv-parse": "1.1.7", diff --git a/node_modules/string_decoder/package.json b/node_modules/string_decoder/package.json index 4e0f5e4..ad03584 100644 --- a/node_modules/string_decoder/package.json +++ b/node_modules/string_decoder/package.json @@ -1,35 +1,38 @@ { - "_from": "string_decoder@~1.0.3", + "_args": [ + [ + "string_decoder@1.0.3", + "/var/www/backend/minis-data" + ] + ], + "_from": "string_decoder@1.0.3", "_id": "string_decoder@1.0.3", "_inBundle": false, "_integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "_location": "/string_decoder", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "string_decoder@~1.0.3", + "raw": "string_decoder@1.0.3", "name": "string_decoder", "escapedName": "string_decoder", - "rawSpec": "~1.0.3", + "rawSpec": "1.0.3", "saveSpec": null, - "fetchSpec": "~1.0.3" + "fetchSpec": "1.0.3" }, "_requiredBy": [ "/readable-stream" ], "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "_shasum": "0fc67d7c141825de94282dd536bec6b9bce860ab", - "_spec": "string_decoder@~1.0.3", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\readable-stream", + "_spec": "1.0.3", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/rvagg/string_decoder/issues" }, - "bundleDependencies": false, "dependencies": { "safe-buffer": "~5.1.0" }, - "deprecated": false, "description": "The string_decoder module from Node core", "devDependencies": { "babel-polyfill": "^6.23.0", diff --git a/node_modules/type-is/package.json b/node_modules/type-is/package.json index 9ab31d9..8e9b1b5 100644 --- a/node_modules/type-is/package.json +++ b/node_modules/type-is/package.json @@ -1,32 +1,36 @@ { - "_from": "type-is@~1.6.15", + "_args": [ + [ + "type-is@1.6.15", + "/var/www/backend/minis-data" + ] + ], + "_from": "type-is@1.6.15", "_id": "type-is@1.6.15", "_inBundle": false, "_integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", "_location": "/type-is", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "type-is@~1.6.15", + "raw": "type-is@1.6.15", "name": "type-is", "escapedName": "type-is", - "rawSpec": "~1.6.15", + "rawSpec": "1.6.15", "saveSpec": null, - "fetchSpec": "~1.6.15" + "fetchSpec": "1.6.15" }, "_requiredBy": [ - "/body-parser", - "/express" + "/express", + "/express/body-parser" ], "_resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", - "_shasum": "cab10fb4909e441c82842eafe1ad646c81804410", - "_spec": "type-is@~1.6.15", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.6.15", + "_where": "/var/www/backend/minis-data", "bugs": { "url": "https://github.com/jshttp/type-is/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -42,7 +46,6 @@ "media-typer": "0.3.0", "mime-types": "~2.1.15" }, - "deprecated": false, "description": "Infer the content-type of a request.", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/underscore/package.json b/node_modules/underscore/package.json index 9d4bdfa..be5addb 100644 --- a/node_modules/underscore/package.json +++ b/node_modules/underscore/package.json @@ -1,28 +1,32 @@ { - "_from": "underscore", + "_args": [ + [ + "underscore@1.9.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "underscore@1.9.0", "_id": "underscore@1.9.0", "_inBundle": false, "_integrity": "sha512-4IV1DSSxC1QK48j9ONFK1MoIAKKkbE8i7u55w2R6IqBqbT7A/iG7aZBCR2Bi8piF0Uz+i/MG1aeqLwl/5vqF+A==", "_location": "/underscore", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "underscore", + "raw": "underscore@1.9.0", "name": "underscore", "escapedName": "underscore", - "rawSpec": "", + "rawSpec": "1.9.0", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "1.9.0" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.0.tgz", - "_shasum": "31dbb314cfcc88f169cd3692d9149d81a00a73e4", - "_spec": "underscore", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI", + "_spec": "1.9.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "Jeremy Ashkenas", "email": "jeremy@documentcloud.org" @@ -30,8 +34,6 @@ "bugs": { "url": "https://github.com/jashkenas/underscore/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "JavaScript's functional programming helper library.", "devDependencies": { "coveralls": "^2.11.2", diff --git a/node_modules/unpipe/package.json b/node_modules/unpipe/package.json index 5b02844..b85ac04 100644 --- a/node_modules/unpipe/package.json +++ b/node_modules/unpipe/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "unpipe@1.0.0", + "/var/www/backend/minis-data" + ] + ], "_from": "unpipe@1.0.0", "_id": "unpipe@1.0.0", "_inBundle": false, @@ -16,13 +22,13 @@ "fetchSpec": "1.0.0" }, "_requiredBy": [ + "/express/raw-body", "/finalhandler", "/raw-body" ], "_resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "_shasum": "b2bf4ee8514aae6165b4817829d21b2ef49904ec", - "_spec": "unpipe@1.0.0", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\raw-body", + "_spec": "1.0.0", + "_where": "/var/www/backend/minis-data", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -30,8 +36,6 @@ "bugs": { "url": "https://github.com/stream-utils/unpipe/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Unpipe a stream from all destinations", "devDependencies": { "istanbul": "0.3.15", diff --git a/node_modules/util-deprecate/package.json b/node_modules/util-deprecate/package.json index 4524215..96c278d 100644 --- a/node_modules/util-deprecate/package.json +++ b/node_modules/util-deprecate/package.json @@ -1,27 +1,32 @@ { - "_from": "util-deprecate@~1.0.1", + "_args": [ + [ + "util-deprecate@1.0.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "util-deprecate@1.0.2", "_id": "util-deprecate@1.0.2", "_inBundle": false, "_integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "_location": "/util-deprecate", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "util-deprecate@~1.0.1", + "raw": "util-deprecate@1.0.2", "name": "util-deprecate", "escapedName": "util-deprecate", - "rawSpec": "~1.0.1", + "rawSpec": "1.0.2", "saveSpec": null, - "fetchSpec": "~1.0.1" + "fetchSpec": "1.0.2" }, "_requiredBy": [ "/readable-stream" ], "_resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "_shasum": "450d4dc9fa70de732762fbd2d4a28981419a0ccf", - "_spec": "util-deprecate@~1.0.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\readable-stream", + "_spec": "1.0.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "Nathan Rajlich", "email": "nathan@tootallnate.net", @@ -31,8 +36,6 @@ "bugs": { "url": "https://github.com/TooTallNate/util-deprecate/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "The Node.js `util.deprecate()` function with browser support", "homepage": "https://github.com/TooTallNate/util-deprecate", "keywords": [ diff --git a/node_modules/util/node_modules/inherits/package.json b/node_modules/util/node_modules/inherits/package.json index e14e102..9ebbedb 100644 --- a/node_modules/util/node_modules/inherits/package.json +++ b/node_modules/util/node_modules/inherits/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "inherits@2.0.1", + "/var/www/backend/minis-data" + ] + ], "_from": "inherits@2.0.1", "_id": "inherits@2.0.1", "_inBundle": false, @@ -19,15 +25,12 @@ "/util" ], "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", - "_spec": "inherits@2.0.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\util", + "_spec": "2.0.1", + "_where": "/var/www/backend/minis-data", "browser": "./inherits_browser.js", "bugs": { "url": "https://github.com/isaacs/inherits/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", "homepage": "https://github.com/isaacs/inherits#readme", "keywords": [ diff --git a/node_modules/util/package.json b/node_modules/util/package.json index 0280c2d..496d5da 100644 --- a/node_modules/util/package.json +++ b/node_modules/util/package.json @@ -1,27 +1,32 @@ { - "_from": "util@^0.10.3", + "_args": [ + [ + "util@0.10.3", + "/var/www/backend/minis-data" + ] + ], + "_from": "util@0.10.3", "_id": "util@0.10.3", "_inBundle": false, "_integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "_location": "/util", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "util@^0.10.3", + "raw": "util@0.10.3", "name": "util", "escapedName": "util", - "rawSpec": "^0.10.3", + "rawSpec": "0.10.3", "saveSpec": null, - "fetchSpec": "^0.10.3" + "fetchSpec": "0.10.3" }, "_requiredBy": [ "/path" ], "_resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "_shasum": "7afb1afe50805246489e3db7fe0ed379336ac0f9", - "_spec": "util@^0.10.3", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\path", + "_spec": "0.10.3", + "_where": "/var/www/backend/minis-data", "author": { "name": "Joyent", "url": "http://www.joyent.com" @@ -32,11 +37,9 @@ "bugs": { "url": "https://github.com/defunctzombie/node-util/issues" }, - "bundleDependencies": false, "dependencies": { "inherits": "2.0.1" }, - "deprecated": false, "description": "Node.JS util module", "devDependencies": { "zuul": "~1.0.9" diff --git a/node_modules/utils-merge/package.json b/node_modules/utils-merge/package.json index da6308a..23a9fe5 100644 --- a/node_modules/utils-merge/package.json +++ b/node_modules/utils-merge/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "utils-merge@1.0.1", + "/var/www/backend/minis-data" + ] + ], "_from": "utils-merge@1.0.1", "_id": "utils-merge@1.0.1", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "_shasum": "9f95710f50a267947b2ccc124741c1028427e713", - "_spec": "utils-merge@1.0.1", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.0.1", + "_where": "/var/www/backend/minis-data", "author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", @@ -30,9 +35,7 @@ "bugs": { "url": "http://github.com/jaredhanson/utils-merge/issues" }, - "bundleDependencies": false, "dependencies": {}, - "deprecated": false, "description": "merge() utility function", "devDependencies": { "chai": "1.x.x", diff --git a/node_modules/uuid/bin/uuid b/node_modules/uuid/bin/uuid old mode 100644 new mode 100755 diff --git a/node_modules/uuid/package.json b/node_modules/uuid/package.json index 47ea692..7484340 100644 --- a/node_modules/uuid/package.json +++ b/node_modules/uuid/package.json @@ -1,28 +1,32 @@ { - "_from": "uuid", + "_args": [ + [ + "uuid@3.1.0", + "/var/www/backend/minis-data" + ] + ], + "_from": "uuid@3.1.0", "_id": "uuid@3.1.0", "_inBundle": false, "_integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==", "_location": "/uuid", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "uuid", + "raw": "uuid@3.1.0", "name": "uuid", "escapedName": "uuid", - "rawSpec": "", + "rawSpec": "3.1.0", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "3.1.0" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "_shasum": "3dd3d3e790abc24d7b0d3a034ffababe28ebbc04", - "_spec": "uuid", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI", + "_spec": "3.1.0", + "_where": "/var/www/backend/minis-data", "bin": { "uuid": "./bin/uuid" }, @@ -33,7 +37,6 @@ "bugs": { "url": "https://github.com/kelektiv/node-uuid/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Robert Kieffer", @@ -56,7 +59,6 @@ "email": "shtylman@gmail.com" } ], - "deprecated": false, "description": "RFC4122 (v1, v4, and v5) UUIDs", "devDependencies": { "mocha": "3.1.2" diff --git a/node_modules/vary/package.json b/node_modules/vary/package.json index 832b948..bb62300 100644 --- a/node_modules/vary/package.json +++ b/node_modules/vary/package.json @@ -1,27 +1,33 @@ { - "_from": "vary@~1.1.2", + "_args": [ + [ + "vary@1.1.2", + "/var/www/backend/minis-data" + ] + ], + "_from": "vary@1.1.2", "_id": "vary@1.1.2", "_inBundle": false, "_integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", "_location": "/vary", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "vary@~1.1.2", + "raw": "vary@1.1.2", "name": "vary", "escapedName": "vary", - "rawSpec": "~1.1.2", + "rawSpec": "1.1.2", "saveSpec": null, - "fetchSpec": "~1.1.2" + "fetchSpec": "1.1.2" }, "_requiredBy": [ + "/cors", "/express" ], "_resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "_shasum": "2299f02c6ded30d4a5961b0b9f74524a18f634fc", - "_spec": "vary@~1.1.2", - "_where": "C:\\Users\\jonio\\Documents\\Programmieren\\Miniportal\\Neu\\MiniportalAPI\\node_modules\\express", + "_spec": "1.1.2", + "_where": "/var/www/backend/minis-data", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,8 +35,6 @@ "bugs": { "url": "https://github.com/jshttp/vary/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Manipulate the HTTP Vary header", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/package-lock.json b/package-lock.json index 0ed56b8..d25244b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", "requires": { - "mime-types": "2.1.17", + "mime-types": "~2.1.16", "negotiator": "0.6.1" } }, @@ -29,15 +29,15 @@ "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", "requires": { "bytes": "3.0.0", - "content-type": "1.0.4", + "content-type": "~1.0.4", "debug": "2.6.9", - "depd": "1.1.2", - "http-errors": "1.6.3", + "depd": "~1.1.2", + "http-errors": "~1.6.3", "iconv-lite": "0.4.23", - "on-finished": "2.3.0", + "on-finished": "~2.3.0", "qs": "6.5.2", "raw-body": "2.3.3", - "type-is": "1.6.16" + "type-is": "~1.6.16" }, "dependencies": { "depd": { @@ -50,10 +50,10 @@ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "requires": { - "depd": "1.1.2", + "depd": "~1.1.2", "inherits": "2.0.3", "setprototypeof": "1.1.0", - "statuses": "1.5.0" + "statuses": ">= 1.4.0 < 2" } }, "mime-db": { @@ -66,7 +66,7 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", "requires": { - "mime-db": "1.35.0" + "mime-db": "~1.35.0" } }, "qs": { @@ -85,7 +85,7 @@ "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", "requires": { "media-typer": "0.3.0", - "mime-types": "2.1.19" + "mime-types": "~2.1.18" } } } @@ -134,8 +134,8 @@ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", "requires": { - "object-assign": "4.1.1", - "vary": "1.1.2" + "object-assign": "^4", + "vary": "^1" } }, "debug": { @@ -171,8 +171,8 @@ "resolved": "https://registry.npmjs.org/errorhandler/-/errorhandler-1.5.0.tgz", "integrity": "sha1-6rpkyl1UKjEayUX1gt78M2Fl2fQ=", "requires": { - "accepts": "1.3.4", - "escape-html": "1.0.3" + "accepts": "~1.3.3", + "escape-html": "~1.0.3" } }, "escape-html": { @@ -190,36 +190,36 @@ "resolved": "https://registry.npmjs.org/express/-/express-4.16.1.tgz", "integrity": "sha512-STB7LZ4N0L+81FJHGla2oboUHTk4PaN1RsOkoRh9OSeEKylvF5hwKYVX1xCLFaCT7MD0BNG/gX2WFMLqY6EMBw==", "requires": { - "accepts": "1.3.4", + "accepts": "~1.3.4", "array-flatten": "1.1.1", "body-parser": "1.18.2", "content-disposition": "0.5.2", - "content-type": "1.0.4", + "content-type": "~1.0.4", "cookie": "0.3.1", "cookie-signature": "1.0.6", "debug": "2.6.9", - "depd": "1.1.1", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "etag": "1.8.1", + "depd": "~1.1.1", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "etag": "~1.8.1", "finalhandler": "1.1.0", "fresh": "0.5.2", "merge-descriptors": "1.0.1", - "methods": "1.1.2", - "on-finished": "2.3.0", - "parseurl": "1.3.2", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", "path-to-regexp": "0.1.7", - "proxy-addr": "2.0.2", + "proxy-addr": "~2.0.2", "qs": "6.5.1", - "range-parser": "1.2.0", + "range-parser": "~1.2.0", "safe-buffer": "5.1.1", "send": "0.16.1", "serve-static": "1.13.1", "setprototypeof": "1.1.0", - "statuses": "1.3.1", - "type-is": "1.6.15", + "statuses": "~1.3.1", + "type-is": "~1.6.15", "utils-merge": "1.0.1", - "vary": "1.1.2" + "vary": "~1.1.2" }, "dependencies": { "body-parser": { @@ -228,15 +228,15 @@ "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", "requires": { "bytes": "3.0.0", - "content-type": "1.0.4", + "content-type": "~1.0.4", "debug": "2.6.9", - "depd": "1.1.1", - "http-errors": "1.6.2", + "depd": "~1.1.1", + "http-errors": "~1.6.2", "iconv-lite": "0.4.19", - "on-finished": "2.3.0", + "on-finished": "~2.3.0", "qs": "6.5.1", "raw-body": "2.3.2", - "type-is": "1.6.15" + "type-is": "~1.6.15" } }, "iconv-lite": { @@ -262,7 +262,7 @@ "resolved": "https://registry.npmjs.org/express-force-ssl/-/express-force-ssl-0.3.2.tgz", "integrity": "sha1-AbK0mK5v0uQRUrIrV6Phc3c69n4=", "requires": { - "lodash.assign": "3.2.0" + "lodash.assign": "^3.2.0" } }, "finalhandler": { @@ -271,12 +271,12 @@ "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", "requires": { "debug": "2.6.9", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "statuses": "1.3.1", - "unpipe": "1.0.0" + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", + "unpipe": "~1.0.0" } }, "forwarded": { @@ -302,7 +302,7 @@ "depd": "1.1.1", "inherits": "2.0.3", "setprototypeof": "1.0.3", - "statuses": "1.3.1" + "statuses": ">= 1.3.1 < 2" }, "dependencies": { "setprototypeof": { @@ -317,7 +317,7 @@ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": ">= 2.1.2 < 3" } }, "inherits": { @@ -340,8 +340,8 @@ "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", "requires": { - "lodash._basecopy": "3.0.1", - "lodash.keys": "3.1.2" + "lodash._basecopy": "^3.0.0", + "lodash.keys": "^3.0.0" } }, "lodash._basecopy": { @@ -359,9 +359,9 @@ "resolved": "https://registry.npmjs.org/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz", "integrity": "sha1-g4pbri/aymOsIt7o4Z+k5taXCxE=", "requires": { - "lodash._bindcallback": "3.0.1", - "lodash._isiterateecall": "3.0.9", - "lodash.restparam": "3.6.1" + "lodash._bindcallback": "^3.0.0", + "lodash._isiterateecall": "^3.0.0", + "lodash.restparam": "^3.0.0" } }, "lodash._getnative": { @@ -379,9 +379,9 @@ "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-3.2.0.tgz", "integrity": "sha1-POnwI0tLIiPilrj6CsH+6OvKZPo=", "requires": { - "lodash._baseassign": "3.2.0", - "lodash._createassigner": "3.1.1", - "lodash.keys": "3.1.2" + "lodash._baseassign": "^3.0.0", + "lodash._createassigner": "^3.0.0", + "lodash.keys": "^3.0.0" } }, "lodash.isarguments": { @@ -399,9 +399,9 @@ "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "requires": { - "lodash._getnative": "3.9.1", - "lodash.isarguments": "3.1.0", - "lodash.isarray": "3.0.4" + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" } }, "lodash.restparam": { @@ -439,7 +439,7 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", "requires": { - "mime-db": "1.30.0" + "mime-db": "~1.30.0" } }, "ms": { @@ -486,8 +486,8 @@ "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", "requires": { - "process": "0.11.10", - "util": "0.10.3" + "process": "^0.11.1", + "util": "^0.10.3" } }, "path-to-regexp": { @@ -510,7 +510,7 @@ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz", "integrity": "sha1-ZXFQT0e7mI7IGAJT+F3X4UlSvew=", "requires": { - "forwarded": "0.1.2", + "forwarded": "~0.1.2", "ipaddr.js": "1.5.2" } }, @@ -545,10 +545,10 @@ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "requires": { - "depd": "1.1.2", + "depd": "~1.1.2", "inherits": "2.0.3", "setprototypeof": "1.1.0", - "statuses": "1.5.0" + "statuses": ">= 1.4.0 < 2" } }, "statuses": { @@ -563,13 +563,13 @@ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "safe-buffer": { @@ -588,18 +588,18 @@ "integrity": "sha512-ElCLJdJIKPk6ux/Hocwhk7NFHpI3pVm/IZOYWqUmoxcgeyM+MpxHHKhb8QmlJDX1pU6WrgaHBkVNm73Sv7uc2A==", "requires": { "debug": "2.6.9", - "depd": "1.1.1", - "destroy": "1.0.4", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "etag": "1.8.1", + "depd": "~1.1.1", + "destroy": "~1.0.4", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "1.6.2", + "http-errors": "~1.6.2", "mime": "1.4.1", "ms": "2.0.0", - "on-finished": "2.3.0", - "range-parser": "1.2.0", - "statuses": "1.3.1" + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.3.1" } }, "serve-static": { @@ -607,9 +607,9 @@ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.1.tgz", "integrity": "sha512-hSMUZrsPa/I09VYFJwa627JJkNs0NrfL1Uzuup+GqHfToR2KcsXFymXSV90hoyw3M+msjFuQly+YzIH/q0MGlQ==", "requires": { - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "parseurl": "1.3.2", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", "send": "0.16.1" } }, @@ -633,7 +633,7 @@ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, "type-is": { @@ -642,7 +642,7 @@ "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", "requires": { "media-typer": "0.3.0", - "mime-types": "2.1.17" + "mime-types": "~2.1.15" } }, "underscore": { diff --git a/server.sh b/server.sh new file mode 100755 index 0000000..0fddb43 --- /dev/null +++ b/server.sh @@ -0,0 +1 @@ +node app.js diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..1837cd2 --- /dev/null +++ b/start.sh @@ -0,0 +1,4 @@ +while true +do + ./server.sh +done