Firebase Update

This commit is contained in:
Lukas Nowy
2018-12-22 23:30:39 +01:00
parent befb44764d
commit acffe619b3
11523 changed files with 1614327 additions and 930246 deletions

124
express-server/node_modules/is/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,124 @@
3.3.0 / 2018-12-14
==================
* [New] add `is.bigint` (#36)
* [Docs] change jsdoc comments "Mixed" to wildcards (#34)
* [Tests] up to `node` `v11.4`, `v10.14`, `v9.11`, `v8.14`, `v7.10`, `v6.15`, `v4.9`; use `nvm install-latest-npm`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape`
3.2.1 / 2017-02-27
==================
* [Fix] `is.fn`: recognize generator and async functions too (#28)
* [Tests] up to `node` `v7.5`, `v4.7`; improve test matrix
* [Dev Deps] update `@ljharb/eslint-config`, `eslint`, `tape`
* [Docs] improve readme formatting (#27)
3.2.0 / 2016-10-24
==================
* [Fix] fix infinite loop when comparing two empty arrays + fix skipping first element (#24, #25)
* [New] add `is.primitive`
* [New] Add `is.date.valid` function and tests (#19)
* [Tests] use `pretest` for `npm run lint`; add `npm run tests-only`
* [Tests] up to `node` `v4.6`, `v5.12`, `v6.9`; improve test matrix
* [Tests] fix description (#18)
* [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config`
3.1.0 / 2015-09-20
==================
* [Enhancement]: `is.array`: Prefer `Array.isArray` when present
* [Fix] Deprecate `is.boolean`/`is.int` (ES3 syntax errors)
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
* [Refactor] Don't use yoda conditions
* [Refactor] `is.equal` can return earlier in some cases (#16)
* [Tests] Quote "throws" (ES3 syntax error)
* [Tests] up to `io.js` `v3.3`, up to `node` `v4.1`
* [Dev Deps] add `npm run eslint`
* [Dev Deps] update `tape`, `covert`, `jscs`
3.0.1 / 2015-02-22
==================
* Version bump to resolve npm bug with v3.0.0
3.0.0 / 2015-02-21
==================
* is.empty should return true for falsy values ([#13](https://github.com/enricomarino/is/issues/13), [#14](https://github.com/enricomarino/is/issues/14))
* All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`.
* Test on `iojs` `v1.2` and `v1.3`, `node` `v0.12`; speed up builds; allow failures on all but two latest minor versions.
* Update `jscs`
2.2.1 / 2015-02-06
==================
* Update `tape`, `jscs`
* `toString` breaks in some browsers; using `toStr` instead.
2.2.0 / 2014-11-29
==================
* Update `tape`, `jscs`
* Add `is.symbol`
2.1.0 / 2014-10-21
==================
* Add `CHANGELOG.md`
* Add `is.hex` and `is.base64` [#12](https://github.com/enricomarino/is/issues/12)
* Update `tape`, `jscs`
* Lock `covert` to v1.0.0 [substack/covert#9](https://github.com/substack/covert/issues/9)
2.0.2 / 2014-10-05
==================
* `undefined` can be redefined in ES3 browsers.
* Update `jscs.json` and make style consistent
* Update `foreach`, `jscs`, `tape`
* Naming URLs in README
2.0.1 / 2014-09-02
==================
* Add the license to package.json
* Add license and downloads badges
* Update `jscs`
2.0.0 / 2014-08-25
==================
* Add `make release`
* Update copyright notice.
* Fix is.empty(new String())
1.1.0 / 2014-08-22
==================
* Removing redundant license
* Add a non-deprecated method for is.null
* Use a more reliable valueOf coercion for is.false/is.true
* Clean up `README.md`
* Running `npm run lint` as part of tests.
* Fixing lint errors.
* Adding `npm run lint`
* Updating `covert`
1.0.0 / 2014-08-07
==================
* Update `tape`, `covert`
* Increase code coverage
* Update `LICENSE.md`, `README.md`
0.3.0 / 2014-03-02
==================
* Update `tape`, `covert`
* Adding `npm run coverage`
* is.arguments -> is.args, because reserved words.
* "undefined" is a reserved word in ES3 browsers.
* Optimizing is.equal to return early if value and other are strictly equal.
* Fixing is.equal for objects.
* Test improvements
0.2.7 / 2013-12-26
==================
* Update `tape`, `foreach`
* is.decimal(Infinity) shouldn't be true [#11](https://github.com/enricomarino/is/issues/11)
0.2.6 / 2013-05-06
==================
* Fix lots of tests [#9](https://github.com/enricomarino/is/issues/9)
* Update tape [#8](https://github.com/enricomarino/is/issues/8)
0.2.5 / 2013-04-24
==================
* Use `tap` instead of `tape` [#7](https://github.com/enricomarino/is/issues/7)

23
express-server/node_modules/is/LICENSE.md generated vendored Normal file
View File

@ -0,0 +1,23 @@
(The MIT License)
Copyright (c) 2013 Enrico Marino
Copyright (c) 2014 Enrico Marino and Jordan Harband
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.

17
express-server/node_modules/is/Makefile generated vendored Normal file
View File

@ -0,0 +1,17 @@
.PHONY: verify-tag release
default: release
verify-tag:
ifndef TAG
$(error TAG is undefined)
endif
release: verify-tag
@ OLD_TAG=`git describe --abbrev=0 --tags` && \
npm run minify && \
replace "$${OLD_TAG/v/}" "$(TAG)" -- *.json README.md && \
git commit -m "v$(TAG)" *.js *.json README.md && \
git tag "v$(TAG)"

142
express-server/node_modules/is/README.md generated vendored Normal file
View File

@ -0,0 +1,142 @@
# is <sup>[![Version Badge][npm-version-svg]][npm-url]</sup>
[![Build Status][travis-svg]][travis-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][npm-url]
[![browser support][testling-png]][testling-url]
The definitive JavaScript type testing library
To be or not to be? This is the library!
## Installation
As a node.js module
```shell
$ npm install is
```
As a component
```shell
$ component install enricomarino/is
```
## API
### general
- ``is.a`` (value, type) or ``is.type`` (value, type)
- ``is.defined`` (value)
- ``is.empty`` (value)
- ``is.equal`` (value, other)
- ``is.hosted`` (value, host)
- ``is.instance`` (value, constructor)
- ``is.instanceof`` (value, constructor) - deprecated, because in ES3 browsers, "instanceof" is a reserved word
- ``is.nil`` (value)
- ``is.null`` (value) - deprecated, because in ES3 browsers, "null" is a reserved word
- ``is.undef`` (value)
- ``is.undefined`` (value) - deprecated, because in ES3 browsers, "undefined" is a reserved word
### arguments
- ``is.args`` (value)
- ``is.arguments`` (value) - deprecated, because "arguments" is a reserved word
- ``is.args.empty`` (value)
### array
- ``is.array`` (value)
- ``is.array.empty`` (value)
- ``is.arraylike`` (value)
### boolean
- ``is.bool`` (value)
- ``is.boolean`` (value) - deprecated, because in ES3 browsers, "boolean" is a reserved word
- ``is.false`` (value) - deprecated, because in ES3 browsers, "false" is a reserved word
- ``is.true`` (value) - deprecated, because in ES3 browsers, "true" is a reserved word
### date
- ``is.date`` (value)
### element
- ``is.element`` (value)
### error
- ``is.error`` (value)
### function
- ``is.fn`` (value)
- ``is.function`` (value) - deprecated, because in ES3 browsers, "function" is a reserved word
### number
- ``is.number`` (value)
- ``is.infinite`` (value)
- ``is.decimal`` (value)
- ``is.divisibleBy`` (value, n)
- ``is.integer`` (value)
- ``is.int`` (value) - deprecated, because in ES3 browsers, "int" is a reserved word
- ``is.maximum`` (value, others)
- ``is.minimum`` (value, others)
- ``is.nan`` (value)
- ``is.even`` (value)
- ``is.odd`` (value)
- ``is.ge`` (value, other)
- ``is.gt`` (value, other)
- ``is.le`` (value, other)
- ``is.lt`` (value, other)
- ``is.within`` (value, start, finish)
### object
- ``is.object`` (value)
### regexp
- ``is.regexp`` (value)
### string
- ``is.string`` (value)
### encoded binary
- ``is.base64`` (value)
- ``is.hex`` (value)
### Symbols
- ``is.symbol`` (value)
### BigInts
- ``is.bigint`` (value)
## Contributors
- [Jordan Harband](https://github.com/ljharb)
[npm-url]: https://npmjs.org/package/is
[npm-version-svg]: http://versionbadg.es/enricomarino/is.svg
[travis-svg]: https://travis-ci.org/enricomarino/is.svg
[travis-url]: https://travis-ci.org/enricomarino/is
[deps-svg]: https://david-dm.org/enricomarino/is.svg
[deps-url]: https://david-dm.org/enricomarino/is
[dev-deps-svg]: https://david-dm.org/enricomarino/is/dev-status.svg
[dev-deps-url]: https://david-dm.org/enricomarino/is#info=devDependencies
[testling-png]: https://ci.testling.com/enricomarino/is.png
[testling-url]: https://ci.testling.com/enricomarino/is
[npm-badge-png]: https://nodei.co/npm/is.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/is.svg
[license-url]: LICENSE.md
[downloads-image]: http://img.shields.io/npm/dm/is.svg
[downloads-url]: http://npm-stat.com/charts.html?package=is

8
express-server/node_modules/is/component.json generated vendored Normal file
View File

@ -0,0 +1,8 @@
{
"name": "is",
"repo": "enricomarino/is",
"description": "The definitive type testing library",
"version": "2.2.0",
"dependencies": {},
"scripts": ["index.js"]
}

818
express-server/node_modules/is/index.js generated vendored Normal file
View File

@ -0,0 +1,818 @@
/* globals window, HTMLElement */
'use strict';
/**!
* is
* the definitive JavaScript type testing library
*
* @copyright 2013-2014 Enrico Marino / Jordan Harband
* @license MIT
*/
var objProto = Object.prototype;
var owns = objProto.hasOwnProperty;
var toStr = objProto.toString;
var symbolValueOf;
if (typeof Symbol === 'function') {
symbolValueOf = Symbol.prototype.valueOf;
}
var bigIntValueOf;
if (typeof BigInt === 'function') {
bigIntValueOf = BigInt.prototype.valueOf;
}
var isActualNaN = function (value) {
return value !== value;
};
var NON_HOST_TYPES = {
'boolean': 1,
number: 1,
string: 1,
undefined: 1
};
var base64Regex = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/;
var hexRegex = /^[A-Fa-f0-9]+$/;
/**
* Expose `is`
*/
var is = {};
/**
* Test general.
*/
/**
* is.type
* Test if `value` is a type of `type`.
*
* @param {*} value value to test
* @param {String} type type
* @return {Boolean} true if `value` is a type of `type`, false otherwise
* @api public
*/
is.a = is.type = function (value, type) {
return typeof value === type;
};
/**
* is.defined
* Test if `value` is defined.
*
* @param {*} value value to test
* @return {Boolean} true if 'value' is defined, false otherwise
* @api public
*/
is.defined = function (value) {
return typeof value !== 'undefined';
};
/**
* is.empty
* Test if `value` is empty.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is empty, false otherwise
* @api public
*/
is.empty = function (value) {
var type = toStr.call(value);
var key;
if (type === '[object Array]' || type === '[object Arguments]' || type === '[object String]') {
return value.length === 0;
}
if (type === '[object Object]') {
for (key in value) {
if (owns.call(value, key)) {
return false;
}
}
return true;
}
return !value;
};
/**
* is.equal
* Test if `value` is equal to `other`.
*
* @param {*} value value to test
* @param {*} other value to compare with
* @return {Boolean} true if `value` is equal to `other`, false otherwise
*/
is.equal = function equal(value, other) {
if (value === other) {
return true;
}
var type = toStr.call(value);
var key;
if (type !== toStr.call(other)) {
return false;
}
if (type === '[object Object]') {
for (key in value) {
if (!is.equal(value[key], other[key]) || !(key in other)) {
return false;
}
}
for (key in other) {
if (!is.equal(value[key], other[key]) || !(key in value)) {
return false;
}
}
return true;
}
if (type === '[object Array]') {
key = value.length;
if (key !== other.length) {
return false;
}
while (key--) {
if (!is.equal(value[key], other[key])) {
return false;
}
}
return true;
}
if (type === '[object Function]') {
return value.prototype === other.prototype;
}
if (type === '[object Date]') {
return value.getTime() === other.getTime();
}
return false;
};
/**
* is.hosted
* Test if `value` is hosted by `host`.
*
* @param {*} value to test
* @param {*} host host to test with
* @return {Boolean} true if `value` is hosted by `host`, false otherwise
* @api public
*/
is.hosted = function (value, host) {
var type = typeof host[value];
return type === 'object' ? !!host[value] : !NON_HOST_TYPES[type];
};
/**
* is.instance
* Test if `value` is an instance of `constructor`.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is an instance of `constructor`
* @api public
*/
is.instance = is['instanceof'] = function (value, constructor) {
return value instanceof constructor;
};
/**
* is.nil / is.null
* Test if `value` is null.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is null, false otherwise
* @api public
*/
is.nil = is['null'] = function (value) {
return value === null;
};
/**
* is.undef / is.undefined
* Test if `value` is undefined.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is undefined, false otherwise
* @api public
*/
is.undef = is.undefined = function (value) {
return typeof value === 'undefined';
};
/**
* Test arguments.
*/
/**
* is.args
* Test if `value` is an arguments object.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is an arguments object, false otherwise
* @api public
*/
is.args = is.arguments = function (value) {
var isStandardArguments = toStr.call(value) === '[object Arguments]';
var isOldArguments = !is.array(value) && is.arraylike(value) && is.object(value) && is.fn(value.callee);
return isStandardArguments || isOldArguments;
};
/**
* Test array.
*/
/**
* is.array
* Test if 'value' is an array.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is an array, false otherwise
* @api public
*/
is.array = Array.isArray || function (value) {
return toStr.call(value) === '[object Array]';
};
/**
* is.arguments.empty
* Test if `value` is an empty arguments object.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is an empty arguments object, false otherwise
* @api public
*/
is.args.empty = function (value) {
return is.args(value) && value.length === 0;
};
/**
* is.array.empty
* Test if `value` is an empty array.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is an empty array, false otherwise
* @api public
*/
is.array.empty = function (value) {
return is.array(value) && value.length === 0;
};
/**
* is.arraylike
* Test if `value` is an arraylike object.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is an arguments object, false otherwise
* @api public
*/
is.arraylike = function (value) {
return !!value && !is.bool(value)
&& owns.call(value, 'length')
&& isFinite(value.length)
&& is.number(value.length)
&& value.length >= 0;
};
/**
* Test boolean.
*/
/**
* is.bool
* Test if `value` is a boolean.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is a boolean, false otherwise
* @api public
*/
is.bool = is['boolean'] = function (value) {
return toStr.call(value) === '[object Boolean]';
};
/**
* is.false
* Test if `value` is false.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is false, false otherwise
* @api public
*/
is['false'] = function (value) {
return is.bool(value) && Boolean(Number(value)) === false;
};
/**
* is.true
* Test if `value` is true.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is true, false otherwise
* @api public
*/
is['true'] = function (value) {
return is.bool(value) && Boolean(Number(value)) === true;
};
/**
* Test date.
*/
/**
* is.date
* Test if `value` is a date.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is a date, false otherwise
* @api public
*/
is.date = function (value) {
return toStr.call(value) === '[object Date]';
};
/**
* is.date.valid
* Test if `value` is a valid date.
*
* @param {*} value value to test
* @returns {Boolean} true if `value` is a valid date, false otherwise
*/
is.date.valid = function (value) {
return is.date(value) && !isNaN(Number(value));
};
/**
* Test element.
*/
/**
* is.element
* Test if `value` is an html element.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is an HTML Element, false otherwise
* @api public
*/
is.element = function (value) {
return value !== undefined
&& typeof HTMLElement !== 'undefined'
&& value instanceof HTMLElement
&& value.nodeType === 1;
};
/**
* Test error.
*/
/**
* is.error
* Test if `value` is an error object.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is an error object, false otherwise
* @api public
*/
is.error = function (value) {
return toStr.call(value) === '[object Error]';
};
/**
* Test function.
*/
/**
* is.fn / is.function (deprecated)
* Test if `value` is a function.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is a function, false otherwise
* @api public
*/
is.fn = is['function'] = function (value) {
var isAlert = typeof window !== 'undefined' && value === window.alert;
if (isAlert) {
return true;
}
var str = toStr.call(value);
return str === '[object Function]' || str === '[object GeneratorFunction]' || str === '[object AsyncFunction]';
};
/**
* Test number.
*/
/**
* is.number
* Test if `value` is a number.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is a number, false otherwise
* @api public
*/
is.number = function (value) {
return toStr.call(value) === '[object Number]';
};
/**
* is.infinite
* Test if `value` is positive or negative infinity.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is positive or negative Infinity, false otherwise
* @api public
*/
is.infinite = function (value) {
return value === Infinity || value === -Infinity;
};
/**
* is.decimal
* Test if `value` is a decimal number.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is a decimal number, false otherwise
* @api public
*/
is.decimal = function (value) {
return is.number(value) && !isActualNaN(value) && !is.infinite(value) && value % 1 !== 0;
};
/**
* is.divisibleBy
* Test if `value` is divisible by `n`.
*
* @param {Number} value value to test
* @param {Number} n dividend
* @return {Boolean} true if `value` is divisible by `n`, false otherwise
* @api public
*/
is.divisibleBy = function (value, n) {
var isDividendInfinite = is.infinite(value);
var isDivisorInfinite = is.infinite(n);
var isNonZeroNumber = is.number(value) && !isActualNaN(value) && is.number(n) && !isActualNaN(n) && n !== 0;
return isDividendInfinite || isDivisorInfinite || (isNonZeroNumber && value % n === 0);
};
/**
* is.integer
* Test if `value` is an integer.
*
* @param value to test
* @return {Boolean} true if `value` is an integer, false otherwise
* @api public
*/
is.integer = is['int'] = function (value) {
return is.number(value) && !isActualNaN(value) && value % 1 === 0;
};
/**
* is.maximum
* Test if `value` is greater than 'others' values.
*
* @param {Number} value value to test
* @param {Array} others values to compare with
* @return {Boolean} true if `value` is greater than `others` values
* @api public
*/
is.maximum = function (value, others) {
if (isActualNaN(value)) {
throw new TypeError('NaN is not a valid value');
} else if (!is.arraylike(others)) {
throw new TypeError('second argument must be array-like');
}
var len = others.length;
while (--len >= 0) {
if (value < others[len]) {
return false;
}
}
return true;
};
/**
* is.minimum
* Test if `value` is less than `others` values.
*
* @param {Number} value value to test
* @param {Array} others values to compare with
* @return {Boolean} true if `value` is less than `others` values
* @api public
*/
is.minimum = function (value, others) {
if (isActualNaN(value)) {
throw new TypeError('NaN is not a valid value');
} else if (!is.arraylike(others)) {
throw new TypeError('second argument must be array-like');
}
var len = others.length;
while (--len >= 0) {
if (value > others[len]) {
return false;
}
}
return true;
};
/**
* is.nan
* Test if `value` is not a number.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is not a number, false otherwise
* @api public
*/
is.nan = function (value) {
return !is.number(value) || value !== value;
};
/**
* is.even
* Test if `value` is an even number.
*
* @param {Number} value value to test
* @return {Boolean} true if `value` is an even number, false otherwise
* @api public
*/
is.even = function (value) {
return is.infinite(value) || (is.number(value) && value === value && value % 2 === 0);
};
/**
* is.odd
* Test if `value` is an odd number.
*
* @param {Number} value value to test
* @return {Boolean} true if `value` is an odd number, false otherwise
* @api public
*/
is.odd = function (value) {
return is.infinite(value) || (is.number(value) && value === value && value % 2 !== 0);
};
/**
* is.ge
* Test if `value` is greater than or equal to `other`.
*
* @param {Number} value value to test
* @param {Number} other value to compare with
* @return {Boolean}
* @api public
*/
is.ge = function (value, other) {
if (isActualNaN(value) || isActualNaN(other)) {
throw new TypeError('NaN is not a valid value');
}
return !is.infinite(value) && !is.infinite(other) && value >= other;
};
/**
* is.gt
* Test if `value` is greater than `other`.
*
* @param {Number} value value to test
* @param {Number} other value to compare with
* @return {Boolean}
* @api public
*/
is.gt = function (value, other) {
if (isActualNaN(value) || isActualNaN(other)) {
throw new TypeError('NaN is not a valid value');
}
return !is.infinite(value) && !is.infinite(other) && value > other;
};
/**
* is.le
* Test if `value` is less than or equal to `other`.
*
* @param {Number} value value to test
* @param {Number} other value to compare with
* @return {Boolean} if 'value' is less than or equal to 'other'
* @api public
*/
is.le = function (value, other) {
if (isActualNaN(value) || isActualNaN(other)) {
throw new TypeError('NaN is not a valid value');
}
return !is.infinite(value) && !is.infinite(other) && value <= other;
};
/**
* is.lt
* Test if `value` is less than `other`.
*
* @param {Number} value value to test
* @param {Number} other value to compare with
* @return {Boolean} if `value` is less than `other`
* @api public
*/
is.lt = function (value, other) {
if (isActualNaN(value) || isActualNaN(other)) {
throw new TypeError('NaN is not a valid value');
}
return !is.infinite(value) && !is.infinite(other) && value < other;
};
/**
* is.within
* Test if `value` is within `start` and `finish`.
*
* @param {Number} value value to test
* @param {Number} start lower bound
* @param {Number} finish upper bound
* @return {Boolean} true if 'value' is is within 'start' and 'finish'
* @api public
*/
is.within = function (value, start, finish) {
if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) {
throw new TypeError('NaN is not a valid value');
} else if (!is.number(value) || !is.number(start) || !is.number(finish)) {
throw new TypeError('all arguments must be numbers');
}
var isAnyInfinite = is.infinite(value) || is.infinite(start) || is.infinite(finish);
return isAnyInfinite || (value >= start && value <= finish);
};
/**
* Test object.
*/
/**
* is.object
* Test if `value` is an object.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is an object, false otherwise
* @api public
*/
is.object = function (value) {
return toStr.call(value) === '[object Object]';
};
/**
* is.primitive
* Test if `value` is a primitive.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is a primitive, false otherwise
* @api public
*/
is.primitive = function isPrimitive(value) {
if (!value) {
return true;
}
if (typeof value === 'object' || is.object(value) || is.fn(value) || is.array(value)) {
return false;
}
return true;
};
/**
* is.hash
* Test if `value` is a hash - a plain object literal.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is a hash, false otherwise
* @api public
*/
is.hash = function (value) {
return is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;
};
/**
* Test regexp.
*/
/**
* is.regexp
* Test if `value` is a regular expression.
*
* @param {*} value value to test
* @return {Boolean} true if `value` is a regexp, false otherwise
* @api public
*/
is.regexp = function (value) {
return toStr.call(value) === '[object RegExp]';
};
/**
* Test string.
*/
/**
* is.string
* Test if `value` is a string.
*
* @param {*} value value to test
* @return {Boolean} true if 'value' is a string, false otherwise
* @api public
*/
is.string = function (value) {
return toStr.call(value) === '[object String]';
};
/**
* Test base64 string.
*/
/**
* is.base64
* Test if `value` is a valid base64 encoded string.
*
* @param {*} value value to test
* @return {Boolean} true if 'value' is a base64 encoded string, false otherwise
* @api public
*/
is.base64 = function (value) {
return is.string(value) && (!value.length || base64Regex.test(value));
};
/**
* Test base64 string.
*/
/**
* is.hex
* Test if `value` is a valid hex encoded string.
*
* @param {*} value value to test
* @return {Boolean} true if 'value' is a hex encoded string, false otherwise
* @api public
*/
is.hex = function (value) {
return is.string(value) && (!value.length || hexRegex.test(value));
};
/**
* is.symbol
* Test if `value` is an ES6 Symbol
*
* @param {*} value value to test
* @return {Boolean} true if `value` is a Symbol, false otherise
* @api public
*/
is.symbol = function (value) {
return typeof Symbol === 'function' && toStr.call(value) === '[object Symbol]' && typeof symbolValueOf.call(value) === 'symbol';
};
/**
* is.bigint
* Test if `value` is an ES-proposed BigInt
*
* @param {*} value value to test
* @return {Boolean} true if `value` is a BigInt, false otherise
* @api public
*/
is.bigint = function (value) {
// eslint-disable-next-line valid-typeof
return typeof BigInt === 'function' && toStr.call(value) === '[object BigInt]' && typeof bigIntValueOf.call(value) === 'bigint';
};
module.exports = is;

99
express-server/node_modules/is/package.json generated vendored Normal file
View File

@ -0,0 +1,99 @@
{
"_from": "is@^3.2.1",
"_id": "is@3.3.0",
"_inBundle": false,
"_integrity": "sha512-nW24QBoPcFGGHJGUwnfpI7Yc5CdqWNdsyHQszVE/z2pKHXzh7FZ5GWhJqSyaQ9wMkQnsTx+kAI8bHlCX4tKdbg==",
"_location": "/is",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "is@^3.2.1",
"name": "is",
"escapedName": "is",
"rawSpec": "^3.2.1",
"saveSpec": null,
"fetchSpec": "^3.2.1"
},
"_requiredBy": [
"/@google-cloud/common",
"/@google-cloud/firestore",
"/@google-cloud/storage"
],
"_resolved": "https://registry.npmjs.org/is/-/is-3.3.0.tgz",
"_shasum": "61cff6dd3c4193db94a3d62582072b44e5645d79",
"_spec": "is@^3.2.1",
"_where": "D:\\Desktop\\Git\\Firebase\\SmartShopperFirebase\\node_modules\\@google-cloud\\firestore",
"author": {
"name": "Enrico Marino",
"url": "http://onirame.com"
},
"bugs": {
"url": "https://github.com/enricomarino/is/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Jordan Harband",
"url": "https://github.com/ljharb"
}
],
"dependencies": {},
"deprecated": false,
"description": "the definitive JavaScript type testing library",
"devDependencies": {
"@ljharb/eslint-config": "^13.0.0",
"covert": "^1.1.0",
"eslint": "^5.10.0",
"foreach": "^2.0.5",
"jscs": "^3.0.7",
"make-generator-function": "^1.1.0",
"safe-publish-latest": "^1.1.2",
"tape": "^4.9.1"
},
"engines": {
"node": "*"
},
"homepage": "https://github.com/enricomarino/is",
"keywords": [
"util",
"type",
"test"
],
"license": "MIT",
"main": "index.js",
"name": "is",
"repository": {
"type": "git",
"url": "git://github.com/enricomarino/is.git"
},
"scripts": {
"coverage": "covert test/index.js",
"coverage-quiet": "covert test/index.js --quiet",
"eslint": "eslint .",
"jscs": "jscs *.js */*.js",
"lint": "npm run jscs && npm run eslint",
"prepublish": "safe-publish-latest",
"pretest": "npm run lint",
"test": "npm run --silent tests-only",
"tests-only": "node test/index.js"
},
"testling": {
"files": "test/index.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0",
"chrome/22.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/5.0.5..latest",
"ipad/6.0..latest",
"iphone/6.0..latest"
]
},
"version": "3.3.0"
}

729
express-server/node_modules/is/test/index.js generated vendored Normal file
View File

@ -0,0 +1,729 @@
/* globals window, document, HTMLElement */
'use strict';
var test = require('tape');
var is = require('../index.js');
var forEach = require('foreach');
var toStr = Object.prototype.toString;
var genFn = require('make-generator-function');
test('is.type', function (t) {
var booleans = [true, false];
forEach(booleans, function (boolean) {
t.ok(is.type(boolean, 'boolean'), '"' + boolean + '" is a boolean');
});
var numbers = [1, 0 / 1, 0 / -1, NaN, Infinity, -Infinity];
forEach(numbers, function (number) {
t.ok(is.type(number, 'number'), '"' + number + '" is a number');
});
var objects = [{}, null, new Date()];
forEach(objects, function (object) {
t.ok(is.type(object, 'object'), '"' + object + '" is an object');
});
var strings = ['', 'abc'];
forEach(strings, function (string) {
t.ok(is.type(string, 'string'), '"' + string + '" is a string');
});
t.ok(is.type(undefined, 'undefined'), 'undefined is undefined');
t.end();
});
test('is.undef', function (t) {
t.ok(is.undef(), 'absent undefined is undefined');
t.ok(is.undef(undefined), 'literal undefined is undefined');
t.notOk(is.undef(null), 'null is not undefined');
t.notOk(is.undef({}), 'object is not undefined');
t.end();
});
test('is.defined', function (t) {
t.notOk(is.defined(), 'undefined is not defined');
t.ok(is.defined(null), 'null is defined');
t.ok(is.defined({}), 'object is defined');
t.end();
});
test('is.empty', function (t) {
t.ok(is.empty(''), 'empty string is empty');
t.ok(is.empty(Object('')), 'empty String object is empty');
t.ok(is.empty([]), 'empty array is empty');
t.ok(is.empty({}), 'empty object is empty');
t.ok(is.empty(null), 'null is empty');
t.ok(is.empty(), 'undefined is empty');
t.ok(is.empty(undefined), 'undefined is empty');
t.ok(is.empty(false), 'false is empty');
t.ok(is.empty(0), '0 is empty');
t.ok(is.empty(NaN), 'nan is empty');
(function () {
t.ok(is.empty(arguments), 'empty arguments is empty');
}());
t.notOk(is.empty({ a: 1 }), 'nonempty object is not empty');
t.notOk(is.empty(true), 'true is not empty');
t.notOk(is.empty(/a/g), 'regex is not empty');
t.notOk(is.empty(new Date()), 'date is not empty');
t.end();
});
test('is.equal', function (t) {
t.test('primitives', function (pt) {
var primitives = [true, false, undefined, null, '', 'foo', 0, Infinity, -Infinity];
pt.plan(primitives.length);
for (var i = 0; i < primitives.length; ++i) {
pt.ok(is.equal(primitives[i], primitives[i]), 'primitives are equal to themselves: ' + primitives[i]);
}
pt.end();
});
t.test('arrays', function (at) {
at.ok(is.equal([1, 2, 3], [1, 2, 3]), 'arrays are shallowly equal');
at.ok(is.equal([1, 2, [3, 4]], [1, 2, [3, 4]]), 'arrays are deep equal');
at.notOk(is.equal([1, 2, 3], [5, 2, 3]), 'inequal arrays are not equal');
at.notOk(is.equal([1, 2], [2, 3]), 'inequal arrays are not equal');
at.notOk(is.equal([1, 2, 3], [2, 3]), 'inequal length arrays are not equal');
at.ok(is.equal([], []), 'empty arrays are equal');
var arr = [1, 2];
at.ok(is.equal(arr, arr), 'array is equal to itself');
at.end();
});
t.test('dates', function (dt) {
dt.plan(2);
var now = new Date();
dt.ok(is.equal(now, new Date(now.getTime())), 'two equal date objects are equal');
setTimeout(function () {
dt.notOk(is.equal(now, new Date()), 'two inequal date objects are not equal');
dt.end();
}, 10);
});
t.test('plain objects', function (ot) {
ot.ok(is.equal({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 }), 'objects are shallowly equal');
ot.ok(is.equal({ a: { b: 1 } }, { a: { b: 1 } }), 'objects are deep equal');
ot.notOk(is.equal({ a: 1 }, { a: 2 }), 'inequal objects are not equal');
ot.end();
});
t.test('object instances', function (ot) {
var F = function F() {
this.foo = 'bar';
};
F.prototype = {};
var G = function G() {
this.foo = 'bar';
};
var f = new F();
var g = new G();
ot.ok(is.equal(f, f), 'the same object instances are equal');
ot.ok(is.equal(f, new F()), 'two object instances are equal when the prototype and props are the same');
ot.ok(is.equal(f, new G()), 'two object instances are equal when the prototype is not the same, but props are');
g.bar = 'baz';
ot.notOk(is.equal(f, g), 'object instances are not equal when the prototype and props are not the same');
ot.notOk(is.equal(g, f), 'object instances are not equal when the prototype and props are not the same');
ot.end();
});
t.test('functions', function (ft) {
var F = function () {};
F.prototype = {};
var G = function () {};
G.prototype = new Date();
ft.notEqual(F.prototype, G.prototype, 'F and G have different prototypes');
ft.notOk(is.equal(F, G), 'two functions are not equal when the prototype is not the same');
var H = function () {};
H.prototype = F.prototype;
ft.equal(F.prototype, H.prototype, 'F and H have the same prototype');
ft.ok(is.equal(F, H), 'two functions are equal when the prototype is the same');
ft.end();
});
t.end();
});
test('is.hosted', function (t) {
t.ok(is.hosted('a', { a: {} }), 'object is hosted');
t.ok(is.hosted('a', { a: [] }), 'array is hosted');
t.ok(is.hosted('a', { a: function () {} }), 'function is hosted');
t.notOk(is.hosted('a', { a: true }), 'boolean value is not hosted');
t.notOk(is.hosted('a', { a: false }), 'boolean value is not hosted');
t.notOk(is.hosted('a', { a: 3 }), 'number value is not hosted');
t.notOk(is.hosted('a', { a: undefined }), 'undefined value is not hosted');
t.notOk(is.hosted('a', { a: 'abc' }), 'string value is not hosted');
t.notOk(is.hosted('a', { a: null }), 'null value is not hosted');
t.end();
});
test('is.instance', function (t) {
t.ok(is.instance(new Date(), Date), 'new Date is instanceof Date');
var F = function () {};
t.ok(is.instance(new F(), F), 'new constructor is instanceof constructor');
t.end();
});
test('is.nil', function (t) {
var isNull = is.nil;
t.equal(isNull, is['null'], 'is.nil is the same as is.null');
t.ok(isNull(null), 'null is null');
t.notOk(isNull(undefined), 'undefined is not null');
t.notOk(isNull({}), 'object is not null');
t.end();
});
test('is.args', function (t) {
t.notOk(is.args([]), 'array is not arguments');
(function () {
t.ok(is.args(arguments), 'arguments is arguments');
}());
(function () {
t.notOk(is.args(Array.prototype.slice.call(arguments)), 'sliced arguments is not arguments');
}());
var fakeOldArguments = {
callee: function () {},
length: 3
};
t.ok(is.args(fakeOldArguments), 'old-style arguments object is arguments');
t.end();
});
test('is.args.empty', function (t) {
t.notOk(is.args.empty([]), 'empty array is not empty arguments');
(function () {
t.ok(is.args.empty(arguments), 'empty arguments is empty arguments');
}());
(function () {
t.notOk(is.args.empty(Array.prototype.slice.call(arguments)), 'empty sliced arguments is not empty arguments');
}());
t.end();
});
test('is.array', function (t) {
t.ok(is.array([]), 'array is array');
(function () {
t.ok(is.array(Array.prototype.slice.call(arguments)), 'sliced arguments is array');
}());
t.end();
});
test('is.array.empty', function (t) {
t.ok(is.array.empty([]), 'empty array is empty array');
(function () {
t.notOk(is.array.empty(arguments), 'empty arguments is not empty array');
}());
(function () {
t.ok(is.array.empty(Array.prototype.slice.call(arguments)), 'empty sliced arguments is empty array');
}());
t.end();
});
test('is.isarraylike', function (t) {
t.notOk(is.arraylike(), 'undefined is not array-like');
t.notOk(is.arraylike(null), 'null is not array-like');
t.notOk(is.arraylike(false), 'false is not array-like');
t.notOk(is.arraylike(true), 'true is not array-like');
t.ok(is.arraylike({ length: 0 }), 'object with zero length is array-like');
t.ok(is.arraylike({ length: 1 }), 'object with positive length is array-like');
t.notOk(is.arraylike({ length: -1 }), 'object with negative length is not array-like');
t.notOk(is.arraylike({ length: NaN }), 'object with NaN length is not array-like');
t.notOk(is.arraylike({ length: 'foo' }), 'object with string length is not array-like');
t.notOk(is.arraylike({ length: '' }), 'object with empty string length is not array-like');
t.ok(is.arraylike([]), 'array is array-like');
(function () {
t.ok(is.arraylike(arguments), 'empty arguments is array-like');
}());
(function () {
t.ok(is.arraylike(arguments), 'nonempty arguments is array-like');
}(1, 2, 3));
t.end();
});
test('is.bool', function (t) {
t.ok(is.bool(true), 'literal true is a boolean');
t.ok(is.bool(false), 'literal false is a boolean');
t.ok(is.bool(Object(true)), 'object true is a boolean');
t.ok(is.bool(Object(false)), 'object false is a boolean');
t.notOk(is.bool(), 'undefined is not a boolean');
t.notOk(is.bool(null), 'null is not a boolean');
t.end();
});
test('is.false', function (t) {
var isFalse = is['false'];
t.ok(isFalse(false), 'false is false');
t.ok(isFalse(Object(false)), 'object false is false');
t.notOk(isFalse(true), 'true is not false');
t.notOk(isFalse(), 'undefined is not false');
t.notOk(isFalse(null), 'null is not false');
t.notOk(isFalse(''), 'empty string is not false');
t.end();
});
test('is.true', function (t) {
var isTrue = is['true'];
t.ok(isTrue(true), 'true is true');
t.ok(isTrue(Object(true)), 'object true is true');
t.notOk(isTrue(false), 'false is not true');
t.notOk(isTrue(), 'undefined is not true');
t.notOk(isTrue(null), 'null is not true');
t.notOk(isTrue(''), 'empty string is not true');
t.end();
});
test('is.date', function (t) {
t.ok(is.date(new Date()), 'new Date is date');
t.notOk(is.date(), 'undefined is not date');
t.notOk(is.date(null), 'null is not date');
t.notOk(is.date(''), 'empty string is not date');
var nowTS = (new Date()).getTime();
t.notOk(is.date(nowTS), 'timestamp is not date');
var F = function () {};
F.prototype = new Date();
t.notOk(is.date(new F()), 'Date subtype is not date');
t.end();
});
test('is.date.valid', function (t) {
t.ok(is.date.valid(new Date()), 'new Date() is a valid date');
t.notOk(is.date.valid(new Date('')), 'new Date("") is not a valid date');
t.end();
});
test('is.element', function (t) {
t.notOk(is.element(), 'undefined is not element');
t.test('when HTMLElement exists', { skip: typeof HTMLElement === 'undefined' }, function (st) {
var element = document.createElement('div');
st.ok(is.element(element), 'HTMLElement is element');
st.notOk(is.element({ nodeType: 1 }), 'object with nodeType is not element');
st.end();
});
t.end();
});
test('is.error', function (t) {
var err = new Error('foo');
t.ok(is.error(err), 'Error is error');
t.notOk(is.error({}), 'object is not error');
var objWithErrorToString = {
toString: function () {
return '[object Error]';
}
};
t.equal(String(objWithErrorToString), toStr.call(new Error()), 'obj has Error\'s toString');
t.notOk(is.error(objWithErrorToString), 'object with Error\'s toString is not error');
t.end();
});
test('is.fn', function (t) {
t.equal(is['function'], is.fn, 'alias works');
t.ok(is.fn(function () {}), 'function is function');
if (typeof window !== 'undefined') {
// in IE7/8, typeof alert === 'object'
t.ok(is.fn(window.alert), 'window.alert is function');
}
t.notOk(is.fn({}), 'object is not function');
t.notOk(is.fn(null), 'null is not function');
t.test('generator functions', { skip: !genFn }, function (st) {
t.ok(is.fn(genFn), 'generator function is function');
st.end();
});
t.end();
});
test('is.number', function (t) {
t.ok(is.number(0), 'positive zero is number');
t.ok(is.number(0 / -1), 'negative zero is number');
t.ok(is.number(3), 'three is number');
t.ok(is.number(NaN), 'NaN is number');
t.ok(is.number(Infinity), 'infinity is number');
t.ok(is.number(-Infinity), 'negative infinity is number');
t.ok(is.number(Object(42)), 'object number is number');
t.notOk(is.number(), 'undefined is not number');
t.notOk(is.number(null), 'null is not number');
t.notOk(is.number(true), 'true is not number');
t.end();
});
test('is.infinite', function (t) {
t.ok(is.infinite(Infinity), 'positive infinity is infinite');
t.ok(is.infinite(-Infinity), 'negative infinity is infinite');
t.notOk(is.infinite(NaN), 'NaN is not infinite');
t.notOk(is.infinite(0), 'a number is not infinite');
t.end();
});
test('is.decimal', function (t) {
t.ok(is.decimal(1.1), 'decimal is decimal');
t.notOk(is.decimal(0), 'zero is not decimal');
t.notOk(is.decimal(1), 'integer is not decimal');
t.notOk(is.decimal(NaN), 'NaN is not decimal');
t.notOk(is.decimal(Infinity), 'Infinity is not decimal');
t.end();
});
test('is.divisibleBy', function (t) {
t.ok(is.divisibleBy(4, 2), '4 is divisible by 2');
t.ok(is.divisibleBy(4, 2), '4 is divisible by 2');
t.ok(is.divisibleBy(0, 1), '0 is divisible by 1');
t.ok(is.divisibleBy(Infinity, 1), 'infinity is divisible by anything');
t.ok(is.divisibleBy(1, Infinity), 'anything is divisible by infinity');
t.ok(is.divisibleBy(Infinity, Infinity), 'infinity is divisible by infinity');
t.notOk(is.divisibleBy(1, 0), '1 is not divisible by 0');
t.notOk(is.divisibleBy(NaN, 1), 'NaN is not divisible by 1');
t.notOk(is.divisibleBy(1, NaN), '1 is not divisible by NaN');
t.notOk(is.divisibleBy(NaN, NaN), 'NaN is not divisible by NaN');
t.notOk(is.divisibleBy(1, 3), '1 is not divisible by 3');
t.end();
});
test('is.integer', function (t) {
t.ok(is.integer(0), '0 is integer');
t.ok(is.integer(3), '3 is integer');
t.notOk(is.integer(1.1), '1.1 is not integer');
t.notOk(is.integer(NaN), 'NaN is not integer');
t.notOk(is.integer(Infinity), 'infinity is not integer');
t.notOk(is.integer(null), 'null is not integer');
t.notOk(is.integer(), 'undefined is not integer');
t.end();
});
test('is.maximum', function (t) {
t.ok(is.maximum(3, [3, 2, 1]), '3 is maximum of [3,2,1]');
t.ok(is.maximum(3, [1, 2, 3]), '3 is maximum of [1,2,3]');
t.ok(is.maximum(4, [1, 2, 3]), '4 is maximum of [1,2,3]');
t.ok(is.maximum('c', ['a', 'b', 'c']), 'c is maximum of [a,b,c]');
t.notOk(is.maximum(2, [1, 2, 3]), '2 is not maximum of [1,2,3]');
var nanError = new TypeError('NaN is not a valid value');
t['throws'](function () { return is.maximum(NaN); }, nanError, 'throws when first value is NaN');
var error = new TypeError('second argument must be array-like');
t['throws'](function () { return is.maximum(2, null); }, error, 'throws when second value is not array-like');
t['throws'](function () { return is.maximum(2, {}); }, error, 'throws when second value is not array-like');
t.end();
});
test('is.minimum', function (t) {
t.ok(is.minimum(1, [1, 2, 3]), '1 is minimum of [1,2,3]');
t.ok(is.minimum(0, [1, 2, 3]), '0 is minimum of [1,2,3]');
t.ok(is.minimum('a', ['a', 'b', 'c']), 'a is minimum of [a,b,c]');
t.notOk(is.minimum(2, [1, 2, 3]), '2 is not minimum of [1,2,3]');
var nanError = new TypeError('NaN is not a valid value');
t['throws'](function () { return is.minimum(NaN); }, nanError, 'throws when first value is NaN');
var error = new TypeError('second argument must be array-like');
t['throws'](function () { return is.minimum(2, null); }, error, 'throws when second value is not array-like');
t['throws'](function () { return is.minimum(2, {}); }, error, 'throws when second value is not array-like');
t.end();
});
test('is.nan', function (t) {
t.ok(is.nan(NaN), 'NaN is not a number');
t.ok(is.nan('abc'), 'string is not a number');
t.ok(is.nan(true), 'boolean is not a number');
t.ok(is.nan({}), 'object is not a number');
t.ok(is.nan([]), 'array is not a number');
t.ok(is.nan(function () {}), 'function is not a number');
t.notOk(is.nan(0), 'zero is a number');
t.notOk(is.nan(3), 'three is a number');
t.notOk(is.nan(1.1), '1.1 is a number');
t.notOk(is.nan(Infinity), 'infinity is a number');
t.end();
});
test('is.even', function (t) {
t.ok(is.even(0), 'zero is even');
t.ok(is.even(2), 'two is even');
t.ok(is.even(Infinity), 'infinity is even');
t.notOk(is.even(1), '1 is not even');
t.notOk(is.even(), 'undefined is not even');
t.notOk(is.even(null), 'null is not even');
t.notOk(is.even(NaN), 'NaN is not even');
t.end();
});
test('is.odd', function (t) {
t.ok(is.odd(1), 'zero is odd');
t.ok(is.odd(3), 'two is odd');
t.ok(is.odd(Infinity), 'infinity is odd');
t.notOk(is.odd(0), '0 is not odd');
t.notOk(is.odd(2), '2 is not odd');
t.notOk(is.odd(), 'undefined is not odd');
t.notOk(is.odd(null), 'null is not odd');
t.notOk(is.odd(NaN), 'NaN is not odd');
t.end();
});
test('is.ge', function (t) {
t.ok(is.ge(3, 2), '3 is greater than 2');
t.notOk(is.ge(2, 3), '2 is not greater than 3');
t.ok(is.ge(3, 3), '3 is greater than or equal to 3');
t.ok(is.ge('abc', 'a'), 'abc is greater than a');
t.ok(is.ge('abc', 'abc'), 'abc is greater than or equal to abc');
t.notOk(is.ge('a', 'abc'), 'a is not greater than abc');
t.notOk(is.ge(Infinity, 0), 'infinity is not greater than anything');
t.notOk(is.ge(0, Infinity), 'anything is not greater than infinity');
var error = new TypeError('NaN is not a valid value');
t['throws'](function () { return is.ge(NaN, 2); }, error, 'throws when first value is NaN');
t['throws'](function () { return is.ge(2, NaN); }, error, 'throws when second value is NaN');
t.end();
});
test('is.gt', function (t) {
t.ok(is.gt(3, 2), '3 is greater than 2');
t.notOk(is.gt(2, 3), '2 is not greater than 3');
t.notOk(is.gt(3, 3), '3 is not greater than 3');
t.ok(is.gt('abc', 'a'), 'abc is greater than a');
t.notOk(is.gt('abc', 'abc'), 'abc is not greater than abc');
t.notOk(is.gt('a', 'abc'), 'a is not greater than abc');
t.notOk(is.gt(Infinity, 0), 'infinity is not greater than anything');
t.notOk(is.gt(0, Infinity), 'anything is not greater than infinity');
var error = new TypeError('NaN is not a valid value');
t['throws'](function () { return is.gt(NaN, 2); }, error, 'throws when first value is NaN');
t['throws'](function () { return is.gt(2, NaN); }, error, 'throws when second value is NaN');
t.end();
});
test('is.le', function (t) {
t.ok(is.le(2, 3), '2 is lesser than or equal to 3');
t.notOk(is.le(3, 2), '3 is not lesser than or equal to 2');
t.ok(is.le(3, 3), '3 is lesser than or equal to 3');
t.ok(is.le('a', 'abc'), 'a is lesser than or equal to abc');
t.ok(is.le('abc', 'abc'), 'abc is lesser than or equal to abc');
t.notOk(is.le('abc', 'a'), 'abc is not lesser than or equal to a');
t.notOk(is.le(Infinity, 0), 'infinity is not lesser than or equal to anything');
t.notOk(is.le(0, Infinity), 'anything is not lesser than or equal to infinity');
var error = new TypeError('NaN is not a valid value');
t['throws'](function () { return is.le(NaN, 2); }, error, 'throws when first value is NaN');
t['throws'](function () { return is.le(2, NaN); }, error, 'throws when second value is NaN');
t.end();
});
test('is.lt', function (t) {
t.ok(is.lt(2, 3), '2 is lesser than 3');
t.notOk(is.lt(3, 2), '3 is not lesser than 2');
t.notOk(is.lt(3, 3), '3 is not lesser than 3');
t.ok(is.lt('a', 'abc'), 'a is lesser than abc');
t.notOk(is.lt('abc', 'abc'), 'abc is not lesser than abc');
t.notOk(is.lt('abc', 'a'), 'abc is not lesser than a');
t.notOk(is.lt(Infinity, 0), 'infinity is not lesser than anything');
t.notOk(is.lt(0, Infinity), 'anything is not lesser than infinity');
var error = new TypeError('NaN is not a valid value');
t['throws'](function () { return is.lt(NaN, 2); }, error, 'throws when first value is NaN');
t['throws'](function () { return is.lt(2, NaN); }, error, 'throws when second value is NaN');
t.end();
});
test('is.within', function (t) {
t.test('throws on NaN', function (st) {
var nanError = new TypeError('NaN is not a valid value');
st['throws'](function () { return is.within(NaN, 0, 0); }, nanError, 'throws when first value is NaN');
st['throws'](function () { return is.within(0, NaN, 0); }, nanError, 'throws when second value is NaN');
st['throws'](function () { return is.within(0, 0, NaN); }, nanError, 'throws when third value is NaN');
st.end();
});
t.test('throws on non-number', function (st) {
var error = new TypeError('all arguments must be numbers');
st['throws'](function () { return is.within('', 0, 0); }, error, 'throws when first value is string');
st['throws'](function () { return is.within(0, '', 0); }, error, 'throws when second value is string');
st['throws'](function () { return is.within(0, 0, ''); }, error, 'throws when third value is string');
st['throws'](function () { return is.within({}, 0, 0); }, error, 'throws when first value is object');
st['throws'](function () { return is.within(0, {}, 0); }, error, 'throws when second value is object');
st['throws'](function () { return is.within(0, 0, {}); }, error, 'throws when third value is object');
st['throws'](function () { return is.within(null, 0, 0); }, error, 'throws when first value is null');
st['throws'](function () { return is.within(0, null, 0); }, error, 'throws when second value is null');
st['throws'](function () { return is.within(0, 0, null); }, error, 'throws when third value is null');
st['throws'](function () { return is.within(undefined, 0, 0); }, error, 'throws when first value is undefined');
st['throws'](function () { return is.within(0, undefined, 0); }, error, 'throws when second value is undefined');
st['throws'](function () { return is.within(0, 0, undefined); }, error, 'throws when third value is undefined');
st.end();
});
t.ok(is.within(2, 1, 3), '2 is between 1 and 3');
t.ok(is.within(0, -1, 1), '0 is between -1 and 1');
t.ok(is.within(2, 0, Infinity), 'infinity always returns true');
t.ok(is.within(2, Infinity, 2), 'infinity always returns true');
t.ok(is.within(Infinity, 0, 1), 'infinity always returns true');
t.notOk(is.within(2, -1, -1), '2 is not between -1 and 1');
t.end();
});
test('is.object', function (t) {
t.ok(is.object({}), 'object literal is object');
t.notOk(is.object(), 'undefined is not an object');
t.notOk(is.object(null), 'null is not an object');
t.notOk(is.object(true), 'true is not an object');
t.notOk(is.object(''), 'string is not an object');
t.notOk(is.object(NaN), 'NaN is not an object');
t.notOk(is.object(Object), 'object constructor is not an object');
t.notOk(is.object(function () {}), 'function is not an object');
t.test('Symbols', { skip: typeof Symbol !== 'function' }, function (st) {
st.notOk(is.object(Symbol('foo')), 'symbol is not an object');
st.end();
});
t.end();
});
test('is.primitive', function (t) {
t.notOk(is.primitive({}), 'object literal is not a primitive');
t.notOk(is.primitive([]), 'array is not a primitive');
t.ok(is.primitive(), 'undefined is a primitive');
t.ok(is.primitive(null), 'null is a primitive');
t.ok(is.primitive(true), 'true is a primitive');
t.ok(is.primitive(''), 'string is a primitive');
t.ok(is.primitive(NaN), 'NaN is a primitive');
t.notOk(is.primitive(Object), 'object constructor is not a primitive');
t.notOk(is.primitive(function () {}), 'function is not a primitive');
t.test('Symbols', { skip: typeof Symbol !== 'function' }, function (st) {
st.ok(is.primitive(Symbol('foo')), 'symbol is a primitive');
st.end();
});
t.end();
});
test('is.hash', function (t) {
t.ok(is.hash({}), 'empty object literal is hash');
t.ok(is.hash({ 1: 2, a: 'b' }), 'object literal is hash');
t.notOk(is.hash(), 'undefined is not a hash');
t.notOk(is.hash(null), 'null is not a hash');
t.notOk(is.hash(new Date()), 'date is not a hash');
t.notOk(is.hash(Object('')), 'string object is not a hash');
t.notOk(is.hash(''), 'string literal is not a hash');
t.notOk(is.hash(Object(0)), 'number object is not a hash');
t.notOk(is.hash(1), 'number literal is not a hash');
t.notOk(is.hash(true), 'true is not a hash');
t.notOk(is.hash(false), 'false is not a hash');
t.notOk(is.hash(Object(false)), 'boolean obj is not hash');
t.notOk(is.hash(false), 'literal false is not hash');
t.notOk(is.hash(true), 'literal true is not hash');
t.test('commonJS environment', { skip: typeof module === 'undefined' }, function (st) {
st.ok(is.hash(module.exports), 'module.exports is a hash');
st.end();
});
t.test('browser stuff', { skip: typeof window === 'undefined' }, function (st) {
st.notOk(is.hash(window), 'window is not a hash');
st.notOk(is.hash(document.createElement('div')), 'element is not a hash');
st.end();
});
t.test('node stuff', { skip: typeof process === 'undefined' }, function (st) {
st.notOk(is.hash(global), 'global is not a hash');
st.notOk(is.hash(process), 'process is not a hash');
st.end();
});
t.end();
});
test('is.regexp', function (t) {
t.ok(is.regexp(/a/g), 'regex literal is regex');
t.ok(is.regexp(new RegExp('a', 'g')), 'regex object is regex');
t.notOk(is.regexp(), 'undefined is not regex');
t.notOk(is.regexp(function () {}), 'function is not regex');
t.notOk(is.regexp('/a/g'), 'string regex is not regex');
t.end();
});
test('is.string', function (t) {
t.ok(is.string('foo'), 'string literal is string');
t.ok(is.string(Object('foo')), 'string object is string');
t.notOk(is.string(), 'undefined is not string');
t.notOk(is.string(String), 'string constructor is not string');
var F = function () {};
F.prototype = Object('');
t.notOk(is.string(F), 'string subtype is not string');
t.end();
});
test('is.base64', function (t) {
t.ok(is.base64('wxyzWXYZ/+=='), 'string is base64 encoded');
t.ok(is.base64(''), 'zero length string is base64 encoded');
t.notOk(is.base64('wxyzWXYZ123/+=='), 'string length not a multiple of four is not base64 encoded');
t.notOk(is.base64('wxyzWXYZ1234|]=='), 'string with invalid characters is not base64 encoded');
t.notOk(is.base64('wxyzWXYZ1234==/+'), 'string with = not at end is not base64 encoded');
t.notOk(is.base64('wxyzWXYZ1234/==='), 'string ending with === is not base64 encoded');
t.end();
});
test('is.hex', function (t) {
t.ok(is.hex('abcdABCD1234'), 'string is hex encoded');
t.ok(is.hex(''), 'zero length string is hex encoded');
t.notOk(is.hex('wxyzWXYZ1234/+=='), 'string with invalid characters is not hex encoded');
t.end();
});
test('is.symbol', function (t) {
t.test('not symbols', function (st) {
var notSymbols = [true, false, null, undefined, {}, [], function () {}, 42, NaN, Infinity, /a/g, '', 0, -0, new Error('error')];
forEach(notSymbols, function (notSymbol) {
st.notOk(is.symbol(notSymbol), notSymbol + ' is not symbol');
});
st.end();
});
t.test('symbols', { skip: typeof Symbol !== 'function' }, function (st) {
st.ok(is.symbol(Symbol('foo')), 'Symbol("foo") is symbol');
var notKnownSymbols = ['length', 'name', 'arguments', 'caller', 'prototype', 'for', 'keyFor'];
var symbolKeys = Object.getOwnPropertyNames(Symbol).filter(function (name) {
return notKnownSymbols.indexOf(name) < 0;
});
forEach(symbolKeys, function (symbolKey) {
st.ok(is.symbol(Symbol[symbolKey]), symbolKey + ' is symbol');
});
st.end();
});
t.end();
});
test('is.bigint', function (t) {
t.test('not bigints', function (st) {
var notBigints = [true, false, null, undefined, {}, [], function () {}, 42, NaN, Infinity, /a/g, '', 0, -0, new Error('error')];
forEach(notBigints, function (notBigint) {
st.notOk(is.bigint(notBigint), notBigint + ' is not bigint');
});
st.end();
});
t.test('bigints', { skip: typeof BigInt !== 'function' }, function (st) {
var bigInts = [
Function('return 42n')(), // eslint-disable-line no-new-func
BigInt(42)
];
forEach(bigInts, function (bigInt) {
st.ok(is.bigint(bigInt), bigInt + ' is bigint');
});
st.end();
});
t.end();
});