package/package.json000644 000765 000024 0000003441 12734772227013034 0ustar00000000 000000 { "name": "expect", "version": "1.20.2", "description": "Write better assertions", "author": "Michael Jackson", "license": "MIT", "main": "lib", "files": [ "lib", "umd" ], "scripts": { "build": "node ./scripts/build.js", "build-lib": "rimraf lib && babel ./modules -d lib --ignore '__tests__'", "build-umd": "webpack modules/index.js umd/expect.js", "build-min": "webpack -p modules/index.js umd/expect.min.js", "lint": "eslint modules", "test": "npm run lint && karma start", "release": "node ./scripts/release.js", "prepublish": "node ./scripts/build.js" }, "dependencies": { "define-properties": "~1.1.2", "has": "^1.0.1", "is-equal": "^1.5.1", "is-regex": "^1.0.3", "object-inspect": "^1.1.0", "object-keys": "^1.0.9", "tmatch": "^2.0.1" }, "devDependencies": { "babel-cli": "^6.6.5", "babel-eslint": "^6.0.0", "babel-loader": "^6.2.4", "babel-preset-es2015": "^6.6.0", "eslint": "^2.5.1", "eslint-config-airbnb": "^9.0.1", "eslint-plugin-import": "^1.7.0", "eslint-plugin-jsx-a11y": "^1.2.0", "eslint-plugin-react": "^5.1.1", "gzip-size": "^3.0.0", "in-publish": "^2.0.0", "karma": "^0.13.22", "karma-browserstack-launcher": "^1.0.0", "karma-chrome-launcher": "^1.0.1", "karma-mocha": "^1.0.1", "karma-mocha-reporter": "^2.0.0", "karma-sourcemap-loader": "^0.3.7", "karma-webpack": "^1.7.0", "mocha": "^2.5.3", "pretty-bytes": "^3.0.1", "readline-sync": "^1.4.1", "rimraf": "^2.5.2", "webpack": "^1.12.14" }, "keywords": [ "expect", "assert", "test", "spec" ], "repository": { "type": "git", "url": "https://github.com/mjackson/expect.git" }, "babel": { "presets": [ "es2015" ] } } package/umd/expect.js000644 000765 000024 0000353575 12734772234013177 0ustar00000000 000000 (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["expect"] = factory(); else root["expect"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _Expectation = __webpack_require__(1); var _Expectation2 = _interopRequireDefault(_Expectation); var _SpyUtils = __webpack_require__(13); var _assert = __webpack_require__(11); var _assert2 = _interopRequireDefault(_assert); var _extend = __webpack_require__(31); var _extend2 = _interopRequireDefault(_extend); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function expect(actual) { return new _Expectation2.default(actual); } expect.createSpy = _SpyUtils.createSpy; expect.spyOn = _SpyUtils.spyOn; expect.isSpy = _SpyUtils.isSpy; expect.restoreSpies = _SpyUtils.restoreSpies; expect.assert = _assert2.default; expect.extend = _extend2.default; module.exports = expect; /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _has = __webpack_require__(2); var _has2 = _interopRequireDefault(_has); var _tmatch = __webpack_require__(5); var _tmatch2 = _interopRequireDefault(_tmatch); var _assert = __webpack_require__(11); var _assert2 = _interopRequireDefault(_assert); var _SpyUtils = __webpack_require__(13); var _TestUtils = __webpack_require__(18); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * An Expectation is a wrapper around an assertion that allows it to be written * in a more natural style, without the need to remember the order of arguments. * This helps prevent you from making mistakes when writing tests. */ var Expectation = function () { function Expectation(actual) { _classCallCheck(this, Expectation); this.actual = actual; if ((0, _TestUtils.isFunction)(actual)) { this.context = null; this.args = []; } } _createClass(Expectation, [{ key: 'toExist', value: function toExist(message) { (0, _assert2.default)(this.actual, message || 'Expected %s to exist', this.actual); return this; } }, { key: 'toNotExist', value: function toNotExist(message) { (0, _assert2.default)(!this.actual, message || 'Expected %s to not exist', this.actual); return this; } }, { key: 'toBe', value: function toBe(value, message) { (0, _assert2.default)(this.actual === value, message || 'Expected %s to be %s', this.actual, value); return this; } }, { key: 'toNotBe', value: function toNotBe(value, message) { (0, _assert2.default)(this.actual !== value, message || 'Expected %s to not be %s', this.actual, value); return this; } }, { key: 'toEqual', value: function toEqual(value, message) { try { (0, _assert2.default)((0, _TestUtils.isEqual)(this.actual, value), message || 'Expected %s to equal %s', this.actual, value); } catch (error) { // These attributes are consumed by Mocha to produce a diff output. error.actual = this.actual; error.expected = value; error.showDiff = true; throw error; } return this; } }, { key: 'toNotEqual', value: function toNotEqual(value, message) { (0, _assert2.default)(!(0, _TestUtils.isEqual)(this.actual, value), message || 'Expected %s to not equal %s', this.actual, value); return this; } }, { key: 'toThrow', value: function toThrow(value, message) { (0, _assert2.default)((0, _TestUtils.isFunction)(this.actual), 'The "actual" argument in expect(actual).toThrow() must be a function, %s was given', this.actual); (0, _assert2.default)((0, _TestUtils.functionThrows)(this.actual, this.context, this.args, value), message || 'Expected %s to throw %s', this.actual, value || 'an error'); return this; } }, { key: 'toNotThrow', value: function toNotThrow(value, message) { (0, _assert2.default)((0, _TestUtils.isFunction)(this.actual), 'The "actual" argument in expect(actual).toNotThrow() must be a function, %s was given', this.actual); (0, _assert2.default)(!(0, _TestUtils.functionThrows)(this.actual, this.context, this.args, value), message || 'Expected %s to not throw %s', this.actual, value || 'an error'); return this; } }, { key: 'toBeA', value: function toBeA(value, message) { (0, _assert2.default)((0, _TestUtils.isFunction)(value) || typeof value === 'string', 'The "value" argument in toBeA(value) must be a function or a string'); (0, _assert2.default)((0, _TestUtils.isA)(this.actual, value), message || 'Expected %s to be a %s', this.actual, value); return this; } }, { key: 'toNotBeA', value: function toNotBeA(value, message) { (0, _assert2.default)((0, _TestUtils.isFunction)(value) || typeof value === 'string', 'The "value" argument in toNotBeA(value) must be a function or a string'); (0, _assert2.default)(!(0, _TestUtils.isA)(this.actual, value), message || 'Expected %s to not be a %s', this.actual, value); return this; } }, { key: 'toMatch', value: function toMatch(pattern, message) { (0, _assert2.default)((0, _tmatch2.default)(this.actual, pattern), message || 'Expected %s to match %s', this.actual, pattern); return this; } }, { key: 'toNotMatch', value: function toNotMatch(pattern, message) { (0, _assert2.default)(!(0, _tmatch2.default)(this.actual, pattern), message || 'Expected %s to not match %s', this.actual, pattern); return this; } }, { key: 'toBeLessThan', value: function toBeLessThan(value, message) { (0, _assert2.default)(typeof this.actual === 'number', 'The "actual" argument in expect(actual).toBeLessThan() must be a number'); (0, _assert2.default)(typeof value === 'number', 'The "value" argument in toBeLessThan(value) must be a number'); (0, _assert2.default)(this.actual < value, message || 'Expected %s to be less than %s', this.actual, value); return this; } }, { key: 'toBeLessThanOrEqualTo', value: function toBeLessThanOrEqualTo(value, message) { (0, _assert2.default)(typeof this.actual === 'number', 'The "actual" argument in expect(actual).toBeLessThanOrEqualTo() must be a number'); (0, _assert2.default)(typeof value === 'number', 'The "value" argument in toBeLessThanOrEqualTo(value) must be a number'); (0, _assert2.default)(this.actual <= value, message || 'Expected %s to be less than or equal to %s', this.actual, value); return this; } }, { key: 'toBeGreaterThan', value: function toBeGreaterThan(value, message) { (0, _assert2.default)(typeof this.actual === 'number', 'The "actual" argument in expect(actual).toBeGreaterThan() must be a number'); (0, _assert2.default)(typeof value === 'number', 'The "value" argument in toBeGreaterThan(value) must be a number'); (0, _assert2.default)(this.actual > value, message || 'Expected %s to be greater than %s', this.actual, value); return this; } }, { key: 'toBeGreaterThanOrEqualTo', value: function toBeGreaterThanOrEqualTo(value, message) { (0, _assert2.default)(typeof this.actual === 'number', 'The "actual" argument in expect(actual).toBeGreaterThanOrEqualTo() must be a number'); (0, _assert2.default)(typeof value === 'number', 'The "value" argument in toBeGreaterThanOrEqualTo(value) must be a number'); (0, _assert2.default)(this.actual >= value, message || 'Expected %s to be greater than or equal to %s', this.actual, value); return this; } }, { key: 'toInclude', value: function toInclude(value, compareValues, message) { if (typeof compareValues === 'string') { message = compareValues; compareValues = null; } if (compareValues == null) compareValues = _TestUtils.isEqual; var contains = false; if ((0, _TestUtils.isArray)(this.actual)) { contains = (0, _TestUtils.arrayContains)(this.actual, value, compareValues); } else if ((0, _TestUtils.isObject)(this.actual)) { contains = (0, _TestUtils.objectContains)(this.actual, value, compareValues); } else if (typeof this.actual === 'string') { contains = (0, _TestUtils.stringContains)(this.actual, value); } else { (0, _assert2.default)(false, 'The "actual" argument in expect(actual).toInclude() must be an array, object, or a string'); } (0, _assert2.default)(contains, message || 'Expected %s to include %s', this.actual, value); return this; } }, { key: 'toExclude', value: function toExclude(value, compareValues, message) { if (typeof compareValues === 'string') { message = compareValues; compareValues = null; } if (compareValues == null) compareValues = _TestUtils.isEqual; var contains = false; if ((0, _TestUtils.isArray)(this.actual)) { contains = (0, _TestUtils.arrayContains)(this.actual, value, compareValues); } else if ((0, _TestUtils.isObject)(this.actual)) { contains = (0, _TestUtils.objectContains)(this.actual, value, compareValues); } else if (typeof this.actual === 'string') { contains = (0, _TestUtils.stringContains)(this.actual, value); } else { (0, _assert2.default)(false, 'The "actual" argument in expect(actual).toExclude() must be an array, object, or a string'); } (0, _assert2.default)(!contains, message || 'Expected %s to exclude %s', this.actual, value); return this; } }, { key: 'toIncludeKeys', value: function toIncludeKeys(keys, comparator, message) { var _this = this; if (typeof comparator === 'string') { message = comparator; comparator = null; } if (comparator == null) comparator = _has2.default; (0, _assert2.default)(_typeof(this.actual) === 'object', 'The "actual" argument in expect(actual).toIncludeKeys() must be an object, not %s', this.actual); (0, _assert2.default)((0, _TestUtils.isArray)(keys), 'The "keys" argument in expect(actual).toIncludeKeys(keys) must be an array, not %s', keys); var contains = keys.every(function (key) { return comparator(_this.actual, key); }); (0, _assert2.default)(contains, message || 'Expected %s to include key(s) %s', this.actual, keys.join(', ')); return this; } }, { key: 'toIncludeKey', value: function toIncludeKey(key) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return this.toIncludeKeys.apply(this, [[key]].concat(args)); } }, { key: 'toExcludeKeys', value: function toExcludeKeys(keys, comparator, message) { var _this2 = this; if (typeof comparator === 'string') { message = comparator; comparator = null; } if (comparator == null) comparator = _has2.default; (0, _assert2.default)(_typeof(this.actual) === 'object', 'The "actual" argument in expect(actual).toExcludeKeys() must be an object, not %s', this.actual); (0, _assert2.default)((0, _TestUtils.isArray)(keys), 'The "keys" argument in expect(actual).toIncludeKeys(keys) must be an array, not %s', keys); var contains = keys.every(function (key) { return comparator(_this2.actual, key); }); (0, _assert2.default)(!contains, message || 'Expected %s to exclude key(s) %s', this.actual, keys.join(', ')); return this; } }, { key: 'toExcludeKey', value: function toExcludeKey(key) { for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } return this.toExcludeKeys.apply(this, [[key]].concat(args)); } }, { key: 'toHaveBeenCalled', value: function toHaveBeenCalled(message) { var spy = this.actual; (0, _assert2.default)((0, _SpyUtils.isSpy)(spy), 'The "actual" argument in expect(actual).toHaveBeenCalled() must be a spy'); (0, _assert2.default)(spy.calls.length > 0, message || 'spy was not called'); return this; } }, { key: 'toHaveBeenCalledWith', value: function toHaveBeenCalledWith() { for (var _len3 = arguments.length, expectedArgs = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { expectedArgs[_key3] = arguments[_key3]; } var spy = this.actual; (0, _assert2.default)((0, _SpyUtils.isSpy)(spy), 'The "actual" argument in expect(actual).toHaveBeenCalledWith() must be a spy'); (0, _assert2.default)(spy.calls.some(function (call) { return (0, _TestUtils.isEqual)(call.arguments, expectedArgs); }), 'spy was never called with %s', expectedArgs); return this; } }, { key: 'toNotHaveBeenCalled', value: function toNotHaveBeenCalled(message) { var spy = this.actual; (0, _assert2.default)((0, _SpyUtils.isSpy)(spy), 'The "actual" argument in expect(actual).toNotHaveBeenCalled() must be a spy'); (0, _assert2.default)(spy.calls.length === 0, message || 'spy was not supposed to be called'); return this; } }]); return Expectation; }(); var deprecate = function deprecate(fn, message) { var alreadyWarned = false; return function () { if (!alreadyWarned) { alreadyWarned = true; console.warn(message); } for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } return fn.apply(this, args); }; }; Expectation.prototype.withContext = deprecate(function (context) { (0, _assert2.default)((0, _TestUtils.isFunction)(this.actual), 'The "actual" argument in expect(actual).withContext() must be a function'); this.context = context; return this; }, '\nwithContext is deprecated; use a closure instead.\n\n expect(fn).withContext(context).toThrow()\n\nbecomes\n\n expect(() => fn.call(context)).toThrow()\n'); Expectation.prototype.withArgs = deprecate(function () { var _args; (0, _assert2.default)((0, _TestUtils.isFunction)(this.actual), 'The "actual" argument in expect(actual).withArgs() must be a function'); if (arguments.length) this.args = (_args = this.args).concat.apply(_args, arguments); return this; }, '\nwithArgs is deprecated; use a closure instead.\n\n expect(fn).withArgs(a, b, c).toThrow()\n\nbecomes\n\n expect(() => fn(a, b, c)).toThrow()\n'); var aliases = { toBeAn: 'toBeA', toNotBeAn: 'toNotBeA', toBeTruthy: 'toExist', toBeFalsy: 'toNotExist', toBeFewerThan: 'toBeLessThan', toBeMoreThan: 'toBeGreaterThan', toContain: 'toInclude', toNotContain: 'toExclude', toNotInclude: 'toExclude', toContainKeys: 'toIncludeKeys', toNotContainKeys: 'toExcludeKeys', toNotIncludeKeys: 'toExcludeKeys', toContainKey: 'toIncludeKey', toNotContainKey: 'toExcludeKey', toNotIncludeKey: 'toExcludeKey' }; for (var alias in aliases) { if (aliases.hasOwnProperty(alias)) Expectation.prototype[alias] = Expectation.prototype[aliases[alias]]; }exports.default = Expectation; /***/ }, /* 2 */ /***/ function(module, exports, __webpack_require__) { var bind = __webpack_require__(3); module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { var implementation = __webpack_require__(4); module.exports = Function.prototype.bind || implementation; /***/ }, /* 4 */ /***/ function(module, exports) { var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; var slice = Array.prototype.slice; var toStr = Object.prototype.toString; var funcType = '[object Function]'; module.exports = function bind(that) { var target = this; if (typeof target !== 'function' || toStr.call(target) !== funcType) { throw new TypeError(ERROR_MESSAGE + target); } var args = slice.call(arguments, 1); var bound; var binder = function () { if (this instanceof bound) { var result = target.apply( this, args.concat(slice.call(arguments)) ); if (Object(result) === result) { return result; } return this; } else { return target.apply( that, args.concat(slice.call(arguments)) ); } }; var boundLength = Math.max(0, target.length - args.length); var boundArgs = []; for (var i = 0; i < boundLength; i++) { boundArgs.push('$' + i); } bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); if (target.prototype) { var Empty = function Empty() {}; Empty.prototype = target.prototype; bound.prototype = new Empty(); Empty.prototype = null; } return bound; }; /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process, Buffer) {'use strict' function isArguments (obj) { return Object.prototype.toString.call(obj) === '[object Arguments]' } module.exports = match function match (obj, pattern) { return match_(obj, pattern, [], []) } /* istanbul ignore next */ var log = (/\btmatch\b/.test(process.env.NODE_DEBUG || '')) ? console.error : function () {} function match_ (obj, pattern, ca, cb) { log('TMATCH', typeof obj, pattern) if (obj == pattern) { log('TMATCH same object or simple value, or problem') // if one is object, and the other isn't, then this is bogus if (obj === null || pattern === null) { return true } else if (typeof obj === 'object' && typeof pattern === 'object') { return true } else if (typeof obj === 'object' && typeof pattern !== 'object') { return false } else if (typeof obj !== 'object' && typeof pattern === 'object') { return false } else { return true } } else if (obj === null || pattern === null) { log('TMATCH null test, already failed ==') return false } else if (typeof obj === 'string' && pattern instanceof RegExp) { log('TMATCH string~=regexp test') return pattern.test(obj) } else if (typeof obj === 'string' && typeof pattern === 'string' && pattern) { log('TMATCH string~=string test') return obj.indexOf(pattern) !== -1 } else if (obj instanceof Date && pattern instanceof Date) { log('TMATCH date test') return obj.getTime() === pattern.getTime() } else if (obj instanceof Date && typeof pattern === 'string') { log('TMATCH date~=string test') return obj.getTime() === new Date(pattern).getTime() } else if (isArguments(obj) || isArguments(pattern)) { log('TMATCH arguments test') var slice = Array.prototype.slice return match_(slice.call(obj), slice.call(pattern), ca, cb) } else if (pattern === Buffer) { log('TMATCH Buffer ctor') return Buffer.isBuffer(obj) } else if (pattern === Function) { log('TMATCH Function ctor') return typeof obj === 'function' } else if (pattern === Number) { log('TMATCH Number ctor (finite, not NaN)') return typeof obj === 'number' && obj === obj && isFinite(obj) } else if (pattern !== pattern) { log('TMATCH NaN') return obj !== obj } else if (pattern === String) { log('TMATCH String ctor') return typeof obj === 'string' } else if (pattern === Boolean) { log('TMATCH Boolean ctor') return typeof obj === 'boolean' } else if (pattern === Array) { log('TMATCH Array ctor', pattern, Array.isArray(obj)) return Array.isArray(obj) } else if (typeof pattern === 'function' && typeof obj === 'object') { log('TMATCH object~=function') return obj instanceof pattern } else if (typeof obj !== 'object' || typeof pattern !== 'object') { log('TMATCH obj is not object, pattern is not object, false') return false } else if (obj instanceof RegExp && pattern instanceof RegExp) { log('TMATCH regexp~=regexp test') return obj.source === pattern.source && obj.global === pattern.global && obj.multiline === pattern.multiline && obj.lastIndex === pattern.lastIndex && obj.ignoreCase === pattern.ignoreCase } else if (Buffer.isBuffer(obj) && Buffer.isBuffer(pattern)) { log('TMATCH buffer test') if (obj.equals) { return obj.equals(pattern) } else { if (obj.length !== pattern.length) return false for (var j = 0; j < obj.length; j++) if (obj[j] != pattern[j]) return false return true } } else { // both are objects. interesting case! log('TMATCH object~=object test') var kobj = Object.keys(obj) var kpat = Object.keys(pattern) log(' TMATCH patternkeys=%j objkeys=%j', kpat, kobj) // don't bother with stack acrobatics if there's nothing there if (kobj.length === 0 && kpat.length === 0) return true // if we've seen this exact pattern and object already, then // it means that pattern and obj have matching cyclicalness // however, non-cyclical patterns can match cyclical objects log(' TMATCH check seen objects...') var cal = ca.length while (cal--) if (ca[cal] === obj && cb[cal] === pattern) return true ca.push(obj); cb.push(pattern) log(' TMATCH not seen previously') var key for (var l = kpat.length - 1; l >= 0; l--) { key = kpat[l] log(' TMATCH test obj[%j]', key, obj[key], pattern[key]) if (!match_(obj[key], pattern[key], ca, cb)) return false } ca.pop() cb.pop() log(' TMATCH object pass') return true } /* istanbul ignore next */ throw new Error('impossible to reach this point') } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6), __webpack_require__(7).Buffer)) /***/ }, /* 6 */ /***/ function(module, exports) { // shim for using process in browser var process = module.exports = {}; var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = setTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; clearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { setTimeout(drainQueue, 0); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }, /* 7 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer, global) {/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ /* eslint-disable no-proto */ 'use strict' var base64 = __webpack_require__(8) var ieee754 = __webpack_require__(9) var isArray = __webpack_require__(10) exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer exports.INSPECT_MAX_BYTES = 50 Buffer.poolSize = 8192 // not used by this implementation var rootParent = {} /** * If `Buffer.TYPED_ARRAY_SUPPORT`: * === true Use Uint8Array implementation (fastest) * === false Use Object implementation (most compatible, even IE6) * * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, * Opera 11.6+, iOS 4.2+. * * Due to various browser bugs, sometimes the Object implementation will be used even * when the browser supports typed arrays. * * Note: * * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. * * - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property * on objects. * * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. * * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of * incorrect length in some situations. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they * get the Object implementation, which is slower but behaves correctly. */ Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport() function typedArraySupport () { function Bar () {} try { var arr = new Uint8Array(1) arr.foo = function () { return 42 } arr.constructor = Bar return arr.foo() === 42 && // typed array instances can be augmented arr.constructor === Bar && // constructor can be set typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` } catch (e) { return false } } function kMaxLength () { return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff } /** * Class: Buffer * ============= * * The Buffer constructor returns instances of `Uint8Array` that are augmented * with function properties for all the node `Buffer` API functions. We use * `Uint8Array` so that square bracket notation works as expected -- it returns * a single octet. * * By augmenting the instances, we can avoid modifying the `Uint8Array` * prototype. */ function Buffer (arg) { if (!(this instanceof Buffer)) { // Avoid going through an ArgumentsAdaptorTrampoline in the common case. if (arguments.length > 1) return new Buffer(arg, arguments[1]) return new Buffer(arg) } if (!Buffer.TYPED_ARRAY_SUPPORT) { this.length = 0 this.parent = undefined } // Common case. if (typeof arg === 'number') { return fromNumber(this, arg) } // Slightly less common case. if (typeof arg === 'string') { return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8') } // Unusual. return fromObject(this, arg) } function fromNumber (that, length) { that = allocate(that, length < 0 ? 0 : checked(length) | 0) if (!Buffer.TYPED_ARRAY_SUPPORT) { for (var i = 0; i < length; i++) { that[i] = 0 } } return that } function fromString (that, string, encoding) { if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8' // Assumption: byteLength() return value is always < kMaxLength. var length = byteLength(string, encoding) | 0 that = allocate(that, length) that.write(string, encoding) return that } function fromObject (that, object) { if (Buffer.isBuffer(object)) return fromBuffer(that, object) if (isArray(object)) return fromArray(that, object) if (object == null) { throw new TypeError('must start with number, buffer, array or string') } if (typeof ArrayBuffer !== 'undefined') { if (object.buffer instanceof ArrayBuffer) { return fromTypedArray(that, object) } if (object instanceof ArrayBuffer) { return fromArrayBuffer(that, object) } } if (object.length) return fromArrayLike(that, object) return fromJsonObject(that, object) } function fromBuffer (that, buffer) { var length = checked(buffer.length) | 0 that = allocate(that, length) buffer.copy(that, 0, 0, length) return that } function fromArray (that, array) { var length = checked(array.length) | 0 that = allocate(that, length) for (var i = 0; i < length; i += 1) { that[i] = array[i] & 255 } return that } // Duplicate of fromArray() to keep fromArray() monomorphic. function fromTypedArray (that, array) { var length = checked(array.length) | 0 that = allocate(that, length) // Truncating the elements is probably not what people expect from typed // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior // of the old Buffer constructor. for (var i = 0; i < length; i += 1) { that[i] = array[i] & 255 } return that } function fromArrayBuffer (that, array) { if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance array.byteLength that = Buffer._augment(new Uint8Array(array)) } else { // Fallback: Return an object instance of the Buffer class that = fromTypedArray(that, new Uint8Array(array)) } return that } function fromArrayLike (that, array) { var length = checked(array.length) | 0 that = allocate(that, length) for (var i = 0; i < length; i += 1) { that[i] = array[i] & 255 } return that } // Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object. // Returns a zero-length buffer for inputs that don't conform to the spec. function fromJsonObject (that, object) { var array var length = 0 if (object.type === 'Buffer' && isArray(object.data)) { array = object.data length = checked(array.length) | 0 } that = allocate(that, length) for (var i = 0; i < length; i += 1) { that[i] = array[i] & 255 } return that } if (Buffer.TYPED_ARRAY_SUPPORT) { Buffer.prototype.__proto__ = Uint8Array.prototype Buffer.__proto__ = Uint8Array } else { // pre-set for values that may exist in the future Buffer.prototype.length = undefined Buffer.prototype.parent = undefined } function allocate (that, length) { if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance that = Buffer._augment(new Uint8Array(length)) that.__proto__ = Buffer.prototype } else { // Fallback: Return an object instance of the Buffer class that.length = length that._isBuffer = true } var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1 if (fromPool) that.parent = rootParent return that } function checked (length) { // Note: cannot use `length < kMaxLength` here because that fails when // length is NaN (which is otherwise coerced to zero.) if (length >= kMaxLength()) { throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes') } return length | 0 } function SlowBuffer (subject, encoding) { if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding) var buf = new Buffer(subject, encoding) delete buf.parent return buf } Buffer.isBuffer = function isBuffer (b) { return !!(b != null && b._isBuffer) } Buffer.compare = function compare (a, b) { if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { throw new TypeError('Arguments must be Buffers') } if (a === b) return 0 var x = a.length var y = b.length var i = 0 var len = Math.min(x, y) while (i < len) { if (a[i] !== b[i]) break ++i } if (i !== len) { x = a[i] y = b[i] } if (x < y) return -1 if (y < x) return 1 return 0 } Buffer.isEncoding = function isEncoding (encoding) { switch (String(encoding).toLowerCase()) { case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'raw': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return true default: return false } } Buffer.concat = function concat (list, length) { if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.') if (list.length === 0) { return new Buffer(0) } var i if (length === undefined) { length = 0 for (i = 0; i < list.length; i++) { length += list[i].length } } var buf = new Buffer(length) var pos = 0 for (i = 0; i < list.length; i++) { var item = list[i] item.copy(buf, pos) pos += item.length } return buf } function byteLength (string, encoding) { if (typeof string !== 'string') string = '' + string var len = string.length if (len === 0) return 0 // Use a for loop to avoid recursion var loweredCase = false for (;;) { switch (encoding) { case 'ascii': case 'binary': // Deprecated case 'raw': case 'raws': return len case 'utf8': case 'utf-8': return utf8ToBytes(string).length case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return len * 2 case 'hex': return len >>> 1 case 'base64': return base64ToBytes(string).length default: if (loweredCase) return utf8ToBytes(string).length // assume utf8 encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.byteLength = byteLength function slowToString (encoding, start, end) { var loweredCase = false start = start | 0 end = end === undefined || end === Infinity ? this.length : end | 0 if (!encoding) encoding = 'utf8' if (start < 0) start = 0 if (end > this.length) end = this.length if (end <= start) return '' while (true) { switch (encoding) { case 'hex': return hexSlice(this, start, end) case 'utf8': case 'utf-8': return utf8Slice(this, start, end) case 'ascii': return asciiSlice(this, start, end) case 'binary': return binarySlice(this, start, end) case 'base64': return base64Slice(this, start, end) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return utf16leSlice(this, start, end) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = (encoding + '').toLowerCase() loweredCase = true } } } Buffer.prototype.toString = function toString () { var length = this.length | 0 if (length === 0) return '' if (arguments.length === 0) return utf8Slice(this, 0, length) return slowToString.apply(this, arguments) } Buffer.prototype.equals = function equals (b) { if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') if (this === b) return true return Buffer.compare(this, b) === 0 } Buffer.prototype.inspect = function inspect () { var str = '' var max = exports.INSPECT_MAX_BYTES if (this.length > 0) { str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') if (this.length > max) str += ' ... ' } return '' } Buffer.prototype.compare = function compare (b) { if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') if (this === b) return 0 return Buffer.compare(this, b) } Buffer.prototype.indexOf = function indexOf (val, byteOffset) { if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff else if (byteOffset < -0x80000000) byteOffset = -0x80000000 byteOffset >>= 0 if (this.length === 0) return -1 if (byteOffset >= this.length) return -1 // Negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0) if (typeof val === 'string') { if (val.length === 0) return -1 // special case: looking for empty string always fails return String.prototype.indexOf.call(this, val, byteOffset) } if (Buffer.isBuffer(val)) { return arrayIndexOf(this, val, byteOffset) } if (typeof val === 'number') { if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') { return Uint8Array.prototype.indexOf.call(this, val, byteOffset) } return arrayIndexOf(this, [ val ], byteOffset) } function arrayIndexOf (arr, val, byteOffset) { var foundIndex = -1 for (var i = 0; byteOffset + i < arr.length; i++) { if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) { if (foundIndex === -1) foundIndex = i if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex } else { foundIndex = -1 } } return -1 } throw new TypeError('val must be string, number or Buffer') } // `get` is deprecated Buffer.prototype.get = function get (offset) { console.log('.get() is deprecated. Access using array indexes instead.') return this.readUInt8(offset) } // `set` is deprecated Buffer.prototype.set = function set (v, offset) { console.log('.set() is deprecated. Access using array indexes instead.') return this.writeUInt8(v, offset) } function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 var remaining = buf.length - offset if (!length) { length = remaining } else { length = Number(length) if (length > remaining) { length = remaining } } // must be an even number of digits var strLen = string.length if (strLen % 2 !== 0) throw new Error('Invalid hex string') if (length > strLen / 2) { length = strLen / 2 } for (var i = 0; i < length; i++) { var parsed = parseInt(string.substr(i * 2, 2), 16) if (isNaN(parsed)) throw new Error('Invalid hex string') buf[offset + i] = parsed } return i } function utf8Write (buf, string, offset, length) { return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } function asciiWrite (buf, string, offset, length) { return blitBuffer(asciiToBytes(string), buf, offset, length) } function binaryWrite (buf, string, offset, length) { return asciiWrite(buf, string, offset, length) } function base64Write (buf, string, offset, length) { return blitBuffer(base64ToBytes(string), buf, offset, length) } function ucs2Write (buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } Buffer.prototype.write = function write (string, offset, length, encoding) { // Buffer#write(string) if (offset === undefined) { encoding = 'utf8' length = this.length offset = 0 // Buffer#write(string, encoding) } else if (length === undefined && typeof offset === 'string') { encoding = offset length = this.length offset = 0 // Buffer#write(string, offset[, length][, encoding]) } else if (isFinite(offset)) { offset = offset | 0 if (isFinite(length)) { length = length | 0 if (encoding === undefined) encoding = 'utf8' } else { encoding = length length = undefined } // legacy write(string, encoding, offset, length) - remove in v0.13 } else { var swap = encoding encoding = offset offset = length | 0 length = swap } var remaining = this.length - offset if (length === undefined || length > remaining) length = remaining if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { throw new RangeError('attempt to write outside buffer bounds') } if (!encoding) encoding = 'utf8' var loweredCase = false for (;;) { switch (encoding) { case 'hex': return hexWrite(this, string, offset, length) case 'utf8': case 'utf-8': return utf8Write(this, string, offset, length) case 'ascii': return asciiWrite(this, string, offset, length) case 'binary': return binaryWrite(this, string, offset, length) case 'base64': // Warning: maxLength not taken into account in base64Write return base64Write(this, string, offset, length) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return ucs2Write(this, string, offset, length) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.prototype.toJSON = function toJSON () { return { type: 'Buffer', data: Array.prototype.slice.call(this._arr || this, 0) } } function base64Slice (buf, start, end) { if (start === 0 && end === buf.length) { return base64.fromByteArray(buf) } else { return base64.fromByteArray(buf.slice(start, end)) } } function utf8Slice (buf, start, end) { end = Math.min(buf.length, end) var res = [] var i = start while (i < end) { var firstByte = buf[i] var codePoint = null var bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 : (firstByte > 0xBF) ? 2 : 1 if (i + bytesPerSequence <= end) { var secondByte, thirdByte, fourthByte, tempCodePoint switch (bytesPerSequence) { case 1: if (firstByte < 0x80) { codePoint = firstByte } break case 2: secondByte = buf[i + 1] if ((secondByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) if (tempCodePoint > 0x7F) { codePoint = tempCodePoint } } break case 3: secondByte = buf[i + 1] thirdByte = buf[i + 2] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { codePoint = tempCodePoint } } break case 4: secondByte = buf[i + 1] thirdByte = buf[i + 2] fourthByte = buf[i + 3] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { codePoint = tempCodePoint } } } } if (codePoint === null) { // we did not generate a valid codePoint so insert a // replacement char (U+FFFD) and advance only 1 byte codePoint = 0xFFFD bytesPerSequence = 1 } else if (codePoint > 0xFFFF) { // encode to utf16 (surrogate pair dance) codePoint -= 0x10000 res.push(codePoint >>> 10 & 0x3FF | 0xD800) codePoint = 0xDC00 | codePoint & 0x3FF } res.push(codePoint) i += bytesPerSequence } return decodeCodePointsArray(res) } // Based on http://stackoverflow.com/a/22747272/680742, the browser with // the lowest limit is Chrome, with 0x10000 args. // We go 1 magnitude less, for safety var MAX_ARGUMENTS_LENGTH = 0x1000 function decodeCodePointsArray (codePoints) { var len = codePoints.length if (len <= MAX_ARGUMENTS_LENGTH) { return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } // Decode in chunks to avoid "call stack size exceeded". var res = '' var i = 0 while (i < len) { res += String.fromCharCode.apply( String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) ) } return res } function asciiSlice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; i++) { ret += String.fromCharCode(buf[i] & 0x7F) } return ret } function binarySlice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; i++) { ret += String.fromCharCode(buf[i]) } return ret } function hexSlice (buf, start, end) { var len = buf.length if (!start || start < 0) start = 0 if (!end || end < 0 || end > len) end = len var out = '' for (var i = start; i < end; i++) { out += toHex(buf[i]) } return out } function utf16leSlice (buf, start, end) { var bytes = buf.slice(start, end) var res = '' for (var i = 0; i < bytes.length; i += 2) { res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) } return res } Buffer.prototype.slice = function slice (start, end) { var len = this.length start = ~~start end = end === undefined ? len : ~~end if (start < 0) { start += len if (start < 0) start = 0 } else if (start > len) { start = len } if (end < 0) { end += len if (end < 0) end = 0 } else if (end > len) { end = len } if (end < start) end = start var newBuf if (Buffer.TYPED_ARRAY_SUPPORT) { newBuf = Buffer._augment(this.subarray(start, end)) } else { var sliceLen = end - start newBuf = new Buffer(sliceLen, undefined) for (var i = 0; i < sliceLen; i++) { newBuf[i] = this[i + start] } } if (newBuf.length) newBuf.parent = this.parent || this return newBuf } /* * Need to make sure that buffer isn't trying to write out of bounds. */ function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') } Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } return val } Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { checkOffset(offset, byteLength, this.length) } var val = this[offset + --byteLength] var mul = 1 while (byteLength > 0 && (mul *= 0x100)) { val += this[offset + --byteLength] * mul } return val } Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length) return this[offset] } Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) return this[offset] | (this[offset + 1] << 8) } Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) return (this[offset] << 8) | this[offset + 1] } Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ((this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16)) + (this[offset + 3] * 0x1000000) } Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] * 0x1000000) + ((this[offset + 1] << 16) | (this[offset + 2] << 8) | this[offset + 3]) } Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var i = byteLength var mul = 1 var val = this[offset + --i] while (i > 0 && (mul *= 0x100)) { val += this[offset + --i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length) if (!(this[offset] & 0x80)) return (this[offset]) return ((0xff - this[offset] + 1) * -1) } Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset] | (this[offset + 1] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset + 1] | (this[offset] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16) | (this[offset + 3] << 24) } Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] << 24) | (this[offset + 1] << 16) | (this[offset + 2] << 8) | (this[offset + 3]) } Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, true, 23, 4) } Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, false, 23, 4) } Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, true, 52, 8) } Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, false, 52, 8) } function checkInt (buf, value, offset, ext, max, min) { if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance') if (value > max || value < min) throw new RangeError('value is out of bounds') if (offset + ext > buf.length) throw new RangeError('index out of range') } Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0) var mul = 1 var i = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0) var i = byteLength - 1 var mul = 1 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) this[offset] = (value & 0xff) return offset + 1 } function objectWriteUInt16 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffff + value + 1 for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) { buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> (littleEndian ? i : 1 - i) * 8 } } Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) } else { objectWriteUInt16(this, value, offset, true) } return offset + 2 } Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) } else { objectWriteUInt16(this, value, offset, false) } return offset + 2 } function objectWriteUInt32 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffffffff + value + 1 for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) { buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff } } Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset + 3] = (value >>> 24) this[offset + 2] = (value >>> 16) this[offset + 1] = (value >>> 8) this[offset] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, true) } return offset + 4 } Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, false) } return offset + 4 } Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = 0 var mul = 1 var sub = value < 0 ? 1 : 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = byteLength - 1 var mul = 1 var sub = value < 0 ? 1 : 0 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) if (value < 0) value = 0xff + value + 1 this[offset] = (value & 0xff) return offset + 1 } Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) } else { objectWriteUInt16(this, value, offset, true) } return offset + 2 } Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) } else { objectWriteUInt16(this, value, offset, false) } return offset + 2 } Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) this[offset + 2] = (value >>> 16) this[offset + 3] = (value >>> 24) } else { objectWriteUInt32(this, value, offset, true) } return offset + 4 } Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (value < 0) value = 0xffffffff + value + 1 if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, false) } return offset + 4 } function checkIEEE754 (buf, value, offset, ext, max, min) { if (value > max || value < min) throw new RangeError('value is out of bounds') if (offset + ext > buf.length) throw new RangeError('index out of range') if (offset < 0) throw new RangeError('index out of range') } function writeFloat (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) } ieee754.write(buf, value, offset, littleEndian, 23, 4) return offset + 4 } Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert) } Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert) } function writeDouble (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) } ieee754.write(buf, value, offset, littleEndian, 52, 8) return offset + 8 } Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert) } Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert) } // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function copy (target, targetStart, start, end) { if (!start) start = 0 if (!end && end !== 0) end = this.length if (targetStart >= target.length) targetStart = target.length if (!targetStart) targetStart = 0 if (end > 0 && end < start) end = start // Copy 0 bytes; we're done if (end === start) return 0 if (target.length === 0 || this.length === 0) return 0 // Fatal error conditions if (targetStart < 0) { throw new RangeError('targetStart out of bounds') } if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') if (end < 0) throw new RangeError('sourceEnd out of bounds') // Are we oob? if (end > this.length) end = this.length if (target.length - targetStart < end - start) { end = target.length - targetStart + start } var len = end - start var i if (this === target && start < targetStart && targetStart < end) { // descending copy from end for (i = len - 1; i >= 0; i--) { target[i + targetStart] = this[i + start] } } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { // ascending copy from start for (i = 0; i < len; i++) { target[i + targetStart] = this[i + start] } } else { target._set(this.subarray(start, start + len), targetStart) } return len } // fill(value, start=0, end=buffer.length) Buffer.prototype.fill = function fill (value, start, end) { if (!value) value = 0 if (!start) start = 0 if (!end) end = this.length if (end < start) throw new RangeError('end < start') // Fill 0 bytes; we're done if (end === start) return if (this.length === 0) return if (start < 0 || start >= this.length) throw new RangeError('start out of bounds') if (end < 0 || end > this.length) throw new RangeError('end out of bounds') var i if (typeof value === 'number') { for (i = start; i < end; i++) { this[i] = value } } else { var bytes = utf8ToBytes(value.toString()) var len = bytes.length for (i = start; i < end; i++) { this[i] = bytes[i % len] } } return this } /** * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance. * Added in Node 0.12. Only available in browsers that support ArrayBuffer. */ Buffer.prototype.toArrayBuffer = function toArrayBuffer () { if (typeof Uint8Array !== 'undefined') { if (Buffer.TYPED_ARRAY_SUPPORT) { return (new Buffer(this)).buffer } else { var buf = new Uint8Array(this.length) for (var i = 0, len = buf.length; i < len; i += 1) { buf[i] = this[i] } return buf.buffer } } else { throw new TypeError('Buffer.toArrayBuffer not supported in this browser') } } // HELPER FUNCTIONS // ================ var BP = Buffer.prototype /** * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods */ Buffer._augment = function _augment (arr) { arr.constructor = Buffer arr._isBuffer = true // save reference to original Uint8Array set method before overwriting arr._set = arr.set // deprecated arr.get = BP.get arr.set = BP.set arr.write = BP.write arr.toString = BP.toString arr.toLocaleString = BP.toString arr.toJSON = BP.toJSON arr.equals = BP.equals arr.compare = BP.compare arr.indexOf = BP.indexOf arr.copy = BP.copy arr.slice = BP.slice arr.readUIntLE = BP.readUIntLE arr.readUIntBE = BP.readUIntBE arr.readUInt8 = BP.readUInt8 arr.readUInt16LE = BP.readUInt16LE arr.readUInt16BE = BP.readUInt16BE arr.readUInt32LE = BP.readUInt32LE arr.readUInt32BE = BP.readUInt32BE arr.readIntLE = BP.readIntLE arr.readIntBE = BP.readIntBE arr.readInt8 = BP.readInt8 arr.readInt16LE = BP.readInt16LE arr.readInt16BE = BP.readInt16BE arr.readInt32LE = BP.readInt32LE arr.readInt32BE = BP.readInt32BE arr.readFloatLE = BP.readFloatLE arr.readFloatBE = BP.readFloatBE arr.readDoubleLE = BP.readDoubleLE arr.readDoubleBE = BP.readDoubleBE arr.writeUInt8 = BP.writeUInt8 arr.writeUIntLE = BP.writeUIntLE arr.writeUIntBE = BP.writeUIntBE arr.writeUInt16LE = BP.writeUInt16LE arr.writeUInt16BE = BP.writeUInt16BE arr.writeUInt32LE = BP.writeUInt32LE arr.writeUInt32BE = BP.writeUInt32BE arr.writeIntLE = BP.writeIntLE arr.writeIntBE = BP.writeIntBE arr.writeInt8 = BP.writeInt8 arr.writeInt16LE = BP.writeInt16LE arr.writeInt16BE = BP.writeInt16BE arr.writeInt32LE = BP.writeInt32LE arr.writeInt32BE = BP.writeInt32BE arr.writeFloatLE = BP.writeFloatLE arr.writeFloatBE = BP.writeFloatBE arr.writeDoubleLE = BP.writeDoubleLE arr.writeDoubleBE = BP.writeDoubleBE arr.fill = BP.fill arr.inspect = BP.inspect arr.toArrayBuffer = BP.toArrayBuffer return arr } var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g function base64clean (str) { // Node strips out invalid characters like \n and \t from the string, base64-js does not str = stringtrim(str).replace(INVALID_BASE64_RE, '') // Node converts strings with length < 2 to '' if (str.length < 2) return '' // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not while (str.length % 4 !== 0) { str = str + '=' } return str } function stringtrim (str) { if (str.trim) return str.trim() return str.replace(/^\s+|\s+$/g, '') } function toHex (n) { if (n < 16) return '0' + n.toString(16) return n.toString(16) } function utf8ToBytes (string, units) { units = units || Infinity var codePoint var length = string.length var leadSurrogate = null var bytes = [] for (var i = 0; i < length; i++) { codePoint = string.charCodeAt(i) // is surrogate component if (codePoint > 0xD7FF && codePoint < 0xE000) { // last char was a lead if (!leadSurrogate) { // no lead yet if (codePoint > 0xDBFF) { // unexpected trail if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } else if (i + 1 === length) { // unpaired lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } // valid lead leadSurrogate = codePoint continue } // 2 leads in a row if (codePoint < 0xDC00) { if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) leadSurrogate = codePoint continue } // valid surrogate pair codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 } else if (leadSurrogate) { // valid bmp char, but last char was a lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) } leadSurrogate = null // encode utf8 if (codePoint < 0x80) { if ((units -= 1) < 0) break bytes.push(codePoint) } else if (codePoint < 0x800) { if ((units -= 2) < 0) break bytes.push( codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x10000) { if ((units -= 3) < 0) break bytes.push( codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x110000) { if ((units -= 4) < 0) break bytes.push( codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else { throw new Error('Invalid code point') } } return bytes } function asciiToBytes (str) { var byteArray = [] for (var i = 0; i < str.length; i++) { // Node's code seems to be doing this and not & 0x7F.. byteArray.push(str.charCodeAt(i) & 0xFF) } return byteArray } function utf16leToBytes (str, units) { var c, hi, lo var byteArray = [] for (var i = 0; i < str.length; i++) { if ((units -= 2) < 0) break c = str.charCodeAt(i) hi = c >> 8 lo = c % 256 byteArray.push(lo) byteArray.push(hi) } return byteArray } function base64ToBytes (str) { return base64.toByteArray(base64clean(str)) } function blitBuffer (src, dst, offset, length) { for (var i = 0; i < length; i++) { if ((i + offset >= dst.length) || (i >= src.length)) break dst[i + offset] = src[i] } return i } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7).Buffer, (function() { return this; }()))) /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; ;(function (exports) { 'use strict'; var Arr = (typeof Uint8Array !== 'undefined') ? Uint8Array : Array var PLUS = '+'.charCodeAt(0) var SLASH = '/'.charCodeAt(0) var NUMBER = '0'.charCodeAt(0) var LOWER = 'a'.charCodeAt(0) var UPPER = 'A'.charCodeAt(0) var PLUS_URL_SAFE = '-'.charCodeAt(0) var SLASH_URL_SAFE = '_'.charCodeAt(0) function decode (elt) { var code = elt.charCodeAt(0) if (code === PLUS || code === PLUS_URL_SAFE) return 62 // '+' if (code === SLASH || code === SLASH_URL_SAFE) return 63 // '/' if (code < NUMBER) return -1 //no match if (code < NUMBER + 10) return code - NUMBER + 26 + 26 if (code < UPPER + 26) return code - UPPER if (code < LOWER + 26) return code - LOWER + 26 } function b64ToByteArray (b64) { var i, j, l, tmp, placeHolders, arr if (b64.length % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4') } // the number of equal signs (place holders) // if there are two placeholders, than the two characters before it // represent one byte // if there is only one, then the three characters before it represent 2 bytes // this is just a cheap hack to not do indexOf twice var len = b64.length placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0 // base64 is 4/3 + up to two characters of the original data arr = new Arr(b64.length * 3 / 4 - placeHolders) // if there are placeholders, only get up to the last complete 4 chars l = placeHolders > 0 ? b64.length - 4 : b64.length var L = 0 function push (v) { arr[L++] = v } for (i = 0, j = 0; i < l; i += 4, j += 3) { tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3)) push((tmp & 0xFF0000) >> 16) push((tmp & 0xFF00) >> 8) push(tmp & 0xFF) } if (placeHolders === 2) { tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4) push(tmp & 0xFF) } else if (placeHolders === 1) { tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2) push((tmp >> 8) & 0xFF) push(tmp & 0xFF) } return arr } function uint8ToBase64 (uint8) { var i, extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes output = "", temp, length function encode (num) { return lookup.charAt(num) } function tripletToBase64 (num) { return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F) } // go through the array every three bytes, we'll deal with trailing stuff later for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) { temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) output += tripletToBase64(temp) } // pad the end with zeros, but make sure to not forget the extra bytes switch (extraBytes) { case 1: temp = uint8[uint8.length - 1] output += encode(temp >> 2) output += encode((temp << 4) & 0x3F) output += '==' break case 2: temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]) output += encode(temp >> 10) output += encode((temp >> 4) & 0x3F) output += encode((temp << 2) & 0x3F) output += '=' break } return output } exports.toByteArray = b64ToByteArray exports.fromByteArray = uint8ToBase64 }( false ? (this.base64js = {}) : exports)) /***/ }, /* 9 */ /***/ function(module, exports) { exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = nBytes * 8 - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var nBits = -7 var i = isLE ? (nBytes - 1) : 0 var d = isLE ? -1 : 1 var s = buffer[offset + i] i += d e = s & ((1 << (-nBits)) - 1) s >>= (-nBits) nBits += eLen for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} m = e & ((1 << (-nBits)) - 1) e >>= (-nBits) nBits += mLen for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} if (e === 0) { e = 1 - eBias } else if (e === eMax) { return m ? NaN : ((s ? -1 : 1) * Infinity) } else { m = m + Math.pow(2, mLen) e = e - eBias } return (s ? -1 : 1) * m * Math.pow(2, e - mLen) } exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var e, m, c var eLen = nBytes * 8 - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) var i = isLE ? 0 : (nBytes - 1) var d = isLE ? 1 : -1 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 value = Math.abs(value) if (isNaN(value) || value === Infinity) { m = isNaN(value) ? 1 : 0 e = eMax } else { e = Math.floor(Math.log(value) / Math.LN2) if (value * (c = Math.pow(2, -e)) < 1) { e-- c *= 2 } if (e + eBias >= 1) { value += rt / c } else { value += rt * Math.pow(2, 1 - eBias) } if (value * c >= 2) { e++ c /= 2 } if (e + eBias >= eMax) { m = 0 e = eMax } else if (e + eBias >= 1) { m = (value * c - 1) * Math.pow(2, mLen) e = e + eBias } else { m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) e = 0 } } for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} e = (e << mLen) | m eLen += mLen for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} buffer[offset + i - d] |= s * 128 } /***/ }, /* 10 */ /***/ function(module, exports) { var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; /***/ }, /* 11 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _objectInspect = __webpack_require__(12); var _objectInspect2 = _interopRequireDefault(_objectInspect); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var formatString = function formatString(string, args) { var index = 0; return string.replace(/%s/g, function () { return (0, _objectInspect2.default)(args[index++]); }); }; var assert = function assert(condition, createMessage) { for (var _len = arguments.length, extraArgs = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { extraArgs[_key - 2] = arguments[_key]; } if (condition) return; var message = typeof createMessage === 'string' ? formatString(createMessage, extraArgs) : createMessage(extraArgs); throw new Error(message); }; exports.default = assert; /***/ }, /* 12 */ /***/ function(module, exports) { var hasMap = typeof Map === 'function' && Map.prototype; var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null; var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null; var mapForEach = hasMap && Map.prototype.forEach; var hasSet = typeof Set === 'function' && Set.prototype; var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null; var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null; var setForEach = hasSet && Set.prototype.forEach; var booleanValueOf = Boolean.prototype.valueOf; module.exports = function inspect_ (obj, opts, depth, seen) { if (!opts) opts = {}; var maxDepth = opts.depth === undefined ? 5 : opts.depth; if (depth === undefined) depth = 0; if (depth >= maxDepth && maxDepth > 0 && obj && typeof obj === 'object') { return '[Object]'; } if (seen === undefined) seen = []; else if (indexOf(seen, obj) >= 0) { return '[Circular]'; } function inspect (value, from) { if (from) { seen = seen.slice(); seen.push(from); } return inspect_(value, opts, depth + 1, seen); } if (typeof obj === 'string') { return inspectString(obj); } else if (typeof obj === 'function') { var name = nameOf(obj); return '[Function' + (name ? ': ' + name : '') + ']'; } else if (obj === null) { return 'null'; } else if (isSymbol(obj)) { var symString = Symbol.prototype.toString.call(obj); return typeof obj === 'object' ? 'Object(' + symString + ')' : symString; } else if (isElement(obj)) { var s = '<' + String(obj.nodeName).toLowerCase(); var attrs = obj.attributes || []; for (var i = 0; i < attrs.length; i++) { s += ' ' + attrs[i].name + '="' + quote(attrs[i].value) + '"'; } s += '>'; if (obj.childNodes && obj.childNodes.length) s += '...'; s += ''; return s; } else if (isArray(obj)) { if (obj.length === 0) return '[]'; var xs = Array(obj.length); for (var i = 0; i < obj.length; i++) { xs[i] = has(obj, i) ? inspect(obj[i], obj) : ''; } return '[ ' + xs.join(', ') + ' ]'; } else if (isError(obj)) { var parts = []; for (var key in obj) { if (!has(obj, key)) continue; if (/[^\w$]/.test(key)) { parts.push(inspect(key) + ': ' + inspect(obj[key])); } else { parts.push(key + ': ' + inspect(obj[key])); } } if (parts.length === 0) return '[' + obj + ']'; return '{ [' + obj + '] ' + parts.join(', ') + ' }'; } else if (typeof obj === 'object' && typeof obj.inspect === 'function') { return obj.inspect(); } else if (isMap(obj)) { var parts = []; mapForEach.call(obj, function (value, key) { parts.push(inspect(key, obj) + ' => ' + inspect(value, obj)); }); return 'Map (' + mapSize.call(obj) + ') {' + parts.join(', ') + '}'; } else if (isSet(obj)) { var parts = []; setForEach.call(obj, function (value ) { parts.push(inspect(value, obj)); }); return 'Set (' + setSize.call(obj) + ') {' + parts.join(', ') + '}'; } else if (typeof obj !== 'object') { return String(obj); } else if (isNumber(obj)) { return 'Object(' + Number(obj) + ')'; } else if (isBoolean(obj)) { return 'Object(' + booleanValueOf.call(obj) + ')'; } else if (isString(obj)) { return 'Object(' + inspect(String(obj)) + ')'; } else if (!isDate(obj) && !isRegExp(obj)) { var xs = [], keys = []; for (var key in obj) { if (has(obj, key)) keys.push(key); } keys.sort(); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (/[^\w$]/.test(key)) { xs.push(inspect(key) + ': ' + inspect(obj[key], obj)); } else xs.push(key + ': ' + inspect(obj[key], obj)); } if (xs.length === 0) return '{}'; return '{ ' + xs.join(', ') + ' }'; } else return String(obj); }; function quote (s) { return String(s).replace(/"/g, '"'); } function isArray (obj) { return toStr(obj) === '[object Array]' } function isDate (obj) { return toStr(obj) === '[object Date]' } function isRegExp (obj) { return toStr(obj) === '[object RegExp]' } function isError (obj) { return toStr(obj) === '[object Error]' } function isSymbol (obj) { return toStr(obj) === '[object Symbol]' } function isString (obj) { return toStr(obj) === '[object String]' } function isNumber (obj) { return toStr(obj) === '[object Number]' } function isBoolean (obj) { return toStr(obj) === '[object Boolean]' } var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; }; function has (obj, key) { return hasOwn.call(obj, key); } function toStr (obj) { return Object.prototype.toString.call(obj); } function nameOf (f) { if (f.name) return f.name; var m = f.toString().match(/^function\s*([\w$]+)/); if (m) return m[1]; } function indexOf (xs, x) { if (xs.indexOf) return xs.indexOf(x); for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) return i; } return -1; } function isMap (x) { if (!mapSize) { return false; } try { mapSize.call(x); return true; } catch (e) {} return false; } function isSet (x) { if (!setSize) { return false; } try { setSize.call(x); return true; } catch (e) {} return false; } function isElement (x) { if (!x || typeof x !== 'object') return false; if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) { return true; } return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function' ; } function inspectString (str) { var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte); return "'" + s + "'"; function lowbyte (c) { var n = c.charCodeAt(0); var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n]; if (x) return '\\' + x; return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16); } } /***/ }, /* 13 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.spyOn = exports.createSpy = exports.restoreSpies = exports.isSpy = undefined; var _defineProperties = __webpack_require__(14); var _assert = __webpack_require__(11); var _assert2 = _interopRequireDefault(_assert); var _TestUtils = __webpack_require__(18); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } /*eslint-disable prefer-rest-params, no-underscore-dangle*/ var noop = function noop() {}; var supportsConfigurableFnLength = _defineProperties.supportsDescriptors && Object.getOwnPropertyDescriptor(function () {}, 'length').configurable; var isSpy = exports.isSpy = function isSpy(object) { return object && object.__isSpy === true; }; var spies = []; var restoreSpies = exports.restoreSpies = function restoreSpies() { for (var i = spies.length - 1; i >= 0; i--) { spies[i].restore(); }spies = []; }; var createSpy = exports.createSpy = function createSpy(fn) { var restore = arguments.length <= 1 || arguments[1] === undefined ? noop : arguments[1]; if (fn == null) fn = noop; (0, _assert2.default)((0, _TestUtils.isFunction)(fn), 'createSpy needs a function'); var targetFn = void 0, thrownValue = void 0, returnValue = void 0, spy = void 0; function spyLogic() { spy.calls.push({ context: this, arguments: Array.prototype.slice.call(arguments, 0) }); if (targetFn) return targetFn.apply(this, arguments); if (thrownValue) throw thrownValue; return returnValue; } if (supportsConfigurableFnLength) { spy = Object.defineProperty(spyLogic, 'length', { value: fn.length, writable: false, enumerable: false, configurable: true }); } else { spy = new Function('spy', 'return function(' + // eslint-disable-line no-new-func [].concat(_toConsumableArray(Array(fn.length))).map(function (_, i) { return '_' + i; }).join(',') + ') {\n return spy.apply(this, arguments)\n }')(spyLogic); } spy.calls = []; spy.andCall = function (otherFn) { targetFn = otherFn; return spy; }; spy.andCallThrough = function () { return spy.andCall(fn); }; spy.andThrow = function (value) { thrownValue = value; return spy; }; spy.andReturn = function (value) { returnValue = value; return spy; }; spy.getLastCall = function () { return spy.calls[spy.calls.length - 1]; }; spy.reset = function () { spy.calls = []; }; spy.restore = spy.destroy = restore; spy.__isSpy = true; spies.push(spy); return spy; }; var spyOn = exports.spyOn = function spyOn(object, methodName) { var original = object[methodName]; if (!isSpy(original)) { (0, _assert2.default)((0, _TestUtils.isFunction)(original), 'Cannot spyOn the %s property; it is not a function', methodName); object[methodName] = createSpy(original, function () { object[methodName] = original; }); } return object[methodName]; }; /***/ }, /* 14 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var keys = __webpack_require__(15); var foreach = __webpack_require__(17); var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; var toStr = Object.prototype.toString; var isFunction = function (fn) { return typeof fn === 'function' && toStr.call(fn) === '[object Function]'; }; var arePropertyDescriptorsSupported = function () { var obj = {}; try { Object.defineProperty(obj, 'x', { enumerable: false, value: obj }); /* eslint-disable no-unused-vars, no-restricted-syntax */ for (var _ in obj) { return false; } /* eslint-enable no-unused-vars, no-restricted-syntax */ return obj.x === obj; } catch (e) { /* this is IE 8. */ return false; } }; var supportsDescriptors = Object.defineProperty && arePropertyDescriptorsSupported(); var defineProperty = function (object, name, value, predicate) { if (name in object && (!isFunction(predicate) || !predicate())) { return; } if (supportsDescriptors) { Object.defineProperty(object, name, { configurable: true, enumerable: false, value: value, writable: true }); } else { object[name] = value; } }; var defineProperties = function (object, map) { var predicates = arguments.length > 2 ? arguments[2] : {}; var props = keys(map); if (hasSymbols) { props = props.concat(Object.getOwnPropertySymbols(map)); } foreach(props, function (name) { defineProperty(object, name, map[name], predicates[name]); }); }; defineProperties.supportsDescriptors = !!supportsDescriptors; module.exports = defineProperties; /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // modified from https://github.com/es-shims/es5-shim var has = Object.prototype.hasOwnProperty; var toStr = Object.prototype.toString; var slice = Array.prototype.slice; var isArgs = __webpack_require__(16); var hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'); var hasProtoEnumBug = function () {}.propertyIsEnumerable('prototype'); var dontEnums = [ 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor' ]; var equalsConstructorPrototype = function (o) { var ctor = o.constructor; return ctor && ctor.prototype === o; }; var blacklistedKeys = { $console: true, $frame: true, $frameElement: true, $frames: true, $parent: true, $self: true, $webkitIndexedDB: true, $webkitStorageInfo: true, $window: true }; var hasAutomationEqualityBug = (function () { /* global window */ if (typeof window === 'undefined') { return false; } for (var k in window) { try { if (!blacklistedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { try { equalsConstructorPrototype(window[k]); } catch (e) { return true; } } } catch (e) { return true; } } return false; }()); var equalsConstructorPrototypeIfNotBuggy = function (o) { /* global window */ if (typeof window === 'undefined' || !hasAutomationEqualityBug) { return equalsConstructorPrototype(o); } try { return equalsConstructorPrototype(o); } catch (e) { return false; } }; var keysShim = function keys(object) { var isObject = object !== null && typeof object === 'object'; var isFunction = toStr.call(object) === '[object Function]'; var isArguments = isArgs(object); var isString = isObject && toStr.call(object) === '[object String]'; var theKeys = []; if (!isObject && !isFunction && !isArguments) { throw new TypeError('Object.keys called on a non-object'); } var skipProto = hasProtoEnumBug && isFunction; if (isString && object.length > 0 && !has.call(object, 0)) { for (var i = 0; i < object.length; ++i) { theKeys.push(String(i)); } } if (isArguments && object.length > 0) { for (var j = 0; j < object.length; ++j) { theKeys.push(String(j)); } } else { for (var name in object) { if (!(skipProto && name === 'prototype') && has.call(object, name)) { theKeys.push(String(name)); } } } if (hasDontEnumBug) { var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); for (var k = 0; k < dontEnums.length; ++k) { if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { theKeys.push(dontEnums[k]); } } } return theKeys; }; keysShim.shim = function shimObjectKeys() { if (Object.keys) { var keysWorksWithArguments = (function () { // Safari 5.0 bug return (Object.keys(arguments) || '').length === 2; }(1, 2)); if (!keysWorksWithArguments) { var originalKeys = Object.keys; Object.keys = function keys(object) { if (isArgs(object)) { return originalKeys(slice.call(object)); } else { return originalKeys(object); } }; } } else { Object.keys = keysShim; } return Object.keys || keysShim; }; module.exports = keysShim; /***/ }, /* 16 */ /***/ function(module, exports) { 'use strict'; var toStr = Object.prototype.toString; module.exports = function isArguments(value) { var str = toStr.call(value); var isArgs = str === '[object Arguments]'; if (!isArgs) { isArgs = str !== '[object Array]' && value !== null && typeof value === 'object' && typeof value.length === 'number' && value.length >= 0 && toStr.call(value.callee) === '[object Function]'; } return isArgs; }; /***/ }, /* 17 */ /***/ function(module, exports) { var hasOwn = Object.prototype.hasOwnProperty; var toString = Object.prototype.toString; module.exports = function forEach (obj, fn, ctx) { if (toString.call(fn) !== '[object Function]') { throw new TypeError('iterator must be a function'); } var l = obj.length; if (l === +l) { for (var i = 0; i < l; i++) { fn.call(ctx, obj[i], i, obj); } } else { for (var k in obj) { if (hasOwn.call(obj, k)) { fn.call(ctx, obj[k], k, obj); } } } }; /***/ }, /* 18 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.stringContains = exports.objectContains = exports.arrayContains = exports.functionThrows = exports.isA = exports.isObject = exports.isArray = exports.isFunction = exports.isEqual = exports.whyNotEqual = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; var _isRegex = __webpack_require__(19); var _isRegex2 = _interopRequireDefault(_isRegex); var _why = __webpack_require__(20); var _why2 = _interopRequireDefault(_why); var _objectKeys = __webpack_require__(15); var _objectKeys2 = _interopRequireDefault(_objectKeys); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Returns the reason why the given arguments are not *conceptually* * equal, if any; the empty string otherwise. */ var whyNotEqual = exports.whyNotEqual = function whyNotEqual(a, b) { return a == b ? '' : (0, _why2.default)(a, b); }; /** * Returns true if the given arguments are *conceptually* equal. */ var isEqual = exports.isEqual = function isEqual(a, b) { return whyNotEqual(a, b) === ''; }; /** * Returns true if the given object is a function. */ var isFunction = exports.isFunction = function isFunction(object) { return typeof object === 'function'; }; /** * Returns true if the given object is an array. */ var isArray = exports.isArray = function isArray(object) { return Array.isArray(object); }; /** * Returns true if the given object is an object. */ var isObject = exports.isObject = function isObject(object) { return object && !isArray(object) && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object'; }; /** * Returns true if the given object is an instanceof value * or its typeof is the given value. */ var isA = exports.isA = function isA(object, value) { if (isFunction(value)) return object instanceof value; if (value === 'array') return Array.isArray(object); return (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === value; }; /** * Returns true if the given function throws the given value * when invoked. The value may be: * * - undefined, to merely assert there was a throw * - a constructor function, for comparing using instanceof * - a regular expression, to compare with the error message * - a string, to find in the error message */ var functionThrows = exports.functionThrows = function functionThrows(fn, context, args, value) { try { fn.apply(context, args); } catch (error) { if (value == null) return true; if (isFunction(value) && error instanceof value) return true; var message = error.message || error; if (typeof message === 'string') { if ((0, _isRegex2.default)(value) && value.test(error.message)) return true; if (typeof value === 'string' && message.indexOf(value) !== -1) return true; } } return false; }; /** * Returns true if the given array contains the value, false * otherwise. The compareValues function must return false to * indicate a non-match. */ var arrayContains = exports.arrayContains = function arrayContains(array, value, compareValues) { return array.some(function (item) { return compareValues(item, value) !== false; }); }; var ownEnumerableKeys = function ownEnumerableKeys(object) { if ((typeof Reflect === 'undefined' ? 'undefined' : _typeof(Reflect)) === 'object' && typeof Reflect.ownKeys === 'function') { return Reflect.ownKeys(object).filter(function (key) { return Object.getOwnPropertyDescriptor(object, key).enumerable; }); } if (typeof Object.getOwnPropertySymbols === 'function') { return Object.getOwnPropertySymbols(object).filter(function (key) { return Object.getOwnPropertyDescriptor(object, key).enumerable; }).concat((0, _objectKeys2.default)(object)); } return (0, _objectKeys2.default)(object); }; /** * Returns true if the given object contains the value, false * otherwise. The compareValues function must return false to * indicate a non-match. */ var objectContains = exports.objectContains = function objectContains(object, value, compareValues) { return ownEnumerableKeys(value).every(function (k) { if (isObject(object[k]) && isObject(value[k])) return objectContains(object[k], value[k], compareValues); return compareValues(object[k], value[k]); }); }; /** * Returns true if the given string contains the value, false otherwise. */ var stringContains = exports.stringContains = function stringContains(string, value) { return string.indexOf(value) !== -1; }; /***/ }, /* 19 */ /***/ function(module, exports) { 'use strict'; var regexExec = RegExp.prototype.exec; var tryRegexExec = function tryRegexExec(value) { try { regexExec.call(value); return true; } catch (e) { return false; } }; var toStr = Object.prototype.toString; var regexClass = '[object RegExp]'; var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; module.exports = function isRegex(value) { if (typeof value !== 'object') { return false; } return hasToStringTag ? tryRegexExec(value) : toStr.call(value) === regexClass; }; /***/ }, /* 20 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var ObjectPrototype = Object.prototype; var toStr = ObjectPrototype.toString; var booleanValue = Boolean.prototype.valueOf; var has = __webpack_require__(2); var isArrowFunction = __webpack_require__(21); var isBoolean = __webpack_require__(23); var isDate = __webpack_require__(24); var isGenerator = __webpack_require__(25); var isNumber = __webpack_require__(26); var isRegex = __webpack_require__(19); var isString = __webpack_require__(27); var isSymbol = __webpack_require__(28); var isCallable = __webpack_require__(22); var isProto = Object.prototype.isPrototypeOf; var foo = function foo() {}; var functionsHaveNames = foo.name === 'foo'; var symbolValue = typeof Symbol === 'function' ? Symbol.prototype.valueOf : null; var symbolIterator = __webpack_require__(29)(); var collectionsForEach = __webpack_require__(30)(); var getPrototypeOf = Object.getPrototypeOf; if (!getPrototypeOf) { /* eslint-disable no-proto */ if (typeof 'test'.__proto__ === 'object') { getPrototypeOf = function (obj) { return obj.__proto__; }; } else { getPrototypeOf = function (obj) { var constructor = obj.constructor, oldConstructor; if (has(obj, 'constructor')) { oldConstructor = constructor; if (!(delete obj.constructor)) { // reset constructor return null; // can't delete obj.constructor, return null } constructor = obj.constructor; // get real constructor obj.constructor = oldConstructor; // restore constructor } return constructor ? constructor.prototype : ObjectPrototype; // needed for IE }; } /* eslint-enable no-proto */ } var isArray = Array.isArray || function (value) { return toStr.call(value) === '[object Array]'; }; var normalizeFnWhitespace = function normalizeFnWhitespace(fnStr) { // this is needed in IE 9, at least, which has inconsistencies here. return fnStr.replace(/^function ?\(/, 'function (').replace('){', ') {'); }; var tryMapSetEntries = function tryMapSetEntries(collection) { var foundEntries = []; try { collectionsForEach.Map.call(collection, function (key, value) { foundEntries.push([key, value]); }); } catch (notMap) { try { collectionsForEach.Set.call(collection, function (value) { foundEntries.push([value]); }); } catch (notSet) { return false; } } return foundEntries; }; module.exports = function whyNotEqual(value, other) { if (value === other) { return ''; } if (value == null || other == null) { return value === other ? '' : String(value) + ' !== ' + String(other); } var valToStr = toStr.call(value); var otherToStr = toStr.call(other); if (valToStr !== otherToStr) { return 'toStringTag is not the same: ' + valToStr + ' !== ' + otherToStr; } var valIsBool = isBoolean(value); var otherIsBool = isBoolean(other); if (valIsBool || otherIsBool) { if (!valIsBool) { return 'first argument is not a boolean; second argument is'; } if (!otherIsBool) { return 'second argument is not a boolean; first argument is'; } var valBoolVal = booleanValue.call(value); var otherBoolVal = booleanValue.call(other); if (valBoolVal === otherBoolVal) { return ''; } return 'primitive value of boolean arguments do not match: ' + valBoolVal + ' !== ' + otherBoolVal; } var valIsNumber = isNumber(value); var otherIsNumber = isNumber(value); if (valIsNumber || otherIsNumber) { if (!valIsNumber) { return 'first argument is not a number; second argument is'; } if (!otherIsNumber) { return 'second argument is not a number; first argument is'; } var valNum = Number(value); var otherNum = Number(other); if (valNum === otherNum) { return ''; } var valIsNaN = isNaN(value); var otherIsNaN = isNaN(other); if (valIsNaN && !otherIsNaN) { return 'first argument is NaN; second is not'; } else if (!valIsNaN && otherIsNaN) { return 'second argument is NaN; first is not'; } else if (valIsNaN && otherIsNaN) { return ''; } return 'numbers are different: ' + value + ' !== ' + other; } var valIsString = isString(value); var otherIsString = isString(other); if (valIsString || otherIsString) { if (!valIsString) { return 'second argument is string; first is not'; } if (!otherIsString) { return 'first argument is string; second is not'; } var stringVal = String(value); var otherVal = String(other); if (stringVal === otherVal) { return ''; } return 'string values are different: "' + stringVal + '" !== "' + otherVal + '"'; } var valIsDate = isDate(value); var otherIsDate = isDate(other); if (valIsDate || otherIsDate) { if (!valIsDate) { return 'second argument is Date, first is not'; } if (!otherIsDate) { return 'first argument is Date, second is not'; } var valTime = +value; var otherTime = +other; if (valTime === otherTime) { return ''; } return 'Dates have different time values: ' + valTime + ' !== ' + otherTime; } var valIsRegex = isRegex(value); var otherIsRegex = isRegex(other); if (valIsRegex || otherIsRegex) { if (!valIsRegex) { return 'second argument is RegExp, first is not'; } if (!otherIsRegex) { return 'first argument is RegExp, second is not'; } var regexStringVal = String(value); var regexStringOther = String(other); if (regexStringVal === regexStringOther) { return ''; } return 'regular expressions differ: ' + regexStringVal + ' !== ' + regexStringOther; } var valIsArray = isArray(value); var otherIsArray = isArray(other); if (valIsArray || otherIsArray) { if (!valIsArray) { return 'second argument is an Array, first is not'; } if (!otherIsArray) { return 'first argument is an Array, second is not'; } if (value.length !== other.length) { return 'arrays have different length: ' + value.length + ' !== ' + other.length; } if (String(value) !== String(other)) { return 'stringified Arrays differ'; } var index = value.length - 1; var equal = ''; var valHasIndex, otherHasIndex; while (equal === '' && index >= 0) { valHasIndex = has(value, index); otherHasIndex = has(other, index); if (!valHasIndex && otherHasIndex) { return 'second argument has index ' + index + '; first does not'; } if (valHasIndex && !otherHasIndex) { return 'first argument has index ' + index + '; second does not'; } equal = whyNotEqual(value[index], other[index]); index -= 1; } return equal; } var valueIsSym = isSymbol(value); var otherIsSym = isSymbol(other); if (valueIsSym !== otherIsSym) { if (valueIsSym) { return 'first argument is Symbol; second is not'; } return 'second argument is Symbol; first is not'; } if (valueIsSym && otherIsSym) { return symbolValue.call(value) === symbolValue.call(other) ? '' : 'first Symbol value !== second Symbol value'; } var valueIsGen = isGenerator(value); var otherIsGen = isGenerator(other); if (valueIsGen !== otherIsGen) { if (valueIsGen) { return 'first argument is a Generator; second is not'; } return 'second argument is a Generator; first is not'; } var valueIsArrow = isArrowFunction(value); var otherIsArrow = isArrowFunction(other); if (valueIsArrow !== otherIsArrow) { if (valueIsArrow) { return 'first argument is an Arrow function; second is not'; } return 'second argument is an Arrow function; first is not'; } if (isCallable(value) || isCallable(other)) { if (functionsHaveNames && whyNotEqual(value.name, other.name) !== '') { return 'Function names differ: "' + value.name + '" !== "' + other.name + '"'; } if (whyNotEqual(value.length, other.length) !== '') { return 'Function lengths differ: ' + value.length + ' !== ' + other.length; } var valueStr = normalizeFnWhitespace(String(value)); var otherStr = normalizeFnWhitespace(String(other)); if (whyNotEqual(valueStr, otherStr) === '') { return ''; } if (!valueIsGen && !valueIsArrow) { return whyNotEqual(valueStr.replace(/\)\s*\{/, '){'), otherStr.replace(/\)\s*\{/, '){')) === '' ? '' : 'Function string representations differ'; } return whyNotEqual(valueStr, otherStr) === '' ? '' : 'Function string representations differ'; } if (typeof value === 'object' || typeof other === 'object') { if (typeof value !== typeof other) { return 'arguments have a different typeof: ' + typeof value + ' !== ' + typeof other; } if (isProto.call(value, other)) { return 'first argument is the [[Prototype]] of the second'; } if (isProto.call(other, value)) { return 'second argument is the [[Prototype]] of the first'; } if (getPrototypeOf(value) !== getPrototypeOf(other)) { return 'arguments have a different [[Prototype]]'; } if (symbolIterator) { var valueIteratorFn = value[symbolIterator]; var valueIsIterable = isCallable(valueIteratorFn); var otherIteratorFn = other[symbolIterator]; var otherIsIterable = isCallable(otherIteratorFn); if (valueIsIterable !== otherIsIterable) { if (valueIsIterable) { return 'first argument is iterable; second is not'; } return 'second argument is iterable; first is not'; } if (valueIsIterable && otherIsIterable) { var valueIterator = valueIteratorFn.call(value); var otherIterator = otherIteratorFn.call(other); var valueNext, otherNext, nextWhy; do { valueNext = valueIterator.next(); otherNext = otherIterator.next(); if (!valueNext.done && !otherNext.done) { nextWhy = whyNotEqual(valueNext, otherNext); if (nextWhy !== '') { return 'iteration results are not equal: ' + nextWhy; } } } while (!valueNext.done && !otherNext.done); if (valueNext.done && !otherNext.done) { return 'first argument finished iterating before second'; } if (!valueNext.done && otherNext.done) { return 'second argument finished iterating before first'; } return ''; } } else if (collectionsForEach.Map || collectionsForEach.Set) { var valueEntries = tryMapSetEntries(value); var otherEntries = tryMapSetEntries(other); var valueEntriesIsArray = isArray(valueEntries); var otherEntriesIsArray = isArray(otherEntries); if (valueEntriesIsArray && !otherEntriesIsArray) { return 'first argument has Collection entries, second does not'; } if (!valueEntriesIsArray && otherEntriesIsArray) { return 'second argument has Collection entries, first does not'; } if (valueEntriesIsArray && otherEntriesIsArray) { var entriesWhy = whyNotEqual(valueEntries, otherEntries); return entriesWhy === '' ? '' : 'Collection entries differ: ' + entriesWhy; } } var key, valueKeyIsRecursive, otherKeyIsRecursive, keyWhy; for (key in value) { if (has(value, key)) { if (!has(other, key)) { return 'first argument has key "' + key + '"; second does not'; } valueKeyIsRecursive = !!value[key] && value[key][key] === value; otherKeyIsRecursive = !!other[key] && other[key][key] === other; if (valueKeyIsRecursive !== otherKeyIsRecursive) { if (valueKeyIsRecursive) { return 'first argument has a circular reference at key "' + key + '"; second does not'; } return 'second argument has a circular reference at key "' + key + '"; first does not'; } if (!valueKeyIsRecursive && !otherKeyIsRecursive) { keyWhy = whyNotEqual(value[key], other[key]); if (keyWhy !== '') { return 'value at key "' + key + '" differs: ' + keyWhy; } } } } for (key in other) { if (has(other, key) && !has(value, key)) { return 'second argument has key "' + key + '"; first does not'; } } return ''; } return false; }; /***/ }, /* 21 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var isCallable = __webpack_require__(22); var fnToStr = Function.prototype.toString; var isNonArrowFnRegex = /^\s*function/; var isArrowFnWithParensRegex = /^\([^\)]*\) *=>/; var isArrowFnWithoutParensRegex = /^[^=]*=>/; module.exports = function isArrowFunction(fn) { if (!isCallable(fn)) { return false; } var fnStr = fnToStr.call(fn); return fnStr.length > 0 && !isNonArrowFnRegex.test(fnStr) && (isArrowFnWithParensRegex.test(fnStr) || isArrowFnWithoutParensRegex.test(fnStr)); }; /***/ }, /* 22 */ /***/ function(module, exports) { 'use strict'; var fnToStr = Function.prototype.toString; var constructorRegex = /^\s*class /; var isES6ClassFn = function isES6ClassFn(value) { try { var fnStr = fnToStr.call(value); var singleStripped = fnStr.replace(/\/\/.*\n/g, ''); var multiStripped = singleStripped.replace(/\/\*[.\s\S]*\*\//g, ''); var spaceStripped = multiStripped.replace(/\n/mg, ' ').replace(/ {2}/g, ' '); return constructorRegex.test(spaceStripped); } catch (e) { return false; // not a function } }; var tryFunctionObject = function tryFunctionObject(value) { try { if (isES6ClassFn(value)) { return false; } fnToStr.call(value); return true; } catch (e) { return false; } }; var toStr = Object.prototype.toString; var fnClass = '[object Function]'; var genClass = '[object GeneratorFunction]'; var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; module.exports = function isCallable(value) { if (!value) { return false; } if (typeof value !== 'function' && typeof value !== 'object') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } if (isES6ClassFn(value)) { return false; } var strClass = toStr.call(value); return strClass === fnClass || strClass === genClass; }; /***/ }, /* 23 */ /***/ function(module, exports) { 'use strict'; var boolToStr = Boolean.prototype.toString; var tryBooleanObject = function tryBooleanObject(value) { try { boolToStr.call(value); return true; } catch (e) { return false; } }; var toStr = Object.prototype.toString; var boolClass = '[object Boolean]'; var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; module.exports = function isBoolean(value) { if (typeof value === 'boolean') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryBooleanObject(value) : toStr.call(value) === boolClass; }; /***/ }, /* 24 */ /***/ function(module, exports) { 'use strict'; var getDay = Date.prototype.getDay; var tryDateObject = function tryDateObject(value) { try { getDay.call(value); return true; } catch (e) { return false; } }; var toStr = Object.prototype.toString; var dateClass = '[object Date]'; var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; module.exports = function isDateObject(value) { if (typeof value !== 'object' || value === null) { return false; } return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass; }; /***/ }, /* 25 */ /***/ function(module, exports) { 'use strict'; var toStr = Object.prototype.toString; var fnToStr = Function.prototype.toString; var isFnRegex = /^\s*function\*/; module.exports = function isGeneratorFunction(fn) { if (typeof fn !== 'function') { return false; } var fnStr = toStr.call(fn); return (fnStr === '[object Function]' || fnStr === '[object GeneratorFunction]') && isFnRegex.test(fnToStr.call(fn)); }; /***/ }, /* 26 */ /***/ function(module, exports) { 'use strict'; var numToStr = Number.prototype.toString; var tryNumberObject = function tryNumberObject(value) { try { numToStr.call(value); return true; } catch (e) { return false; } }; var toStr = Object.prototype.toString; var numClass = '[object Number]'; var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; module.exports = function isNumberObject(value) { if (typeof value === 'number') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryNumberObject(value) : toStr.call(value) === numClass; }; /***/ }, /* 27 */ /***/ function(module, exports) { 'use strict'; var strValue = String.prototype.valueOf; var tryStringObject = function tryStringObject(value) { try { strValue.call(value); return true; } catch (e) { return false; } }; var toStr = Object.prototype.toString; var strClass = '[object String]'; var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; module.exports = function isString(value) { if (typeof value === 'string') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass; }; /***/ }, /* 28 */ /***/ function(module, exports) { 'use strict'; var toStr = Object.prototype.toString; var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; if (hasSymbols) { var symToStr = Symbol.prototype.toString; var symStringRegex = /^Symbol\(.*\)$/; var isSymbolObject = function isSymbolObject(value) { if (typeof value.valueOf() !== 'symbol') { return false; } return symStringRegex.test(symToStr.call(value)); }; module.exports = function isSymbol(value) { if (typeof value === 'symbol') { return true; } if (toStr.call(value) !== '[object Symbol]') { return false; } try { return isSymbolObject(value); } catch (e) { return false; } }; } else { module.exports = function isSymbol(value) { // this environment does not support Symbols. return false; }; } /***/ }, /* 29 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var isSymbol = __webpack_require__(28); module.exports = function getSymbolIterator() { var symbolIterator = typeof Symbol === 'function' && isSymbol(Symbol.iterator) ? Symbol.iterator : null; if (typeof Object.getOwnPropertyNames === 'function' && typeof Map === 'function' && typeof Map.prototype.entries === 'function') { Object.getOwnPropertyNames(Map.prototype).forEach(function (name) { if (name !== 'entries' && name !== 'size' && Map.prototype[name] === Map.prototype.entries) { symbolIterator = name; } }); } return symbolIterator; }; /***/ }, /* 30 */ /***/ function(module, exports) { 'use strict'; module.exports = function () { var mapForEach = (function () { if (typeof Map !== 'function') { return null; } try { Map.prototype.forEach.call({}, function () {}); } catch (e) { return Map.prototype.forEach; } return null; }()); var setForEach = (function () { if (typeof Set !== 'function') { return null; } try { Set.prototype.forEach.call({}, function () {}); } catch (e) { return Set.prototype.forEach; } return null; }()); return { Map: mapForEach, Set: setForEach }; }; /***/ }, /* 31 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Expectation = __webpack_require__(1); var _Expectation2 = _interopRequireDefault(_Expectation); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Extensions = []; function extend(extension) { if (Extensions.indexOf(extension) === -1) { Extensions.push(extension); for (var p in extension) { if (extension.hasOwnProperty(p)) _Expectation2.default.prototype[p] = extension[p]; } } } exports.default = extend; /***/ } /******/ ]) }); ;package/umd/expect.min.js000644 000765 000024 0000154556 12734772237013762 0ustar00000000 000000 !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.expect=e():t.expect=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){return new u["default"](t)}var i=r(2),u=n(i),a=r(3),s=r(1),c=n(s),f=r(11),l=n(f);o.createSpy=a.createSpy,o.spyOn=a.spyOn,o.isSpy=a.isSpy,o.restoreSpies=a.restoreSpies,o.assert=c["default"],o.extend=l["default"],t.exports=o},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(28),i=n(o),u=function(t,e){var r=0;return t.replace(/%s/g,function(){return(0,i["default"])(e[r++])})},a=function(t,e){for(var r=arguments.length,n=Array(r>2?r-2:0),o=2;r>o;o++)n[o-2]=arguments[o];if(!t){var i="string"==typeof e?u(e,n):e(n);throw new Error(i)}};e["default"]=a},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},u=function(){function t(t,e){for(var r=0;rt,e||"Expected %s to be greater than %s",this.actual,t),this}},{key:"toBeGreaterThanOrEqualTo",value:function(t,e){return(0,h["default"])("number"==typeof this.actual,'The "actual" argument in expect(actual).toBeGreaterThanOrEqualTo() must be a number'),(0,h["default"])("number"==typeof t,'The "value" argument in toBeGreaterThanOrEqualTo(value) must be a number'),(0,h["default"])(this.actual>=t,e||"Expected %s to be greater than or equal to %s",this.actual,t),this}},{key:"toInclude",value:function(t,e,r){"string"==typeof e&&(r=e,e=null),null==e&&(e=y.isEqual);var n=!1;return(0,y.isArray)(this.actual)?n=(0,y.arrayContains)(this.actual,t,e):(0,y.isObject)(this.actual)?n=(0,y.objectContains)(this.actual,t,e):"string"==typeof this.actual?n=(0,y.stringContains)(this.actual,t):(0,h["default"])(!1,'The "actual" argument in expect(actual).toInclude() must be an array, object, or a string'),(0,h["default"])(n,r||"Expected %s to include %s",this.actual,t),this}},{key:"toExclude",value:function(t,e,r){"string"==typeof e&&(r=e,e=null),null==e&&(e=y.isEqual);var n=!1;return(0,y.isArray)(this.actual)?n=(0,y.arrayContains)(this.actual,t,e):(0,y.isObject)(this.actual)?n=(0,y.objectContains)(this.actual,t,e):"string"==typeof this.actual?n=(0,y.stringContains)(this.actual,t):(0,h["default"])(!1,'The "actual" argument in expect(actual).toExclude() must be an array, object, or a string'),(0,h["default"])(!n,r||"Expected %s to exclude %s",this.actual,t),this}},{key:"toIncludeKeys",value:function(t,e,r){var n=this;"string"==typeof e&&(r=e,e=null),null==e&&(e=s["default"]),(0,h["default"])("object"===i(this.actual),'The "actual" argument in expect(actual).toIncludeKeys() must be an object, not %s',this.actual),(0,h["default"])((0,y.isArray)(t),'The "keys" argument in expect(actual).toIncludeKeys(keys) must be an array, not %s',t);var o=t.every(function(t){return e(n.actual,t)});return(0,h["default"])(o,r||"Expected %s to include key(s) %s",this.actual,t.join(", ")),this}},{key:"toIncludeKey",value:function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;e>n;n++)r[n-1]=arguments[n];return this.toIncludeKeys.apply(this,[[t]].concat(r))}},{key:"toExcludeKeys",value:function(t,e,r){var n=this;"string"==typeof e&&(r=e,e=null),null==e&&(e=s["default"]),(0,h["default"])("object"===i(this.actual),'The "actual" argument in expect(actual).toExcludeKeys() must be an object, not %s',this.actual),(0,h["default"])((0,y.isArray)(t),'The "keys" argument in expect(actual).toIncludeKeys(keys) must be an array, not %s',t);var o=t.every(function(t){return e(n.actual,t)});return(0,h["default"])(!o,r||"Expected %s to exclude key(s) %s",this.actual,t.join(", ")),this}},{key:"toExcludeKey",value:function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;e>n;n++)r[n-1]=arguments[n];return this.toExcludeKeys.apply(this,[[t]].concat(r))}},{key:"toHaveBeenCalled",value:function(t){var e=this.actual;return(0,h["default"])((0,p.isSpy)(e),'The "actual" argument in expect(actual).toHaveBeenCalled() must be a spy'),(0,h["default"])(e.calls.length>0,t||"spy was not called"),this}},{key:"toHaveBeenCalledWith",value:function(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=this.actual;return(0,h["default"])((0,p.isSpy)(n),'The "actual" argument in expect(actual).toHaveBeenCalledWith() must be a spy'),(0,h["default"])(n.calls.some(function(t){return(0,y.isEqual)(t.arguments,e)}),"spy was never called with %s",e),this}},{key:"toNotHaveBeenCalled",value:function(t){var e=this.actual;return(0,h["default"])((0,p.isSpy)(e),'The "actual" argument in expect(actual).toNotHaveBeenCalled() must be a spy'),(0,h["default"])(0===e.calls.length,t||"spy was not supposed to be called"),this}}]),t}(),d=function(t,e){var r=!1;return function(){r||(r=!0,console.warn(e));for(var n=arguments.length,o=Array(n),i=0;n>i;i++)o[i]=arguments[i];return t.apply(this,o)}};g.prototype.withContext=d(function(t){return(0,h["default"])((0,y.isFunction)(this.actual),'The "actual" argument in expect(actual).withContext() must be a function'),this.context=t,this},"\nwithContext is deprecated; use a closure instead.\n\n expect(fn).withContext(context).toThrow()\n\nbecomes\n\n expect(() => fn.call(context)).toThrow()\n"),g.prototype.withArgs=d(function(){var t;return(0,h["default"])((0,y.isFunction)(this.actual),'The "actual" argument in expect(actual).withArgs() must be a function'),arguments.length&&(this.args=(t=this.args).concat.apply(t,arguments)),this},"\nwithArgs is deprecated; use a closure instead.\n\n expect(fn).withArgs(a, b, c).toThrow()\n\nbecomes\n\n expect(() => fn(a, b, c)).toThrow()\n");var b={toBeAn:"toBeA",toNotBeAn:"toNotBeA",toBeTruthy:"toExist",toBeFalsy:"toNotExist",toBeFewerThan:"toBeLessThan",toBeMoreThan:"toBeGreaterThan",toContain:"toInclude",toNotContain:"toExclude",toNotInclude:"toExclude",toContainKeys:"toIncludeKeys",toNotContainKeys:"toExcludeKeys",toNotIncludeKeys:"toExcludeKeys",toContainKey:"toIncludeKey",toNotContainKey:"toExcludeKey",toNotIncludeKey:"toExcludeKey"};for(var v in b)b.hasOwnProperty(v)&&(g.prototype[v]=g.prototype[b[v]]);e["default"]=g},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e=0;t--)h[t].restore();h=[]},e.createSpy=function(t){function e(){if(l.calls.push({context:this,arguments:Array.prototype.slice.call(arguments,0)}),n)return n.apply(this,arguments);if(i)throw i;return u}var r=arguments.length<=1||void 0===arguments[1]?c:arguments[1];null==t&&(t=c),(0,a["default"])((0,s.isFunction)(t),"createSpy needs a function");var n=void 0,i=void 0,u=void 0,l=void 0;return l=f?Object.defineProperty(e,"length",{value:t.length,writable:!1,enumerable:!1,configurable:!0}):new Function("spy","return function("+[].concat(o(Array(t.length))).map(function(t,e){return"_"+e}).join(",")+") {\n return spy.apply(this, arguments)\n }")(e),l.calls=[],l.andCall=function(t){return n=t,l},l.andCallThrough=function(){return l.andCall(t)},l.andThrow=function(t){return i=t,l},l.andReturn=function(t){return u=t,l},l.getLastCall=function(){return l.calls[l.calls.length-1]},l.reset=function(){l.calls=[]},l.restore=l.destroy=r,l.__isSpy=!0,h.push(l),l});e.spyOn=function(t,e){var r=t[e];return l(r)||((0,a["default"])((0,s.isFunction)(r),"Cannot spyOn the %s property; it is not a function",e),t[e]=p(r,function(){t[e]=r})),t[e]}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.stringContains=e.objectContains=e.arrayContains=e.functionThrows=e.isA=e.isObject=e.isArray=e.isFunction=e.isEqual=e.whyNotEqual=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},i=r(8),u=n(i),a=r(23),s=n(a),c=r(10),f=n(c),l=e.whyNotEqual=function(t,e){return t==e?"":(0,s["default"])(t,e)},h=(e.isEqual=function(t,e){return""===l(t,e)},e.isFunction=function(t){return"function"==typeof t}),p=e.isArray=function(t){return Array.isArray(t)},y=e.isObject=function(t){return t&&!p(t)&&"object"===("undefined"==typeof t?"undefined":o(t))},g=(e.isA=function(t,e){return h(e)?t instanceof e:"array"===e?Array.isArray(t):("undefined"==typeof t?"undefined":o(t))===e},e.functionThrows=function(t,e,r,n){try{t.apply(e,r)}catch(o){if(null==n)return!0;if(h(n)&&o instanceof n)return!0;var i=o.message||o;if("string"==typeof i){if((0,u["default"])(n)&&n.test(o.message))return!0;if("string"==typeof n&&-1!==i.indexOf(n))return!0}}return!1},e.arrayContains=function(t,e,r){return t.some(function(t){return r(t,e)!==!1})},function(t){return"object"===("undefined"==typeof Reflect?"undefined":o(Reflect))&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}):"function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}).concat((0,f["default"])(t)):(0,f["default"])(t)});e.objectContains=function d(t,e,r){return g(e).every(function(n){return y(t[n])&&y(e[n])?d(t[n],e[n],r):r(t[n],e[n])})},e.stringContains=function(t,e){return-1!==t.indexOf(e)}},function(t,e,r){(function(t,n){/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ "use strict";function o(){function t(){}try{var e=new Uint8Array(1);return e.foo=function(){return 42},e.constructor=t,42===e.foo()&&e.constructor===t&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(r){return!1}}function i(){return t.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function t(e){return this instanceof t?(t.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof e?u(this,e):"string"==typeof e?a(this,e,arguments.length>1?arguments[1]:"utf8"):s(this,e)):arguments.length>1?new t(e,arguments[1]):new t(e)}function u(e,r){if(e=g(e,0>r?0:0|d(r)),!t.TYPED_ARRAY_SUPPORT)for(var n=0;r>n;n++)e[n]=0;return e}function a(t,e,r){"string"==typeof r&&""!==r||(r="utf8");var n=0|v(e,r);return t=g(t,n),t.write(e,r),t}function s(e,r){if(t.isBuffer(r))return c(e,r);if(X(r))return f(e,r);if(null==r)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(r.buffer instanceof ArrayBuffer)return l(e,r);if(r instanceof ArrayBuffer)return h(e,r)}return r.length?p(e,r):y(e,r)}function c(t,e){var r=0|d(e.length);return t=g(t,r),e.copy(t,0,0,r),t}function f(t,e){var r=0|d(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function l(t,e){var r=0|d(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function h(e,r){return t.TYPED_ARRAY_SUPPORT?(r.byteLength,e=t._augment(new Uint8Array(r))):e=l(e,new Uint8Array(r)),e}function p(t,e){var r=0|d(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function y(t,e){var r,n=0;"Buffer"===e.type&&X(e.data)&&(r=e.data,n=0|d(r.length)),t=g(t,n);for(var o=0;n>o;o+=1)t[o]=255&r[o];return t}function g(e,r){t.TYPED_ARRAY_SUPPORT?(e=t._augment(new Uint8Array(r)),e.__proto__=t.prototype):(e.length=r,e._isBuffer=!0);var n=0!==r&&r<=t.poolSize>>>1;return n&&(e.parent=Z),e}function d(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function b(e,r){if(!(this instanceof b))return new b(e,r);var n=new t(e,r);return delete n.parent,n}function v(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return I(this,e,r);case"binary":return _(this,e,r);case"base64":return j(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;var i=e.length;if(i%2!==0)throw new Error("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;n>u;u++){var a=parseInt(e.substr(2*u,2),16);if(isNaN(a))throw new Error("Invalid hex string");t[r+u]=a}return u}function E(t,e,r,n){return z(q(e,t.length-r),t,r,n)}function A(t,e,r,n){return z(K(e),t,r,n)}function T(t,e,r,n){return A(t,e,r,n)}function S(t,e,r,n){return z(G(e),t,r,n)}function x(t,e,r,n){return z($(e,t.length-r),t,r,n)}function j(t,e,r){return 0===e&&r===t.length?J.fromByteArray(t):J.fromByteArray(t.slice(e,r))}function O(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;r>o;){var i=t[o],u=null,a=i>239?4:i>223?3:i>191?2:1;if(r>=o+a){var s,c,f,l;switch(a){case 1:128>i&&(u=i);break;case 2:s=t[o+1],128===(192&s)&&(l=(31&i)<<6|63&s,l>127&&(u=l));break;case 3:s=t[o+1],c=t[o+2],128===(192&s)&&128===(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c,l>2047&&(55296>l||l>57343)&&(u=l));break;case 4:s=t[o+1],c=t[o+2],f=t[o+3],128===(192&s)&&128===(192&c)&&128===(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f,l>65535&&1114112>l&&(u=l))}}null===u?(u=65533,a=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),o+=a}return B(n)}function B(t){var e=t.length;if(Q>=e)return String.fromCharCode.apply(String,t);for(var r="",n=0;e>n;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Q));return r}function I(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;r>o;o++)n+=String.fromCharCode(127&t[o]);return n}function _(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;r>o;o++)n+=String.fromCharCode(t[o]);return n}function P(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var o="",i=e;r>i;i++)o+=H(t[i]);return o}function R(t,e,r){for(var n=t.slice(e,r),o="",i=0;it)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,r,n,o,i,u){if(!t.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(r>i||u>r)throw new RangeError("value is out of bounds");if(n+o>e.length)throw new RangeError("index out of range")}function U(t,e,r,n){0>e&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);i>o;o++)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function L(t,e,r,n){0>e&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);i>o;o++)t[r+o]=e>>>8*(n?o:3-o)&255}function N(t,e,r,n,o,i){if(e>o||i>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function k(t,e,r,n,o){return o||N(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,o){return o||N(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,e,r,n,52,8),r+8}function F(t){if(t=Y(t).replace(tt,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function Y(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function H(t){return 16>t?"0"+t.toString(16):t.toString(16)}function q(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],u=0;n>u;u++){if(r=t.charCodeAt(u),r>55295&&57344>r){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(56320>r){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,128>r){if((e-=1)<0)break;i.push(r)}else if(2048>r){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function K(t){for(var e=[],r=0;r>8,o=r%256,i.push(o),i.push(n);return i}function G(t){return J.toByteArray(F(t))}function z(t,e,r,n){for(var o=0;n>o&&!(o+r>=e.length||o>=t.length);o++)e[o+r]=t[o];return o}var J=r(12),W=r(17),X=r(27);e.Buffer=t,e.SlowBuffer=b,e.INSPECT_MAX_BYTES=50,t.poolSize=8192;var Z={};t.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:o(),t.TYPED_ARRAY_SUPPORT?(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array):(t.prototype.length=void 0,t.prototype.parent=void 0),t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,o=r.length,i=0,u=Math.min(n,o);u>i&&e[i]===r[i];)++i;return i!==u&&(n=e[i],o=r[i]),o>n?-1:n>o?1:0},t.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,r){if(!X(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new t(0);var n;if(void 0===r)for(r=0,n=0;n0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},t.prototype.compare=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:t.compare(this,e)},t.prototype.indexOf=function(e,r){function n(t,e,r){for(var n=-1,o=0;r+o2147483647?r=2147483647:-2147483648>r&&(r=-2147483648),r>>=0,0===this.length)return-1;if(r>=this.length)return-1;if(0>r&&(r=Math.max(this.length+r,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,r);if(t.isBuffer(e))return n(this,e,r);if("number"==typeof e)return t.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,r):n(this,[e],r);throw new TypeError("val must be string, number or Buffer")},t.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},t.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},t.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var o=n;n=e,e=0|r,r=o}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var u=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":return A(this,t,e,r);case"binary":return T(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,r);default:if(u)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),u=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;t.prototype.slice=function(e,r){var n=this.length;e=~~e,r=void 0===r?n:~~r,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>r?(r+=n,0>r&&(r=0)):r>n&&(r=n),e>r&&(r=e);var o;if(t.TYPED_ARRAY_SUPPORT)o=t._augment(this.subarray(e,r));else{var i=r-e;o=new t(i,void 0);for(var u=0;i>u;u++)o[u]=this[u+e]}return o.length&&(o.parent=this.parent||this),o},t.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t],o=1,i=0;++i0&&(o*=256);)n+=this[t+--e]*o;return n},t.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t],o=1,i=0;++i=o&&(n-=Math.pow(2,8*e)),n},t.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},t.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},t.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),W.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),W.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),W.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),W.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||M(this,t,e,r,Math.pow(2,8*r),0);var o=1,i=0;for(this[e]=255&t;++i=0&&(i*=256);)this[e+o]=t/i&255;return e+r},t.prototype.writeUInt8=function(e,r,n){return e=+e,r=0|r,n||M(this,e,r,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},t.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=0|r,n||M(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):U(this,e,r,!0),r+2},t.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=0|r,n||M(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):U(this,e,r,!1),r+2},t.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=0|r,n||M(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):L(this,e,r,!0),r+4},t.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=0|r,n||M(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):L(this,e,r,!1),r+4},t.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}var i=0,u=1,a=0>t?1:0;for(this[e]=255&t;++i>0)-a&255;return e+r},t.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}var i=r-1,u=1,a=0>t?1:0;for(this[e+i]=255&t;--i>=0&&(u*=256);)this[e+i]=(t/u>>0)-a&255;return e+r},t.prototype.writeInt8=function(e,r,n){return e=+e,r=0|r,n||M(this,e,r,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[r]=255&e,r+1},t.prototype.writeInt16LE=function(e,r,n){return e=+e,r=0|r,n||M(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):U(this,e,r,!0),r+2},t.prototype.writeInt16BE=function(e,r,n){return e=+e,r=0|r,n||M(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):U(this,e,r,!1),r+2},t.prototype.writeInt32LE=function(e,r,n){return e=+e,r=0|r,n||M(this,e,r,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):L(this,e,r,!0),r+4},t.prototype.writeInt32BE=function(e,r,n){return e=+e,r=0|r,n||M(this,e,r,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):L(this,e,r,!1),r+4},t.prototype.writeFloatLE=function(t,e,r){return k(this,t,e,!0,r)},t.prototype.writeFloatBE=function(t,e,r){return k(this,t,e,!1,r)},t.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},t.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},t.prototype.copy=function(e,r,n,o){if(n||(n=0),o||0===o||(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&n>o&&(o=n),o===n)return 0;if(0===e.length||0===this.length)return 0;if(0>r)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>o)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-rn&&o>r)for(i=u-1;i>=0;i--)e[i+r]=this[i+n];else if(1e3>u||!t.TYPED_ARRAY_SUPPORT)for(i=0;u>i;i++)e[i+r]=this[i+n];else e._set(this.subarray(n,n+u),r);return u},t.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),e>r)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;r>n;n++)this[n]=t;else{var o=q(t.toString()),i=o.length;for(n=e;r>n;n++)this[n]=o[n%i]}return this}},t.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(t.TYPED_ARRAY_SUPPORT)return new t(this).buffer;for(var e=new Uint8Array(this.length),r=0,n=e.length;n>r;r+=1)e[r]=this[r];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var V=t.prototype;t._augment=function(e){return e.constructor=t,e._isBuffer=!0,e._set=e.set,e.get=V.get,e.set=V.set,e.write=V.write,e.toString=V.toString,e.toLocaleString=V.toString,e.toJSON=V.toJSON,e.equals=V.equals,e.compare=V.compare,e.indexOf=V.indexOf,e.copy=V.copy,e.slice=V.slice,e.readUIntLE=V.readUIntLE,e.readUIntBE=V.readUIntBE,e.readUInt8=V.readUInt8,e.readUInt16LE=V.readUInt16LE,e.readUInt16BE=V.readUInt16BE,e.readUInt32LE=V.readUInt32LE,e.readUInt32BE=V.readUInt32BE,e.readIntLE=V.readIntLE,e.readIntBE=V.readIntBE,e.readInt8=V.readInt8,e.readInt16LE=V.readInt16LE,e.readInt16BE=V.readInt16BE,e.readInt32LE=V.readInt32LE,e.readInt32BE=V.readInt32BE,e.readFloatLE=V.readFloatLE,e.readFloatBE=V.readFloatBE,e.readDoubleLE=V.readDoubleLE,e.readDoubleBE=V.readDoubleBE,e.writeUInt8=V.writeUInt8,e.writeUIntLE=V.writeUIntLE,e.writeUIntBE=V.writeUIntBE,e.writeUInt16LE=V.writeUInt16LE,e.writeUInt16BE=V.writeUInt16BE,e.writeUInt32LE=V.writeUInt32LE,e.writeUInt32BE=V.writeUInt32BE,e.writeIntLE=V.writeIntLE,e.writeIntBE=V.writeIntBE,e.writeInt8=V.writeInt8,e.writeInt16LE=V.writeInt16LE,e.writeInt16BE=V.writeInt16BE,e.writeInt32LE=V.writeInt32LE,e.writeInt32BE=V.writeInt32BE,e.writeFloatLE=V.writeFloatLE,e.writeFloatBE=V.writeFloatBE,e.writeDoubleLE=V.writeDoubleLE,e.writeDoubleBE=V.writeDoubleBE,e.fill=V.fill,e.inspect=V.inspect,e.toArrayBuffer=V.toArrayBuffer,e};var tt=/[^+\/0-9A-Za-z-_]/g}).call(e,r(5).Buffer,function(){return this}())},function(t,e,r){var n=r(16);t.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},function(t,e){"use strict";var r=Function.prototype.toString,n=/^\s*class /,o=function(t){try{var e=r.call(t),o=e.replace(/\/\/.*\n/g,""),i=o.replace(/\/\*[.\s\S]*\*\//g,""),u=i.replace(/\n/gm," ").replace(/ {2}/g," ");return n.test(u)}catch(a){return!1}},i=function(t){try{return o(t)?!1:(r.call(t),!0)}catch(e){return!1}},u=Object.prototype.toString,a="[object Function]",s="[object GeneratorFunction]",c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(c)return i(t);if(o(t))return!1;var e=u.call(t);return e===a||e===s}},function(t,e){"use strict";var r=RegExp.prototype.exec,n=function(t){try{return r.call(t),!0}catch(e){return!1}},o=Object.prototype.toString,i="[object RegExp]",u="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"object"!=typeof t?!1:u?n(t):o.call(t)===i}},function(t,e){"use strict";var r=Object.prototype.toString,n="function"==typeof Symbol&&"symbol"==typeof Symbol();if(n){var o=Symbol.prototype.toString,i=/^Symbol\(.*\)$/,u=function(t){return"symbol"!=typeof t.valueOf()?!1:i.test(o.call(t))};t.exports=function(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==r.call(t))return!1;try{return u(t)}catch(e){return!1}}}else t.exports=function(t){return!1}},function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=Array.prototype.slice,u=r(29),a=!{toString:null}.propertyIsEnumerable("toString"),s=function(){}.propertyIsEnumerable("prototype"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=function(t){var e=t.constructor;return e&&e.prototype===t},l={$console:!0,$frame:!0,$frameElement:!0,$frames:!0,$parent:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!l["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{f(window[t])}catch(e){return!0}}catch(e){return!0}return!1}(),p=function(t){if("undefined"==typeof window||!h)return f(t);try{return f(t)}catch(e){return!1}},y=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),i=u(t),f=e&&"[object String]"===o.call(t),l=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var h=s&&r;if(f&&t.length>0&&!n.call(t,0))for(var y=0;y0)for(var g=0;ge?-1:s+10>e?e-s+26+26:f+26>e?e-f:c+26>e?e-c+26:void 0}function r(t){function r(t){c[l++]=t}var n,o,u,a,s,c;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=t.length;s="="===t.charAt(f-2)?2:"="===t.charAt(f-1)?1:0,c=new i(3*t.length/4-s),u=s>0?t.length-4:t.length;var l=0;for(n=0,o=0;u>n;n+=4,o+=3)a=e(t.charAt(n))<<18|e(t.charAt(n+1))<<12|e(t.charAt(n+2))<<6|e(t.charAt(n+3)),r((16711680&a)>>16),r((65280&a)>>8),r(255&a);return 2===s?(a=e(t.charAt(n))<<2|e(t.charAt(n+1))>>4,r(255&a)):1===s&&(a=e(t.charAt(n))<<10|e(t.charAt(n+1))<<4|e(t.charAt(n+2))>>2,r(a>>8&255),r(255&a)),c}function o(t){function e(t){return n.charAt(t)}function r(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var o,i,u,a=t.length%3,s="";for(o=0,u=t.length-a;u>o;o+=3)i=(t[o]<<16)+(t[o+1]<<8)+t[o+2],s+=r(i);switch(a){case 1:i=t[t.length-1],s+=e(i>>2),s+=e(i<<4&63),s+="==";break;case 2:i=(t[t.length-2]<<8)+t[t.length-1],s+=e(i>>10),s+=e(i>>4&63),s+=e(i<<2&63),s+="="}return s}var i="undefined"!=typeof Uint8Array?Uint8Array:Array,u="+".charCodeAt(0),a="/".charCodeAt(0),s="0".charCodeAt(0),c="a".charCodeAt(0),f="A".charCodeAt(0),l="-".charCodeAt(0),h="_".charCodeAt(0);t.toByteArray=r,t.fromByteArray=o}(e)},function(t,e,r){"use strict";var n=r(10),o=r(14),i="function"==typeof Symbol&&"symbol"==typeof Symbol(),u=Object.prototype.toString,a=function(t){return"function"==typeof t&&"[object Function]"===u.call(t)},s=function(){var t={};try{Object.defineProperty(t,"x",{enumerable:!1,value:t});for(var e in t)return!1;return t.x===t}catch(r){return!1}},c=Object.defineProperty&&s(),f=function(t,e,r,n){(!(e in t)||a(n)&&n())&&(c?Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},l=function(t,e){var r=arguments.length>2?arguments[2]:{},u=n(e);i&&(u=u.concat(Object.getOwnPropertySymbols(e))),o(u,function(n){f(t,n,e[n],r[n])})};l.supportsDescriptors=!!c,t.exports=l},function(t,e){var r=Object.prototype.hasOwnProperty,n=Object.prototype.toString;t.exports=function(t,e,o){if("[object Function]"!==n.call(e))throw new TypeError("iterator must be a function");var i=t.length;if(i===+i)for(var u=0;i>u;u++)e.call(o,t[u],u,t);else for(var a in t)r.call(t,a)&&e.call(o,t[a],a,t)}},function(t,e){var r="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,o=Object.prototype.toString,i="[object Function]";t.exports=function(t){var e=this;if("function"!=typeof e||o.call(e)!==i)throw new TypeError(r+e);for(var u,a=n.call(arguments,1),s=function(){if(this instanceof u){var r=e.apply(this,a.concat(n.call(arguments)));return Object(r)===r?r:this}return e.apply(t,a.concat(n.call(arguments)))},c=Math.max(0,e.length-a.length),f=[],l=0;c>l;l++)f.push("$"+l);if(u=Function("binder","return function ("+f.join(",")+"){ return binder.apply(this,arguments); }")(s),e.prototype){var h=function(){};h.prototype=e.prototype,u.prototype=new h,h.prototype=null}return u}},function(t,e,r){var n=r(15);t.exports=Function.prototype.bind||n},function(t,e){e.read=function(t,e,r,n,o){var i,u,a=8*o-n-1,s=(1<>1,f=-7,l=r?o-1:0,h=r?-1:1,p=t[e+l];for(l+=h,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=256*i+t[e+l],l+=h,f-=8);for(u=i&(1<<-f)-1,i>>=-f,f+=n;f>0;u=256*u+t[e+l],l+=h,f-=8);if(0===i)i=1-c;else{if(i===s)return u?NaN:(p?-1:1)*(1/0);u+=Math.pow(2,n),i-=c}return(p?-1:1)*u*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var u,a,s,c=8*i-o-1,f=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,y=n?1:-1,g=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,u=f):(u=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-u))<1&&(u--,s*=2),e+=u+l>=1?h/s:h*Math.pow(2,1-l),e*s>=2&&(u++,s/=2),u+l>=f?(a=0,u=f):u+l>=1?(a=(e*s-1)*Math.pow(2,o),u+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[r+p]=255&a,p+=y,a/=256,o-=8);for(u=u<0;t[r+p]=255&u,p+=y,u/=256,c-=8);t[r+p-y]|=128*g}},function(t,e,r){"use strict";var n=r(7),o=Function.prototype.toString,i=/^\s*function/,u=/^\([^\)]*\) *=>/,a=/^[^=]*=>/;t.exports=function(t){if(!n(t))return!1;var e=o.call(t);return e.length>0&&!i.test(e)&&(u.test(e)||a.test(e))}},function(t,e){"use strict";var r=Boolean.prototype.toString,n=function(t){try{return r.call(t),!0}catch(e){return!1}},o=Object.prototype.toString,i="[object Boolean]",u="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"boolean"==typeof t?!0:"object"!=typeof t?!1:u?n(t):o.call(t)===i}},function(t,e){"use strict";var r=Date.prototype.getDay,n=function(t){try{return r.call(t),!0}catch(e){return!1}},o=Object.prototype.toString,i="[object Date]",u="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"object"!=typeof t||null===t?!1:u?n(t):o.call(t)===i}},function(t,e){"use strict";t.exports=function(){var t=function(){if("function"!=typeof Map)return null;try{Map.prototype.forEach.call({},function(){})}catch(t){return Map.prototype.forEach}return null}(),e=function(){if("function"!=typeof Set)return null;try{Set.prototype.forEach.call({},function(){})}catch(t){return Set.prototype.forEach}return null}();return{Map:t,Set:e}}},function(t,e,r){"use strict";var n=r(9);t.exports=function(){var t="function"==typeof Symbol&&n(Symbol.iterator)?Symbol.iterator:null;return"function"==typeof Object.getOwnPropertyNames&&"function"==typeof Map&&"function"==typeof Map.prototype.entries&&Object.getOwnPropertyNames(Map.prototype).forEach(function(e){"entries"!==e&&"size"!==e&&Map.prototype[e]===Map.prototype.entries&&(t=e)}),t}},function(t,e,r){"use strict";var n=Object.prototype,o=n.toString,i=Boolean.prototype.valueOf,u=r(6),a=r(18),s=r(19),c=r(20),f=r(24),l=r(25),h=r(8),p=r(26),y=r(9),g=r(7),d=Object.prototype.isPrototypeOf,b=function(){},v="foo"===b.name,m="function"==typeof Symbol?Symbol.prototype.valueOf:null,w=r(22)(),E=r(21)(),A=Object.getPrototypeOf;A||(A="object"==typeof"test".__proto__?function(t){return t.__proto__}:function(t){var e,r=t.constructor;if(u(t,"constructor")){if(e=r,!delete t.constructor)return null;r=t.constructor,t.constructor=e}return r?r.prototype:n});var T=Array.isArray||function(t){return"[object Array]"===o.call(t)},S=function(t){return t.replace(/^function ?\(/,"function (").replace("){",") {")},x=function(t){var e=[];try{E.Map.call(t,function(t,r){e.push([t,r])})}catch(r){try{E.Set.call(t,function(t){e.push([t])})}catch(n){return!1}}return e};t.exports=function j(t,e){if(t===e)return"";if(null==t||null==e)return t===e?"":String(t)+" !== "+String(e);var r=o.call(t),n=o.call(e);if(r!==n)return"toStringTag is not the same: "+r+" !== "+n;var b=s(t),O=s(e);if(b||O){if(!b)return"first argument is not a boolean; second argument is";if(!O)return"second argument is not a boolean; first argument is";var B=i.call(t),I=i.call(e);return B===I?"":"primitive value of boolean arguments do not match: "+B+" !== "+I}var _=l(t),P=l(t);if(_||P){if(!_)return"first argument is not a number; second argument is";if(!P)return"second argument is not a number; first argument is";var R=Number(t),C=Number(e);if(R===C)return"";var M=isNaN(t),U=isNaN(e);return M&&!U?"first argument is NaN; second is not":!M&&U?"second argument is NaN; first is not":M&&U?"":"numbers are different: "+t+" !== "+e}var L=p(t),N=p(e);if(L||N){if(!L)return"second argument is string; first is not";if(!N)return"first argument is string; second is not";var k=String(t),D=String(e);return k===D?"":'string values are different: "'+k+'" !== "'+D+'"'}var F=c(t),Y=c(e);if(F||Y){if(!F)return"second argument is Date, first is not";if(!Y)return"first argument is Date, second is not";var H=+t,q=+e;return H===q?"":"Dates have different time values: "+H+" !== "+q}var K=h(t),$=h(e);if(K||$){if(!K)return"second argument is RegExp, first is not";if(!$)return"first argument is RegExp, second is not";var G=String(t),z=String(e);return G===z?"":"regular expressions differ: "+G+" !== "+z}var J=T(t),W=T(e);if(J||W){if(!J)return"second argument is an Array, first is not";if(!W)return"first argument is an Array, second is not";if(t.length!==e.length)return"arrays have different length: "+t.length+" !== "+e.length;if(String(t)!==String(e))return"stringified Arrays differ";for(var X,Z,Q=t.length-1,V="";""===V&&Q>=0;){if(X=u(t,Q),Z=u(e,Q),!X&&Z)return"second argument has index "+Q+"; first does not";if(X&&!Z)return"first argument has index "+Q+"; second does not";V=j(t[Q],e[Q]),Q-=1}return V}var tt=y(t),et=y(e);if(tt!==et)return tt?"first argument is Symbol; second is not":"second argument is Symbol; first is not";if(tt&&et)return m.call(t)===m.call(e)?"":"first Symbol value !== second Symbol value";var rt=f(t),nt=f(e);if(rt!==nt)return rt?"first argument is a Generator; second is not":"second argument is a Generator; first is not";var ot=a(t),it=a(e);if(ot!==it)return ot?"first argument is an Arrow function; second is not":"second argument is an Arrow function; first is not";if(g(t)||g(e)){if(v&&""!==j(t.name,e.name))return'Function names differ: "'+t.name+'" !== "'+e.name+'"';if(""!==j(t.length,e.length))return"Function lengths differ: "+t.length+" !== "+e.length;var ut=S(String(t)),at=S(String(e));return""===j(ut,at)?"":rt||ot?""===j(ut,at)?"":"Function string representations differ":""===j(ut.replace(/\)\s*\{/,"){"),at.replace(/\)\s*\{/,"){"))?"":"Function string representations differ"}if("object"==typeof t||"object"==typeof e){if(typeof t!=typeof e)return"arguments have a different typeof: "+typeof t+" !== "+typeof e;if(d.call(t,e))return"first argument is the [[Prototype]] of the second";if(d.call(e,t))return"second argument is the [[Prototype]] of the first";if(A(t)!==A(e))return"arguments have a different [[Prototype]]";if(w){var st=t[w],ct=g(st),ft=e[w],lt=g(ft);if(ct!==lt)return ct?"first argument is iterable; second is not":"second argument is iterable; first is not";if(ct&<){var ht,pt,yt,gt=st.call(t),dt=ft.call(e);do if(ht=gt.next(),pt=dt.next(),!ht.done&&!pt.done&&(yt=j(ht,pt), ""!==yt))return"iteration results are not equal: "+yt;while(!ht.done&&!pt.done);return ht.done&&!pt.done?"first argument finished iterating before second":!ht.done&&pt.done?"second argument finished iterating before first":""}}else if(E.Map||E.Set){var bt=x(t),vt=x(e),mt=T(bt),wt=T(vt);if(mt&&!wt)return"first argument has Collection entries, second does not";if(!mt&&wt)return"second argument has Collection entries, first does not";if(mt&&wt){var Et=j(bt,vt);return""===Et?"":"Collection entries differ: "+Et}}var At,Tt,St,xt;for(At in t)if(u(t,At)){if(!u(e,At))return'first argument has key "'+At+'"; second does not';if(Tt=!!t[At]&&t[At][At]===t,St=!!e[At]&&e[At][At]===e,Tt!==St)return Tt?'first argument has a circular reference at key "'+At+'"; second does not':'second argument has a circular reference at key "'+At+'"; first does not';if(!Tt&&!St&&(xt=j(t[At],e[At]),""!==xt))return'value at key "'+At+'" differs: '+xt}for(At in e)if(u(e,At)&&!u(t,At))return'second argument has key "'+At+'"; first does not';return""}return!1}},function(t,e){"use strict";var r=Object.prototype.toString,n=Function.prototype.toString,o=/^\s*function\*/;t.exports=function(t){if("function"!=typeof t)return!1;var e=r.call(t);return("[object Function]"===e||"[object GeneratorFunction]"===e)&&o.test(n.call(t))}},function(t,e){"use strict";var r=Number.prototype.toString,n=function(t){try{return r.call(t),!0}catch(e){return!1}},o=Object.prototype.toString,i="[object Number]",u="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"number"==typeof t?!0:"object"!=typeof t?!1:u?n(t):o.call(t)===i}},function(t,e){"use strict";var r=String.prototype.valueOf,n=function(t){try{return r.call(t),!0}catch(e){return!1}},o=Object.prototype.toString,i="[object String]",u="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"string"==typeof t?!0:"object"!=typeof t?!1:u?n(t):o.call(t)===i}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){function r(t){return String(t).replace(/"/g,""")}function n(t){return"[object Array]"===h(t)}function o(t){return"[object Date]"===h(t)}function i(t){return"[object RegExp]"===h(t)}function u(t){return"[object Error]"===h(t)}function a(t){return"[object Symbol]"===h(t)}function s(t){return"[object String]"===h(t)}function c(t){return"[object Number]"===h(t)}function f(t){return"[object Boolean]"===h(t)}function l(t,e){return B.call(t,e)}function h(t){return Object.prototype.toString.call(t)}function p(t){if(t.name)return t.name;var e=t.toString().match(/^function\s*([\w$]+)/);return e?e[1]:void 0}function y(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;n>r;r++)if(t[r]===e)return r;return-1}function g(t){if(!E)return!1;try{return E.call(t),!0}catch(e){}return!1}function d(t){if(!x)return!1;try{return x.call(t),!0}catch(e){}return!1}function b(t){return t&&"object"==typeof t?"undefined"!=typeof HTMLElement&&t instanceof HTMLElement?!0:"string"==typeof t.nodeName&&"function"==typeof t.getAttribute:!1}function v(t){function e(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(16>e?"0":"")+e.toString(16)}var r=t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,e);return"'"+r+"'"}var m="function"==typeof Map&&Map.prototype,w=Object.getOwnPropertyDescriptor&&m?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,E=m&&w&&"function"==typeof w.get?w.get:null,A=m&&Map.prototype.forEach,T="function"==typeof Set&&Set.prototype,S=Object.getOwnPropertyDescriptor&&T?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,x=T&&S&&"function"==typeof S.get?S.get:null,j=T&&Set.prototype.forEach,O=Boolean.prototype.valueOf;t.exports=function I(t,e,h,m){function w(t,r){return r&&(m=m.slice(),m.push(r)),I(t,e,h+1,m)}e||(e={});var T=void 0===e.depth?5:e.depth;if(void 0===h&&(h=0),h>=T&&T>0&&t&&"object"==typeof t)return"[Object]";if(void 0===m)m=[];else if(y(m,t)>=0)return"[Circular]";if("string"==typeof t)return v(t);if("function"==typeof t){var S=p(t);return"[Function"+(S?": "+S:"")+"]"}if(null===t)return"null";if(a(t)){var B=Symbol.prototype.toString.call(t);return"object"==typeof t?"Object("+B+")":B}if(b(t)){for(var _="<"+String(t.nodeName).toLowerCase(),P=t.attributes||[],R=0;R"}if(n(t)){if(0===t.length)return"[]";for(var C=Array(t.length),R=0;R "+w(e,t))}),"Map ("+E.call(t)+") {"+M.join(", ")+"}"}if(d(t)){var M=[];return j.call(t,function(e){M.push(w(e,t))}),"Set ("+x.call(t)+") {"+M.join(", ")+"}"}if("object"!=typeof t)return String(t);if(c(t))return"Object("+Number(t)+")";if(f(t))return"Object("+O.call(t)+")";if(s(t))return"Object("+w(String(t))+")";if(o(t)||i(t))return String(t);var C=[],L=[];for(var U in t)l(t,U)&&L.push(U);L.sort();for(var R=0;R=0&&"[object Function]"===r.call(t.callee)),n}},function(t,e){function r(){c&&u&&(c=!1,u.length?s=u.concat(s):f=-1,s.length&&n())}function n(){if(!c){var t=setTimeout(r);c=!0;for(var e=s.length;e;){for(u=s,s=[];++f1)for(var r=1;r=0;y--)if(p=l[y],u(" TMATCH test obj[%j]",p,t[p],e[p]),!i(t[p],e[p],o,a))return!1;return o.pop(),a.pop(),u(" TMATCH object pass"),!0}t.exports=o;var u=/\btmatch\b/.test(e.env.NODE_DEBUG||"")?console.error:function(){}}).call(e,r(30),r(5).Buffer)}])});package/CHANGES.md000644 000765 000024 0000012724 12714464743012143 0ustar00000000 000000 ## [HEAD] - `toMatch` and `toNotMatch` use `tmatch` directly, so a wider array of objects and patterns are supported [HEAD]: https://github.com/mjackson/expect/compare/v1.20.1...HEAD ## [v1.20.1] > May 7, 2016 - Objects that have different prototypes are not considered "equal". It was a bug to ever treat them as such. [v1.20.1]: https://github.com/mjackson/expect/compare/v1.20.0...v1.20.1 ## [v1.20.0] > May 6, 2016 - Objects that differ only by prototype are considered "equal". This means e.g. that `expect(Object.create(null)).toEqual({})` passes - Restored `isEqual` to behaving more like `==` instead of `===`. This is a regression that was introduced in 1.13.1 ([#62]) - Handle non-array keys in `toIncludeKeys` ([#94], thanks @wuct) [v1.20.0]: https://github.com/mjackson/expect/compare/v1.19.0...v1.20.0 [#62]: https://github.com/mjackson/expect/issues/62 [#94]: https://github.com/mjackson/expect/pull/94 ## [v1.19.0] > May 2, 2016 - Spies preserve `length` property of original function ([#90], thanks @nfcampos) - Added ability to pass a `createMessage` function to `assert` that is only called when the assertion fails - Added `toNotIncludeKey(s)` alias [v1.19.0]: https://github.com/mjackson/expect/compare/v1.18.0...v1.19.0 ## [v1.18.0] > Apr 18, 2016 - Added support for using [tmatch] in `expect(object).toMatch` [v1.18.0]: https://github.com/mjackson/expect/compare/v1.17.0...v1.18.0 [tmatch]: https://github.com/tapjs/tmatch ## [v1.17.0] > Apr 18, 2016 - Added support for objects in `toExclude` ([#86], thanks @calebmer) - Added `toIncludeKeys` and `toExcludeKeys` ([#87], thanks @calebmer) - Added `toNotInclude` alias for `toExclude` - Deprecated `withContext` and `withArgs`. Use a closure instead. - Updated `is-equal` and `object-inspect` dependencies [v1.17.0]: https://github.com/mjackson/expect/compare/v1.16.0...v1.17.0 [#86]: https://github.com/mjackson/expect/pull/86 [#87]: https://github.com/mjackson/expect/pull/87 ## [v1.16.0] > Mar 23, 1016 - Added support for objects in `toInclude` (thanks @elado) - Minor fixes to docs [v1.16.0]: https://github.com/mjackson/expect/compare/v1.15.2...v1.16.0 ## [v1.15.2] > Mar 11, 2016 - Removed named exports, fixed a bad 1.15.0 release ([#72]) [#72]: https://github.com/mjackson/expect/issues/72 [v1.15.2]: https://github.com/mjackson/expect/compare/v1.15.0...v1.15.2 ## [v1.15.0] > Mar 10, 2016 - Various build system improvements [v1.15.0]: https://github.com/mjackson/expect/compare/v1.14.0...v1.15.0 ## [v1.14.0] > Feb 1, 2016 - Added `toBeGreaterThanOrEqualTo` and `toBeLessThanOrEqualTo` ([#11] and [#59]) - Added `spy.reset()` ([#57]) [v1.14.0]: https://github.com/mjackson/expect/compare/v1.13.4...v1.14.0 [#11]: https://github.com/mjackson/expect/issues/11 [#59]: https://github.com/mjackson/expect/issues/59 [#57]: https://github.com/mjackson/expect/pull/57 ## [v1.13.4] > Dec 16, 2015 - Fixed comparing two arrays of nested objects when the first items are not equal ([#53]) [v1.13.4]: https://github.com/mjackson/expect/compare/v1.13.3...v1.13.4 [#53]: https://github.com/mjackson/expect/issues/53 ## [v1.13.3] > Dec 14, 2015 - Fix failing Map/Set tests [v1.13.3]: https://github.com/mjackson/expect/compare/v1.13.2...v1.13.3 ## [v1.13.2] > Dec 11, 2015 - Bump is-equal dependency to 1.4 [v1.13.2]: https://github.com/mjackson/expect/compare/v1.13.1...v1.13.2 ## [v1.13.1] > Dec 10, 2015 - Fix comparisons of ES6 iterables Map and Set ([#47]) - Fix comparisons of objects with circular references ([#50]) - Better error messages in `toThrow`/`toNotThrow` [v1.13.1]: https://github.com/mjackson/expect/compare/v1.13.0...v1.13.1 [#47]: https://github.com/mjackson/expect/issues/47 [#50]: https://github.com/mjackson/expect/issues/50 ## [v1.13.0] > Nov 13, 2015 - Fix `toInclude` to use `deepEqual` for comparisons ([#44]) - Run test suite in browsers [v1.13.0]: https://github.com/mjackson/expect/compare/v1.12.2...v1.13.0 [#44]: https://github.com/mjackson/expect/issues/44 ## [v1.12.2] > Oct 13, 2015 - Fix postinstall script on Windows (see [#39]) [v1.12.2]: https://github.com/mjackson/expect/compare/v1.12.1...v1.12.2 [#39]: https://github.com/mjackson/expect/issues/39 ## [v1.12.1] > Oct 10, 2015 - Add support for building on Windows - Add postinstall npm script for installing from git repo [v1.12.1]: https://github.com/mjackson/expect/compare/v1.12.0...v1.12.1 ## [v1.12.0] > Oct 5, 2015 - Add `expect.extend(assertions)` (see [#34]) - Add `expect.restoreSpies()` (see [#12]) - Show object diffs using `toEqual()` in Mocha (see [#29]) [v1.12.0]: https://github.com/mjackson/expect/compare/v1.11.1...v1.12.0 [#29]: https://github.com/mjackson/expect/issues/29 [#34]: https://github.com/mjackson/expect/pull/34 ## [v1.11.1] > Sep 26, 2015 - Add `spy.destroy()` (see [#12]) [v1.11.1]: https://github.com/mjackson/expect/compare/v1.11.0...v1.11.1 [#12]: https://github.com/mjackson/expect/issues/12 ## [v1.11.0] > Sep 12, 2015 - Add `expect.isSpy()` - Significant internal refactoring to use ES6 classes and the Babel transpiler [v1.11.0]: https://github.com/mjackson/expect/compare/v1.10.0...v1.11.0 ## [v1.10.0] > Sep 3, 2015 - Add `expect(spy).toNotHaveBeenCalled()` - Add `expect(obj).toBeAn('array')` - Add `expect(str).toNotMatch(regexp)` - Use [invariant](https://www.npmjs.com/package/invariant) instead of `assert` where applicable - Improve expectation error messages - Internal: use [eslint](https://www.npmjs.com/package/eslint) for linting [v1.10.0]: https://github.com/mjackson/expect/compare/v1.9.0...v1.10.0 package/LICENSE.md000644 000765 000024 0000002044 12621542316012135 0ustar00000000 000000 Copyright (c) 2015 Michael Jackson 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. package/lib/Expectation.js000644 000765 000024 0000035750 12734772232014141 0ustar00000000 000000 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _has = require('has'); var _has2 = _interopRequireDefault(_has); var _tmatch = require('tmatch'); var _tmatch2 = _interopRequireDefault(_tmatch); var _assert = require('./assert'); var _assert2 = _interopRequireDefault(_assert); var _SpyUtils = require('./SpyUtils'); var _TestUtils = require('./TestUtils'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * An Expectation is a wrapper around an assertion that allows it to be written * in a more natural style, without the need to remember the order of arguments. * This helps prevent you from making mistakes when writing tests. */ var Expectation = function () { function Expectation(actual) { _classCallCheck(this, Expectation); this.actual = actual; if ((0, _TestUtils.isFunction)(actual)) { this.context = null; this.args = []; } } _createClass(Expectation, [{ key: 'toExist', value: function toExist(message) { (0, _assert2.default)(this.actual, message || 'Expected %s to exist', this.actual); return this; } }, { key: 'toNotExist', value: function toNotExist(message) { (0, _assert2.default)(!this.actual, message || 'Expected %s to not exist', this.actual); return this; } }, { key: 'toBe', value: function toBe(value, message) { (0, _assert2.default)(this.actual === value, message || 'Expected %s to be %s', this.actual, value); return this; } }, { key: 'toNotBe', value: function toNotBe(value, message) { (0, _assert2.default)(this.actual !== value, message || 'Expected %s to not be %s', this.actual, value); return this; } }, { key: 'toEqual', value: function toEqual(value, message) { try { (0, _assert2.default)((0, _TestUtils.isEqual)(this.actual, value), message || 'Expected %s to equal %s', this.actual, value); } catch (error) { // These attributes are consumed by Mocha to produce a diff output. error.actual = this.actual; error.expected = value; error.showDiff = true; throw error; } return this; } }, { key: 'toNotEqual', value: function toNotEqual(value, message) { (0, _assert2.default)(!(0, _TestUtils.isEqual)(this.actual, value), message || 'Expected %s to not equal %s', this.actual, value); return this; } }, { key: 'toThrow', value: function toThrow(value, message) { (0, _assert2.default)((0, _TestUtils.isFunction)(this.actual), 'The "actual" argument in expect(actual).toThrow() must be a function, %s was given', this.actual); (0, _assert2.default)((0, _TestUtils.functionThrows)(this.actual, this.context, this.args, value), message || 'Expected %s to throw %s', this.actual, value || 'an error'); return this; } }, { key: 'toNotThrow', value: function toNotThrow(value, message) { (0, _assert2.default)((0, _TestUtils.isFunction)(this.actual), 'The "actual" argument in expect(actual).toNotThrow() must be a function, %s was given', this.actual); (0, _assert2.default)(!(0, _TestUtils.functionThrows)(this.actual, this.context, this.args, value), message || 'Expected %s to not throw %s', this.actual, value || 'an error'); return this; } }, { key: 'toBeA', value: function toBeA(value, message) { (0, _assert2.default)((0, _TestUtils.isFunction)(value) || typeof value === 'string', 'The "value" argument in toBeA(value) must be a function or a string'); (0, _assert2.default)((0, _TestUtils.isA)(this.actual, value), message || 'Expected %s to be a %s', this.actual, value); return this; } }, { key: 'toNotBeA', value: function toNotBeA(value, message) { (0, _assert2.default)((0, _TestUtils.isFunction)(value) || typeof value === 'string', 'The "value" argument in toNotBeA(value) must be a function or a string'); (0, _assert2.default)(!(0, _TestUtils.isA)(this.actual, value), message || 'Expected %s to not be a %s', this.actual, value); return this; } }, { key: 'toMatch', value: function toMatch(pattern, message) { (0, _assert2.default)((0, _tmatch2.default)(this.actual, pattern), message || 'Expected %s to match %s', this.actual, pattern); return this; } }, { key: 'toNotMatch', value: function toNotMatch(pattern, message) { (0, _assert2.default)(!(0, _tmatch2.default)(this.actual, pattern), message || 'Expected %s to not match %s', this.actual, pattern); return this; } }, { key: 'toBeLessThan', value: function toBeLessThan(value, message) { (0, _assert2.default)(typeof this.actual === 'number', 'The "actual" argument in expect(actual).toBeLessThan() must be a number'); (0, _assert2.default)(typeof value === 'number', 'The "value" argument in toBeLessThan(value) must be a number'); (0, _assert2.default)(this.actual < value, message || 'Expected %s to be less than %s', this.actual, value); return this; } }, { key: 'toBeLessThanOrEqualTo', value: function toBeLessThanOrEqualTo(value, message) { (0, _assert2.default)(typeof this.actual === 'number', 'The "actual" argument in expect(actual).toBeLessThanOrEqualTo() must be a number'); (0, _assert2.default)(typeof value === 'number', 'The "value" argument in toBeLessThanOrEqualTo(value) must be a number'); (0, _assert2.default)(this.actual <= value, message || 'Expected %s to be less than or equal to %s', this.actual, value); return this; } }, { key: 'toBeGreaterThan', value: function toBeGreaterThan(value, message) { (0, _assert2.default)(typeof this.actual === 'number', 'The "actual" argument in expect(actual).toBeGreaterThan() must be a number'); (0, _assert2.default)(typeof value === 'number', 'The "value" argument in toBeGreaterThan(value) must be a number'); (0, _assert2.default)(this.actual > value, message || 'Expected %s to be greater than %s', this.actual, value); return this; } }, { key: 'toBeGreaterThanOrEqualTo', value: function toBeGreaterThanOrEqualTo(value, message) { (0, _assert2.default)(typeof this.actual === 'number', 'The "actual" argument in expect(actual).toBeGreaterThanOrEqualTo() must be a number'); (0, _assert2.default)(typeof value === 'number', 'The "value" argument in toBeGreaterThanOrEqualTo(value) must be a number'); (0, _assert2.default)(this.actual >= value, message || 'Expected %s to be greater than or equal to %s', this.actual, value); return this; } }, { key: 'toInclude', value: function toInclude(value, compareValues, message) { if (typeof compareValues === 'string') { message = compareValues; compareValues = null; } if (compareValues == null) compareValues = _TestUtils.isEqual; var contains = false; if ((0, _TestUtils.isArray)(this.actual)) { contains = (0, _TestUtils.arrayContains)(this.actual, value, compareValues); } else if ((0, _TestUtils.isObject)(this.actual)) { contains = (0, _TestUtils.objectContains)(this.actual, value, compareValues); } else if (typeof this.actual === 'string') { contains = (0, _TestUtils.stringContains)(this.actual, value); } else { (0, _assert2.default)(false, 'The "actual" argument in expect(actual).toInclude() must be an array, object, or a string'); } (0, _assert2.default)(contains, message || 'Expected %s to include %s', this.actual, value); return this; } }, { key: 'toExclude', value: function toExclude(value, compareValues, message) { if (typeof compareValues === 'string') { message = compareValues; compareValues = null; } if (compareValues == null) compareValues = _TestUtils.isEqual; var contains = false; if ((0, _TestUtils.isArray)(this.actual)) { contains = (0, _TestUtils.arrayContains)(this.actual, value, compareValues); } else if ((0, _TestUtils.isObject)(this.actual)) { contains = (0, _TestUtils.objectContains)(this.actual, value, compareValues); } else if (typeof this.actual === 'string') { contains = (0, _TestUtils.stringContains)(this.actual, value); } else { (0, _assert2.default)(false, 'The "actual" argument in expect(actual).toExclude() must be an array, object, or a string'); } (0, _assert2.default)(!contains, message || 'Expected %s to exclude %s', this.actual, value); return this; } }, { key: 'toIncludeKeys', value: function toIncludeKeys(keys, comparator, message) { var _this = this; if (typeof comparator === 'string') { message = comparator; comparator = null; } if (comparator == null) comparator = _has2.default; (0, _assert2.default)(_typeof(this.actual) === 'object', 'The "actual" argument in expect(actual).toIncludeKeys() must be an object, not %s', this.actual); (0, _assert2.default)((0, _TestUtils.isArray)(keys), 'The "keys" argument in expect(actual).toIncludeKeys(keys) must be an array, not %s', keys); var contains = keys.every(function (key) { return comparator(_this.actual, key); }); (0, _assert2.default)(contains, message || 'Expected %s to include key(s) %s', this.actual, keys.join(', ')); return this; } }, { key: 'toIncludeKey', value: function toIncludeKey(key) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return this.toIncludeKeys.apply(this, [[key]].concat(args)); } }, { key: 'toExcludeKeys', value: function toExcludeKeys(keys, comparator, message) { var _this2 = this; if (typeof comparator === 'string') { message = comparator; comparator = null; } if (comparator == null) comparator = _has2.default; (0, _assert2.default)(_typeof(this.actual) === 'object', 'The "actual" argument in expect(actual).toExcludeKeys() must be an object, not %s', this.actual); (0, _assert2.default)((0, _TestUtils.isArray)(keys), 'The "keys" argument in expect(actual).toIncludeKeys(keys) must be an array, not %s', keys); var contains = keys.every(function (key) { return comparator(_this2.actual, key); }); (0, _assert2.default)(!contains, message || 'Expected %s to exclude key(s) %s', this.actual, keys.join(', ')); return this; } }, { key: 'toExcludeKey', value: function toExcludeKey(key) { for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } return this.toExcludeKeys.apply(this, [[key]].concat(args)); } }, { key: 'toHaveBeenCalled', value: function toHaveBeenCalled(message) { var spy = this.actual; (0, _assert2.default)((0, _SpyUtils.isSpy)(spy), 'The "actual" argument in expect(actual).toHaveBeenCalled() must be a spy'); (0, _assert2.default)(spy.calls.length > 0, message || 'spy was not called'); return this; } }, { key: 'toHaveBeenCalledWith', value: function toHaveBeenCalledWith() { for (var _len3 = arguments.length, expectedArgs = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { expectedArgs[_key3] = arguments[_key3]; } var spy = this.actual; (0, _assert2.default)((0, _SpyUtils.isSpy)(spy), 'The "actual" argument in expect(actual).toHaveBeenCalledWith() must be a spy'); (0, _assert2.default)(spy.calls.some(function (call) { return (0, _TestUtils.isEqual)(call.arguments, expectedArgs); }), 'spy was never called with %s', expectedArgs); return this; } }, { key: 'toNotHaveBeenCalled', value: function toNotHaveBeenCalled(message) { var spy = this.actual; (0, _assert2.default)((0, _SpyUtils.isSpy)(spy), 'The "actual" argument in expect(actual).toNotHaveBeenCalled() must be a spy'); (0, _assert2.default)(spy.calls.length === 0, message || 'spy was not supposed to be called'); return this; } }]); return Expectation; }(); var deprecate = function deprecate(fn, message) { var alreadyWarned = false; return function () { if (!alreadyWarned) { alreadyWarned = true; console.warn(message); } for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } return fn.apply(this, args); }; }; Expectation.prototype.withContext = deprecate(function (context) { (0, _assert2.default)((0, _TestUtils.isFunction)(this.actual), 'The "actual" argument in expect(actual).withContext() must be a function'); this.context = context; return this; }, '\nwithContext is deprecated; use a closure instead.\n\n expect(fn).withContext(context).toThrow()\n\nbecomes\n\n expect(() => fn.call(context)).toThrow()\n'); Expectation.prototype.withArgs = deprecate(function () { var _args; (0, _assert2.default)((0, _TestUtils.isFunction)(this.actual), 'The "actual" argument in expect(actual).withArgs() must be a function'); if (arguments.length) this.args = (_args = this.args).concat.apply(_args, arguments); return this; }, '\nwithArgs is deprecated; use a closure instead.\n\n expect(fn).withArgs(a, b, c).toThrow()\n\nbecomes\n\n expect(() => fn(a, b, c)).toThrow()\n'); var aliases = { toBeAn: 'toBeA', toNotBeAn: 'toNotBeA', toBeTruthy: 'toExist', toBeFalsy: 'toNotExist', toBeFewerThan: 'toBeLessThan', toBeMoreThan: 'toBeGreaterThan', toContain: 'toInclude', toNotContain: 'toExclude', toNotInclude: 'toExclude', toContainKeys: 'toIncludeKeys', toNotContainKeys: 'toExcludeKeys', toNotIncludeKeys: 'toExcludeKeys', toContainKey: 'toIncludeKey', toNotContainKey: 'toExcludeKey', toNotIncludeKey: 'toExcludeKey' }; for (var alias in aliases) { if (aliases.hasOwnProperty(alias)) Expectation.prototype[alias] = Expectation.prototype[aliases[alias]]; }exports.default = Expectation;package/lib/SpyUtils.js000644 000765 000024 0000006235 12734772233013447 0ustar00000000 000000 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.spyOn = exports.createSpy = exports.restoreSpies = exports.isSpy = undefined; var _defineProperties = require('define-properties'); var _assert = require('./assert'); var _assert2 = _interopRequireDefault(_assert); var _TestUtils = require('./TestUtils'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } /*eslint-disable prefer-rest-params, no-underscore-dangle*/ var noop = function noop() {}; var supportsConfigurableFnLength = _defineProperties.supportsDescriptors && Object.getOwnPropertyDescriptor(function () {}, 'length').configurable; var isSpy = exports.isSpy = function isSpy(object) { return object && object.__isSpy === true; }; var spies = []; var restoreSpies = exports.restoreSpies = function restoreSpies() { for (var i = spies.length - 1; i >= 0; i--) { spies[i].restore(); }spies = []; }; var createSpy = exports.createSpy = function createSpy(fn) { var restore = arguments.length <= 1 || arguments[1] === undefined ? noop : arguments[1]; if (fn == null) fn = noop; (0, _assert2.default)((0, _TestUtils.isFunction)(fn), 'createSpy needs a function'); var targetFn = void 0, thrownValue = void 0, returnValue = void 0, spy = void 0; function spyLogic() { spy.calls.push({ context: this, arguments: Array.prototype.slice.call(arguments, 0) }); if (targetFn) return targetFn.apply(this, arguments); if (thrownValue) throw thrownValue; return returnValue; } if (supportsConfigurableFnLength) { spy = Object.defineProperty(spyLogic, 'length', { value: fn.length, writable: false, enumerable: false, configurable: true }); } else { spy = new Function('spy', 'return function(' + // eslint-disable-line no-new-func [].concat(_toConsumableArray(Array(fn.length))).map(function (_, i) { return '_' + i; }).join(',') + ') {\n return spy.apply(this, arguments)\n }')(spyLogic); } spy.calls = []; spy.andCall = function (otherFn) { targetFn = otherFn; return spy; }; spy.andCallThrough = function () { return spy.andCall(fn); }; spy.andThrow = function (value) { thrownValue = value; return spy; }; spy.andReturn = function (value) { returnValue = value; return spy; }; spy.getLastCall = function () { return spy.calls[spy.calls.length - 1]; }; spy.reset = function () { spy.calls = []; }; spy.restore = spy.destroy = restore; spy.__isSpy = true; spies.push(spy); return spy; }; var spyOn = exports.spyOn = function spyOn(object, methodName) { var original = object[methodName]; if (!isSpy(original)) { (0, _assert2.default)((0, _TestUtils.isFunction)(original), 'Cannot spyOn the %s property; it is not a function', methodName); object[methodName] = createSpy(original, function () { object[methodName] = original; }); } return object[methodName]; };package/lib/TestUtils.js000644 000765 000024 0000011265 12734772233013612 0ustar00000000 000000 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.stringContains = exports.objectContains = exports.arrayContains = exports.functionThrows = exports.isA = exports.isObject = exports.isArray = exports.isFunction = exports.isEqual = exports.whyNotEqual = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; var _isRegex = require('is-regex'); var _isRegex2 = _interopRequireDefault(_isRegex); var _why = require('is-equal/why'); var _why2 = _interopRequireDefault(_why); var _objectKeys = require('object-keys'); var _objectKeys2 = _interopRequireDefault(_objectKeys); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Returns the reason why the given arguments are not *conceptually* * equal, if any; the empty string otherwise. */ var whyNotEqual = exports.whyNotEqual = function whyNotEqual(a, b) { return a == b ? '' : (0, _why2.default)(a, b); }; /** * Returns true if the given arguments are *conceptually* equal. */ var isEqual = exports.isEqual = function isEqual(a, b) { return whyNotEqual(a, b) === ''; }; /** * Returns true if the given object is a function. */ var isFunction = exports.isFunction = function isFunction(object) { return typeof object === 'function'; }; /** * Returns true if the given object is an array. */ var isArray = exports.isArray = function isArray(object) { return Array.isArray(object); }; /** * Returns true if the given object is an object. */ var isObject = exports.isObject = function isObject(object) { return object && !isArray(object) && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object'; }; /** * Returns true if the given object is an instanceof value * or its typeof is the given value. */ var isA = exports.isA = function isA(object, value) { if (isFunction(value)) return object instanceof value; if (value === 'array') return Array.isArray(object); return (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === value; }; /** * Returns true if the given function throws the given value * when invoked. The value may be: * * - undefined, to merely assert there was a throw * - a constructor function, for comparing using instanceof * - a regular expression, to compare with the error message * - a string, to find in the error message */ var functionThrows = exports.functionThrows = function functionThrows(fn, context, args, value) { try { fn.apply(context, args); } catch (error) { if (value == null) return true; if (isFunction(value) && error instanceof value) return true; var message = error.message || error; if (typeof message === 'string') { if ((0, _isRegex2.default)(value) && value.test(error.message)) return true; if (typeof value === 'string' && message.indexOf(value) !== -1) return true; } } return false; }; /** * Returns true if the given array contains the value, false * otherwise. The compareValues function must return false to * indicate a non-match. */ var arrayContains = exports.arrayContains = function arrayContains(array, value, compareValues) { return array.some(function (item) { return compareValues(item, value) !== false; }); }; var ownEnumerableKeys = function ownEnumerableKeys(object) { if ((typeof Reflect === 'undefined' ? 'undefined' : _typeof(Reflect)) === 'object' && typeof Reflect.ownKeys === 'function') { return Reflect.ownKeys(object).filter(function (key) { return Object.getOwnPropertyDescriptor(object, key).enumerable; }); } if (typeof Object.getOwnPropertySymbols === 'function') { return Object.getOwnPropertySymbols(object).filter(function (key) { return Object.getOwnPropertyDescriptor(object, key).enumerable; }).concat((0, _objectKeys2.default)(object)); } return (0, _objectKeys2.default)(object); }; /** * Returns true if the given object contains the value, false * otherwise. The compareValues function must return false to * indicate a non-match. */ var objectContains = exports.objectContains = function objectContains(object, value, compareValues) { return ownEnumerableKeys(value).every(function (k) { if (isObject(object[k]) && isObject(value[k])) return objectContains(object[k], value[k], compareValues); return compareValues(object[k], value[k]); }); }; /** * Returns true if the given string contains the value, false otherwise. */ var stringContains = exports.stringContains = function stringContains(string, value) { return string.indexOf(value) !== -1; };package/lib/assert.js000644 000765 000024 0000001600 12734772233013143 0ustar00000000 000000 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _objectInspect = require('object-inspect'); var _objectInspect2 = _interopRequireDefault(_objectInspect); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var formatString = function formatString(string, args) { var index = 0; return string.replace(/%s/g, function () { return (0, _objectInspect2.default)(args[index++]); }); }; var assert = function assert(condition, createMessage) { for (var _len = arguments.length, extraArgs = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { extraArgs[_key - 2] = arguments[_key]; } if (condition) return; var message = typeof createMessage === 'string' ? formatString(createMessage, extraArgs) : createMessage(extraArgs); throw new Error(message); }; exports.default = assert;package/lib/extend.js000644 000765 000024 0000001074 12734772233013136 0ustar00000000 000000 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Expectation = require('./Expectation'); var _Expectation2 = _interopRequireDefault(_Expectation); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Extensions = []; function extend(extension) { if (Extensions.indexOf(extension) === -1) { Extensions.push(extension); for (var p in extension) { if (extension.hasOwnProperty(p)) _Expectation2.default.prototype[p] = extension[p]; } } } exports.default = extend;package/lib/index.js000644 000765 000024 0000001347 12734772233012761 0ustar00000000 000000 'use strict'; var _Expectation = require('./Expectation'); var _Expectation2 = _interopRequireDefault(_Expectation); var _SpyUtils = require('./SpyUtils'); var _assert = require('./assert'); var _assert2 = _interopRequireDefault(_assert); var _extend = require('./extend'); var _extend2 = _interopRequireDefault(_extend); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function expect(actual) { return new _Expectation2.default(actual); } expect.createSpy = _SpyUtils.createSpy; expect.spyOn = _SpyUtils.spyOn; expect.isSpy = _SpyUtils.isSpy; expect.restoreSpies = _SpyUtils.restoreSpies; expect.assert = _assert2.default; expect.extend = _extend2.default; module.exports = expect;