From 347ec9c4c8672f0da4f86cfa6a4ca44d5eabe364 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Sat, 26 Sep 2015 01:30:55 -0600 Subject: [PATCH 01/13] =?UTF-8?q?chore(dist):=20Remove=20=20from=20master?= =?UTF-8?q?=20=F0=9F=8E=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/api-check.js | 1332 ------------------------------------- dist/api-check.min.js | 3 - dist/api-check.min.js.map | 1 - 3 files changed, 1336 deletions(-) delete mode 100644 dist/api-check.js delete mode 100644 dist/api-check.min.js delete mode 100644 dist/api-check.min.js.map diff --git a/dist/api-check.js b/dist/api-check.js deleted file mode 100644 index 4dc1774..0000000 --- a/dist/api-check.js +++ /dev/null @@ -1,1332 +0,0 @@ -//! api-check version 0.0.0-semantically-released.0 built with ♥ by Kent C. Dodds (http://kent.doddsfamily.us) (ó ì_í)=óò=(ì_í ò) - -(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["apiCheck"] = factory(); - else - root["apiCheck"] = 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'; - - Object.defineProperty(exports, '__esModule', { - value: true - }); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - - var _apiCheck = __webpack_require__(1); - - var _apiCheck2 = _interopRequireDefault(_apiCheck); - - exports['default'] = _apiCheck2['default']; - module.exports = exports['default']; - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var stringify = __webpack_require__(2); - var apiCheckUtil = __webpack_require__(3); - var each = apiCheckUtil.each; - var isError = apiCheckUtil.isError; - var t = apiCheckUtil.t; - var arrayify = apiCheckUtil.arrayify; - var getCheckerDisplay = apiCheckUtil.getCheckerDisplay; - var typeOf = apiCheckUtil.typeOf; - var getError = apiCheckUtil.getError; - - var checkers = __webpack_require__(4); - var apiCheckApis = getApiCheckApis(); - - module.exports = getApiCheckInstance; - module.exports.VERSION = ("0.0.0-semantically-released.0"); - module.exports.utils = apiCheckUtil; - module.exports.globalConfig = { - verbose: false, - disabled: false - }; - - var apiCheckApiCheck = getApiCheckInstance({ - output: { prefix: 'apiCheck' } - }); - module.exports.internalChecker = apiCheckApiCheck; - - each(checkers, function (checker, name) { - return module.exports[name] = checker; - }); - - function getApiCheckInstance() { - var config = arguments[0] === undefined ? {} : arguments[0]; - var extraCheckers = arguments[1] === undefined ? {} : arguments[1]; - - /* eslint complexity:[2, 6] */ - if (apiCheckApiCheck && arguments.length) { - apiCheckApiCheck['throw'](apiCheckApis.getApiCheckInstanceCheckers, arguments, { - prefix: 'creating an apiCheck instance' - }); - } - - var additionalProperties = { - 'throw': getApiCheck(true), - warn: getApiCheck(false), - getErrorMessage: getErrorMessage, - handleErrorMessage: handleErrorMessage, - config: { - output: config.output || { - prefix: '', - suffix: '', - docsBaseUrl: '' - }, - verbose: config.verbose || false, - disabled: config.disabled || false - }, - utils: apiCheckUtil - }; - - each(additionalProperties, function (wrapper, name) { - return apiCheck[name] = wrapper; - }); - - var disabled = apiCheck.disabled || module.exports.globalConfig.disabled; - each(checkers.getCheckers(disabled), function (checker, name) { - return apiCheck[name] = checker; - }); - each(extraCheckers, function (checker, name) { - return apiCheck[name] = checker; - }); - - return apiCheck; - - /** - * This is the instance function. Other things are attached to this see additional properties above. - * @param {Array} api - the checkers to check with - * @param {Array} args - the args to check - * @param {Object} output - output options - * @returns {Object} - if this has a failed = true property, then it failed - */ - function apiCheck(api, args, output) { - /* eslint complexity:[2, 8] */ - if (apiCheck.config.disabled || module.exports.globalConfig.disabled) { - return { - apiTypes: {}, argTypes: {}, - passed: true, message: '', - failed: false - }; // empty version of what is normally returned - } - checkApiCheckApi(arguments); - if (!Array.isArray(api)) { - api = [api]; - args = [args]; - } else { - // turn arguments into an array - args = Array.prototype.slice.call(args); - } - var messages = checkEnoughArgs(api, args); - if (!messages.length) { - // this is where we actually go perform the checks. - messages = checkApiWithArgs(api, args); - } - - var returnObject = getTypes(api, args); - returnObject.args = args; - if (messages.length) { - returnObject.message = apiCheck.getErrorMessage(api, args, messages, output); - returnObject.failed = true; - returnObject.passed = false; - } else { - returnObject.message = ''; - returnObject.failed = false; - returnObject.passed = true; - } - return returnObject; - } - - /** - * checkApiCheckApi, should be read like: check apiCheck api. As in, check the api for apiCheck :-) - * @param {Array} checkApiArgs - args provided to apiCheck function - */ - function checkApiCheckApi(checkApiArgs) { - var api = checkApiArgs[0]; - var args = checkApiArgs[1]; - var isArrayOrArgs = Array.isArray(args) || args && typeof args === 'object' && typeof args.length === 'number'; - - if (Array.isArray(api) && !isArrayOrArgs) { - throw new Error(getErrorMessage(api, [args], ['If an array is provided for the api, an array must be provided for the args as well.'], { prefix: 'apiCheck' })); - } - // dog fooding here - var errors = checkApiWithArgs(apiCheckApis.checkApiCheckApi, checkApiArgs); - if (errors.length) { - var message = apiCheck.getErrorMessage(apiCheckApis.checkApiCheckApi, checkApiArgs, errors, { - prefix: 'apiCheck' - }); - apiCheck.handleErrorMessage(message, true); - } - } - - function getApiCheck(shouldThrow) { - return function apiCheckWrapper(api, args, output) { - var result = apiCheck(api, args, output); - apiCheck.handleErrorMessage(result.message, shouldThrow); - return result; // wont get here if an error is thrown - }; - } - - function handleErrorMessage(message, shouldThrow) { - if (shouldThrow && message) { - throw new Error(message); - } else if (message) { - /* eslint no-console:0 */ - console.warn(message); - } - } - - function getErrorMessage(api, args) { - var messages = arguments[2] === undefined ? [] : arguments[2]; - var output = arguments[3] === undefined ? {} : arguments[3]; - - var gOut = apiCheck.config.output || {}; - var prefix = getPrefix(); - var suffix = getSuffix(); - var url = getUrl(); - var message = 'apiCheck failed! ' + messages.join(', '); - var passedAndShouldHavePassed = '\n\n' + buildMessageFromApiAndArgs(api, args); - return ('' + prefix + ' ' + message + ' ' + suffix + ' ' + (url || '') + '' + passedAndShouldHavePassed).trim(); - - function getPrefix() { - var p = output.onlyPrefix; - if (!p) { - p = ('' + (gOut.prefix || '') + ' ' + (output.prefix || '')).trim(); - } - return p; - } - - function getSuffix() { - var s = output.onlySuffix; - if (!s) { - s = ('' + (output.suffix || '') + ' ' + (gOut.suffix || '')).trim(); - } - return s; - } - - function getUrl() { - var u = output.url; - if (!u) { - u = gOut.docsBaseUrl && output.urlSuffix && ('' + gOut.docsBaseUrl + '' + output.urlSuffix).trim(); - } - return u; - } - } - - function buildMessageFromApiAndArgs(api, args) { - var _getTypes = getTypes(api, args); - - var apiTypes = _getTypes.apiTypes; - var argTypes = _getTypes.argTypes; - - var copy = Array.prototype.slice.call(args || []); - var replacedItems = []; - replaceFunctionWithName(copy); - var passedArgs = getObjectString(copy); - argTypes = getObjectString(argTypes); - apiTypes = getObjectString(apiTypes); - - return generateMessage(); - - // functions - - function replaceFunctionWithName(obj) { - each(obj, function (val, name) { - /* eslint complexity:[2, 6] */ - if (replacedItems.indexOf(val) === -1) { - // avoid recursive problems - replacedItems.push(val); - if (typeof val === 'object') { - replaceFunctionWithName(obj); - } else if (typeof val === 'function') { - obj[name] = val.displayName || val.name || 'anonymous function'; - } - } - }); - } - - function getObjectString(types) { - if (!types || !types.length) { - return 'nothing'; - } else if (types && types.length === 1) { - types = types[0]; - } - return stringify(types, null, 2); - } - - function generateMessage() { - var n = '\n'; - var useS = true; - if (args && args.length === 1) { - if (typeof args[0] === 'object' && args[0] !== null) { - useS = !!Object.keys(args[0]).length; - } else { - useS = false; - } - } - var types = 'type' + (useS ? 's' : ''); - var newLine = n + n; - return 'You passed:' + n + '' + passedArgs + '' + newLine + ('With the ' + types + ':' + n + '' + argTypes + '' + newLine) + ('The API calls for:' + n + '' + apiTypes); - } - } - - function getTypes(api, args) { - api = arrayify(api); - args = arrayify(args); - var apiTypes = api.map(function (checker, index) { - var specified = module.exports.globalConfig.hasOwnProperty('verbose'); - return getCheckerDisplay(checker, { - terse: specified ? !module.exports.globalConfig.verbose : !apiCheck.config.verbose, - obj: args[index], - addHelpers: true - }); - }); - var argTypes = args.map(function (arg) { - return getArgDisplay(arg, []); - }); - return { argTypes: argTypes, apiTypes: apiTypes }; - } - } - - // STATELESS FUNCTIONS - - /** - * This is where the magic happens for actually checking the arguments with the api. - * @param {Array} api - checkers - * @param {Array} args - and arguments object - * @returns {Array} - the error messages - */ - function checkApiWithArgs(api, args) { - /* eslint complexity:[2, 7] */ - var messages = []; - var failed = false; - var checkerIndex = 0; - var argIndex = 0; - var arg = undefined, - checker = undefined, - res = undefined, - lastChecker = undefined, - argName = undefined, - argFailed = undefined, - skipPreviousChecker = undefined; - /* jshint -W084 */ - while ((checker = api[checkerIndex++]) && argIndex < args.length) { - arg = args[argIndex++]; - argName = 'Argument ' + argIndex + (checker.isOptional ? ' (optional)' : ''); - res = checker(arg, 'value', argName); - argFailed = isError(res); - lastChecker = checkerIndex >= api.length; - skipPreviousChecker = checkerIndex > 1 && api[checkerIndex - 1].isOptional; - if (argFailed && lastChecker || argFailed && !lastChecker && !checker.isOptional && !skipPreviousChecker) { - failed = true; - messages.push(getCheckerErrorMessage(res, checker, arg)); - } else if (argFailed && checker.isOptional) { - argIndex--; - } else { - messages.push('' + t(argName) + ' passed'); - } - } - return failed ? messages : []; - } - - checkerTypeType.type = 'function with __apiCheckData property and `${function.type}` property'; - function checkerTypeType(checkerType, name, location) { - var apiCheckDataChecker = checkers.shape({ - type: checkers.string, - optional: checkers.bool - }); - var asFunc = checkers.func.withProperties({ __apiCheckData: apiCheckDataChecker }); - var asShape = checkers.shape({ __apiCheckData: apiCheckDataChecker }); - var wrongShape = checkers.oneOfType([asFunc, asShape])(checkerType, name, location); - if (isError(wrongShape)) { - return wrongShape; - } - if (typeof checkerType !== 'function' && !checkerType.hasOwnProperty(checkerType.__apiCheckData.type)) { - return getError(name, location, checkerTypeType.type); - } - } - - function getCheckerErrorMessage(res, checker, val) { - var checkerHelp = getCheckerHelp(checker, val); - checkerHelp = checkerHelp ? ' - ' + checkerHelp : ''; - return res.message + checkerHelp; - } - - function getCheckerHelp(_ref, val) { - var help = _ref.help; - - if (!help) { - return ''; - } - if (typeof help === 'function') { - help = help(val); - } - return help; - } - - function checkEnoughArgs(api, args) { - var requiredArgs = api.filter(function (a) { - return !a.isOptional; - }); - if (args.length < requiredArgs.length) { - return ['Not enough arguments specified. Requires `' + requiredArgs.length + '`, you passed `' + args.length + '`']; - } else { - return []; - } - } - - function getArgDisplay(arg, gottenArgs) { - /* eslint complexity:[2, 7] */ - var cName = arg && arg.constructor && arg.constructor.name; - var type = typeOf(arg); - if (type === 'function') { - if (hasKeys()) { - var properties = stringify(getDisplayIfNotGotten()); - return cName + ' (with properties: ' + properties + ')'; - } - return cName; - } - - if (arg === null) { - return 'null'; - } - - if (type !== 'array' && type !== 'object') { - return type; - } - - if (hasKeys()) { - return getDisplayIfNotGotten(); - } - - return cName; - - // utility functions - function hasKeys() { - return arg && Object.keys(arg).length; - } - - function getDisplayIfNotGotten() { - if (gottenArgs.indexOf(arg) !== -1) { - return '[Circular]'; - } - gottenArgs.push(arg); - return getDisplay(arg, gottenArgs); - } - } - - function getDisplay(obj, gottenArgs) { - var argDisplay = {}; - each(obj, function (v, k) { - return argDisplay[k] = getArgDisplay(v, gottenArgs); - }); - return argDisplay; - } - - function getApiCheckApis() { - var os = checkers.string.optional; - - var checkerFnChecker = checkers.func.withProperties({ - type: checkers.oneOfType([checkers.string, checkerTypeType]).optional, - displayName: checkers.string.optional, - shortType: checkers.string.optional, - notOptional: checkers.bool.optional, - notRequired: checkers.bool.optional - }); - - var getApiCheckInstanceCheckers = [checkers.shape({ - output: checkers.shape({ - prefix: checkers.string.optional, - suffix: checkers.string.optional, - docsBaseUrl: checkers.string.optional - }).strict.optional, - verbose: checkers.bool.optional, - disabled: checkers.bool.optional - }).strict.optional, checkers.objectOf(checkerFnChecker).optional]; - - var checkApiCheckApi = [checkers.typeOrArrayOf(checkerFnChecker), checkers.any.optional, checkers.shape({ - prefix: os, suffix: os, urlSuffix: os, // appended case - onlyPrefix: os, onlySuffix: os, url: os // override case - }).strict.optional]; - - return { - checkerFnChecker: checkerFnChecker, - getApiCheckInstanceCheckers: getApiCheckInstanceCheckers, - checkApiCheckApi: checkApiCheckApi - }; - } - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - module.exports = stringify; - - function getSerialize (fn, decycle) { - var seen = [], keys = []; - decycle = decycle || function(key, value) { - return '[Circular ' + getPath(value, seen, keys) + ']' - }; - return function(key, value) { - var ret = value; - if (typeof value === 'object' && value) { - if (seen.indexOf(value) !== -1) - ret = decycle(key, value); - else { - seen.push(value); - keys.push(key); - } - } - if (fn) ret = fn(key, ret); - return ret; - } - } - - function getPath (value, seen, keys) { - var index = seen.indexOf(value); - var path = [ keys[index] ]; - for (index--; index >= 0; index--) { - if (seen[index][ path[0] ] === value) { - value = seen[index]; - path.unshift(keys[index]); - } - } - return '~' + path.join('.'); - } - - function stringify(obj, fn, spaces, decycle) { - return JSON.stringify(obj, getSerialize(fn, decycle), spaces); - } - - stringify.getSerialize = getSerialize; - - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - function _defineProperty(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } - - var stringify = __webpack_require__(2); - var checkerHelpers = { - addOptional: addOptional, getRequiredVersion: getRequiredVersion, setupChecker: setupChecker, addNullable: addNullable - }; - - module.exports = { - each: each, copy: copy, typeOf: typeOf, arrayify: arrayify, getCheckerDisplay: getCheckerDisplay, - isError: isError, list: list, getError: getError, nAtL: nAtL, t: t, undef: undef, checkerHelpers: checkerHelpers, - noop: noop - }; - - function copy(obj) { - var type = typeOf(obj); - var daCopy = undefined; - if (type === 'array') { - daCopy = []; - } else if (type === 'object') { - daCopy = {}; - } else { - return obj; - } - each(obj, function (val, key) { - daCopy[key] = val; // cannot single-line this because we don't want to abort the each - }); - return daCopy; - } - - function typeOf(obj) { - if (Array.isArray(obj)) { - return 'array'; - } else if (obj instanceof RegExp) { - return 'object'; - } else { - return typeof obj; - } - } - - function getCheckerDisplay(checker, options) { - /* eslint complexity:[2, 7] */ - var display = undefined; - var short = options && options.short; - if (short && checker.shortType) { - display = checker.shortType; - } else if (!short && typeof checker.type === 'object' || checker.type === 'function') { - display = getCheckerType(checker, options); - } else { - display = getCheckerType(checker, options) || checker.displayName || checker.name; - } - return display; - } - - function getCheckerType(_ref, options) { - var type = _ref.type; - - if (typeof type === 'function') { - var __apiCheckData = type.__apiCheckData; - var typeTypes = type(options); - type = _defineProperty({ - __apiCheckData: __apiCheckData - }, __apiCheckData.type, typeTypes); - } - return type; - } - - function arrayify(obj) { - if (!obj) { - return []; - } else if (Array.isArray(obj)) { - return obj; - } else { - return [obj]; - } - } - - function each(obj, iterator, context) { - if (Array.isArray(obj)) { - return eachArry(obj, iterator, context); - } else { - return eachObj(obj, iterator, context); - } - } - - function eachObj(obj, iterator, context) { - var ret = undefined; - var hasOwn = Object.prototype.hasOwnProperty; - /* eslint prefer-const:0 */ // some weird eslint bug? - for (var key in obj) { - if (hasOwn.call(obj, key)) { - ret = iterator.call(context, obj[key], key, obj); - if (ret === false) { - return ret; - } - } - } - return true; - } - - function eachArry(obj, iterator, context) { - var ret = undefined; - var length = obj.length; - for (var i = 0; i < length; i++) { - ret = iterator.call(context, obj[i], i, obj); - if (ret === false) { - return ret; - } - } - return true; - } - - function isError(obj) { - return obj instanceof Error; - } - - function list(arry, join, finalJoin) { - arry = arrayify(arry); - var copy = arry.slice(); - var last = copy.pop(); - if (copy.length === 1) { - join = ' '; - } - return copy.join(join) + ('' + (copy.length ? join + finalJoin : '') + '' + last); - } - - function getError(name, location, checkerType) { - if (typeof checkerType === 'function') { - checkerType = checkerType({ short: true }); - } - var stringType = typeof checkerType !== 'object' ? checkerType : stringify(checkerType); - return new Error('' + nAtL(name, location) + ' must be ' + t(stringType)); - } - - function nAtL(name, location) { - var tName = t(name || 'value'); - var tLocation = !location ? '' : ' at ' + t(location); - return '' + tName + '' + tLocation; - } - - function t(thing) { - return '`' + thing + '`'; - } - - function undef(thing) { - return typeof thing === 'undefined'; - } - - /** - * This will set up the checker with all of the defaults that most checkers want like required by default and an - * optional version - * - * @param {Function} checker - the checker to setup with properties - * @param {Object} properties - properties to add to the checker - * @param {boolean} disabled - when set to true, this will set the checker to a no-op function - * @returns {Function} checker - the setup checker - */ - function setupChecker(checker, properties, disabled) { - /* eslint complexity:[2, 9] */ - if (disabled) { - // swap out the checker for its own copy of noop - checker = getNoop(); - checker.isNoop = true; - } - - if (typeof checker.type === 'string') { - checker.shortType = checker.type; - } - - // assign all properties given - each(properties, function (prop, name) { - return checker[name] = prop; - }); - - if (!checker.displayName) { - checker.displayName = 'apiCheck ' + t(checker.shortType || checker.type || checker.name) + ' type checker'; - } - - if (!checker.notRequired) { - checker = getRequiredVersion(checker, disabled); - } - - if (!checker.notNullable) { - addNullable(checker, disabled); - } - - if (!checker.notOptional) { - addOptional(checker, disabled); - } - - return checker; - } - - function getRequiredVersion(checker, disabled) { - var requiredChecker = disabled ? getNoop() : function requiredChecker(val, name, location, obj) { - if (undef(val) && !checker.isOptional) { - var tLocation = location ? ' in ' + t(location) : ''; - var type = getCheckerDisplay(checker, { short: true }); - var stringType = typeof type !== 'object' ? type : stringify(type); - return new Error('Required ' + t(name) + ' not specified' + tLocation + '. Must be ' + t(stringType)); - } else { - return checker(val, name, location, obj); - } - }; - copyProps(checker, requiredChecker); - requiredChecker.originalChecker = checker; - return requiredChecker; - } - - function addOptional(checker, disabled) { - var optionalCheck = disabled ? getNoop() : function optionalCheck(val, name, location, obj) { - if (!undef(val)) { - return checker(val, name, location, obj); - } - }; - // inherit all properties on the original checker - copyProps(checker, optionalCheck); - - optionalCheck.isOptional = true; - optionalCheck.displayName = checker.displayName + ' (optional)'; - optionalCheck.originalChecker = checker; - - // the magic line that allows you to add .optional to the end of the checkers - checker.optional = optionalCheck; - - fixType(checker, checker.optional); - } - - function addNullable(checker, disabled) { - var nullableCheck = disabled ? getNoop() : function nullableCheck(val, name, location, obj) { - if (val !== null) { - return checker(val, name, location, obj); - } - }; - // inherit all properties on the original checker - copyProps(checker, nullableCheck); - - nullableCheck.isNullable = true; - nullableCheck.displayName = checker.displayName + ' (nullable)'; - nullableCheck.originalChecker = checker; - - // the magic line that allows you to add .nullable to the end of the checkers - checker.nullable = nullableCheck; - - fixType(checker, checker.nullable); - if (!checker.notOptional) { - addOptional(checker.nullable, disabled); - } - } - - function fixType(checker, checkerCopy) { - // fix type, because it's not a straight copy... - // the reason is we need to specify type.__apiCheckData.optional as true for the terse/verbose option. - // we also want to add "(optional)" to the types with a string - if (typeof checkerCopy.type === 'object') { - checkerCopy.type = copy(checkerCopy.type); // make our own copy of this - } else if (typeof checkerCopy.type === 'function') { - checkerCopy.type = function () { - return checker.type.apply(checker, arguments); - }; - } else { - checkerCopy.type += ' (optional)'; - return; - } - checkerCopy.type.__apiCheckData = copy(checker.type.__apiCheckData) || {}; // and this - checkerCopy.type.__apiCheckData.optional = true; - } - - // UTILS - - function copyProps(src, dest) { - each(Object.keys(src), function (key) { - return dest[key] = src[key]; - }); - } - - function noop() {} - - function getNoop() { - /* eslint no-shadow:0 */ - /* istanbul ignore next */ - return function noop() {}; - } - -/***/ }, -/* 4 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var stringify = __webpack_require__(2); - - var _require = __webpack_require__(3); - - var typeOf = _require.typeOf; - var each = _require.each; - var copy = _require.copy; - var getCheckerDisplay = _require.getCheckerDisplay; - var isError = _require.isError; - var arrayify = _require.arrayify; - var list = _require.list; - var getError = _require.getError; - var nAtL = _require.nAtL; - var t = _require.t; - var checkerHelpers = _require.checkerHelpers; - var undef = _require.undef; - var setupChecker = checkerHelpers.setupChecker; - - var checkers = module.exports = getCheckers(); - module.exports.getCheckers = getCheckers; - - function getCheckers(disabled) { - return { - array: typeOfCheckGetter('Array'), - bool: typeOfCheckGetter('Boolean'), - number: typeOfCheckGetter('Number'), - string: typeOfCheckGetter('String'), - func: funcCheckGetter(), - object: objectCheckGetter(), - - emptyObject: emptyObjectCheckGetter(), - - instanceOf: instanceCheckGetter, - oneOf: oneOfCheckGetter, - oneOfType: oneOfTypeCheckGetter, - - arrayOf: arrayOfCheckGetter, - objectOf: objectOfCheckGetter, - typeOrArrayOf: typeOrArrayOfCheckGetter, - - range: rangeCheckGetter, - lessThan: lessThanCheckGetter, - greaterThan: greaterThanCheckGetter, - - shape: getShapeCheckGetter(), - args: argumentsCheckerGetter(), - - any: anyCheckGetter(), - 'null': nullCheckGetter() - - }; - - function typeOfCheckGetter(type) { - var lType = type.toLowerCase(); - return setupChecker(function typeOfCheckerDefinition(val, name, location) { - if (typeOf(val) !== lType) { - return getError(name, location, type); - } - }, { type: type }, disabled); - } - - function funcCheckGetter() { - var type = 'Function'; - var functionChecker = setupChecker(function functionCheckerDefinition(val, name, location) { - if (typeOf(val) !== 'function') { - return getError(name, location, type); - } - }, { type: type }, disabled); - - functionChecker.withProperties = function getWithPropertiesChecker(properties) { - var apiError = checkers.objectOf(checkers.func)(properties, 'properties', 'apiCheck.func.withProperties'); - if (isError(apiError)) { - throw apiError; - } - var shapeChecker = checkers.shape(properties, true); - shapeChecker.type.__apiCheckData.type = 'func.withProperties'; - - return setupChecker(function functionWithPropertiesChecker(val, name, location) { - var notFunction = checkers.func(val, name, location); - if (isError(notFunction)) { - return notFunction; - } - return shapeChecker(val, name, location); - }, { type: shapeChecker.type, shortType: 'func.withProperties' }, disabled); - }; - return functionChecker; - } - - function objectCheckGetter() { - var type = 'Object'; - var nullType = 'Object (null ok)'; - var objectNullOkChecker = setupChecker(function objectNullOkCheckerDefinition(val, name, location) { - if (typeOf(val) !== 'object') { - return getError(name, location, nullType); - } - }, { type: nullType }, disabled); - - var objectChecker = setupChecker(function objectCheckerDefinition(val, name, location) { - if (val === null || isError(objectNullOkChecker(val, name, location))) { - return getError(name, location, objectChecker.type); - } - }, { type: type, nullOk: objectNullOkChecker }, disabled); - - return objectChecker; - } - - function instanceCheckGetter(classToCheck) { - return setupChecker(function instanceCheckerDefinition(val, name, location) { - if (!(val instanceof classToCheck)) { - return getError(name, location, classToCheck.name); - } - }, { type: classToCheck.name }, disabled); - } - - function oneOfCheckGetter(enums) { - var type = { - __apiCheckData: { optional: false, type: 'enum' }, - 'enum': enums - }; - var shortType = 'oneOf[' + enums.map(function (enm) { - return stringify(enm); - }).join(', ') + ']'; - return setupChecker(function oneOfCheckerDefinition(val, name, location) { - if (!enums.some(function (enm) { - return enm === val; - })) { - return getError(name, location, shortType); - } - }, { type: type, shortType: shortType }, disabled); - } - - function oneOfTypeCheckGetter(typeCheckers) { - var checkersDisplay = typeCheckers.map(function (checker) { - return getCheckerDisplay(checker, { short: true }); - }); - var shortType = 'oneOfType[' + checkersDisplay.join(', ') + ']'; - function type(options) { - if (options && options.short) { - return shortType; - } - return typeCheckers.map(function (checker) { - return getCheckerDisplay(checker, options); - }); - } - type.__apiCheckData = { optional: false, type: 'oneOfType' }; - return setupChecker(function oneOfTypeCheckerDefinition(val, name, location) { - if (!typeCheckers.some(function (checker) { - return !isError(checker(val, name, location)); - })) { - return getError(name, location, shortType); - } - }, { type: type, shortType: shortType }, disabled); - } - - function arrayOfCheckGetter(checker) { - var shortCheckerDisplay = getCheckerDisplay(checker, { short: true }); - var shortType = 'arrayOf[' + shortCheckerDisplay + ']'; - - function type(options) { - if (options && options.short) { - return shortType; - } - return getCheckerDisplay(checker, options); - } - type.__apiCheckData = { optional: false, type: 'arrayOf' }; - - return setupChecker(function arrayOfCheckerDefinition(val, name, location) { - if (isError(checkers.array(val)) || !val.every(function (item) { - return !isError(checker(item)); - })) { - return getError(name, location, shortType); - } - }, { type: type, shortType: shortType }, disabled); - } - - function objectOfCheckGetter(checker) { - var checkerDisplay = getCheckerDisplay(checker, { short: true }); - var shortType = 'objectOf[' + checkerDisplay + ']'; - - function type(options) { - if (options && options.short) { - return shortType; - } - return getCheckerDisplay(checker, options); - } - type.__apiCheckData = { optional: false, type: 'objectOf' }; - - return setupChecker(function objectOfCheckerDefinition(val, name, location) { - var notObject = checkers.object(val, name, location); - if (isError(notObject)) { - return notObject; - } - var allTypesSuccess = each(val, function (item, key) { - if (isError(checker(item, key, name))) { - return false; - } - }); - if (!allTypesSuccess) { - return getError(name, location, shortType); - } - }, { type: type, shortType: shortType }, disabled); - } - - function typeOrArrayOfCheckGetter(checker) { - var checkerDisplay = getCheckerDisplay(checker, { short: true }); - var shortType = 'typeOrArrayOf[' + checkerDisplay + ']'; - - function type(options) { - if (options && options.short) { - return shortType; - } - return getCheckerDisplay(checker, options); - } - - type.__apiCheckData = { optional: false, type: 'typeOrArrayOf' }; - return setupChecker(function typeOrArrayOfDefinition(val, name, location, obj) { - if (isError(checkers.oneOfType([checker, checkers.arrayOf(checker)])(val, name, location, obj))) { - return getError(name, location, shortType); - } - }, { type: type, shortType: shortType }, disabled); - } - - function getShapeCheckGetter() { - function shapeCheckGetter(shape, nonObject) { - var shapeTypes = {}; - each(shape, function (checker, prop) { - shapeTypes[prop] = getCheckerDisplay(checker); - }); - function type() { - var options = arguments[0] === undefined ? {} : arguments[0]; - - var ret = {}; - var terse = options.terse; - var obj = options.obj; - var addHelpers = options.addHelpers; - - var parentRequired = options.required; - each(shape, function (checker, prop) { - /* eslint complexity:[2, 6] */ - var specified = obj && obj.hasOwnProperty(prop); - var required = undef(parentRequired) ? !checker.isOptional : parentRequired; - if (!terse || (specified || !checker.isOptional)) { - ret[prop] = getCheckerDisplay(checker, { terse: terse, obj: obj && obj[prop], required: required, addHelpers: addHelpers }); - } - if (addHelpers) { - modifyTypeDisplayToHelpOut(ret, prop, specified, checker, required); - } - }); - return ret; - - function modifyTypeDisplayToHelpOut(theRet, prop, specified, checker, required) { - if (!specified && required && !checker.isOptional) { - var item = 'ITEM'; - if (checker.type && checker.type.__apiCheckData) { - item = checker.type.__apiCheckData.type.toUpperCase(); - } - addHelper('missing', 'MISSING THIS ' + item, ' <-- YOU ARE MISSING THIS'); - } else if (specified) { - var error = checker(obj[prop], prop, null, obj); - if (isError(error)) { - addHelper('error', 'THIS IS THE PROBLEM: ' + error.message, ' <-- THIS IS THE PROBLEM: ' + error.message); - } - } - - function addHelper(property, objectMessage, stringMessage) { - if (typeof theRet[prop] === 'string') { - theRet[prop] += stringMessage; - } else { - theRet[prop].__apiCheckData[property] = objectMessage; - } - } - } - } - - type.__apiCheckData = { strict: false, optional: false, type: 'shape' }; - var shapeChecker = setupChecker(function shapeCheckerDefinition(val, name, location) { - /* eslint complexity:[2, 6] */ - var isObject = !nonObject && checkers.object(val, name, location); - if (isError(isObject)) { - return isObject; - } - var shapePropError = undefined; - location = location ? location + (name ? '/' : '') : ''; - name = name || ''; - each(shape, function (checker, prop) { - if (val.hasOwnProperty(prop) || !checker.isOptional) { - shapePropError = checker(val[prop], prop, '' + location + '' + name, val); - return !isError(shapePropError); - } - }); - if (isError(shapePropError)) { - return shapePropError; - } - }, { type: type, shortType: 'shape' }, disabled); - - function strictType() { - return type.apply(undefined, arguments); - } - - strictType.__apiCheckData = copy(shapeChecker.type.__apiCheckData); - strictType.__apiCheckData.strict = true; - shapeChecker.strict = setupChecker(function strictShapeCheckerDefinition(val, name, location) { - var shapeError = shapeChecker(val, name, location); - if (isError(shapeError)) { - return shapeError; - } - var allowedProperties = Object.keys(shape); - var extraProps = Object.keys(val).filter(function (prop) { - return allowedProperties.indexOf(prop) === -1; - }); - if (extraProps.length) { - return new Error('' + nAtL(name, location) + ' cannot have extra properties: ' + t(extraProps.join('`, `')) + '.' + ('It is limited to ' + t(allowedProperties.join('`, `')))); - } - }, { type: strictType, shortType: 'strict shape' }, disabled); - - return shapeChecker; - } - - shapeCheckGetter.ifNot = function ifNot(otherProps, propChecker) { - if (!Array.isArray(otherProps)) { - otherProps = [otherProps]; - } - var description = undefined; - if (otherProps.length === 1) { - description = 'specified only if ' + otherProps[0] + ' is not specified'; - } else { - description = 'specified only if none of the following are specified: [' + list(otherProps, ', ', 'and ') + ']'; - } - var shortType = 'ifNot[' + otherProps.join(', ') + ']'; - var type = getTypeForShapeChild(propChecker, description, shortType); - return setupChecker(function ifNotChecker(prop, propName, location, obj) { - var propExists = obj && obj.hasOwnProperty(propName); - var otherPropsExist = otherProps.some(function (otherProp) { - return obj && obj.hasOwnProperty(otherProp); - }); - if (propExists === otherPropsExist) { - return getError(propName, location, type); - } else if (propExists) { - return propChecker(prop, propName, location, obj); - } - }, { notRequired: true, type: type, shortType: shortType }, disabled); - }; - - shapeCheckGetter.onlyIf = function onlyIf(otherProps, propChecker) { - otherProps = arrayify(otherProps); - var description = undefined; - if (otherProps.length === 1) { - description = 'specified only if ' + otherProps[0] + ' is also specified'; - } else { - description = 'specified only if all of the following are specified: [' + list(otherProps, ', ', 'and ') + ']'; - } - var shortType = 'onlyIf[' + otherProps.join(', ') + ']'; - var type = getTypeForShapeChild(propChecker, description, shortType); - return setupChecker(function onlyIfCheckerDefinition(prop, propName, location, obj) { - var othersPresent = otherProps.every(function (property) { - return obj.hasOwnProperty(property); - }); - if (!othersPresent) { - return getError(propName, location, type); - } else { - return propChecker(prop, propName, location, obj); - } - }, { type: type, shortType: shortType }, disabled); - }; - - shapeCheckGetter.requiredIfNot = function shapeRequiredIfNot(otherProps, propChecker) { - if (!Array.isArray(otherProps)) { - otherProps = [otherProps]; - } - return getRequiredIfNotChecker(false, otherProps, propChecker); - }; - - shapeCheckGetter.requiredIfNot.all = function shapeRequiredIfNotAll(otherProps, propChecker) { - if (!Array.isArray(otherProps)) { - throw new Error('requiredIfNot.all must be passed an array'); - } - return getRequiredIfNotChecker(true, otherProps, propChecker); - }; - - function getRequiredIfNotChecker(all, otherProps, propChecker) { - var props = t(otherProps.join(', ')); - var ifProps = 'if ' + (all ? 'all of' : 'at least one of'); - var description = 'specified ' + ifProps + ' these are not specified: ' + props + ' (otherwise it\'s optional)'; - var shortType = 'requiredIfNot' + (all ? '.all' : '') + '[' + otherProps.join(', ') + '}]'; - var type = getTypeForShapeChild(propChecker, description, shortType); - return setupChecker(function shapeRequiredIfNotDefinition(prop, propName, location, obj) { - var propExists = obj && obj.hasOwnProperty(propName); - var iteration = all ? 'every' : 'some'; - var otherPropsExist = otherProps[iteration](function (otherProp) { - return obj && obj.hasOwnProperty(otherProp); - }); - if (!otherPropsExist && !propExists) { - return getError(propName, location, type); - } else if (propExists) { - return propChecker(prop, propName, location, obj); - } - }, { type: type, notRequired: true }, disabled); - } - - return shapeCheckGetter; - - function getTypeForShapeChild(propChecker, description, shortType) { - function type(options) { - if (options && options.short) { - return shortType; - } - return getCheckerDisplay(propChecker); - } - type.__apiCheckData = { optional: false, type: 'ifNot', description: description }; - return type; - } - } - - function argumentsCheckerGetter() { - var type = 'function arguments'; - return setupChecker(function argsCheckerDefinition(val, name, location) { - if (Array.isArray(val) || isError(checkers.object(val)) || isError(checkers.number(val.length))) { - return getError(name, location, type); - } - }, { type: type }, disabled); - } - - function anyCheckGetter() { - return setupChecker(function anyCheckerDefinition() {}, { type: 'any' }, disabled); - } - - function nullCheckGetter() { - var type = 'null'; - return setupChecker(function nullChecker(val, name, location) { - if (val !== null) { - return getError(name, location, type); - } - }, { type: type }, disabled); - } - - function rangeCheckGetter(min, max) { - var type = 'Range (' + min + ' - ' + max + ')'; - return setupChecker(function rangeChecker(val, name, location) { - if (typeof val !== 'number' || val < min || val > max) { - return getError(name, location, type); - } - }, { type: type }, disabled); - } - - function lessThanCheckGetter(min) { - var type = 'lessThan[' + min + ']'; - return setupChecker(function lessThanChecker(val, name, location) { - if (typeof val !== 'number' || val > min) { - return getError(name, location, type); - } - }, { type: type }, disabled); - } - - function greaterThanCheckGetter(max) { - var type = 'greaterThan[' + max + ']'; - return setupChecker(function greaterThanChecker(val, name, location) { - if (typeof val !== 'number' || val < max) { - return getError(name, location, type); - } - }, { type: type }, disabled); - } - - function emptyObjectCheckGetter() { - var type = 'empty object'; - return setupChecker(function emptyObjectChecker(val, name, location) { - if (typeOf(val) !== 'object' || val === null || Object.keys(val).length) { - return getError(name, location, type); - } - }, { type: type }, disabled); - } - } - - // don't do anything - -/***/ } -/******/ ]) -}); -; \ No newline at end of file diff --git a/dist/api-check.min.js b/dist/api-check.min.js deleted file mode 100644 index df18585..0000000 --- a/dist/api-check.min.js +++ /dev/null @@ -1,3 +0,0 @@ -//! api-check version 0.0.0-semantically-released.0 built with ♥ by Kent C. Dodds (http://kent.doddsfamily.us) (ó ì_í)=óò=(ì_í ò) -!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):"object"==typeof exports?exports.apiCheck=r():e.apiCheck=r()}(this,function(){return function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var o=t(3),i=n(o);r["default"]=i["default"],e.exports=r["default"]},function(e,r){function t(e,r){var t=[],o=[];return r=r||function(e,r){return"[Circular "+n(r,t,o)+"]"},function(n,i){var a=i;return"object"==typeof i&&i&&(-1!==t.indexOf(i)?a=r(n,i):(t.push(i),o.push(n))),e&&(a=e(n,a)),a}}function n(e,r,t){var n=r.indexOf(e),o=[t[n]];for(n--;n>=0;n--)r[n][o[0]]===e&&(e=r[n],o.unshift(t[n]));return"~"+o.join(".")}function o(e,r,n,o){return JSON.stringify(e,t(r,o),n)}e.exports=o,o.getSerialize=t},function(e,r,t){"use strict";function n(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0})}function o(e){var r=i(e),t=void 0;if("array"===r)t=[];else{if("object"!==r)return e;t={}}return f(e,function(e,r){t[r]=e}),t}function i(e){return Array.isArray(e)?"array":e instanceof RegExp?"object":typeof e}function a(e,r){var t=void 0,n=r&&r["short"];return t=n&&e.shortType?e.shortType:!n&&"object"==typeof e.type||"function"===e.type?u(e,r):u(e,r)||e.displayName||e.name}function u(e,r){var t=e.type;if("function"==typeof t){var o=t.__apiCheckData,i=t(r);t=n({__apiCheckData:o},o.type,i)}return t}function p(e){return e?Array.isArray(e)?e:[e]:[]}function f(e,r,t){return Array.isArray(e)?s(e,r,t):c(e,r,t)}function c(e,r,t){var n=void 0,o=Object.prototype.hasOwnProperty;for(var i in e)if(o.call(e,i)&&(n=r.call(t,e[i],i,e),n===!1))return n;return!0}function s(e,r,t){for(var n=void 0,o=e.length,i=0;o>i;i++)if(n=r.call(t,e[i],i,e),n===!1)return n;return!0}function l(e){return e instanceof Error}function y(e,r,t){e=p(e);var n=e.slice(),o=n.pop();return 1===n.length&&(r=" "),n.join(r)+(""+(n.length?r+t:"")+o)}function h(e,r,t){"function"==typeof t&&(t=t({"short":!0}));var n="object"!=typeof t?t:A(t);return new Error(""+d(e,r)+" must be "+v(n))}function d(e,r){var t=v(e||"value"),n=r?" at "+v(r):"";return""+t+n}function v(e){return"`"+e+"`"}function g(e){return"undefined"==typeof e}function b(e,r,t){return t&&(e=_(),e.isNoop=!0),"string"==typeof e.type&&(e.shortType=e.type),f(r,function(r,t){return e[t]=r}),e.displayName||(e.displayName="apiCheck "+v(e.shortType||e.type||e.name)+" type checker"),e.notRequired||(e=O(e,t)),e.notNullable||k(e,t),e.notOptional||m(e,t),e}function O(e,r){var t=r?_():function(r,t,n,o){if(g(r)&&!e.isOptional){var i=n?" in "+v(n):"",u=a(e,{"short":!0}),p="object"!=typeof u?u:A(u);return new Error("Required "+v(t)+" not specified"+i+". Must be "+v(p))}return e(r,t,n,o)};return j(e,t),t.originalChecker=e,t}function m(e,r){var t=r?_():function(r,t,n,o){return g(r)?void 0:e(r,t,n,o)};j(e,t),t.isOptional=!0,t.displayName=e.displayName+" (optional)",t.originalChecker=e,e.optional=t,C(e,e.optional)}function k(e,r){var t=r?_():function(r,t,n,o){return null!==r?e(r,t,n,o):void 0};j(e,t),t.isNullable=!0,t.displayName=e.displayName+" (nullable)",t.originalChecker=e,e.nullable=t,C(e,e.nullable),e.notOptional||m(e.nullable,r)}function C(e,r){if("object"==typeof r.type)r.type=o(r.type);else{if("function"!=typeof r.type)return void(r.type+=" (optional)");r.type=function(){return e.type.apply(e,arguments)}}r.type.__apiCheckData=o(e.type.__apiCheckData)||{},r.type.__apiCheckData.optional=!0}function j(e,r){f(Object.keys(e),function(t){return r[t]=e[t]})}function x(){}function _(){return function(){}}var A=t(1),T={addOptional:m,getRequiredVersion:O,setupChecker:b,addNullable:k};e.exports={each:f,copy:o,typeOf:i,arrayify:p,getCheckerDisplay:a,isError:l,list:y,getError:h,nAtL:d,t:v,undef:g,checkerHelpers:T,noop:x}},function(e,r,t){"use strict";function n(){function r(n,i,a){if(r.config.disabled||e.exports.globalConfig.disabled)return{apiTypes:{},argTypes:{},passed:!0,message:"",failed:!1};t(arguments),Array.isArray(n)?i=Array.prototype.slice.call(i):(n=[n],i=[i]);var u=p(n,i);u.length||(u=o(n,i));var f=c(n,i);return f.args=i,u.length?(f.message=r.getErrorMessage(n,i,u,a),f.failed=!0,f.passed=!1):(f.message="",f.failed=!1,f.passed=!0),f}function t(e){var t=e[0],n=e[1],i=Array.isArray(n)||n&&"object"==typeof n&&"number"==typeof n.length;if(Array.isArray(t)&&!i)throw new Error(a(t,[n],["If an array is provided for the api, an array must be provided for the args as well."],{prefix:"apiCheck"}));var u=o(C.checkApiCheckApi,e);if(u.length){var p=r.getErrorMessage(C.checkApiCheckApi,e,u,{prefix:"apiCheck"});r.handleErrorMessage(p,!0)}}function n(e){return function(t,n,o){var i=r(t,n,o);return r.handleErrorMessage(i.message,e),i}}function i(e,r){if(r&&e)throw new Error(e);e&&console.warn(e)}function a(e,t){function n(){var e=p.onlyPrefix;return e||(e=(""+(f.prefix||"")+" "+(p.prefix||"")).trim()),e}function o(){var e=p.onlySuffix;return e||(e=(""+(p.suffix||"")+" "+(f.suffix||"")).trim()),e}function i(){var e=p.url;return e||(e=f.docsBaseUrl&&p.urlSuffix&&(""+f.docsBaseUrl+p.urlSuffix).trim()),e}var a=void 0===arguments[2]?[]:arguments[2],p=void 0===arguments[3]?{}:arguments[3],f=r.config.output||{},c=n(),s=o(),l=i(),y="apiCheck failed! "+a.join(", "),h="\n\n"+u(e,t);return(""+c+" "+y+" "+s+" "+(l||"")+h).trim()}function u(e,r){function t(e){h(e,function(r,n){-1===f.indexOf(r)&&(f.push(r),"object"==typeof r?t(e):"function"==typeof r&&(e[n]=r.displayName||r.name||"anonymous function"))})}function n(e){return e&&e.length?(e&&1===e.length&&(e=e[0]),l(e,null,2)):"nothing"}function o(){var e="\n",t=!0;r&&1===r.length&&(t="object"==typeof r[0]&&null!==r[0]?!!Object.keys(r[0]).length:!1);var n="type"+(t?"s":""),o=e+e;return"You passed:"+e+s+o+("With the "+n+":"+e+u+o)+("The API calls for:"+e+a)}var i=c(e,r),a=i.apiTypes,u=i.argTypes,p=Array.prototype.slice.call(r||[]),f=[];t(p);var s=n(p);return u=n(u),a=n(a),o()}function c(t,n){t=g(t),n=g(n);var o=t.map(function(t,o){var i=e.exports.globalConfig.hasOwnProperty("verbose");return b(t,{terse:i?!e.exports.globalConfig.verbose:!r.config.verbose,obj:n[o],addHelpers:!0})}),i=n.map(function(e){return f(e,[])});return{argTypes:i,apiTypes:o}}var s=void 0===arguments[0]?{}:arguments[0],d=void 0===arguments[1]?{}:arguments[1];j&&arguments.length&&j["throw"](C.getApiCheckInstanceCheckers,arguments,{prefix:"creating an apiCheck instance"});var v={"throw":n(!0),warn:n(!1),getErrorMessage:a,handleErrorMessage:i,config:{output:s.output||{prefix:"",suffix:"",docsBaseUrl:""},verbose:s.verbose||!1,disabled:s.disabled||!1},utils:y};h(v,function(e,t){return r[t]=e});var O=r.disabled||e.exports.globalConfig.disabled;return h(k.getCheckers(O),function(e,t){return r[t]=e}),h(d,function(e,t){return r[t]=e}),r}function o(e,r){for(var t=[],n=!1,o=0,i=0,u=void 0,p=void 0,f=void 0,c=void 0,s=void 0,l=void 0,y=void 0;(p=e[o++])&&i=e.length,y=o>1&&e[o-1].isOptional,l&&c||l&&!c&&!p.isOptional&&!y?(n=!0,t.push(a(f,p,u))):l&&p.isOptional?i--:t.push(""+v(s)+" passed");return n?t:[]}function i(e,r,t){var n=k.shape({type:k.string,optional:k.bool}),o=k.func.withProperties({__apiCheckData:n}),a=k.shape({__apiCheckData:n}),u=k.oneOfType([o,a])(e,r,t);return d(u)?u:"function"==typeof e||e.hasOwnProperty(e.__apiCheckData.type)?void 0:m(r,t,i.type)}function a(e,r,t){var n=u(r,t);return n=n?" - "+n:"",e.message+n}function u(e,r){var t=e.help;return t?("function"==typeof t&&(t=t(r)),t):""}function p(e,r){var t=e.filter(function(e){return!e.isOptional});return r.lengthe||e>t?y(o,i,n):void 0},{type:n},e)}function E(r){var t="lessThan["+r+"]";return b(function(e,n,o){return"number"!=typeof e||e>r?y(n,o,t):void 0},{type:t},e)}function D(r){var t="greaterThan["+r+"]";return b(function(e,n,o){return"number"!=typeof e||r>e?y(n,o,t):void 0},{type:t},e)}function N(){var r="empty object";return b(function(e,t,n){return"object"!==a(e)||null===e||Object.keys(e).length?y(t,n,r):void 0},{type:r},e)}return{array:r("Array"),bool:r("Boolean"),number:r("Number"),string:r("String"),func:t(),object:n(),emptyObject:N(),instanceOf:i,oneOf:v,oneOfType:m,arrayOf:k,objectOf:C,typeOrArrayOf:j,range:w,lessThan:E,greaterThan:D,shape:x(),args:_(),any:A(),"null":T()}}var o=t(1),i=t(2),a=i.typeOf,u=i.each,p=i.copy,f=i.getCheckerDisplay,c=i.isError,s=i.arrayify,l=i.list,y=i.getError,h=i.nAtL,d=i.t,v=i.checkerHelpers,g=i.undef,b=v.setupChecker,O=e.exports=n();e.exports.getCheckers=n}])}); -//# sourceMappingURL=api-check.min.js.map \ No newline at end of file diff --git a/dist/api-check.min.js.map b/dist/api-check.min.js.map deleted file mode 100644 index 81cdfe2..0000000 --- a/dist/api-check.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///dist/api-check.min.js","webpack:///webpack/bootstrap 2dcdb22645a8a0fb0993","webpack:///./index.js","webpack:///../~/json-stringify-safe/stringify.js","webpack:///./api-check-util.js","webpack:///./api-check.js","webpack:///./checkers.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","Object","defineProperty","value","_apiCheck","_apiCheck2","getSerialize","fn","decycle","seen","keys","key","getPath","ret","indexOf","push","index","path","unshift","join","stringify","spaces","JSON","_defineProperty","enumerable","configurable","writable","copy","type","typeOf","daCopy","undefined","each","val","Array","isArray","RegExp","getCheckerDisplay","checker","options","display","short","shortType","getCheckerType","displayName","name","_ref","__apiCheckData","typeTypes","arrayify","iterator","context","eachArry","eachObj","hasOwn","prototype","hasOwnProperty","length","i","isError","Error","list","arry","finalJoin","slice","last","pop","getError","location","checkerType","stringType","nAtL","t","tName","tLocation","thing","undef","setupChecker","properties","disabled","getNoop","isNoop","prop","notRequired","getRequiredVersion","notNullable","addNullable","notOptional","addOptional","requiredChecker","isOptional","copyProps","originalChecker","optionalCheck","optional","fixType","nullableCheck","isNullable","nullable","checkerCopy","apply","arguments","src","dest","noop","checkerHelpers","getApiCheckInstance","apiCheck","api","args","output","config","globalConfig","apiTypes","argTypes","passed","message","failed","checkApiCheckApi","messages","checkEnoughArgs","checkApiWithArgs","returnObject","getTypes","getErrorMessage","checkApiArgs","isArrayOrArgs","prefix","errors","apiCheckApis","handleErrorMessage","getApiCheck","shouldThrow","result","console","warn","getPrefix","onlyPrefix","gOut","trim","getSuffix","s","onlySuffix","suffix","getUrl","u","url","docsBaseUrl","urlSuffix","passedAndShouldHavePassed","buildMessageFromApiAndArgs","replaceFunctionWithName","replacedItems","getObjectString","types","generateMessage","n","useS","newLine","passedArgs","_getTypes","map","specified","terse","verbose","addHelpers","arg","getArgDisplay","extraCheckers","apiCheckApiCheck","getApiCheckInstanceCheckers","additionalProperties","throw","utils","apiCheckUtil","wrapper","checkers","getCheckers","checkerIndex","argIndex","res","lastChecker","argName","argFailed","skipPreviousChecker","getCheckerErrorMessage","checkerTypeType","apiCheckDataChecker","shape","string","bool","asFunc","func","withProperties","asShape","wrongShape","oneOfType","checkerHelp","getCheckerHelp","help","requiredArgs","filter","a","gottenArgs","hasKeys","getDisplayIfNotGotten","getDisplay","cName","constructor","argDisplay","v","k","getApiCheckApis","os","checkerFnChecker","strict","objectOf","typeOrArrayOf","any","VERSION","internalChecker","typeOfCheckGetter","lType","toLowerCase","funcCheckGetter","functionChecker","apiError","shapeChecker","notFunction","objectCheckGetter","nullType","objectNullOkChecker","objectChecker","nullOk","instanceCheckGetter","classToCheck","oneOfCheckGetter","enums","enum","enm","some","oneOfTypeCheckGetter","typeCheckers","checkersDisplay","arrayOfCheckGetter","shortCheckerDisplay","array","every","item","objectOfCheckGetter","checkerDisplay","notObject","object","allTypesSuccess","typeOrArrayOfCheckGetter","arrayOf","getShapeCheckGetter","shapeCheckGetter","nonObject","modifyTypeDisplayToHelpOut","theRet","required","addHelper","property","objectMessage","stringMessage","error","toUpperCase","parentRequired","strictType","shapeTypes","isObject","shapePropError","shapeError","allowedProperties","extraProps","getRequiredIfNotChecker","all","otherProps","propChecker","props","ifProps","description","getTypeForShapeChild","propName","propExists","iteration","otherPropsExist","otherProp","ifNot","onlyIf","othersPresent","requiredIfNot","argumentsCheckerGetter","number","anyCheckGetter","nullCheckGetter","rangeCheckGetter","min","max","lessThanCheckGetter","greaterThanCheckGetter","emptyObjectCheckGetter","emptyObject","instanceOf","oneOf","range","lessThan","greaterThan","null","_require"],"mappings":";CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAAH,GACA,gBAAAC,SACAA,QAAA,SAAAD,IAEAD,EAAA,SAAAC,KACCK,KAAA,WACD,MCEgB,UAAUC,GCR1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDkBM,SAASL,EAAQD,EAASM,GAE/B,YAMA,SAASS,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,UAAWF,GAJzFG,OAAOC,eAAepB,EAAS,cAC7BqB,OAAO,GAKT,IAAIC,GAAYhB,EElEW,GFoEvBiB,EAAaR,EAAuBO,EAExCtB,GAAQ,WAAauB,EAAW,WAChCtB,EAAOD,QAAUA,EAAQ,YAIpB,SAASC,EAAQD,GGzEvB,QAAAwB,GAAAC,EAAAC,GACA,GAAAC,MAAAC,IAIA,OAHAF,MAAA,SAAAG,EAAAR,GACA,mBAAAS,EA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GAAOD,QAAQmM,YAAcA","file":"dist/api-check.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"apiCheck\"] = factory();\n\telse\n\t\troot[\"apiCheck\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","//! api-check version 0.0.0-semantically-released.0 built with ♥ by Kent C. Dodds (http://kent.doddsfamily.us) (ó ì_í)=óò=(ì_í ò)\n\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"apiCheck\"] = factory();\n\telse\n\t\troot[\"apiCheck\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _apiCheck = __webpack_require__(3);\n\t\n\tvar _apiCheck2 = _interopRequireDefault(_apiCheck);\n\n\texports['default'] = _apiCheck2['default'];\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = stringify;\n\t\n\tfunction getSerialize (fn, decycle) {\n\t var seen = [], keys = [];\n\t decycle = decycle || function(key, value) {\n\t return '[Circular ' + getPath(value, seen, keys) + ']'\n\t };\n\t return function(key, value) {\n\t var ret = value;\n\t if (typeof value === 'object' && value) {\n\t if (seen.indexOf(value) !== -1)\n\t ret = decycle(key, value);\n\t else {\n\t seen.push(value);\n\t keys.push(key);\n\t }\n\t }\n\t if (fn) ret = fn(key, ret);\n\t return ret;\n\t }\n\t}\n\t\n\tfunction getPath (value, seen, keys) {\n\t var index = seen.indexOf(value);\n\t var path = [ keys[index] ];\n\t for (index--; index >= 0; index--) {\n\t if (seen[index][ path[0] ] === value) {\n\t value = seen[index];\n\t path.unshift(keys[index]);\n\t }\n\t }\n\t return '~' + path.join('.');\n\t}\n\t\n\tfunction stringify(obj, fn, spaces, decycle) {\n\t return JSON.stringify(obj, getSerialize(fn, decycle), spaces);\n\t}\n\t\n\tstringify.getSerialize = getSerialize;\n\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tfunction _defineProperty(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); }\n\t\n\tvar stringify = __webpack_require__(1);\n\tvar checkerHelpers = {\n\t addOptional: addOptional, getRequiredVersion: getRequiredVersion, setupChecker: setupChecker, addNullable: addNullable\n\t};\n\t\n\tmodule.exports = {\n\t each: each, copy: copy, typeOf: typeOf, arrayify: arrayify, getCheckerDisplay: getCheckerDisplay,\n\t isError: isError, list: list, getError: getError, nAtL: nAtL, t: t, undef: undef, checkerHelpers: checkerHelpers,\n\t noop: noop\n\t};\n\t\n\tfunction copy(obj) {\n\t var type = typeOf(obj);\n\t var daCopy = undefined;\n\t if (type === 'array') {\n\t daCopy = [];\n\t } else if (type === 'object') {\n\t daCopy = {};\n\t } else {\n\t return obj;\n\t }\n\t each(obj, function (val, key) {\n\t daCopy[key] = val; // cannot single-line this because we don't want to abort the each\n\t });\n\t return daCopy;\n\t}\n\t\n\tfunction typeOf(obj) {\n\t if (Array.isArray(obj)) {\n\t return 'array';\n\t } else if (obj instanceof RegExp) {\n\t return 'object';\n\t } else {\n\t return typeof obj;\n\t }\n\t}\n\t\n\tfunction getCheckerDisplay(checker, options) {\n\t /* eslint complexity:[2, 7] */\n\t var display = undefined;\n\t var short = options && options.short;\n\t if (short && checker.shortType) {\n\t display = checker.shortType;\n\t } else if (!short && typeof checker.type === 'object' || checker.type === 'function') {\n\t display = getCheckerType(checker, options);\n\t } else {\n\t display = getCheckerType(checker, options) || checker.displayName || checker.name;\n\t }\n\t return display;\n\t}\n\t\n\tfunction getCheckerType(_ref, options) {\n\t var type = _ref.type;\n\t\n\t if (typeof type === 'function') {\n\t var __apiCheckData = type.__apiCheckData;\n\t var typeTypes = type(options);\n\t type = _defineProperty({\n\t __apiCheckData: __apiCheckData\n\t }, __apiCheckData.type, typeTypes);\n\t }\n\t return type;\n\t}\n\t\n\tfunction arrayify(obj) {\n\t if (!obj) {\n\t return [];\n\t } else if (Array.isArray(obj)) {\n\t return obj;\n\t } else {\n\t return [obj];\n\t }\n\t}\n\t\n\tfunction each(obj, iterator, context) {\n\t if (Array.isArray(obj)) {\n\t return eachArry(obj, iterator, context);\n\t } else {\n\t return eachObj(obj, iterator, context);\n\t }\n\t}\n\t\n\tfunction eachObj(obj, iterator, context) {\n\t var ret = undefined;\n\t var hasOwn = Object.prototype.hasOwnProperty;\n\t /* eslint prefer-const:0 */ // some weird eslint bug?\n\t for (var key in obj) {\n\t if (hasOwn.call(obj, key)) {\n\t ret = iterator.call(context, obj[key], key, obj);\n\t if (ret === false) {\n\t return ret;\n\t }\n\t }\n\t }\n\t return true;\n\t}\n\t\n\tfunction eachArry(obj, iterator, context) {\n\t var ret = undefined;\n\t var length = obj.length;\n\t for (var i = 0; i < length; i++) {\n\t ret = iterator.call(context, obj[i], i, obj);\n\t if (ret === false) {\n\t return ret;\n\t }\n\t }\n\t return true;\n\t}\n\t\n\tfunction isError(obj) {\n\t return obj instanceof Error;\n\t}\n\t\n\tfunction list(arry, join, finalJoin) {\n\t arry = arrayify(arry);\n\t var copy = arry.slice();\n\t var last = copy.pop();\n\t if (copy.length === 1) {\n\t join = ' ';\n\t }\n\t return copy.join(join) + ('' + (copy.length ? join + finalJoin : '') + '' + last);\n\t}\n\t\n\tfunction getError(name, location, checkerType) {\n\t if (typeof checkerType === 'function') {\n\t checkerType = checkerType({ short: true });\n\t }\n\t var stringType = typeof checkerType !== 'object' ? checkerType : stringify(checkerType);\n\t return new Error('' + nAtL(name, location) + ' must be ' + t(stringType));\n\t}\n\t\n\tfunction nAtL(name, location) {\n\t var tName = t(name || 'value');\n\t var tLocation = !location ? '' : ' at ' + t(location);\n\t return '' + tName + '' + tLocation;\n\t}\n\t\n\tfunction t(thing) {\n\t return '`' + thing + '`';\n\t}\n\t\n\tfunction undef(thing) {\n\t return typeof thing === 'undefined';\n\t}\n\t\n\t/**\n\t * This will set up the checker with all of the defaults that most checkers want like required by default and an\n\t * optional version\n\t *\n\t * @param {Function} checker - the checker to setup with properties\n\t * @param {Object} properties - properties to add to the checker\n\t * @param {boolean} disabled - when set to true, this will set the checker to a no-op function\n\t * @returns {Function} checker - the setup checker\n\t */\n\tfunction setupChecker(checker, properties, disabled) {\n\t /* eslint complexity:[2, 9] */\n\t if (disabled) {\n\t // swap out the checker for its own copy of noop\n\t checker = getNoop();\n\t checker.isNoop = true;\n\t }\n\t\n\t if (typeof checker.type === 'string') {\n\t checker.shortType = checker.type;\n\t }\n\t\n\t // assign all properties given\n\t each(properties, function (prop, name) {\n\t return checker[name] = prop;\n\t });\n\t\n\t if (!checker.displayName) {\n\t checker.displayName = 'apiCheck ' + t(checker.shortType || checker.type || checker.name) + ' type checker';\n\t }\n\t\n\t if (!checker.notRequired) {\n\t checker = getRequiredVersion(checker, disabled);\n\t }\n\t\n\t if (!checker.notNullable) {\n\t addNullable(checker, disabled);\n\t }\n\t\n\t if (!checker.notOptional) {\n\t addOptional(checker, disabled);\n\t }\n\t\n\t return checker;\n\t}\n\t\n\tfunction getRequiredVersion(checker, disabled) {\n\t var requiredChecker = disabled ? getNoop() : function requiredChecker(val, name, location, obj) {\n\t if (undef(val) && !checker.isOptional) {\n\t var tLocation = location ? ' in ' + t(location) : '';\n\t var type = getCheckerDisplay(checker, { short: true });\n\t var stringType = typeof type !== 'object' ? type : stringify(type);\n\t return new Error('Required ' + t(name) + ' not specified' + tLocation + '. Must be ' + t(stringType));\n\t } else {\n\t return checker(val, name, location, obj);\n\t }\n\t };\n\t copyProps(checker, requiredChecker);\n\t requiredChecker.originalChecker = checker;\n\t return requiredChecker;\n\t}\n\t\n\tfunction addOptional(checker, disabled) {\n\t var optionalCheck = disabled ? getNoop() : function optionalCheck(val, name, location, obj) {\n\t if (!undef(val)) {\n\t return checker(val, name, location, obj);\n\t }\n\t };\n\t // inherit all properties on the original checker\n\t copyProps(checker, optionalCheck);\n\t\n\t optionalCheck.isOptional = true;\n\t optionalCheck.displayName = checker.displayName + ' (optional)';\n\t optionalCheck.originalChecker = checker;\n\t\n\t // the magic line that allows you to add .optional to the end of the checkers\n\t checker.optional = optionalCheck;\n\t\n\t fixType(checker, checker.optional);\n\t}\n\t\n\tfunction addNullable(checker, disabled) {\n\t var nullableCheck = disabled ? getNoop() : function nullableCheck(val, name, location, obj) {\n\t if (val !== null) {\n\t return checker(val, name, location, obj);\n\t }\n\t };\n\t // inherit all properties on the original checker\n\t copyProps(checker, nullableCheck);\n\t\n\t nullableCheck.isNullable = true;\n\t nullableCheck.displayName = checker.displayName + ' (nullable)';\n\t nullableCheck.originalChecker = checker;\n\t\n\t // the magic line that allows you to add .nullable to the end of the checkers\n\t checker.nullable = nullableCheck;\n\t\n\t fixType(checker, checker.nullable);\n\t if (!checker.notOptional) {\n\t addOptional(checker.nullable, disabled);\n\t }\n\t}\n\t\n\tfunction fixType(checker, checkerCopy) {\n\t // fix type, because it's not a straight copy...\n\t // the reason is we need to specify type.__apiCheckData.optional as true for the terse/verbose option.\n\t // we also want to add \"(optional)\" to the types with a string\n\t if (typeof checkerCopy.type === 'object') {\n\t checkerCopy.type = copy(checkerCopy.type); // make our own copy of this\n\t } else if (typeof checkerCopy.type === 'function') {\n\t checkerCopy.type = function () {\n\t return checker.type.apply(checker, arguments);\n\t };\n\t } else {\n\t checkerCopy.type += ' (optional)';\n\t return;\n\t }\n\t checkerCopy.type.__apiCheckData = copy(checker.type.__apiCheckData) || {}; // and this\n\t checkerCopy.type.__apiCheckData.optional = true;\n\t}\n\t\n\t// UTILS\n\t\n\tfunction copyProps(src, dest) {\n\t each(Object.keys(src), function (key) {\n\t return dest[key] = src[key];\n\t });\n\t}\n\t\n\tfunction noop() {}\n\t\n\tfunction getNoop() {\n\t /* eslint no-shadow:0 */\n\t /* istanbul ignore next */\n\t return function noop() {};\n\t}\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar stringify = __webpack_require__(1);\n\tvar apiCheckUtil = __webpack_require__(2);\n\tvar each = apiCheckUtil.each;\n\tvar isError = apiCheckUtil.isError;\n\tvar t = apiCheckUtil.t;\n\tvar arrayify = apiCheckUtil.arrayify;\n\tvar getCheckerDisplay = apiCheckUtil.getCheckerDisplay;\n\tvar typeOf = apiCheckUtil.typeOf;\n\tvar getError = apiCheckUtil.getError;\n\t\n\tvar checkers = __webpack_require__(4);\n\tvar apiCheckApis = getApiCheckApis();\n\t\n\tmodule.exports = getApiCheckInstance;\n\tmodule.exports.VERSION = (\"0.0.0-semantically-released.0\");\n\tmodule.exports.utils = apiCheckUtil;\n\tmodule.exports.globalConfig = {\n\t verbose: false,\n\t disabled: false\n\t};\n\t\n\tvar apiCheckApiCheck = getApiCheckInstance({\n\t output: { prefix: 'apiCheck' }\n\t});\n\tmodule.exports.internalChecker = apiCheckApiCheck;\n\t\n\teach(checkers, function (checker, name) {\n\t return module.exports[name] = checker;\n\t});\n\t\n\tfunction getApiCheckInstance() {\n\t var config = arguments[0] === undefined ? {} : arguments[0];\n\t var extraCheckers = arguments[1] === undefined ? {} : arguments[1];\n\t\n\t /* eslint complexity:[2, 6] */\n\t if (apiCheckApiCheck && arguments.length) {\n\t apiCheckApiCheck['throw'](apiCheckApis.getApiCheckInstanceCheckers, arguments, {\n\t prefix: 'creating an apiCheck instance'\n\t });\n\t }\n\t\n\t var additionalProperties = {\n\t 'throw': getApiCheck(true),\n\t warn: getApiCheck(false),\n\t getErrorMessage: getErrorMessage,\n\t handleErrorMessage: handleErrorMessage,\n\t config: {\n\t output: config.output || {\n\t prefix: '',\n\t suffix: '',\n\t docsBaseUrl: ''\n\t },\n\t verbose: config.verbose || false,\n\t disabled: config.disabled || false\n\t },\n\t utils: apiCheckUtil\n\t };\n\t\n\t each(additionalProperties, function (wrapper, name) {\n\t return apiCheck[name] = wrapper;\n\t });\n\t\n\t var disabled = apiCheck.disabled || module.exports.globalConfig.disabled;\n\t each(checkers.getCheckers(disabled), function (checker, name) {\n\t return apiCheck[name] = checker;\n\t });\n\t each(extraCheckers, function (checker, name) {\n\t return apiCheck[name] = checker;\n\t });\n\t\n\t return apiCheck;\n\t\n\t /**\n\t * This is the instance function. Other things are attached to this see additional properties above.\n\t * @param {Array} api - the checkers to check with\n\t * @param {Array} args - the args to check\n\t * @param {Object} output - output options\n\t * @returns {Object} - if this has a failed = true property, then it failed\n\t */\n\t function apiCheck(api, args, output) {\n\t /* eslint complexity:[2, 8] */\n\t if (apiCheck.config.disabled || module.exports.globalConfig.disabled) {\n\t return {\n\t apiTypes: {}, argTypes: {},\n\t passed: true, message: '',\n\t failed: false\n\t }; // empty version of what is normally returned\n\t }\n\t checkApiCheckApi(arguments);\n\t if (!Array.isArray(api)) {\n\t api = [api];\n\t args = [args];\n\t } else {\n\t // turn arguments into an array\n\t args = Array.prototype.slice.call(args);\n\t }\n\t var messages = checkEnoughArgs(api, args);\n\t if (!messages.length) {\n\t // this is where we actually go perform the checks.\n\t messages = checkApiWithArgs(api, args);\n\t }\n\t\n\t var returnObject = getTypes(api, args);\n\t returnObject.args = args;\n\t if (messages.length) {\n\t returnObject.message = apiCheck.getErrorMessage(api, args, messages, output);\n\t returnObject.failed = true;\n\t returnObject.passed = false;\n\t } else {\n\t returnObject.message = '';\n\t returnObject.failed = false;\n\t returnObject.passed = true;\n\t }\n\t return returnObject;\n\t }\n\t\n\t /**\n\t * checkApiCheckApi, should be read like: check apiCheck api. As in, check the api for apiCheck :-)\n\t * @param {Array} checkApiArgs - args provided to apiCheck function\n\t */\n\t function checkApiCheckApi(checkApiArgs) {\n\t var api = checkApiArgs[0];\n\t var args = checkApiArgs[1];\n\t var isArrayOrArgs = Array.isArray(args) || args && typeof args === 'object' && typeof args.length === 'number';\n\t\n\t if (Array.isArray(api) && !isArrayOrArgs) {\n\t throw new Error(getErrorMessage(api, [args], ['If an array is provided for the api, an array must be provided for the args as well.'], { prefix: 'apiCheck' }));\n\t }\n\t // dog fooding here\n\t var errors = checkApiWithArgs(apiCheckApis.checkApiCheckApi, checkApiArgs);\n\t if (errors.length) {\n\t var message = apiCheck.getErrorMessage(apiCheckApis.checkApiCheckApi, checkApiArgs, errors, {\n\t prefix: 'apiCheck'\n\t });\n\t apiCheck.handleErrorMessage(message, true);\n\t }\n\t }\n\t\n\t function getApiCheck(shouldThrow) {\n\t return function apiCheckWrapper(api, args, output) {\n\t var result = apiCheck(api, args, output);\n\t apiCheck.handleErrorMessage(result.message, shouldThrow);\n\t return result; // wont get here if an error is thrown\n\t };\n\t }\n\t\n\t function handleErrorMessage(message, shouldThrow) {\n\t if (shouldThrow && message) {\n\t throw new Error(message);\n\t } else if (message) {\n\t /* eslint no-console:0 */\n\t console.warn(message);\n\t }\n\t }\n\t\n\t function getErrorMessage(api, args) {\n\t var messages = arguments[2] === undefined ? [] : arguments[2];\n\t var output = arguments[3] === undefined ? {} : arguments[3];\n\t\n\t var gOut = apiCheck.config.output || {};\n\t var prefix = getPrefix();\n\t var suffix = getSuffix();\n\t var url = getUrl();\n\t var message = 'apiCheck failed! ' + messages.join(', ');\n\t var passedAndShouldHavePassed = '\\n\\n' + buildMessageFromApiAndArgs(api, args);\n\t return ('' + prefix + ' ' + message + ' ' + suffix + ' ' + (url || '') + '' + passedAndShouldHavePassed).trim();\n\t\n\t function getPrefix() {\n\t var p = output.onlyPrefix;\n\t if (!p) {\n\t p = ('' + (gOut.prefix || '') + ' ' + (output.prefix || '')).trim();\n\t }\n\t return p;\n\t }\n\t\n\t function getSuffix() {\n\t var s = output.onlySuffix;\n\t if (!s) {\n\t s = ('' + (output.suffix || '') + ' ' + (gOut.suffix || '')).trim();\n\t }\n\t return s;\n\t }\n\t\n\t function getUrl() {\n\t var u = output.url;\n\t if (!u) {\n\t u = gOut.docsBaseUrl && output.urlSuffix && ('' + gOut.docsBaseUrl + '' + output.urlSuffix).trim();\n\t }\n\t return u;\n\t }\n\t }\n\t\n\t function buildMessageFromApiAndArgs(api, args) {\n\t var _getTypes = getTypes(api, args);\n\t\n\t var apiTypes = _getTypes.apiTypes;\n\t var argTypes = _getTypes.argTypes;\n\t\n\t var copy = Array.prototype.slice.call(args || []);\n\t var replacedItems = [];\n\t replaceFunctionWithName(copy);\n\t var passedArgs = getObjectString(copy);\n\t argTypes = getObjectString(argTypes);\n\t apiTypes = getObjectString(apiTypes);\n\t\n\t return generateMessage();\n\t\n\t // functions\n\t\n\t function replaceFunctionWithName(obj) {\n\t each(obj, function (val, name) {\n\t /* eslint complexity:[2, 6] */\n\t if (replacedItems.indexOf(val) === -1) {\n\t // avoid recursive problems\n\t replacedItems.push(val);\n\t if (typeof val === 'object') {\n\t replaceFunctionWithName(obj);\n\t } else if (typeof val === 'function') {\n\t obj[name] = val.displayName || val.name || 'anonymous function';\n\t }\n\t }\n\t });\n\t }\n\t\n\t function getObjectString(types) {\n\t if (!types || !types.length) {\n\t return 'nothing';\n\t } else if (types && types.length === 1) {\n\t types = types[0];\n\t }\n\t return stringify(types, null, 2);\n\t }\n\t\n\t function generateMessage() {\n\t var n = '\\n';\n\t var useS = true;\n\t if (args && args.length === 1) {\n\t if (typeof args[0] === 'object' && args[0] !== null) {\n\t useS = !!Object.keys(args[0]).length;\n\t } else {\n\t useS = false;\n\t }\n\t }\n\t var types = 'type' + (useS ? 's' : '');\n\t var newLine = n + n;\n\t return 'You passed:' + n + '' + passedArgs + '' + newLine + ('With the ' + types + ':' + n + '' + argTypes + '' + newLine) + ('The API calls for:' + n + '' + apiTypes);\n\t }\n\t }\n\t\n\t function getTypes(api, args) {\n\t api = arrayify(api);\n\t args = arrayify(args);\n\t var apiTypes = api.map(function (checker, index) {\n\t var specified = module.exports.globalConfig.hasOwnProperty('verbose');\n\t return getCheckerDisplay(checker, {\n\t terse: specified ? !module.exports.globalConfig.verbose : !apiCheck.config.verbose,\n\t obj: args[index],\n\t addHelpers: true\n\t });\n\t });\n\t var argTypes = args.map(function (arg) {\n\t return getArgDisplay(arg, []);\n\t });\n\t return { argTypes: argTypes, apiTypes: apiTypes };\n\t }\n\t}\n\t\n\t// STATELESS FUNCTIONS\n\t\n\t/**\n\t * This is where the magic happens for actually checking the arguments with the api.\n\t * @param {Array} api - checkers\n\t * @param {Array} args - and arguments object\n\t * @returns {Array} - the error messages\n\t */\n\tfunction checkApiWithArgs(api, args) {\n\t /* eslint complexity:[2, 7] */\n\t var messages = [];\n\t var failed = false;\n\t var checkerIndex = 0;\n\t var argIndex = 0;\n\t var arg = undefined,\n\t checker = undefined,\n\t res = undefined,\n\t lastChecker = undefined,\n\t argName = undefined,\n\t argFailed = undefined,\n\t skipPreviousChecker = undefined;\n\t /* jshint -W084 */\n\t while ((checker = api[checkerIndex++]) && argIndex < args.length) {\n\t arg = args[argIndex++];\n\t argName = 'Argument ' + argIndex + (checker.isOptional ? ' (optional)' : '');\n\t res = checker(arg, 'value', argName);\n\t argFailed = isError(res);\n\t lastChecker = checkerIndex >= api.length;\n\t skipPreviousChecker = checkerIndex > 1 && api[checkerIndex - 1].isOptional;\n\t if (argFailed && lastChecker || argFailed && !lastChecker && !checker.isOptional && !skipPreviousChecker) {\n\t failed = true;\n\t messages.push(getCheckerErrorMessage(res, checker, arg));\n\t } else if (argFailed && checker.isOptional) {\n\t argIndex--;\n\t } else {\n\t messages.push('' + t(argName) + ' passed');\n\t }\n\t }\n\t return failed ? messages : [];\n\t}\n\t\n\tcheckerTypeType.type = 'function with __apiCheckData property and `${function.type}` property';\n\tfunction checkerTypeType(checkerType, name, location) {\n\t var apiCheckDataChecker = checkers.shape({\n\t type: checkers.string,\n\t optional: checkers.bool\n\t });\n\t var asFunc = checkers.func.withProperties({ __apiCheckData: apiCheckDataChecker });\n\t var asShape = checkers.shape({ __apiCheckData: apiCheckDataChecker });\n\t var wrongShape = checkers.oneOfType([asFunc, asShape])(checkerType, name, location);\n\t if (isError(wrongShape)) {\n\t return wrongShape;\n\t }\n\t if (typeof checkerType !== 'function' && !checkerType.hasOwnProperty(checkerType.__apiCheckData.type)) {\n\t return getError(name, location, checkerTypeType.type);\n\t }\n\t}\n\t\n\tfunction getCheckerErrorMessage(res, checker, val) {\n\t var checkerHelp = getCheckerHelp(checker, val);\n\t checkerHelp = checkerHelp ? ' - ' + checkerHelp : '';\n\t return res.message + checkerHelp;\n\t}\n\t\n\tfunction getCheckerHelp(_ref, val) {\n\t var help = _ref.help;\n\t\n\t if (!help) {\n\t return '';\n\t }\n\t if (typeof help === 'function') {\n\t help = help(val);\n\t }\n\t return help;\n\t}\n\t\n\tfunction checkEnoughArgs(api, args) {\n\t var requiredArgs = api.filter(function (a) {\n\t return !a.isOptional;\n\t });\n\t if (args.length < requiredArgs.length) {\n\t return ['Not enough arguments specified. Requires `' + requiredArgs.length + '`, you passed `' + args.length + '`'];\n\t } else {\n\t return [];\n\t }\n\t}\n\t\n\tfunction getArgDisplay(arg, gottenArgs) {\n\t /* eslint complexity:[2, 7] */\n\t var cName = arg && arg.constructor && arg.constructor.name;\n\t var type = typeOf(arg);\n\t if (type === 'function') {\n\t if (hasKeys()) {\n\t var properties = stringify(getDisplayIfNotGotten());\n\t return cName + ' (with properties: ' + properties + ')';\n\t }\n\t return cName;\n\t }\n\t\n\t if (arg === null) {\n\t return 'null';\n\t }\n\t\n\t if (type !== 'array' && type !== 'object') {\n\t return type;\n\t }\n\t\n\t if (hasKeys()) {\n\t return getDisplayIfNotGotten();\n\t }\n\t\n\t return cName;\n\t\n\t // utility functions\n\t function hasKeys() {\n\t return arg && Object.keys(arg).length;\n\t }\n\t\n\t function getDisplayIfNotGotten() {\n\t if (gottenArgs.indexOf(arg) !== -1) {\n\t return '[Circular]';\n\t }\n\t gottenArgs.push(arg);\n\t return getDisplay(arg, gottenArgs);\n\t }\n\t}\n\t\n\tfunction getDisplay(obj, gottenArgs) {\n\t var argDisplay = {};\n\t each(obj, function (v, k) {\n\t return argDisplay[k] = getArgDisplay(v, gottenArgs);\n\t });\n\t return argDisplay;\n\t}\n\t\n\tfunction getApiCheckApis() {\n\t var os = checkers.string.optional;\n\t\n\t var checkerFnChecker = checkers.func.withProperties({\n\t type: checkers.oneOfType([checkers.string, checkerTypeType]).optional,\n\t displayName: checkers.string.optional,\n\t shortType: checkers.string.optional,\n\t notOptional: checkers.bool.optional,\n\t notRequired: checkers.bool.optional\n\t });\n\t\n\t var getApiCheckInstanceCheckers = [checkers.shape({\n\t output: checkers.shape({\n\t prefix: checkers.string.optional,\n\t suffix: checkers.string.optional,\n\t docsBaseUrl: checkers.string.optional\n\t }).strict.optional,\n\t verbose: checkers.bool.optional,\n\t disabled: checkers.bool.optional\n\t }).strict.optional, checkers.objectOf(checkerFnChecker).optional];\n\t\n\t var checkApiCheckApi = [checkers.typeOrArrayOf(checkerFnChecker), checkers.any.optional, checkers.shape({\n\t prefix: os, suffix: os, urlSuffix: os, // appended case\n\t onlyPrefix: os, onlySuffix: os, url: os // override case\n\t }).strict.optional];\n\t\n\t return {\n\t checkerFnChecker: checkerFnChecker,\n\t getApiCheckInstanceCheckers: getApiCheckInstanceCheckers,\n\t checkApiCheckApi: checkApiCheckApi\n\t };\n\t}\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar stringify = __webpack_require__(1);\n\t\n\tvar _require = __webpack_require__(2);\n\t\n\tvar typeOf = _require.typeOf;\n\tvar each = _require.each;\n\tvar copy = _require.copy;\n\tvar getCheckerDisplay = _require.getCheckerDisplay;\n\tvar isError = _require.isError;\n\tvar arrayify = _require.arrayify;\n\tvar list = _require.list;\n\tvar getError = _require.getError;\n\tvar nAtL = _require.nAtL;\n\tvar t = _require.t;\n\tvar checkerHelpers = _require.checkerHelpers;\n\tvar undef = _require.undef;\n\tvar setupChecker = checkerHelpers.setupChecker;\n\t\n\tvar checkers = module.exports = getCheckers();\n\tmodule.exports.getCheckers = getCheckers;\n\t\n\tfunction getCheckers(disabled) {\n\t return {\n\t array: typeOfCheckGetter('Array'),\n\t bool: typeOfCheckGetter('Boolean'),\n\t number: typeOfCheckGetter('Number'),\n\t string: typeOfCheckGetter('String'),\n\t func: funcCheckGetter(),\n\t object: objectCheckGetter(),\n\t\n\t emptyObject: emptyObjectCheckGetter(),\n\t\n\t instanceOf: instanceCheckGetter,\n\t oneOf: oneOfCheckGetter,\n\t oneOfType: oneOfTypeCheckGetter,\n\t\n\t arrayOf: arrayOfCheckGetter,\n\t objectOf: objectOfCheckGetter,\n\t typeOrArrayOf: typeOrArrayOfCheckGetter,\n\t\n\t range: rangeCheckGetter,\n\t lessThan: lessThanCheckGetter,\n\t greaterThan: greaterThanCheckGetter,\n\t\n\t shape: getShapeCheckGetter(),\n\t args: argumentsCheckerGetter(),\n\t\n\t any: anyCheckGetter(),\n\t 'null': nullCheckGetter()\n\t\n\t };\n\t\n\t function typeOfCheckGetter(type) {\n\t var lType = type.toLowerCase();\n\t return setupChecker(function typeOfCheckerDefinition(val, name, location) {\n\t if (typeOf(val) !== lType) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function funcCheckGetter() {\n\t var type = 'Function';\n\t var functionChecker = setupChecker(function functionCheckerDefinition(val, name, location) {\n\t if (typeOf(val) !== 'function') {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t\n\t functionChecker.withProperties = function getWithPropertiesChecker(properties) {\n\t var apiError = checkers.objectOf(checkers.func)(properties, 'properties', 'apiCheck.func.withProperties');\n\t if (isError(apiError)) {\n\t throw apiError;\n\t }\n\t var shapeChecker = checkers.shape(properties, true);\n\t shapeChecker.type.__apiCheckData.type = 'func.withProperties';\n\t\n\t return setupChecker(function functionWithPropertiesChecker(val, name, location) {\n\t var notFunction = checkers.func(val, name, location);\n\t if (isError(notFunction)) {\n\t return notFunction;\n\t }\n\t return shapeChecker(val, name, location);\n\t }, { type: shapeChecker.type, shortType: 'func.withProperties' }, disabled);\n\t };\n\t return functionChecker;\n\t }\n\t\n\t function objectCheckGetter() {\n\t var type = 'Object';\n\t var nullType = 'Object (null ok)';\n\t var objectNullOkChecker = setupChecker(function objectNullOkCheckerDefinition(val, name, location) {\n\t if (typeOf(val) !== 'object') {\n\t return getError(name, location, nullType);\n\t }\n\t }, { type: nullType }, disabled);\n\t\n\t var objectChecker = setupChecker(function objectCheckerDefinition(val, name, location) {\n\t if (val === null || isError(objectNullOkChecker(val, name, location))) {\n\t return getError(name, location, objectChecker.type);\n\t }\n\t }, { type: type, nullOk: objectNullOkChecker }, disabled);\n\t\n\t return objectChecker;\n\t }\n\t\n\t function instanceCheckGetter(classToCheck) {\n\t return setupChecker(function instanceCheckerDefinition(val, name, location) {\n\t if (!(val instanceof classToCheck)) {\n\t return getError(name, location, classToCheck.name);\n\t }\n\t }, { type: classToCheck.name }, disabled);\n\t }\n\t\n\t function oneOfCheckGetter(enums) {\n\t var type = {\n\t __apiCheckData: { optional: false, type: 'enum' },\n\t 'enum': enums\n\t };\n\t var shortType = 'oneOf[' + enums.map(function (enm) {\n\t return stringify(enm);\n\t }).join(', ') + ']';\n\t return setupChecker(function oneOfCheckerDefinition(val, name, location) {\n\t if (!enums.some(function (enm) {\n\t return enm === val;\n\t })) {\n\t return getError(name, location, shortType);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t }\n\t\n\t function oneOfTypeCheckGetter(typeCheckers) {\n\t var checkersDisplay = typeCheckers.map(function (checker) {\n\t return getCheckerDisplay(checker, { short: true });\n\t });\n\t var shortType = 'oneOfType[' + checkersDisplay.join(', ') + ']';\n\t function type(options) {\n\t if (options && options.short) {\n\t return shortType;\n\t }\n\t return typeCheckers.map(function (checker) {\n\t return getCheckerDisplay(checker, options);\n\t });\n\t }\n\t type.__apiCheckData = { optional: false, type: 'oneOfType' };\n\t return setupChecker(function oneOfTypeCheckerDefinition(val, name, location) {\n\t if (!typeCheckers.some(function (checker) {\n\t return !isError(checker(val, name, location));\n\t })) {\n\t return getError(name, location, shortType);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t }\n\t\n\t function arrayOfCheckGetter(checker) {\n\t var shortCheckerDisplay = getCheckerDisplay(checker, { short: true });\n\t var shortType = 'arrayOf[' + shortCheckerDisplay + ']';\n\t\n\t function type(options) {\n\t if (options && options.short) {\n\t return shortType;\n\t }\n\t return getCheckerDisplay(checker, options);\n\t }\n\t type.__apiCheckData = { optional: false, type: 'arrayOf' };\n\t\n\t return setupChecker(function arrayOfCheckerDefinition(val, name, location) {\n\t if (isError(checkers.array(val)) || !val.every(function (item) {\n\t return !isError(checker(item));\n\t })) {\n\t return getError(name, location, shortType);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t }\n\t\n\t function objectOfCheckGetter(checker) {\n\t var checkerDisplay = getCheckerDisplay(checker, { short: true });\n\t var shortType = 'objectOf[' + checkerDisplay + ']';\n\t\n\t function type(options) {\n\t if (options && options.short) {\n\t return shortType;\n\t }\n\t return getCheckerDisplay(checker, options);\n\t }\n\t type.__apiCheckData = { optional: false, type: 'objectOf' };\n\t\n\t return setupChecker(function objectOfCheckerDefinition(val, name, location) {\n\t var notObject = checkers.object(val, name, location);\n\t if (isError(notObject)) {\n\t return notObject;\n\t }\n\t var allTypesSuccess = each(val, function (item, key) {\n\t if (isError(checker(item, key, name))) {\n\t return false;\n\t }\n\t });\n\t if (!allTypesSuccess) {\n\t return getError(name, location, shortType);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t }\n\t\n\t function typeOrArrayOfCheckGetter(checker) {\n\t var checkerDisplay = getCheckerDisplay(checker, { short: true });\n\t var shortType = 'typeOrArrayOf[' + checkerDisplay + ']';\n\t\n\t function type(options) {\n\t if (options && options.short) {\n\t return shortType;\n\t }\n\t return getCheckerDisplay(checker, options);\n\t }\n\t\n\t type.__apiCheckData = { optional: false, type: 'typeOrArrayOf' };\n\t return setupChecker(function typeOrArrayOfDefinition(val, name, location, obj) {\n\t if (isError(checkers.oneOfType([checker, checkers.arrayOf(checker)])(val, name, location, obj))) {\n\t return getError(name, location, shortType);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t }\n\t\n\t function getShapeCheckGetter() {\n\t function shapeCheckGetter(shape, nonObject) {\n\t var shapeTypes = {};\n\t each(shape, function (checker, prop) {\n\t shapeTypes[prop] = getCheckerDisplay(checker);\n\t });\n\t function type() {\n\t var options = arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var ret = {};\n\t var terse = options.terse;\n\t var obj = options.obj;\n\t var addHelpers = options.addHelpers;\n\t\n\t var parentRequired = options.required;\n\t each(shape, function (checker, prop) {\n\t /* eslint complexity:[2, 6] */\n\t var specified = obj && obj.hasOwnProperty(prop);\n\t var required = undef(parentRequired) ? !checker.isOptional : parentRequired;\n\t if (!terse || (specified || !checker.isOptional)) {\n\t ret[prop] = getCheckerDisplay(checker, { terse: terse, obj: obj && obj[prop], required: required, addHelpers: addHelpers });\n\t }\n\t if (addHelpers) {\n\t modifyTypeDisplayToHelpOut(ret, prop, specified, checker, required);\n\t }\n\t });\n\t return ret;\n\t\n\t function modifyTypeDisplayToHelpOut(theRet, prop, specified, checker, required) {\n\t if (!specified && required && !checker.isOptional) {\n\t var item = 'ITEM';\n\t if (checker.type && checker.type.__apiCheckData) {\n\t item = checker.type.__apiCheckData.type.toUpperCase();\n\t }\n\t addHelper('missing', 'MISSING THIS ' + item, ' <-- YOU ARE MISSING THIS');\n\t } else if (specified) {\n\t var error = checker(obj[prop], prop, null, obj);\n\t if (isError(error)) {\n\t addHelper('error', 'THIS IS THE PROBLEM: ' + error.message, ' <-- THIS IS THE PROBLEM: ' + error.message);\n\t }\n\t }\n\t\n\t function addHelper(property, objectMessage, stringMessage) {\n\t if (typeof theRet[prop] === 'string') {\n\t theRet[prop] += stringMessage;\n\t } else {\n\t theRet[prop].__apiCheckData[property] = objectMessage;\n\t }\n\t }\n\t }\n\t }\n\t\n\t type.__apiCheckData = { strict: false, optional: false, type: 'shape' };\n\t var shapeChecker = setupChecker(function shapeCheckerDefinition(val, name, location) {\n\t /* eslint complexity:[2, 6] */\n\t var isObject = !nonObject && checkers.object(val, name, location);\n\t if (isError(isObject)) {\n\t return isObject;\n\t }\n\t var shapePropError = undefined;\n\t location = location ? location + (name ? '/' : '') : '';\n\t name = name || '';\n\t each(shape, function (checker, prop) {\n\t if (val.hasOwnProperty(prop) || !checker.isOptional) {\n\t shapePropError = checker(val[prop], prop, '' + location + '' + name, val);\n\t return !isError(shapePropError);\n\t }\n\t });\n\t if (isError(shapePropError)) {\n\t return shapePropError;\n\t }\n\t }, { type: type, shortType: 'shape' }, disabled);\n\t\n\t function strictType() {\n\t return type.apply(undefined, arguments);\n\t }\n\t\n\t strictType.__apiCheckData = copy(shapeChecker.type.__apiCheckData);\n\t strictType.__apiCheckData.strict = true;\n\t shapeChecker.strict = setupChecker(function strictShapeCheckerDefinition(val, name, location) {\n\t var shapeError = shapeChecker(val, name, location);\n\t if (isError(shapeError)) {\n\t return shapeError;\n\t }\n\t var allowedProperties = Object.keys(shape);\n\t var extraProps = Object.keys(val).filter(function (prop) {\n\t return allowedProperties.indexOf(prop) === -1;\n\t });\n\t if (extraProps.length) {\n\t return new Error('' + nAtL(name, location) + ' cannot have extra properties: ' + t(extraProps.join('`, `')) + '.' + ('It is limited to ' + t(allowedProperties.join('`, `'))));\n\t }\n\t }, { type: strictType, shortType: 'strict shape' }, disabled);\n\t\n\t return shapeChecker;\n\t }\n\t\n\t shapeCheckGetter.ifNot = function ifNot(otherProps, propChecker) {\n\t if (!Array.isArray(otherProps)) {\n\t otherProps = [otherProps];\n\t }\n\t var description = undefined;\n\t if (otherProps.length === 1) {\n\t description = 'specified only if ' + otherProps[0] + ' is not specified';\n\t } else {\n\t description = 'specified only if none of the following are specified: [' + list(otherProps, ', ', 'and ') + ']';\n\t }\n\t var shortType = 'ifNot[' + otherProps.join(', ') + ']';\n\t var type = getTypeForShapeChild(propChecker, description, shortType);\n\t return setupChecker(function ifNotChecker(prop, propName, location, obj) {\n\t var propExists = obj && obj.hasOwnProperty(propName);\n\t var otherPropsExist = otherProps.some(function (otherProp) {\n\t return obj && obj.hasOwnProperty(otherProp);\n\t });\n\t if (propExists === otherPropsExist) {\n\t return getError(propName, location, type);\n\t } else if (propExists) {\n\t return propChecker(prop, propName, location, obj);\n\t }\n\t }, { notRequired: true, type: type, shortType: shortType }, disabled);\n\t };\n\t\n\t shapeCheckGetter.onlyIf = function onlyIf(otherProps, propChecker) {\n\t otherProps = arrayify(otherProps);\n\t var description = undefined;\n\t if (otherProps.length === 1) {\n\t description = 'specified only if ' + otherProps[0] + ' is also specified';\n\t } else {\n\t description = 'specified only if all of the following are specified: [' + list(otherProps, ', ', 'and ') + ']';\n\t }\n\t var shortType = 'onlyIf[' + otherProps.join(', ') + ']';\n\t var type = getTypeForShapeChild(propChecker, description, shortType);\n\t return setupChecker(function onlyIfCheckerDefinition(prop, propName, location, obj) {\n\t var othersPresent = otherProps.every(function (property) {\n\t return obj.hasOwnProperty(property);\n\t });\n\t if (!othersPresent) {\n\t return getError(propName, location, type);\n\t } else {\n\t return propChecker(prop, propName, location, obj);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t };\n\t\n\t shapeCheckGetter.requiredIfNot = function shapeRequiredIfNot(otherProps, propChecker) {\n\t if (!Array.isArray(otherProps)) {\n\t otherProps = [otherProps];\n\t }\n\t return getRequiredIfNotChecker(false, otherProps, propChecker);\n\t };\n\t\n\t shapeCheckGetter.requiredIfNot.all = function shapeRequiredIfNotAll(otherProps, propChecker) {\n\t if (!Array.isArray(otherProps)) {\n\t throw new Error('requiredIfNot.all must be passed an array');\n\t }\n\t return getRequiredIfNotChecker(true, otherProps, propChecker);\n\t };\n\t\n\t function getRequiredIfNotChecker(all, otherProps, propChecker) {\n\t var props = t(otherProps.join(', '));\n\t var ifProps = 'if ' + (all ? 'all of' : 'at least one of');\n\t var description = 'specified ' + ifProps + ' these are not specified: ' + props + ' (otherwise it\\'s optional)';\n\t var shortType = 'requiredIfNot' + (all ? '.all' : '') + '[' + otherProps.join(', ') + '}]';\n\t var type = getTypeForShapeChild(propChecker, description, shortType);\n\t return setupChecker(function shapeRequiredIfNotDefinition(prop, propName, location, obj) {\n\t var propExists = obj && obj.hasOwnProperty(propName);\n\t var iteration = all ? 'every' : 'some';\n\t var otherPropsExist = otherProps[iteration](function (otherProp) {\n\t return obj && obj.hasOwnProperty(otherProp);\n\t });\n\t if (!otherPropsExist && !propExists) {\n\t return getError(propName, location, type);\n\t } else if (propExists) {\n\t return propChecker(prop, propName, location, obj);\n\t }\n\t }, { type: type, notRequired: true }, disabled);\n\t }\n\t\n\t return shapeCheckGetter;\n\t\n\t function getTypeForShapeChild(propChecker, description, shortType) {\n\t function type(options) {\n\t if (options && options.short) {\n\t return shortType;\n\t }\n\t return getCheckerDisplay(propChecker);\n\t }\n\t type.__apiCheckData = { optional: false, type: 'ifNot', description: description };\n\t return type;\n\t }\n\t }\n\t\n\t function argumentsCheckerGetter() {\n\t var type = 'function arguments';\n\t return setupChecker(function argsCheckerDefinition(val, name, location) {\n\t if (Array.isArray(val) || isError(checkers.object(val)) || isError(checkers.number(val.length))) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function anyCheckGetter() {\n\t return setupChecker(function anyCheckerDefinition() {}, { type: 'any' }, disabled);\n\t }\n\t\n\t function nullCheckGetter() {\n\t var type = 'null';\n\t return setupChecker(function nullChecker(val, name, location) {\n\t if (val !== null) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function rangeCheckGetter(min, max) {\n\t var type = 'Range (' + min + ' - ' + max + ')';\n\t return setupChecker(function rangeChecker(val, name, location) {\n\t if (typeof val !== 'number' || val < min || val > max) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function lessThanCheckGetter(min) {\n\t var type = 'lessThan[' + min + ']';\n\t return setupChecker(function lessThanChecker(val, name, location) {\n\t if (typeof val !== 'number' || val > min) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function greaterThanCheckGetter(max) {\n\t var type = 'greaterThan[' + max + ']';\n\t return setupChecker(function greaterThanChecker(val, name, location) {\n\t if (typeof val !== 'number' || val < max) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function emptyObjectCheckGetter() {\n\t var type = 'empty object';\n\t return setupChecker(function emptyObjectChecker(val, name, location) {\n\t if (typeOf(val) !== 'object' || val === null || Object.keys(val).length) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t}\n\t\n\t// don't do anything\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** dist/api-check.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 2dcdb22645a8a0fb0993\n **/","import apiCheckFactory from './api-check';\n\nexport default apiCheckFactory;\n\n\n\n/** WEBPACK FOOTER **\n ** ../~/eslint-loader!./index.js\n **/","module.exports = stringify;\n\nfunction getSerialize (fn, decycle) {\n var seen = [], keys = [];\n decycle = decycle || function(key, value) {\n return '[Circular ' + getPath(value, seen, keys) + ']'\n };\n return function(key, value) {\n var ret = value;\n if (typeof value === 'object' && value) {\n if (seen.indexOf(value) !== -1)\n ret = decycle(key, value);\n else {\n seen.push(value);\n keys.push(key);\n }\n }\n if (fn) ret = fn(key, ret);\n return ret;\n }\n}\n\nfunction getPath (value, seen, keys) {\n var index = seen.indexOf(value);\n var path = [ keys[index] ];\n for (index--; index >= 0; index--) {\n if (seen[index][ path[0] ] === value) {\n value = seen[index];\n path.unshift(keys[index]);\n }\n }\n return '~' + path.join('.');\n}\n\nfunction stringify(obj, fn, spaces, decycle) {\n return JSON.stringify(obj, getSerialize(fn, decycle), spaces);\n}\n\nstringify.getSerialize = getSerialize;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ../~/json-stringify-safe/stringify.js\n ** module id = 1\n ** module chunks = 0\n **/","const stringify = require('json-stringify-safe');\nconst checkerHelpers = {\n addOptional, getRequiredVersion, setupChecker, addNullable\n};\n\nmodule.exports = {\n each, copy, typeOf, arrayify, getCheckerDisplay,\n isError, list, getError, nAtL, t, undef, checkerHelpers,\n noop\n};\n\nfunction copy(obj) {\n const type = typeOf(obj);\n let daCopy;\n if (type === 'array') {\n daCopy = [];\n } else if (type === 'object') {\n daCopy = {};\n } else {\n return obj;\n }\n each(obj, (val, key) => {\n daCopy[key] = val; // cannot single-line this because we don't want to abort the each\n });\n return daCopy;\n}\n\n\nfunction typeOf(obj) {\n if (Array.isArray(obj)) {\n return 'array';\n } else if (obj instanceof RegExp) {\n return 'object';\n } else {\n return typeof obj;\n }\n}\n\nfunction getCheckerDisplay(checker, options) {\n /* eslint complexity:[2, 7] */\n let display;\n const short = options && options.short;\n if (short && checker.shortType) {\n display = checker.shortType;\n } else if (!short && typeof checker.type === 'object' || checker.type === 'function') {\n display = getCheckerType(checker, options);\n } else {\n display = getCheckerType(checker, options) || checker.displayName || checker.name;\n }\n return display;\n}\n\nfunction getCheckerType({type}, options) {\n if (typeof type === 'function') {\n const __apiCheckData = type.__apiCheckData;\n const typeTypes = type(options);\n type = {\n __apiCheckData,\n [__apiCheckData.type]: typeTypes\n };\n }\n return type;\n}\n\nfunction arrayify(obj) {\n if (!obj) {\n return [];\n } else if (Array.isArray(obj)) {\n return obj;\n } else {\n return [obj];\n }\n}\n\n\nfunction each(obj, iterator, context) {\n if (Array.isArray(obj)) {\n return eachArry(obj, iterator, context);\n } else {\n return eachObj(obj, iterator, context);\n }\n}\n\nfunction eachObj(obj, iterator, context) {\n let ret;\n const hasOwn = Object.prototype.hasOwnProperty;\n /* eslint prefer-const:0 */ // some weird eslint bug?\n for (let key in obj) {\n if (hasOwn.call(obj, key)) {\n ret = iterator.call(context, obj[key], key, obj);\n if (ret === false) {\n return ret;\n }\n }\n }\n return true;\n}\n\nfunction eachArry(obj, iterator, context) {\n let ret;\n const length = obj.length;\n for (let i = 0; i < length; i++) {\n ret = iterator.call(context, obj[i], i, obj);\n if (ret === false) {\n return ret;\n }\n }\n return true;\n}\n\nfunction isError(obj) {\n return obj instanceof Error;\n}\n\nfunction list(arry, join, finalJoin) {\n arry = arrayify(arry);\n const copy = arry.slice();\n const last = copy.pop();\n if (copy.length === 1) {\n join = ' ';\n }\n return copy.join(join) + `${copy.length ? join + finalJoin : ''}${last}`;\n}\n\n\nfunction getError(name, location, checkerType) {\n if (typeof checkerType === 'function') {\n checkerType = checkerType({short: true});\n }\n const stringType = typeof checkerType !== 'object' ? checkerType : stringify(checkerType);\n return new Error(`${nAtL(name, location)} must be ${t(stringType)}`);\n}\n\nfunction nAtL(name, location) {\n const tName = t(name || 'value');\n let tLocation = !location ? '' : ' at ' + t(location);\n return `${tName}${tLocation}`;\n}\n\nfunction t(thing) {\n return '`' + thing + '`';\n}\n\nfunction undef(thing) {\n return typeof thing === 'undefined';\n}\n\n\n/**\n * This will set up the checker with all of the defaults that most checkers want like required by default and an\n * optional version\n *\n * @param {Function} checker - the checker to setup with properties\n * @param {Object} properties - properties to add to the checker\n * @param {boolean} disabled - when set to true, this will set the checker to a no-op function\n * @returns {Function} checker - the setup checker\n */\nfunction setupChecker(checker, properties, disabled) {\n /* eslint complexity:[2, 9] */\n if (disabled) { // swap out the checker for its own copy of noop\n checker = getNoop();\n checker.isNoop = true;\n }\n\n if (typeof checker.type === 'string') {\n checker.shortType = checker.type;\n }\n\n // assign all properties given\n each(properties, (prop, name) => checker[name] = prop);\n\n if (!checker.displayName) {\n checker.displayName = `apiCheck ${t(checker.shortType || checker.type || checker.name)} type checker`;\n }\n\n\n if (!checker.notRequired) {\n checker = getRequiredVersion(checker, disabled);\n }\n\n if (!checker.notNullable) {\n addNullable(checker, disabled);\n }\n\n if (!checker.notOptional) {\n addOptional(checker, disabled);\n }\n\n return checker;\n}\n\nfunction getRequiredVersion(checker, disabled) {\n const requiredChecker = disabled ? getNoop() : function requiredChecker(val, name, location, obj) {\n if (undef(val) && !checker.isOptional) {\n let tLocation = location ? ` in ${t(location)}` : '';\n const type = getCheckerDisplay(checker, {short: true});\n const stringType = typeof type !== 'object' ? type : stringify(type);\n return new Error(`Required ${t(name)} not specified${tLocation}. Must be ${t(stringType)}`);\n } else {\n return checker(val, name, location, obj);\n }\n };\n copyProps(checker, requiredChecker);\n requiredChecker.originalChecker = checker;\n return requiredChecker;\n}\n\nfunction addOptional(checker, disabled) {\n const optionalCheck = disabled ? getNoop() : function optionalCheck(val, name, location, obj) {\n if (!undef(val)) {\n return checker(val, name, location, obj);\n }\n };\n // inherit all properties on the original checker\n copyProps(checker, optionalCheck);\n\n optionalCheck.isOptional = true;\n optionalCheck.displayName = checker.displayName + ' (optional)';\n optionalCheck.originalChecker = checker;\n\n\n // the magic line that allows you to add .optional to the end of the checkers\n checker.optional = optionalCheck;\n\n fixType(checker, checker.optional);\n}\n\nfunction addNullable(checker, disabled) {\n const nullableCheck = disabled ? getNoop() : function nullableCheck(val, name, location, obj) {\n if (val !== null) {\n return checker(val, name, location, obj);\n }\n };\n // inherit all properties on the original checker\n copyProps(checker, nullableCheck);\n\n nullableCheck.isNullable = true;\n nullableCheck.displayName = checker.displayName + ' (nullable)';\n nullableCheck.originalChecker = checker;\n\n // the magic line that allows you to add .nullable to the end of the checkers\n checker.nullable = nullableCheck;\n\n fixType(checker, checker.nullable);\n if (!checker.notOptional) {\n addOptional(checker.nullable, disabled);\n }\n}\n\nfunction fixType(checker, checkerCopy) {\n // fix type, because it's not a straight copy...\n // the reason is we need to specify type.__apiCheckData.optional as true for the terse/verbose option.\n // we also want to add \"(optional)\" to the types with a string\n if (typeof checkerCopy.type === 'object') {\n checkerCopy.type = copy(checkerCopy.type); // make our own copy of this\n } else if (typeof checkerCopy.type === 'function') {\n checkerCopy.type = function() {\n return checker.type(...arguments);\n };\n } else {\n checkerCopy.type += ' (optional)';\n return;\n }\n checkerCopy.type.__apiCheckData = copy(checker.type.__apiCheckData) || {}; // and this\n checkerCopy.type.__apiCheckData.optional = true;\n}\n\n\n// UTILS\n\nfunction copyProps(src, dest) {\n each(Object.keys(src), key => dest[key] = src[key]);\n}\n\nfunction noop() {\n}\n\nfunction getNoop() {\n /* eslint no-shadow:0 */\n /* istanbul ignore next */\n return function noop() {\n };\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ../~/eslint-loader!./api-check-util.js\n **/","const stringify = require('json-stringify-safe');\nconst apiCheckUtil = require('./api-check-util');\nconst {each, isError, t, arrayify, getCheckerDisplay, typeOf, getError} = apiCheckUtil;\nconst checkers = require('./checkers');\nconst apiCheckApis = getApiCheckApis();\n\nmodule.exports = getApiCheckInstance;\nmodule.exports.VERSION = VERSION;\nmodule.exports.utils = apiCheckUtil;\nmodule.exports.globalConfig = {\n verbose: false,\n disabled: false\n};\n\nconst apiCheckApiCheck = getApiCheckInstance({\n output: {prefix: 'apiCheck'}\n});\nmodule.exports.internalChecker = apiCheckApiCheck;\n\n\neach(checkers, (checker, name) => module.exports[name] = checker);\n\nfunction getApiCheckInstance(config = {}, extraCheckers = {}) {\n /* eslint complexity:[2, 6] */\n if (apiCheckApiCheck && arguments.length) {\n apiCheckApiCheck.throw(apiCheckApis.getApiCheckInstanceCheckers, arguments, {\n prefix: 'creating an apiCheck instance'\n });\n }\n\n const additionalProperties = {\n throw: getApiCheck(true),\n warn: getApiCheck(false),\n getErrorMessage,\n handleErrorMessage,\n config: {\n output: config.output || {\n prefix: '',\n suffix: '',\n docsBaseUrl: ''\n },\n verbose: config.verbose || false,\n disabled: config.disabled || false\n },\n utils: apiCheckUtil\n };\n\n each(additionalProperties, (wrapper, name) => apiCheck[name] = wrapper);\n\n const disabled = apiCheck.disabled || module.exports.globalConfig.disabled;\n each(checkers.getCheckers(disabled), (checker, name) => apiCheck[name] = checker);\n each(extraCheckers, (checker, name) => apiCheck[name] = checker);\n\n return apiCheck;\n\n\n /**\n * This is the instance function. Other things are attached to this see additional properties above.\n * @param {Array} api - the checkers to check with\n * @param {Array} args - the args to check\n * @param {Object} output - output options\n * @returns {Object} - if this has a failed = true property, then it failed\n */\n function apiCheck(api, args, output) {\n /* eslint complexity:[2, 8] */\n if (apiCheck.config.disabled || module.exports.globalConfig.disabled) {\n return {\n apiTypes: {}, argTypes: {},\n passed: true, message: '',\n failed: false\n }; // empty version of what is normally returned\n }\n checkApiCheckApi(arguments);\n if (!Array.isArray(api)) {\n api = [api];\n args = [args];\n } else {\n // turn arguments into an array\n args = Array.prototype.slice.call(args);\n }\n let messages = checkEnoughArgs(api, args);\n if (!messages.length) {\n // this is where we actually go perform the checks.\n messages = checkApiWithArgs(api, args);\n }\n\n const returnObject = getTypes(api, args);\n returnObject.args = args;\n if (messages.length) {\n returnObject.message = apiCheck.getErrorMessage(api, args, messages, output);\n returnObject.failed = true;\n returnObject.passed = false;\n } else {\n returnObject.message = '';\n returnObject.failed = false;\n returnObject.passed = true;\n }\n return returnObject;\n }\n\n /**\n * checkApiCheckApi, should be read like: check apiCheck api. As in, check the api for apiCheck :-)\n * @param {Array} checkApiArgs - args provided to apiCheck function\n */\n function checkApiCheckApi(checkApiArgs) {\n const api = checkApiArgs[0];\n const args = checkApiArgs[1];\n const isArrayOrArgs = Array.isArray(args) || (args && typeof args === 'object' && typeof args.length === 'number');\n\n if (Array.isArray(api) && !isArrayOrArgs) {\n throw new Error(getErrorMessage(api, [args],\n ['If an array is provided for the api, an array must be provided for the args as well.'],\n {prefix: 'apiCheck'}\n ));\n }\n // dog fooding here\n const errors = checkApiWithArgs(apiCheckApis.checkApiCheckApi, checkApiArgs);\n if (errors.length) {\n const message = apiCheck.getErrorMessage(apiCheckApis.checkApiCheckApi, checkApiArgs, errors, {\n prefix: 'apiCheck'\n });\n apiCheck.handleErrorMessage(message, true);\n }\n }\n\n\n function getApiCheck(shouldThrow) {\n return function apiCheckWrapper(api, args, output) {\n const result = apiCheck(api, args, output);\n apiCheck.handleErrorMessage(result.message, shouldThrow);\n return result; // wont get here if an error is thrown\n };\n }\n\n function handleErrorMessage(message, shouldThrow) {\n if (shouldThrow && message) {\n throw new Error(message);\n } else if (message) {\n /* eslint no-console:0 */\n console.warn(message);\n }\n }\n\n function getErrorMessage(api, args, messages = [], output = {}) {\n const gOut = apiCheck.config.output || {};\n const prefix = getPrefix();\n const suffix = getSuffix();\n const url = getUrl();\n const message = `apiCheck failed! ${messages.join(', ')}`;\n const passedAndShouldHavePassed = '\\n\\n' + buildMessageFromApiAndArgs(api, args);\n return `${prefix} ${message} ${suffix} ${url || ''}${passedAndShouldHavePassed}`.trim();\n\n function getPrefix() {\n let p = output.onlyPrefix;\n if (!p) {\n p = `${gOut.prefix || ''} ${output.prefix || ''}`.trim();\n }\n return p;\n }\n\n function getSuffix() {\n let s = output.onlySuffix;\n if (!s) {\n s = `${output.suffix || ''} ${gOut.suffix || ''}`.trim();\n }\n return s;\n }\n\n function getUrl() {\n let u = output.url;\n if (!u) {\n u = gOut.docsBaseUrl && output.urlSuffix && `${gOut.docsBaseUrl}${output.urlSuffix}`.trim();\n }\n return u;\n }\n }\n\n function buildMessageFromApiAndArgs(api, args) {\n let {apiTypes, argTypes} = getTypes(api, args);\n const copy = Array.prototype.slice.call(args || []);\n const replacedItems = [];\n replaceFunctionWithName(copy);\n const passedArgs = getObjectString(copy);\n argTypes = getObjectString(argTypes);\n apiTypes = getObjectString(apiTypes);\n\n return generateMessage();\n\n\n // functions\n\n function replaceFunctionWithName(obj) {\n each(obj, (val, name) => {\n /* eslint complexity:[2, 6] */\n if (replacedItems.indexOf(val) === -1) { // avoid recursive problems\n replacedItems.push(val);\n if (typeof val === 'object') {\n replaceFunctionWithName(obj);\n } else if (typeof val === 'function') {\n obj[name] = val.displayName || val.name || 'anonymous function';\n }\n }\n });\n }\n\n function getObjectString(types) {\n if (!types || !types.length) {\n return 'nothing';\n } else if (types && types.length === 1) {\n types = types[0];\n }\n return stringify(types, null, 2);\n }\n\n function generateMessage() {\n const n = '\\n';\n let useS = true;\n if (args && args.length === 1) {\n if (typeof args[0] === 'object' && args[0] !== null) {\n useS = !!Object.keys(args[0]).length;\n } else {\n useS = false;\n }\n }\n const types = `type${useS ? 's' : ''}`;\n const newLine = n + n;\n return `You passed:${n}${passedArgs}${newLine}` +\n `With the ${types}:${n}${argTypes}${newLine}` +\n `The API calls for:${n}${apiTypes}`;\n }\n }\n\n function getTypes(api, args) {\n api = arrayify(api);\n args = arrayify(args);\n const apiTypes = api.map((checker, index) => {\n const specified = module.exports.globalConfig.hasOwnProperty('verbose');\n return getCheckerDisplay(checker, {\n terse: specified ? !module.exports.globalConfig.verbose : !apiCheck.config.verbose,\n obj: args[index],\n addHelpers: true\n });\n });\n const argTypes = args.map((arg) => getArgDisplay(arg, []));\n return {argTypes, apiTypes};\n }\n\n}\n\n\n// STATELESS FUNCTIONS\n\n/**\n * This is where the magic happens for actually checking the arguments with the api.\n * @param {Array} api - checkers\n * @param {Array} args - and arguments object\n * @returns {Array} - the error messages\n */\nfunction checkApiWithArgs(api, args) {\n /* eslint complexity:[2, 7] */\n const messages = [];\n let failed = false;\n let checkerIndex = 0;\n let argIndex = 0;\n let arg, checker, res, lastChecker, argName, argFailed, skipPreviousChecker;\n /* jshint -W084 */\n while ((checker = api[checkerIndex++]) && (argIndex < args.length)) {\n arg = args[argIndex++];\n argName = 'Argument ' + argIndex + (checker.isOptional ? ' (optional)' : '');\n res = checker(arg, 'value', argName);\n argFailed = isError(res);\n lastChecker = checkerIndex >= api.length;\n skipPreviousChecker = checkerIndex > 1 && api[checkerIndex - 1].isOptional;\n if ((argFailed && lastChecker) || (argFailed && !lastChecker && !checker.isOptional && !skipPreviousChecker)) {\n failed = true;\n messages.push(getCheckerErrorMessage(res, checker, arg));\n } else if (argFailed && checker.isOptional) {\n argIndex--;\n } else {\n messages.push(`${t(argName)} passed`);\n }\n }\n return failed ? messages : [];\n}\n\n\ncheckerTypeType.type = 'function with __apiCheckData property and `${function.type}` property';\nfunction checkerTypeType(checkerType, name, location) {\n const apiCheckDataChecker = checkers.shape({\n type: checkers.string,\n optional: checkers.bool\n });\n const asFunc = checkers.func.withProperties({__apiCheckData: apiCheckDataChecker});\n const asShape = checkers.shape({__apiCheckData: apiCheckDataChecker});\n const wrongShape = checkers.oneOfType([\n asFunc, asShape\n ])(checkerType, name, location);\n if (isError(wrongShape)) {\n return wrongShape;\n }\n if (typeof checkerType !== 'function' && !checkerType.hasOwnProperty(checkerType.__apiCheckData.type)) {\n return getError(name, location, checkerTypeType.type);\n }\n}\n\nfunction getCheckerErrorMessage(res, checker, val) {\n let checkerHelp = getCheckerHelp(checker, val);\n checkerHelp = checkerHelp ? ' - ' + checkerHelp : '';\n return res.message + checkerHelp;\n}\n\nfunction getCheckerHelp({help}, val) {\n if (!help) {\n return '';\n }\n if (typeof help === 'function') {\n help = help(val);\n }\n return help;\n}\n\n\nfunction checkEnoughArgs(api, args) {\n const requiredArgs = api.filter(a => !a.isOptional);\n if (args.length < requiredArgs.length) {\n return [\n 'Not enough arguments specified. Requires `' + requiredArgs.length + '`, you passed `' + args.length + '`'\n ];\n } else {\n return [];\n }\n}\n\nfunction getArgDisplay(arg, gottenArgs) {\n /* eslint complexity:[2, 7] */\n const cName = arg && arg.constructor && arg.constructor.name;\n const type = typeOf(arg);\n if (type === 'function') {\n if (hasKeys()) {\n const properties = stringify(getDisplayIfNotGotten());\n return cName + ' (with properties: ' + properties + ')';\n }\n return cName;\n }\n\n if (arg === null) {\n return 'null';\n }\n\n if (type !== 'array' && type !== 'object') {\n return type;\n }\n\n if (hasKeys()) {\n return getDisplayIfNotGotten();\n }\n\n return cName;\n\n // utility functions\n function hasKeys() {\n return arg && Object.keys(arg).length;\n }\n\n function getDisplayIfNotGotten() {\n if (gottenArgs.indexOf(arg) !== -1) {\n return '[Circular]';\n }\n gottenArgs.push(arg);\n return getDisplay(arg, gottenArgs);\n }\n}\n\nfunction getDisplay(obj, gottenArgs) {\n const argDisplay = {};\n each(obj, (v, k) => argDisplay[k] = getArgDisplay(v, gottenArgs));\n return argDisplay;\n}\n\nfunction getApiCheckApis() {\n const os = checkers.string.optional;\n\n const checkerFnChecker = checkers.func.withProperties({\n type: checkers.oneOfType([checkers.string, checkerTypeType]).optional,\n displayName: checkers.string.optional,\n shortType: checkers.string.optional,\n notOptional: checkers.bool.optional,\n notRequired: checkers.bool.optional\n });\n\n const getApiCheckInstanceCheckers = [\n checkers.shape({\n output: checkers.shape({\n prefix: checkers.string.optional,\n suffix: checkers.string.optional,\n docsBaseUrl: checkers.string.optional\n }).strict.optional,\n verbose: checkers.bool.optional,\n disabled: checkers.bool.optional\n }).strict.optional,\n checkers.objectOf(checkerFnChecker).optional\n ];\n\n const checkApiCheckApi = [\n checkers.typeOrArrayOf(checkerFnChecker),\n checkers.any.optional,\n checkers.shape({\n prefix: os, suffix: os, urlSuffix: os, // appended case\n onlyPrefix: os, onlySuffix: os, url: os // override case\n }).strict.optional\n ];\n\n return {\n checkerFnChecker,\n getApiCheckInstanceCheckers,\n checkApiCheckApi\n };\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ../~/eslint-loader!./api-check.js\n **/","const stringify = require('json-stringify-safe');\nconst {\n typeOf, each, copy, getCheckerDisplay, isError,\n arrayify, list, getError, nAtL, t, checkerHelpers,\n undef\n } = require('./api-check-util');\nconst {setupChecker} = checkerHelpers;\n\nconst checkers = module.exports = getCheckers();\nmodule.exports.getCheckers = getCheckers;\n\nfunction getCheckers(disabled) {\n return {\n array: typeOfCheckGetter('Array'),\n bool: typeOfCheckGetter('Boolean'),\n number: typeOfCheckGetter('Number'),\n string: typeOfCheckGetter('String'),\n func: funcCheckGetter(),\n object: objectCheckGetter(),\n\n emptyObject: emptyObjectCheckGetter(),\n\n instanceOf: instanceCheckGetter,\n oneOf: oneOfCheckGetter,\n oneOfType: oneOfTypeCheckGetter,\n\n arrayOf: arrayOfCheckGetter,\n objectOf: objectOfCheckGetter,\n typeOrArrayOf: typeOrArrayOfCheckGetter,\n\n range: rangeCheckGetter,\n lessThan: lessThanCheckGetter,\n greaterThan: greaterThanCheckGetter,\n\n shape: getShapeCheckGetter(),\n args: argumentsCheckerGetter(),\n\n any: anyCheckGetter(),\n null: nullCheckGetter()\n\n };\n\n function typeOfCheckGetter(type) {\n const lType = type.toLowerCase();\n return setupChecker(function typeOfCheckerDefinition(val, name, location) {\n if (typeOf(val) !== lType) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function funcCheckGetter() {\n const type = 'Function';\n const functionChecker = setupChecker(function functionCheckerDefinition(val, name, location) {\n if (typeOf(val) !== 'function') {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n\n functionChecker.withProperties = function getWithPropertiesChecker(properties) {\n const apiError = checkers.objectOf(checkers.func)(properties, 'properties', 'apiCheck.func.withProperties');\n if (isError(apiError)) {\n throw apiError;\n }\n const shapeChecker = checkers.shape(properties, true);\n shapeChecker.type.__apiCheckData.type = 'func.withProperties';\n\n return setupChecker(function functionWithPropertiesChecker(val, name, location) {\n const notFunction = checkers.func(val, name, location);\n if (isError(notFunction)) {\n return notFunction;\n }\n return shapeChecker(val, name, location);\n }, {type: shapeChecker.type, shortType: 'func.withProperties'}, disabled);\n };\n return functionChecker;\n }\n\n function objectCheckGetter() {\n const type = 'Object';\n const nullType = 'Object (null ok)';\n const objectNullOkChecker = setupChecker(function objectNullOkCheckerDefinition(val, name, location) {\n if (typeOf(val) !== 'object') {\n return getError(name, location, nullType);\n }\n }, {type: nullType}, disabled);\n\n const objectChecker = setupChecker(function objectCheckerDefinition(val, name, location) {\n if (val === null || isError(objectNullOkChecker(val, name, location))) {\n return getError(name, location, objectChecker.type);\n }\n }, {type, nullOk: objectNullOkChecker}, disabled);\n\n return objectChecker;\n }\n\n\n function instanceCheckGetter(classToCheck) {\n return setupChecker(function instanceCheckerDefinition(val, name, location) {\n if (!(val instanceof classToCheck)) {\n return getError(name, location, classToCheck.name);\n }\n }, {type: classToCheck.name}, disabled);\n }\n\n function oneOfCheckGetter(enums) {\n const type = {\n __apiCheckData: {optional: false, type: 'enum'},\n enum: enums\n };\n const shortType = `oneOf[${enums.map(enm => stringify(enm)).join(', ')}]`;\n return setupChecker(function oneOfCheckerDefinition(val, name, location) {\n if (!enums.some(enm => enm === val)) {\n return getError(name, location, shortType);\n }\n }, {type, shortType}, disabled);\n }\n\n function oneOfTypeCheckGetter(typeCheckers) {\n const checkersDisplay = typeCheckers.map((checker) => getCheckerDisplay(checker, {short: true}));\n const shortType = `oneOfType[${checkersDisplay.join(', ')}]`;\n function type(options) {\n if (options && options.short) {\n return shortType;\n }\n return typeCheckers.map((checker) => getCheckerDisplay(checker, options));\n }\n type.__apiCheckData = {optional: false, type: 'oneOfType'};\n return setupChecker(function oneOfTypeCheckerDefinition(val, name, location) {\n if (!typeCheckers.some(checker => !isError(checker(val, name, location)))) {\n return getError(name, location, shortType);\n }\n }, {type, shortType}, disabled);\n }\n\n function arrayOfCheckGetter(checker) {\n const shortCheckerDisplay = getCheckerDisplay(checker, {short: true});\n const shortType = `arrayOf[${shortCheckerDisplay}]`;\n\n function type(options) {\n if (options && options.short) {\n return shortType;\n }\n return getCheckerDisplay(checker, options);\n }\n type.__apiCheckData = {optional: false, type: 'arrayOf'};\n\n return setupChecker(function arrayOfCheckerDefinition(val, name, location) {\n if (isError(checkers.array(val)) || !val.every((item) => !isError(checker(item)))) {\n return getError(name, location, shortType);\n }\n }, {type, shortType}, disabled);\n }\n\n function objectOfCheckGetter(checker) {\n const checkerDisplay = getCheckerDisplay(checker, {short: true});\n const shortType = `objectOf[${checkerDisplay}]`;\n\n function type(options) {\n if (options && options.short) {\n return shortType;\n }\n return getCheckerDisplay(checker, options);\n }\n type.__apiCheckData = {optional: false, type: 'objectOf'};\n\n return setupChecker(function objectOfCheckerDefinition(val, name, location) {\n const notObject = checkers.object(val, name, location);\n if (isError(notObject)) {\n return notObject;\n }\n const allTypesSuccess = each(val, (item, key) => {\n if (isError(checker(item, key, name))) {\n return false;\n }\n });\n if (!allTypesSuccess) {\n return getError(name, location, shortType);\n }\n }, {type, shortType}, disabled);\n }\n\n function typeOrArrayOfCheckGetter(checker) {\n const checkerDisplay = getCheckerDisplay(checker, {short: true});\n const shortType = `typeOrArrayOf[${checkerDisplay}]`;\n\n function type(options) {\n if (options && options.short) {\n return shortType;\n }\n return getCheckerDisplay(checker, options);\n }\n\n type.__apiCheckData = {optional: false, type: 'typeOrArrayOf'};\n return setupChecker(function typeOrArrayOfDefinition(val, name, location, obj) {\n if (isError(checkers.oneOfType([checker, checkers.arrayOf(checker)])(val, name, location, obj))) {\n return getError(name, location, shortType);\n }\n }, {type, shortType}, disabled);\n }\n\n function getShapeCheckGetter() {\n function shapeCheckGetter(shape, nonObject) {\n const shapeTypes = {};\n each(shape, (checker, prop) => {\n shapeTypes[prop] = getCheckerDisplay(checker);\n });\n function type(options = {}) {\n const ret = {};\n const {terse, obj, addHelpers} = options;\n const parentRequired = options.required;\n each(shape, (checker, prop) => {\n /* eslint complexity:[2, 6] */\n const specified = obj && obj.hasOwnProperty(prop);\n const required = undef(parentRequired) ? !checker.isOptional : parentRequired;\n if (!terse || (specified || !checker.isOptional)) {\n ret[prop] = getCheckerDisplay(checker, {terse, obj: obj && obj[prop], required, addHelpers});\n }\n if (addHelpers) {\n modifyTypeDisplayToHelpOut(ret, prop, specified, checker, required);\n }\n });\n return ret;\n\n function modifyTypeDisplayToHelpOut(theRet, prop, specified, checker, required) {\n if (!specified && required && !checker.isOptional) {\n let item = 'ITEM';\n if (checker.type && checker.type.__apiCheckData) {\n item = checker.type.__apiCheckData.type.toUpperCase();\n }\n addHelper('missing', `MISSING THIS ${item}`, ' <-- YOU ARE MISSING THIS');\n } else if (specified) {\n const error = checker(obj[prop], prop, null, obj);\n if (isError(error)) {\n addHelper('error', `THIS IS THE PROBLEM: ${error.message}`, ` <-- THIS IS THE PROBLEM: ${error.message}`);\n }\n }\n\n function addHelper(property, objectMessage, stringMessage) {\n if (typeof theRet[prop] === 'string') {\n theRet[prop] += stringMessage;\n } else {\n theRet[prop].__apiCheckData[property] = objectMessage;\n }\n }\n }\n }\n\n type.__apiCheckData = {strict: false, optional: false, type: 'shape'};\n const shapeChecker = setupChecker(function shapeCheckerDefinition(val, name, location) {\n /* eslint complexity:[2, 6] */\n const isObject = !nonObject && checkers.object(val, name, location);\n if (isError(isObject)) {\n return isObject;\n }\n let shapePropError;\n location = location ? location + (name ? '/' : '') : '';\n name = name || '';\n each(shape, (checker, prop) => {\n if (val.hasOwnProperty(prop) || !checker.isOptional) {\n shapePropError = checker(val[prop], prop, `${location}${name}`, val);\n return !isError(shapePropError);\n }\n });\n if (isError(shapePropError)) {\n return shapePropError;\n }\n }, {type, shortType: 'shape'}, disabled);\n\n function strictType() {\n return type(...arguments);\n }\n\n strictType.__apiCheckData = copy(shapeChecker.type.__apiCheckData);\n strictType.__apiCheckData.strict = true;\n shapeChecker.strict = setupChecker(function strictShapeCheckerDefinition(val, name, location) {\n const shapeError = shapeChecker(val, name, location);\n if (isError(shapeError)) {\n return shapeError;\n }\n const allowedProperties = Object.keys(shape);\n const extraProps = Object.keys(val).filter(prop => allowedProperties.indexOf(prop) === -1);\n if (extraProps.length) {\n return new Error(\n `${nAtL(name, location)} cannot have extra properties: ${t(extraProps.join('`, `'))}.` +\n `It is limited to ${t(allowedProperties.join('`, `'))}`\n );\n }\n }, {type: strictType, shortType: 'strict shape'}, disabled);\n\n return shapeChecker;\n }\n\n shapeCheckGetter.ifNot = function ifNot(otherProps, propChecker) {\n if (!Array.isArray(otherProps)) {\n otherProps = [otherProps];\n }\n let description;\n if (otherProps.length === 1) {\n description = `specified only if ${otherProps[0]} is not specified`;\n } else {\n description = `specified only if none of the following are specified: [${list(otherProps, ', ', 'and ')}]`;\n }\n const shortType = `ifNot[${otherProps.join(', ')}]`;\n const type = getTypeForShapeChild(propChecker, description, shortType);\n return setupChecker(function ifNotChecker(prop, propName, location, obj) {\n const propExists = obj && obj.hasOwnProperty(propName);\n const otherPropsExist = otherProps.some(otherProp => obj && obj.hasOwnProperty(otherProp));\n if (propExists === otherPropsExist) {\n return getError(propName, location, type);\n } else if (propExists) {\n return propChecker(prop, propName, location, obj);\n }\n }, {notRequired: true, type, shortType}, disabled);\n };\n\n shapeCheckGetter.onlyIf = function onlyIf(otherProps, propChecker) {\n otherProps = arrayify(otherProps);\n let description;\n if (otherProps.length === 1) {\n description = `specified only if ${otherProps[0]} is also specified`;\n } else {\n description = `specified only if all of the following are specified: [${list(otherProps, ', ', 'and ')}]`;\n }\n const shortType = `onlyIf[${otherProps.join(', ')}]`;\n const type = getTypeForShapeChild(propChecker, description, shortType);\n return setupChecker(function onlyIfCheckerDefinition(prop, propName, location, obj) {\n const othersPresent = otherProps.every(property => obj.hasOwnProperty(property));\n if (!othersPresent) {\n return getError(propName, location, type);\n } else {\n return propChecker(prop, propName, location, obj);\n }\n }, {type, shortType}, disabled);\n };\n\n shapeCheckGetter.requiredIfNot = function shapeRequiredIfNot(otherProps, propChecker) {\n if (!Array.isArray(otherProps)) {\n otherProps = [otherProps];\n }\n return getRequiredIfNotChecker(false, otherProps, propChecker);\n };\n\n shapeCheckGetter.requiredIfNot.all = function shapeRequiredIfNotAll(otherProps, propChecker) {\n if (!Array.isArray(otherProps)) {\n throw new Error('requiredIfNot.all must be passed an array');\n }\n return getRequiredIfNotChecker(true, otherProps, propChecker);\n };\n\n function getRequiredIfNotChecker(all, otherProps, propChecker) {\n const props = t(otherProps.join(', '));\n const ifProps = `if ${all ? 'all of' : 'at least one of'}`;\n const description = `specified ${ifProps} these are not specified: ${props} (otherwise it's optional)`;\n const shortType = `requiredIfNot${all ? '.all' : ''}[${otherProps.join(', ')}}]`;\n const type = getTypeForShapeChild(propChecker, description, shortType);\n return setupChecker(function shapeRequiredIfNotDefinition(prop, propName, location, obj) {\n const propExists = obj && obj.hasOwnProperty(propName);\n const iteration = all ? 'every' : 'some';\n const otherPropsExist = otherProps[iteration](function(otherProp) {\n return obj && obj.hasOwnProperty(otherProp);\n });\n if (!otherPropsExist && !propExists) {\n return getError(propName, location, type);\n } else if (propExists) {\n return propChecker(prop, propName, location, obj);\n }\n }, {type, notRequired: true}, disabled);\n }\n\n return shapeCheckGetter;\n\n function getTypeForShapeChild(propChecker, description, shortType) {\n function type(options) {\n if (options && options.short) {\n return shortType;\n }\n return getCheckerDisplay(propChecker);\n }\n type.__apiCheckData = {optional: false, type: 'ifNot', description};\n return type;\n }\n }\n\n function argumentsCheckerGetter() {\n const type = 'function arguments';\n return setupChecker(function argsCheckerDefinition(val, name, location) {\n if (Array.isArray(val) || isError(checkers.object(val)) || isError(checkers.number(val.length))) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function anyCheckGetter() {\n return setupChecker(function anyCheckerDefinition() {\n // don't do anything\n }, {type: 'any'}, disabled);\n }\n\n function nullCheckGetter() {\n const type = 'null';\n return setupChecker(function nullChecker(val, name, location) {\n if (val !== null) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function rangeCheckGetter(min, max) {\n const type = `Range (${min} - ${max})`;\n return setupChecker(function rangeChecker(val, name, location) {\n if (typeof val !== 'number' || val < min || val > max) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function lessThanCheckGetter(min) {\n const type = `lessThan[${min}]`;\n return setupChecker(function lessThanChecker(val, name, location) {\n if (typeof val !== 'number' || val > min) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function greaterThanCheckGetter(max) {\n const type = `greaterThan[${max}]`;\n return setupChecker(function greaterThanChecker(val, name, location) {\n if (typeof val !== 'number' || val < max) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function emptyObjectCheckGetter() {\n const type = 'empty object';\n return setupChecker(function emptyObjectChecker(val, name, location) {\n if (typeOf(val) !== 'object' || val === null || Object.keys(val).length) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ../~/eslint-loader!./checkers.js\n **/"],"sourceRoot":""} \ No newline at end of file From 179c337d9feda2f4d251ca53aaf86ec9d2359008 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Sat, 26 Sep 2015 12:29:18 -0600 Subject: [PATCH 02/13] chore(package): pinned dependencies http://greenkeeper.io/ --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 95e6a40..b6ed056 100644 --- a/package.json +++ b/package.json @@ -33,9 +33,9 @@ "kcd-common-tools": "1.0.0-beta.9", "lodash": "3.9.3", "mocha": "2.1.0", - "node-libs-browser": "^0.5.2", + "node-libs-browser": "0.5.3", "publish-latest": "1.1.2", - "semantic-release": "^4.3.5", + "semantic-release": "4.3.5", "surge": "0.14.2", "uglify-loader": "1.2.0", "validate-commit-msg": "1.0.0", From b74b8251e5ef40d8f263cb601290abc69b58c323 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Sun, 27 Sep 2015 03:01:31 -0600 Subject: [PATCH 03/13] chore(package): updated lodash to version 3.10.1 http://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b6ed056..09081a7 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "karma-mocha": "0.1.10", "karma-webpack": "1.5.1", "kcd-common-tools": "1.0.0-beta.9", - "lodash": "3.9.3", + "lodash": "3.10.1", "mocha": "2.1.0", "node-libs-browser": "0.5.3", "publish-latest": "1.1.2", From 8516a0d40347d34bf3ce7ad998aa50a52a669fd3 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Sun, 27 Sep 2015 03:04:15 -0600 Subject: [PATCH 04/13] chore(package): updated chai to version 3.3.0 http://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 09081a7..194e0af 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "babel-eslint": "3.1.17", "babel-loader": "5.1.4", "bootstrap": "3.3.5", - "chai": "2.1.0", + "chai": "3.3.0", "codecov.io": "0.1.4", "commitizen": "1.0.4", "cz-conventional-changelog": "1.1.0", From 0f2b5552445b7d641dc8cae0d0e4edd3b9b478a1 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Sun, 27 Sep 2015 20:16:51 -0600 Subject: [PATCH 05/13] chore(package): updated cz-conventional-changelog to version 1.1.2 http://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 194e0af..658c674 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "chai": "3.3.0", "codecov.io": "0.1.4", "commitizen": "1.0.4", - "cz-conventional-changelog": "1.1.0", + "cz-conventional-changelog": "1.1.2", "eslint": "1.5.1", "eslint-config-kentcdodds": "4.0.0", "eslint-loader": "1.0.0", From 6f67c3367dd2ff0a6828a0a4877881925467246e Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Mon, 28 Sep 2015 08:36:51 -0600 Subject: [PATCH 06/13] chore(package): update commitizen to version 1.0.5 http://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 658c674..23f0d64 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "bootstrap": "3.3.5", "chai": "3.3.0", "codecov.io": "0.1.4", - "commitizen": "1.0.4", + "commitizen": "1.0.5", "cz-conventional-changelog": "1.1.2", "eslint": "1.5.1", "eslint-config-kentcdodds": "4.0.0", From 23c4202bbc638862a2266600f4596dd0e971974a Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Tue, 29 Sep 2015 05:35:04 -0600 Subject: [PATCH 07/13] chore(package): update karma-webpack to version 1.7.0 http://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 23f0d64..f5005a0 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "karma-coverage": "0.4.2", "karma-firefox-launcher": "0.1.6", "karma-mocha": "0.1.10", - "karma-webpack": "1.5.1", + "karma-webpack": "1.7.0", "kcd-common-tools": "1.0.0-beta.9", "lodash": "3.10.1", "mocha": "2.1.0", From 0032d668a26ec9314306da92c5004365153945d3 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Tue, 29 Sep 2015 10:03:38 -0600 Subject: [PATCH 08/13] chore(package): update mocha to version 2.3.3 http://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5005a0..18415d8 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "karma-webpack": "1.7.0", "kcd-common-tools": "1.0.0-beta.9", "lodash": "3.10.1", - "mocha": "2.1.0", + "mocha": "2.3.3", "node-libs-browser": "0.5.3", "publish-latest": "1.1.2", "semantic-release": "4.3.5", From 4b87fafd9cfc9600ebd054b33fc04f5a73e1e9a0 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Tue, 29 Sep 2015 10:01:14 -0600 Subject: [PATCH 09/13] chore(package): update istanbul to version 0.3.21 http://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 18415d8..35b5530 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "ghooks": "0.3.2", "isparta": "3.0.3", "isparta-loader": "0.2.0", - "istanbul": "0.3.5", + "istanbul": "0.3.21", "json-stringify-safe": "5.0.0", "karma": "0.12.36", "karma-chai": "0.1.0", From a7976b8272d317c4162eb134424040359c9df2f5 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Tue, 29 Sep 2015 03:41:00 -0600 Subject: [PATCH 10/13] chore(package): update babel-core to version 5.8.25 http://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 35b5530..2678871 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "dependencies": {}, "devDependencies": { "babel": "5.5.8", - "babel-core": "5.5.8", + "babel-core": "5.8.25", "babel-eslint": "3.1.17", "babel-loader": "5.1.4", "bootstrap": "3.3.5", From 22f73082a5ad837527106ae3476e2969cf8ddf22 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Mon, 26 Oct 2015 10:06:24 -0600 Subject: [PATCH 11/13] fix(bower): Remove version from bower.json Bower will default to the tag if there is not a version in the bower.json closes #46 --- bower.json | 1 - 1 file changed, 1 deletion(-) diff --git a/bower.json b/bower.json index 76fd6f7..a15173e 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,5 @@ { "name": "api-check", - "version": "7.3.0", "homepage": "https://github.com/kentcdodds/apiCheck.js", "authors": [ "Kent C. Dodds (http://kent.doddsfamily.us)" From f1e92b91efe00e5bb96d3f110fbe160faa923e79 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Mon, 26 Oct 2015 10:24:24 -0600 Subject: [PATCH 12/13] chore(package): Update commitizen --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 2678871..9b79252 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "bootstrap": "3.3.5", "chai": "3.3.0", "codecov.io": "0.1.4", - "commitizen": "1.0.5", - "cz-conventional-changelog": "1.1.2", + "commitizen": "2.3.0", + "cz-conventional-changelog": "1.1.4", "eslint": "1.5.1", "eslint-config-kentcdodds": "4.0.0", "eslint-loader": "1.0.0", @@ -80,11 +80,11 @@ "config": { "ghooks": { "pre-commit": "./node_modules/.bin/validate-commit-msg && npm run code-checks && npm t && npm run check-coverage" + }, + "commitizen": { + "path": "node_modules/cz-conventional-changelog" } }, - "czConfig": { - "path": "node_modules/cz-conventional-changelog" - }, "kcdCommon": { "webpack": { "output": { From 45cc660be93feadf65f2588a5dbebdb5e2e1216c Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Mon, 26 Oct 2015 16:27:03 +0000 Subject: [PATCH 13/13] v7.5.4 --- dist/api-check.js | 1332 +++++++++++++++++++++++++++++++++++++ dist/api-check.min.js | 3 + dist/api-check.min.js.map | 1 + package.json | 4 +- 4 files changed, 1338 insertions(+), 2 deletions(-) create mode 100644 dist/api-check.js create mode 100644 dist/api-check.min.js create mode 100644 dist/api-check.min.js.map diff --git a/dist/api-check.js b/dist/api-check.js new file mode 100644 index 0000000..9d43d82 --- /dev/null +++ b/dist/api-check.js @@ -0,0 +1,1332 @@ +//! api-check version 7.5.4 built with ♥ by Kent C. Dodds (http://kent.doddsfamily.us) (ó ì_í)=óò=(ì_í ò) + +(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["apiCheck"] = factory(); + else + root["apiCheck"] = 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'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _apiCheck = __webpack_require__(1); + + var _apiCheck2 = _interopRequireDefault(_apiCheck); + + exports['default'] = _apiCheck2['default']; + module.exports = exports['default']; + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var stringify = __webpack_require__(2); + var apiCheckUtil = __webpack_require__(3); + var each = apiCheckUtil.each; + var isError = apiCheckUtil.isError; + var t = apiCheckUtil.t; + var arrayify = apiCheckUtil.arrayify; + var getCheckerDisplay = apiCheckUtil.getCheckerDisplay; + var typeOf = apiCheckUtil.typeOf; + var getError = apiCheckUtil.getError; + + var checkers = __webpack_require__(4); + var apiCheckApis = getApiCheckApis(); + + module.exports = getApiCheckInstance; + module.exports.VERSION = ("7.5.4"); + module.exports.utils = apiCheckUtil; + module.exports.globalConfig = { + verbose: false, + disabled: false + }; + + var apiCheckApiCheck = getApiCheckInstance({ + output: { prefix: 'apiCheck' } + }); + module.exports.internalChecker = apiCheckApiCheck; + + each(checkers, function (checker, name) { + return module.exports[name] = checker; + }); + + function getApiCheckInstance() { + var config = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + var extraCheckers = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + /* eslint complexity:[2, 6] */ + if (apiCheckApiCheck && arguments.length) { + apiCheckApiCheck['throw'](apiCheckApis.getApiCheckInstanceCheckers, arguments, { + prefix: 'creating an apiCheck instance' + }); + } + + var additionalProperties = { + 'throw': getApiCheck(true), + warn: getApiCheck(false), + getErrorMessage: getErrorMessage, + handleErrorMessage: handleErrorMessage, + config: { + output: config.output || { + prefix: '', + suffix: '', + docsBaseUrl: '' + }, + verbose: config.verbose || false, + disabled: config.disabled || false + }, + utils: apiCheckUtil + }; + + each(additionalProperties, function (wrapper, name) { + return apiCheck[name] = wrapper; + }); + + var disabled = apiCheck.disabled || module.exports.globalConfig.disabled; + each(checkers.getCheckers(disabled), function (checker, name) { + return apiCheck[name] = checker; + }); + each(extraCheckers, function (checker, name) { + return apiCheck[name] = checker; + }); + + return apiCheck; + + /** + * This is the instance function. Other things are attached to this see additional properties above. + * @param {Array} api - the checkers to check with + * @param {Array} args - the args to check + * @param {Object} output - output options + * @returns {Object} - if this has a failed = true property, then it failed + */ + function apiCheck(api, args, output) { + /* eslint complexity:[2, 8] */ + if (apiCheck.config.disabled || module.exports.globalConfig.disabled) { + return { + apiTypes: {}, argTypes: {}, + passed: true, message: '', + failed: false + }; // empty version of what is normally returned + } + checkApiCheckApi(arguments); + if (!Array.isArray(api)) { + api = [api]; + args = [args]; + } else { + // turn arguments into an array + args = Array.prototype.slice.call(args); + } + var messages = checkEnoughArgs(api, args); + if (!messages.length) { + // this is where we actually go perform the checks. + messages = checkApiWithArgs(api, args); + } + + var returnObject = getTypes(api, args); + returnObject.args = args; + if (messages.length) { + returnObject.message = apiCheck.getErrorMessage(api, args, messages, output); + returnObject.failed = true; + returnObject.passed = false; + } else { + returnObject.message = ''; + returnObject.failed = false; + returnObject.passed = true; + } + return returnObject; + } + + /** + * checkApiCheckApi, should be read like: check apiCheck api. As in, check the api for apiCheck :-) + * @param {Array} checkApiArgs - args provided to apiCheck function + */ + function checkApiCheckApi(checkApiArgs) { + var api = checkApiArgs[0]; + var args = checkApiArgs[1]; + var isArrayOrArgs = Array.isArray(args) || args && typeof args === 'object' && typeof args.length === 'number'; + + if (Array.isArray(api) && !isArrayOrArgs) { + throw new Error(getErrorMessage(api, [args], ['If an array is provided for the api, an array must be provided for the args as well.'], { prefix: 'apiCheck' })); + } + // dog fooding here + var errors = checkApiWithArgs(apiCheckApis.checkApiCheckApi, checkApiArgs); + if (errors.length) { + var message = apiCheck.getErrorMessage(apiCheckApis.checkApiCheckApi, checkApiArgs, errors, { + prefix: 'apiCheck' + }); + apiCheck.handleErrorMessage(message, true); + } + } + + function getApiCheck(shouldThrow) { + return function apiCheckWrapper(api, args, output) { + var result = apiCheck(api, args, output); + apiCheck.handleErrorMessage(result.message, shouldThrow); + return result; // wont get here if an error is thrown + }; + } + + function handleErrorMessage(message, shouldThrow) { + if (shouldThrow && message) { + throw new Error(message); + } else if (message) { + /* eslint no-console:0 */ + console.warn(message); + } + } + + function getErrorMessage(api, args) { + var messages = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2]; + var output = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; + + var gOut = apiCheck.config.output || {}; + var prefix = getPrefix(); + var suffix = getSuffix(); + var url = getUrl(); + var message = 'apiCheck failed! ' + messages.join(', '); + var passedAndShouldHavePassed = '\n\n' + buildMessageFromApiAndArgs(api, args); + return (prefix + ' ' + message + ' ' + suffix + ' ' + (url || '') + passedAndShouldHavePassed).trim(); + + function getPrefix() { + var p = output.onlyPrefix; + if (!p) { + p = ((gOut.prefix || '') + ' ' + (output.prefix || '')).trim(); + } + return p; + } + + function getSuffix() { + var s = output.onlySuffix; + if (!s) { + s = ((output.suffix || '') + ' ' + (gOut.suffix || '')).trim(); + } + return s; + } + + function getUrl() { + var u = output.url; + if (!u) { + u = gOut.docsBaseUrl && output.urlSuffix && ('' + gOut.docsBaseUrl + output.urlSuffix).trim(); + } + return u; + } + } + + function buildMessageFromApiAndArgs(api, args) { + var _getTypes = getTypes(api, args); + + var apiTypes = _getTypes.apiTypes; + var argTypes = _getTypes.argTypes; + + var copy = Array.prototype.slice.call(args || []); + var replacedItems = []; + replaceFunctionWithName(copy); + var passedArgs = getObjectString(copy); + argTypes = getObjectString(argTypes); + apiTypes = getObjectString(apiTypes); + + return generateMessage(); + + // functions + + function replaceFunctionWithName(obj) { + each(obj, function (val, name) { + /* eslint complexity:[2, 6] */ + if (replacedItems.indexOf(val) === -1) { + // avoid recursive problems + replacedItems.push(val); + if (typeof val === 'object') { + replaceFunctionWithName(obj); + } else if (typeof val === 'function') { + obj[name] = val.displayName || val.name || 'anonymous function'; + } + } + }); + } + + function getObjectString(types) { + if (!types || !types.length) { + return 'nothing'; + } else if (types && types.length === 1) { + types = types[0]; + } + return stringify(types, null, 2); + } + + function generateMessage() { + var n = '\n'; + var useS = true; + if (args && args.length === 1) { + if (typeof args[0] === 'object' && args[0] !== null) { + useS = !!Object.keys(args[0]).length; + } else { + useS = false; + } + } + var types = 'type' + (useS ? 's' : ''); + var newLine = n + n; + return 'You passed:' + n + passedArgs + newLine + ('With the ' + types + ':' + n + argTypes + newLine) + ('The API calls for:' + n + apiTypes); + } + } + + function getTypes(api, args) { + api = arrayify(api); + args = arrayify(args); + var apiTypes = api.map(function (checker, index) { + var specified = module.exports.globalConfig.hasOwnProperty('verbose'); + return getCheckerDisplay(checker, { + terse: specified ? !module.exports.globalConfig.verbose : !apiCheck.config.verbose, + obj: args[index], + addHelpers: true + }); + }); + var argTypes = args.map(function (arg) { + return getArgDisplay(arg, []); + }); + return { argTypes: argTypes, apiTypes: apiTypes }; + } + } + + // STATELESS FUNCTIONS + + /** + * This is where the magic happens for actually checking the arguments with the api. + * @param {Array} api - checkers + * @param {Array} args - and arguments object + * @returns {Array} - the error messages + */ + function checkApiWithArgs(api, args) { + /* eslint complexity:[2, 7] */ + var messages = []; + var failed = false; + var checkerIndex = 0; + var argIndex = 0; + var arg = undefined, + checker = undefined, + res = undefined, + lastChecker = undefined, + argName = undefined, + argFailed = undefined, + skipPreviousChecker = undefined; + /* jshint -W084 */ + while ((checker = api[checkerIndex++]) && argIndex < args.length) { + arg = args[argIndex++]; + argName = 'Argument ' + argIndex + (checker.isOptional ? ' (optional)' : ''); + res = checker(arg, 'value', argName); + argFailed = isError(res); + lastChecker = checkerIndex >= api.length; + skipPreviousChecker = checkerIndex > 1 && api[checkerIndex - 1].isOptional; + if (argFailed && lastChecker || argFailed && !lastChecker && !checker.isOptional && !skipPreviousChecker) { + failed = true; + messages.push(getCheckerErrorMessage(res, checker, arg)); + } else if (argFailed && checker.isOptional) { + argIndex--; + } else { + messages.push(t(argName) + ' passed'); + } + } + return failed ? messages : []; + } + + checkerTypeType.type = 'function with __apiCheckData property and `${function.type}` property'; + function checkerTypeType(checkerType, name, location) { + var apiCheckDataChecker = checkers.shape({ + type: checkers.string, + optional: checkers.bool + }); + var asFunc = checkers.func.withProperties({ __apiCheckData: apiCheckDataChecker }); + var asShape = checkers.shape({ __apiCheckData: apiCheckDataChecker }); + var wrongShape = checkers.oneOfType([asFunc, asShape])(checkerType, name, location); + if (isError(wrongShape)) { + return wrongShape; + } + if (typeof checkerType !== 'function' && !checkerType.hasOwnProperty(checkerType.__apiCheckData.type)) { + return getError(name, location, checkerTypeType.type); + } + } + + function getCheckerErrorMessage(res, checker, val) { + var checkerHelp = getCheckerHelp(checker, val); + checkerHelp = checkerHelp ? ' - ' + checkerHelp : ''; + return res.message + checkerHelp; + } + + function getCheckerHelp(_ref, val) { + var help = _ref.help; + + if (!help) { + return ''; + } + if (typeof help === 'function') { + help = help(val); + } + return help; + } + + function checkEnoughArgs(api, args) { + var requiredArgs = api.filter(function (a) { + return !a.isOptional; + }); + if (args.length < requiredArgs.length) { + return ['Not enough arguments specified. Requires `' + requiredArgs.length + '`, you passed `' + args.length + '`']; + } else { + return []; + } + } + + function getArgDisplay(arg, gottenArgs) { + /* eslint complexity:[2, 7] */ + var cName = arg && arg.constructor && arg.constructor.name; + var type = typeOf(arg); + if (type === 'function') { + if (hasKeys()) { + var properties = stringify(getDisplayIfNotGotten()); + return cName + ' (with properties: ' + properties + ')'; + } + return cName; + } + + if (arg === null) { + return 'null'; + } + + if (type !== 'array' && type !== 'object') { + return type; + } + + if (hasKeys()) { + return getDisplayIfNotGotten(); + } + + return cName; + + // utility functions + function hasKeys() { + return arg && Object.keys(arg).length; + } + + function getDisplayIfNotGotten() { + if (gottenArgs.indexOf(arg) !== -1) { + return '[Circular]'; + } + gottenArgs.push(arg); + return getDisplay(arg, gottenArgs); + } + } + + function getDisplay(obj, gottenArgs) { + var argDisplay = {}; + each(obj, function (v, k) { + return argDisplay[k] = getArgDisplay(v, gottenArgs); + }); + return argDisplay; + } + + function getApiCheckApis() { + var os = checkers.string.optional; + + var checkerFnChecker = checkers.func.withProperties({ + type: checkers.oneOfType([checkers.string, checkerTypeType]).optional, + displayName: checkers.string.optional, + shortType: checkers.string.optional, + notOptional: checkers.bool.optional, + notRequired: checkers.bool.optional + }); + + var getApiCheckInstanceCheckers = [checkers.shape({ + output: checkers.shape({ + prefix: checkers.string.optional, + suffix: checkers.string.optional, + docsBaseUrl: checkers.string.optional + }).strict.optional, + verbose: checkers.bool.optional, + disabled: checkers.bool.optional + }).strict.optional, checkers.objectOf(checkerFnChecker).optional]; + + var checkApiCheckApi = [checkers.typeOrArrayOf(checkerFnChecker), checkers.any.optional, checkers.shape({ + prefix: os, suffix: os, urlSuffix: os, // appended case + onlyPrefix: os, onlySuffix: os, url: os // override case + }).strict.optional]; + + return { + checkerFnChecker: checkerFnChecker, + getApiCheckInstanceCheckers: getApiCheckInstanceCheckers, + checkApiCheckApi: checkApiCheckApi + }; + } + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + module.exports = stringify; + + function getSerialize (fn, decycle) { + var seen = [], keys = []; + decycle = decycle || function(key, value) { + return '[Circular ' + getPath(value, seen, keys) + ']' + }; + return function(key, value) { + var ret = value; + if (typeof value === 'object' && value) { + if (seen.indexOf(value) !== -1) + ret = decycle(key, value); + else { + seen.push(value); + keys.push(key); + } + } + if (fn) ret = fn(key, ret); + return ret; + } + } + + function getPath (value, seen, keys) { + var index = seen.indexOf(value); + var path = [ keys[index] ]; + for (index--; index >= 0; index--) { + if (seen[index][ path[0] ] === value) { + value = seen[index]; + path.unshift(keys[index]); + } + } + return '~' + path.join('.'); + } + + function stringify(obj, fn, spaces, decycle) { + return JSON.stringify(obj, getSerialize(fn, decycle), spaces); + } + + stringify.getSerialize = getSerialize; + + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + + var stringify = __webpack_require__(2); + var checkerHelpers = { + addOptional: addOptional, getRequiredVersion: getRequiredVersion, setupChecker: setupChecker, addNullable: addNullable + }; + + module.exports = { + each: each, copy: copy, typeOf: typeOf, arrayify: arrayify, getCheckerDisplay: getCheckerDisplay, + isError: isError, list: list, getError: getError, nAtL: nAtL, t: t, undef: undef, checkerHelpers: checkerHelpers, + noop: noop + }; + + function copy(obj) { + var type = typeOf(obj); + var daCopy = undefined; + if (type === 'array') { + daCopy = []; + } else if (type === 'object') { + daCopy = {}; + } else { + return obj; + } + each(obj, function (val, key) { + daCopy[key] = val; // cannot single-line this because we don't want to abort the each + }); + return daCopy; + } + + function typeOf(obj) { + if (Array.isArray(obj)) { + return 'array'; + } else if (obj instanceof RegExp) { + return 'object'; + } else { + return typeof obj; + } + } + + function getCheckerDisplay(checker, options) { + /* eslint complexity:[2, 7] */ + var display = undefined; + var short = options && options.short; + if (short && checker.shortType) { + display = checker.shortType; + } else if (!short && typeof checker.type === 'object' || checker.type === 'function') { + display = getCheckerType(checker, options); + } else { + display = getCheckerType(checker, options) || checker.displayName || checker.name; + } + return display; + } + + function getCheckerType(_ref, options) { + var type = _ref.type; + + if (typeof type === 'function') { + var __apiCheckData = type.__apiCheckData; + var typeTypes = type(options); + type = _defineProperty({ + __apiCheckData: __apiCheckData + }, __apiCheckData.type, typeTypes); + } + return type; + } + + function arrayify(obj) { + if (!obj) { + return []; + } else if (Array.isArray(obj)) { + return obj; + } else { + return [obj]; + } + } + + function each(obj, iterator, context) { + if (Array.isArray(obj)) { + return eachArry(obj, iterator, context); + } else { + return eachObj(obj, iterator, context); + } + } + + function eachObj(obj, iterator, context) { + var ret = undefined; + var hasOwn = Object.prototype.hasOwnProperty; + /* eslint prefer-const:0 */ // some weird eslint bug? + for (var key in obj) { + if (hasOwn.call(obj, key)) { + ret = iterator.call(context, obj[key], key, obj); + if (ret === false) { + return ret; + } + } + } + return true; + } + + function eachArry(obj, iterator, context) { + var ret = undefined; + var length = obj.length; + for (var i = 0; i < length; i++) { + ret = iterator.call(context, obj[i], i, obj); + if (ret === false) { + return ret; + } + } + return true; + } + + function isError(obj) { + return obj instanceof Error; + } + + function list(arry, join, finalJoin) { + arry = arrayify(arry); + var copy = arry.slice(); + var last = copy.pop(); + if (copy.length === 1) { + join = ' '; + } + return copy.join(join) + ('' + (copy.length ? join + finalJoin : '') + last); + } + + function getError(name, location, checkerType) { + if (typeof checkerType === 'function') { + checkerType = checkerType({ short: true }); + } + var stringType = typeof checkerType !== 'object' ? checkerType : stringify(checkerType); + return new Error(nAtL(name, location) + ' must be ' + t(stringType)); + } + + function nAtL(name, location) { + var tName = t(name || 'value'); + var tLocation = !location ? '' : ' at ' + t(location); + return '' + tName + tLocation; + } + + function t(thing) { + return '`' + thing + '`'; + } + + function undef(thing) { + return typeof thing === 'undefined'; + } + + /** + * This will set up the checker with all of the defaults that most checkers want like required by default and an + * optional version + * + * @param {Function} checker - the checker to setup with properties + * @param {Object} properties - properties to add to the checker + * @param {boolean} disabled - when set to true, this will set the checker to a no-op function + * @returns {Function} checker - the setup checker + */ + function setupChecker(checker, properties, disabled) { + /* eslint complexity:[2, 9] */ + if (disabled) { + // swap out the checker for its own copy of noop + checker = getNoop(); + checker.isNoop = true; + } + + if (typeof checker.type === 'string') { + checker.shortType = checker.type; + } + + // assign all properties given + each(properties, function (prop, name) { + return checker[name] = prop; + }); + + if (!checker.displayName) { + checker.displayName = 'apiCheck ' + t(checker.shortType || checker.type || checker.name) + ' type checker'; + } + + if (!checker.notRequired) { + checker = getRequiredVersion(checker, disabled); + } + + if (!checker.notNullable) { + addNullable(checker, disabled); + } + + if (!checker.notOptional) { + addOptional(checker, disabled); + } + + return checker; + } + + function getRequiredVersion(checker, disabled) { + var requiredChecker = disabled ? getNoop() : function requiredChecker(val, name, location, obj) { + if (undef(val) && !checker.isOptional) { + var tLocation = location ? ' in ' + t(location) : ''; + var type = getCheckerDisplay(checker, { short: true }); + var stringType = typeof type !== 'object' ? type : stringify(type); + return new Error('Required ' + t(name) + ' not specified' + tLocation + '. Must be ' + t(stringType)); + } else { + return checker(val, name, location, obj); + } + }; + copyProps(checker, requiredChecker); + requiredChecker.originalChecker = checker; + return requiredChecker; + } + + function addOptional(checker, disabled) { + var optionalCheck = disabled ? getNoop() : function optionalCheck(val, name, location, obj) { + if (!undef(val)) { + return checker(val, name, location, obj); + } + }; + // inherit all properties on the original checker + copyProps(checker, optionalCheck); + + optionalCheck.isOptional = true; + optionalCheck.displayName = checker.displayName + ' (optional)'; + optionalCheck.originalChecker = checker; + + // the magic line that allows you to add .optional to the end of the checkers + checker.optional = optionalCheck; + + fixType(checker, checker.optional); + } + + function addNullable(checker, disabled) { + var nullableCheck = disabled ? getNoop() : function nullableCheck(val, name, location, obj) { + if (val !== null) { + return checker(val, name, location, obj); + } + }; + // inherit all properties on the original checker + copyProps(checker, nullableCheck); + + nullableCheck.isNullable = true; + nullableCheck.displayName = checker.displayName + ' (nullable)'; + nullableCheck.originalChecker = checker; + + // the magic line that allows you to add .nullable to the end of the checkers + checker.nullable = nullableCheck; + + fixType(checker, checker.nullable); + if (!checker.notOptional) { + addOptional(checker.nullable, disabled); + } + } + + function fixType(checker, checkerCopy) { + // fix type, because it's not a straight copy... + // the reason is we need to specify type.__apiCheckData.optional as true for the terse/verbose option. + // we also want to add "(optional)" to the types with a string + if (typeof checkerCopy.type === 'object') { + checkerCopy.type = copy(checkerCopy.type); // make our own copy of this + } else if (typeof checkerCopy.type === 'function') { + checkerCopy.type = function () { + return checker.type.apply(checker, arguments); + }; + } else { + checkerCopy.type += ' (optional)'; + return; + } + checkerCopy.type.__apiCheckData = copy(checker.type.__apiCheckData) || {}; // and this + checkerCopy.type.__apiCheckData.optional = true; + } + + // UTILS + + function copyProps(src, dest) { + each(Object.keys(src), function (key) { + return dest[key] = src[key]; + }); + } + + function noop() {} + + function getNoop() { + /* eslint no-shadow:0 */ + /* istanbul ignore next */ + return function noop() {}; + } + +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var stringify = __webpack_require__(2); + + var _require = __webpack_require__(3); + + var typeOf = _require.typeOf; + var each = _require.each; + var copy = _require.copy; + var getCheckerDisplay = _require.getCheckerDisplay; + var isError = _require.isError; + var arrayify = _require.arrayify; + var list = _require.list; + var getError = _require.getError; + var nAtL = _require.nAtL; + var t = _require.t; + var checkerHelpers = _require.checkerHelpers; + var undef = _require.undef; + var setupChecker = checkerHelpers.setupChecker; + + var checkers = module.exports = getCheckers(); + module.exports.getCheckers = getCheckers; + + function getCheckers(disabled) { + return { + array: typeOfCheckGetter('Array'), + bool: typeOfCheckGetter('Boolean'), + number: typeOfCheckGetter('Number'), + string: typeOfCheckGetter('String'), + func: funcCheckGetter(), + object: objectCheckGetter(), + + emptyObject: emptyObjectCheckGetter(), + + instanceOf: instanceCheckGetter, + oneOf: oneOfCheckGetter, + oneOfType: oneOfTypeCheckGetter, + + arrayOf: arrayOfCheckGetter, + objectOf: objectOfCheckGetter, + typeOrArrayOf: typeOrArrayOfCheckGetter, + + range: rangeCheckGetter, + lessThan: lessThanCheckGetter, + greaterThan: greaterThanCheckGetter, + + shape: getShapeCheckGetter(), + args: argumentsCheckerGetter(), + + any: anyCheckGetter(), + 'null': nullCheckGetter() + + }; + + function typeOfCheckGetter(type) { + var lType = type.toLowerCase(); + return setupChecker(function typeOfCheckerDefinition(val, name, location) { + if (typeOf(val) !== lType) { + return getError(name, location, type); + } + }, { type: type }, disabled); + } + + function funcCheckGetter() { + var type = 'Function'; + var functionChecker = setupChecker(function functionCheckerDefinition(val, name, location) { + if (typeOf(val) !== 'function') { + return getError(name, location, type); + } + }, { type: type }, disabled); + + functionChecker.withProperties = function getWithPropertiesChecker(properties) { + var apiError = checkers.objectOf(checkers.func)(properties, 'properties', 'apiCheck.func.withProperties'); + if (isError(apiError)) { + throw apiError; + } + var shapeChecker = checkers.shape(properties, true); + shapeChecker.type.__apiCheckData.type = 'func.withProperties'; + + return setupChecker(function functionWithPropertiesChecker(val, name, location) { + var notFunction = checkers.func(val, name, location); + if (isError(notFunction)) { + return notFunction; + } + return shapeChecker(val, name, location); + }, { type: shapeChecker.type, shortType: 'func.withProperties' }, disabled); + }; + return functionChecker; + } + + function objectCheckGetter() { + var type = 'Object'; + var nullType = 'Object (null ok)'; + var objectNullOkChecker = setupChecker(function objectNullOkCheckerDefinition(val, name, location) { + if (typeOf(val) !== 'object') { + return getError(name, location, nullType); + } + }, { type: nullType }, disabled); + + var objectChecker = setupChecker(function objectCheckerDefinition(val, name, location) { + if (val === null || isError(objectNullOkChecker(val, name, location))) { + return getError(name, location, objectChecker.type); + } + }, { type: type, nullOk: objectNullOkChecker }, disabled); + + return objectChecker; + } + + function instanceCheckGetter(classToCheck) { + return setupChecker(function instanceCheckerDefinition(val, name, location) { + if (!(val instanceof classToCheck)) { + return getError(name, location, classToCheck.name); + } + }, { type: classToCheck.name }, disabled); + } + + function oneOfCheckGetter(enums) { + var type = { + __apiCheckData: { optional: false, type: 'enum' }, + 'enum': enums + }; + var shortType = 'oneOf[' + enums.map(function (enm) { + return stringify(enm); + }).join(', ') + ']'; + return setupChecker(function oneOfCheckerDefinition(val, name, location) { + if (!enums.some(function (enm) { + return enm === val; + })) { + return getError(name, location, shortType); + } + }, { type: type, shortType: shortType }, disabled); + } + + function oneOfTypeCheckGetter(typeCheckers) { + var checkersDisplay = typeCheckers.map(function (checker) { + return getCheckerDisplay(checker, { short: true }); + }); + var shortType = 'oneOfType[' + checkersDisplay.join(', ') + ']'; + function type(options) { + if (options && options.short) { + return shortType; + } + return typeCheckers.map(function (checker) { + return getCheckerDisplay(checker, options); + }); + } + type.__apiCheckData = { optional: false, type: 'oneOfType' }; + return setupChecker(function oneOfTypeCheckerDefinition(val, name, location) { + if (!typeCheckers.some(function (checker) { + return !isError(checker(val, name, location)); + })) { + return getError(name, location, shortType); + } + }, { type: type, shortType: shortType }, disabled); + } + + function arrayOfCheckGetter(checker) { + var shortCheckerDisplay = getCheckerDisplay(checker, { short: true }); + var shortType = 'arrayOf[' + shortCheckerDisplay + ']'; + + function type(options) { + if (options && options.short) { + return shortType; + } + return getCheckerDisplay(checker, options); + } + type.__apiCheckData = { optional: false, type: 'arrayOf' }; + + return setupChecker(function arrayOfCheckerDefinition(val, name, location) { + if (isError(checkers.array(val)) || !val.every(function (item) { + return !isError(checker(item)); + })) { + return getError(name, location, shortType); + } + }, { type: type, shortType: shortType }, disabled); + } + + function objectOfCheckGetter(checker) { + var checkerDisplay = getCheckerDisplay(checker, { short: true }); + var shortType = 'objectOf[' + checkerDisplay + ']'; + + function type(options) { + if (options && options.short) { + return shortType; + } + return getCheckerDisplay(checker, options); + } + type.__apiCheckData = { optional: false, type: 'objectOf' }; + + return setupChecker(function objectOfCheckerDefinition(val, name, location) { + var notObject = checkers.object(val, name, location); + if (isError(notObject)) { + return notObject; + } + var allTypesSuccess = each(val, function (item, key) { + if (isError(checker(item, key, name))) { + return false; + } + }); + if (!allTypesSuccess) { + return getError(name, location, shortType); + } + }, { type: type, shortType: shortType }, disabled); + } + + function typeOrArrayOfCheckGetter(checker) { + var checkerDisplay = getCheckerDisplay(checker, { short: true }); + var shortType = 'typeOrArrayOf[' + checkerDisplay + ']'; + + function type(options) { + if (options && options.short) { + return shortType; + } + return getCheckerDisplay(checker, options); + } + + type.__apiCheckData = { optional: false, type: 'typeOrArrayOf' }; + return setupChecker(function typeOrArrayOfDefinition(val, name, location, obj) { + if (isError(checkers.oneOfType([checker, checkers.arrayOf(checker)])(val, name, location, obj))) { + return getError(name, location, shortType); + } + }, { type: type, shortType: shortType }, disabled); + } + + function getShapeCheckGetter() { + function shapeCheckGetter(shape, nonObject) { + var shapeTypes = {}; + each(shape, function (checker, prop) { + shapeTypes[prop] = getCheckerDisplay(checker); + }); + function type() { + var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + var ret = {}; + var terse = options.terse; + var obj = options.obj; + var addHelpers = options.addHelpers; + + var parentRequired = options.required; + each(shape, function (checker, prop) { + /* eslint complexity:[2, 6] */ + var specified = obj && obj.hasOwnProperty(prop); + var required = undef(parentRequired) ? !checker.isOptional : parentRequired; + if (!terse || (specified || !checker.isOptional)) { + ret[prop] = getCheckerDisplay(checker, { terse: terse, obj: obj && obj[prop], required: required, addHelpers: addHelpers }); + } + if (addHelpers) { + modifyTypeDisplayToHelpOut(ret, prop, specified, checker, required); + } + }); + return ret; + + function modifyTypeDisplayToHelpOut(theRet, prop, specified, checker, required) { + if (!specified && required && !checker.isOptional) { + var item = 'ITEM'; + if (checker.type && checker.type.__apiCheckData) { + item = checker.type.__apiCheckData.type.toUpperCase(); + } + addHelper('missing', 'MISSING THIS ' + item, ' <-- YOU ARE MISSING THIS'); + } else if (specified) { + var error = checker(obj[prop], prop, null, obj); + if (isError(error)) { + addHelper('error', 'THIS IS THE PROBLEM: ' + error.message, ' <-- THIS IS THE PROBLEM: ' + error.message); + } + } + + function addHelper(property, objectMessage, stringMessage) { + if (typeof theRet[prop] === 'string') { + theRet[prop] += stringMessage; + } else { + theRet[prop].__apiCheckData[property] = objectMessage; + } + } + } + } + + type.__apiCheckData = { strict: false, optional: false, type: 'shape' }; + var shapeChecker = setupChecker(function shapeCheckerDefinition(val, name, location) { + /* eslint complexity:[2, 6] */ + var isObject = !nonObject && checkers.object(val, name, location); + if (isError(isObject)) { + return isObject; + } + var shapePropError = undefined; + location = location ? location + (name ? '/' : '') : ''; + name = name || ''; + each(shape, function (checker, prop) { + if (val.hasOwnProperty(prop) || !checker.isOptional) { + shapePropError = checker(val[prop], prop, '' + location + name, val); + return !isError(shapePropError); + } + }); + if (isError(shapePropError)) { + return shapePropError; + } + }, { type: type, shortType: 'shape' }, disabled); + + function strictType() { + return type.apply(undefined, arguments); + } + + strictType.__apiCheckData = copy(shapeChecker.type.__apiCheckData); + strictType.__apiCheckData.strict = true; + shapeChecker.strict = setupChecker(function strictShapeCheckerDefinition(val, name, location) { + var shapeError = shapeChecker(val, name, location); + if (isError(shapeError)) { + return shapeError; + } + var allowedProperties = Object.keys(shape); + var extraProps = Object.keys(val).filter(function (prop) { + return allowedProperties.indexOf(prop) === -1; + }); + if (extraProps.length) { + return new Error(nAtL(name, location) + ' cannot have extra properties: ' + t(extraProps.join('`, `')) + '.' + ('It is limited to ' + t(allowedProperties.join('`, `')))); + } + }, { type: strictType, shortType: 'strict shape' }, disabled); + + return shapeChecker; + } + + shapeCheckGetter.ifNot = function ifNot(otherProps, propChecker) { + if (!Array.isArray(otherProps)) { + otherProps = [otherProps]; + } + var description = undefined; + if (otherProps.length === 1) { + description = 'specified only if ' + otherProps[0] + ' is not specified'; + } else { + description = 'specified only if none of the following are specified: [' + list(otherProps, ', ', 'and ') + ']'; + } + var shortType = 'ifNot[' + otherProps.join(', ') + ']'; + var type = getTypeForShapeChild(propChecker, description, shortType); + return setupChecker(function ifNotChecker(prop, propName, location, obj) { + var propExists = obj && obj.hasOwnProperty(propName); + var otherPropsExist = otherProps.some(function (otherProp) { + return obj && obj.hasOwnProperty(otherProp); + }); + if (propExists === otherPropsExist) { + return getError(propName, location, type); + } else if (propExists) { + return propChecker(prop, propName, location, obj); + } + }, { notRequired: true, type: type, shortType: shortType }, disabled); + }; + + shapeCheckGetter.onlyIf = function onlyIf(otherProps, propChecker) { + otherProps = arrayify(otherProps); + var description = undefined; + if (otherProps.length === 1) { + description = 'specified only if ' + otherProps[0] + ' is also specified'; + } else { + description = 'specified only if all of the following are specified: [' + list(otherProps, ', ', 'and ') + ']'; + } + var shortType = 'onlyIf[' + otherProps.join(', ') + ']'; + var type = getTypeForShapeChild(propChecker, description, shortType); + return setupChecker(function onlyIfCheckerDefinition(prop, propName, location, obj) { + var othersPresent = otherProps.every(function (property) { + return obj.hasOwnProperty(property); + }); + if (!othersPresent) { + return getError(propName, location, type); + } else { + return propChecker(prop, propName, location, obj); + } + }, { type: type, shortType: shortType }, disabled); + }; + + shapeCheckGetter.requiredIfNot = function shapeRequiredIfNot(otherProps, propChecker) { + if (!Array.isArray(otherProps)) { + otherProps = [otherProps]; + } + return getRequiredIfNotChecker(false, otherProps, propChecker); + }; + + shapeCheckGetter.requiredIfNot.all = function shapeRequiredIfNotAll(otherProps, propChecker) { + if (!Array.isArray(otherProps)) { + throw new Error('requiredIfNot.all must be passed an array'); + } + return getRequiredIfNotChecker(true, otherProps, propChecker); + }; + + function getRequiredIfNotChecker(all, otherProps, propChecker) { + var props = t(otherProps.join(', ')); + var ifProps = 'if ' + (all ? 'all of' : 'at least one of'); + var description = 'specified ' + ifProps + ' these are not specified: ' + props + ' (otherwise it\'s optional)'; + var shortType = 'requiredIfNot' + (all ? '.all' : '') + '[' + otherProps.join(', ') + '}]'; + var type = getTypeForShapeChild(propChecker, description, shortType); + return setupChecker(function shapeRequiredIfNotDefinition(prop, propName, location, obj) { + var propExists = obj && obj.hasOwnProperty(propName); + var iteration = all ? 'every' : 'some'; + var otherPropsExist = otherProps[iteration](function (otherProp) { + return obj && obj.hasOwnProperty(otherProp); + }); + if (!otherPropsExist && !propExists) { + return getError(propName, location, type); + } else if (propExists) { + return propChecker(prop, propName, location, obj); + } + }, { type: type, notRequired: true }, disabled); + } + + return shapeCheckGetter; + + function getTypeForShapeChild(propChecker, description, shortType) { + function type(options) { + if (options && options.short) { + return shortType; + } + return getCheckerDisplay(propChecker); + } + type.__apiCheckData = { optional: false, type: 'ifNot', description: description }; + return type; + } + } + + function argumentsCheckerGetter() { + var type = 'function arguments'; + return setupChecker(function argsCheckerDefinition(val, name, location) { + if (Array.isArray(val) || isError(checkers.object(val)) || isError(checkers.number(val.length))) { + return getError(name, location, type); + } + }, { type: type }, disabled); + } + + function anyCheckGetter() { + return setupChecker(function anyCheckerDefinition() { + // don't do anything + }, { type: 'any' }, disabled); + } + + function nullCheckGetter() { + var type = 'null'; + return setupChecker(function nullChecker(val, name, location) { + if (val !== null) { + return getError(name, location, type); + } + }, { type: type }, disabled); + } + + function rangeCheckGetter(min, max) { + var type = 'Range (' + min + ' - ' + max + ')'; + return setupChecker(function rangeChecker(val, name, location) { + if (typeof val !== 'number' || val < min || val > max) { + return getError(name, location, type); + } + }, { type: type }, disabled); + } + + function lessThanCheckGetter(min) { + var type = 'lessThan[' + min + ']'; + return setupChecker(function lessThanChecker(val, name, location) { + if (typeof val !== 'number' || val > min) { + return getError(name, location, type); + } + }, { type: type }, disabled); + } + + function greaterThanCheckGetter(max) { + var type = 'greaterThan[' + max + ']'; + return setupChecker(function greaterThanChecker(val, name, location) { + if (typeof val !== 'number' || val < max) { + return getError(name, location, type); + } + }, { type: type }, disabled); + } + + function emptyObjectCheckGetter() { + var type = 'empty object'; + return setupChecker(function emptyObjectChecker(val, name, location) { + if (typeOf(val) !== 'object' || val === null || Object.keys(val).length) { + return getError(name, location, type); + } + }, { type: type }, disabled); + } + } + +/***/ } +/******/ ]) +}); +; \ No newline at end of file diff --git a/dist/api-check.min.js b/dist/api-check.min.js new file mode 100644 index 0000000..9ce8862 --- /dev/null +++ b/dist/api-check.min.js @@ -0,0 +1,3 @@ +//! api-check version 7.5.4 built with ♥ by Kent C. Dodds (http://kent.doddsfamily.us) (ó ì_í)=óò=(ì_í ò) +!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):"object"==typeof exports?exports.apiCheck=r():e.apiCheck=r()}(this,function(){return function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var o=t(3),i=n(o);r["default"]=i["default"],e.exports=r["default"]},function(e,r){function t(e,r){var t=[],o=[];return r=r||function(e,r){return"[Circular "+n(r,t,o)+"]"},function(n,i){var a=i;return"object"==typeof i&&i&&(-1!==t.indexOf(i)?a=r(n,i):(t.push(i),o.push(n))),e&&(a=e(n,a)),a}}function n(e,r,t){var n=r.indexOf(e),o=[t[n]];for(n--;n>=0;n--)r[n][o[0]]===e&&(e=r[n],o.unshift(t[n]));return"~"+o.join(".")}function o(e,r,n,o){return JSON.stringify(e,t(r,o),n)}e.exports=o,o.getSerialize=t},function(e,r,t){"use strict";function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e){var r=i(e),t=void 0;if("array"===r)t=[];else{if("object"!==r)return e;t={}}return f(e,function(e,r){t[r]=e}),t}function i(e){return Array.isArray(e)?"array":e instanceof RegExp?"object":typeof e}function a(e,r){var t=void 0,n=r&&r["short"];return t=n&&e.shortType?e.shortType:!n&&"object"==typeof e.type||"function"===e.type?u(e,r):u(e,r)||e.displayName||e.name}function u(e,r){var t=e.type;if("function"==typeof t){var o=t.__apiCheckData,i=t(r);t=n({__apiCheckData:o},o.type,i)}return t}function p(e){return e?Array.isArray(e)?e:[e]:[]}function f(e,r,t){return Array.isArray(e)?s(e,r,t):c(e,r,t)}function c(e,r,t){var n=void 0,o=Object.prototype.hasOwnProperty;for(var i in e)if(o.call(e,i)&&(n=r.call(t,e[i],i,e),n===!1))return n;return!0}function s(e,r,t){for(var n=void 0,o=e.length,i=0;o>i;i++)if(n=r.call(t,e[i],i,e),n===!1)return n;return!0}function l(e){return e instanceof Error}function y(e,r,t){e=p(e);var n=e.slice(),o=n.pop();return 1===n.length&&(r=" "),n.join(r)+(""+(n.length?r+t:"")+o)}function h(e,r,t){"function"==typeof t&&(t=t({"short":!0}));var n="object"!=typeof t?t:A(t);return new Error(d(e,r)+" must be "+v(n))}function d(e,r){var t=v(e||"value"),n=r?" at "+v(r):"";return""+t+n}function v(e){return"`"+e+"`"}function g(e){return"undefined"==typeof e}function b(e,r,t){return t&&(e=_(),e.isNoop=!0),"string"==typeof e.type&&(e.shortType=e.type),f(r,function(r,t){return e[t]=r}),e.displayName||(e.displayName="apiCheck "+v(e.shortType||e.type||e.name)+" type checker"),e.notRequired||(e=m(e,t)),e.notNullable||k(e,t),e.notOptional||O(e,t),e}function m(e,r){var t=r?_():function(r,t,n,o){if(g(r)&&!e.isOptional){var i=n?" in "+v(n):"",u=a(e,{"short":!0}),p="object"!=typeof u?u:A(u);return new Error("Required "+v(t)+" not specified"+i+". Must be "+v(p))}return e(r,t,n,o)};return j(e,t),t.originalChecker=e,t}function O(e,r){var t=r?_():function(r,t,n,o){return g(r)?void 0:e(r,t,n,o)};j(e,t),t.isOptional=!0,t.displayName=e.displayName+" (optional)",t.originalChecker=e,e.optional=t,C(e,e.optional)}function k(e,r){var t=r?_():function(r,t,n,o){return null!==r?e(r,t,n,o):void 0};j(e,t),t.isNullable=!0,t.displayName=e.displayName+" (nullable)",t.originalChecker=e,e.nullable=t,C(e,e.nullable),e.notOptional||O(e.nullable,r)}function C(e,r){if("object"==typeof r.type)r.type=o(r.type);else{if("function"!=typeof r.type)return void(r.type+=" (optional)");r.type=function(){return e.type.apply(e,arguments)}}r.type.__apiCheckData=o(e.type.__apiCheckData)||{},r.type.__apiCheckData.optional=!0}function j(e,r){f(Object.keys(e),function(t){return r[t]=e[t]})}function x(){}function _(){return function(){}}var A=t(1),T={addOptional:O,getRequiredVersion:m,setupChecker:b,addNullable:k};e.exports={each:f,copy:o,typeOf:i,arrayify:p,getCheckerDisplay:a,isError:l,list:y,getError:h,nAtL:d,t:v,undef:g,checkerHelpers:T,noop:x}},function(e,r,t){"use strict";function n(){function r(n,i,a){if(r.config.disabled||e.exports.globalConfig.disabled)return{apiTypes:{},argTypes:{},passed:!0,message:"",failed:!1};t(arguments),Array.isArray(n)?i=Array.prototype.slice.call(i):(n=[n],i=[i]);var u=p(n,i);u.length||(u=o(n,i));var f=c(n,i);return f.args=i,u.length?(f.message=r.getErrorMessage(n,i,u,a),f.failed=!0,f.passed=!1):(f.message="",f.failed=!1,f.passed=!0),f}function t(e){var t=e[0],n=e[1],i=Array.isArray(n)||n&&"object"==typeof n&&"number"==typeof n.length;if(Array.isArray(t)&&!i)throw new Error(a(t,[n],["If an array is provided for the api, an array must be provided for the args as well."],{prefix:"apiCheck"}));var u=o(C.checkApiCheckApi,e);if(u.length){var p=r.getErrorMessage(C.checkApiCheckApi,e,u,{prefix:"apiCheck"});r.handleErrorMessage(p,!0)}}function n(e){return function(t,n,o){var i=r(t,n,o);return r.handleErrorMessage(i.message,e),i}}function i(e,r){if(r&&e)throw new Error(e);e&&console.warn(e)}function a(e,t){function n(){var e=p.onlyPrefix;return e||(e=((f.prefix||"")+" "+(p.prefix||"")).trim()),e}function o(){var e=p.onlySuffix;return e||(e=((p.suffix||"")+" "+(f.suffix||"")).trim()),e}function i(){var e=p.url;return e||(e=f.docsBaseUrl&&p.urlSuffix&&(""+f.docsBaseUrl+p.urlSuffix).trim()),e}var a=arguments.length<=2||void 0===arguments[2]?[]:arguments[2],p=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],f=r.config.output||{},c=n(),s=o(),l=i(),y="apiCheck failed! "+a.join(", "),h="\n\n"+u(e,t);return(c+" "+y+" "+s+" "+(l||"")+h).trim()}function u(e,r){function t(e){h(e,function(r,n){-1===f.indexOf(r)&&(f.push(r),"object"==typeof r?t(e):"function"==typeof r&&(e[n]=r.displayName||r.name||"anonymous function"))})}function n(e){return e&&e.length?(e&&1===e.length&&(e=e[0]),l(e,null,2)):"nothing"}function o(){var e="\n",t=!0;r&&1===r.length&&(t="object"==typeof r[0]&&null!==r[0]?!!Object.keys(r[0]).length:!1);var n="type"+(t?"s":""),o=e+e;return"You passed:"+e+s+o+("With the "+n+":"+e+u+o)+("The API calls for:"+e+a)}var i=c(e,r),a=i.apiTypes,u=i.argTypes,p=Array.prototype.slice.call(r||[]),f=[];t(p);var s=n(p);return u=n(u),a=n(a),o()}function c(t,n){t=g(t),n=g(n);var o=t.map(function(t,o){var i=e.exports.globalConfig.hasOwnProperty("verbose");return b(t,{terse:i?!e.exports.globalConfig.verbose:!r.config.verbose,obj:n[o],addHelpers:!0})}),i=n.map(function(e){return f(e,[])});return{argTypes:i,apiTypes:o}}var s=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],d=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];j&&arguments.length&&j["throw"](C.getApiCheckInstanceCheckers,arguments,{prefix:"creating an apiCheck instance"});var v={"throw":n(!0),warn:n(!1),getErrorMessage:a,handleErrorMessage:i,config:{output:s.output||{prefix:"",suffix:"",docsBaseUrl:""},verbose:s.verbose||!1,disabled:s.disabled||!1},utils:y};h(v,function(e,t){return r[t]=e});var m=r.disabled||e.exports.globalConfig.disabled;return h(k.getCheckers(m),function(e,t){return r[t]=e}),h(d,function(e,t){return r[t]=e}),r}function o(e,r){for(var t=[],n=!1,o=0,i=0,u=void 0,p=void 0,f=void 0,c=void 0,s=void 0,l=void 0,y=void 0;(p=e[o++])&&i=e.length,y=o>1&&e[o-1].isOptional,l&&c||l&&!c&&!p.isOptional&&!y?(n=!0,t.push(a(f,p,u))):l&&p.isOptional?i--:t.push(v(s)+" passed");return n?t:[]}function i(e,r,t){var n=k.shape({type:k.string,optional:k.bool}),o=k.func.withProperties({__apiCheckData:n}),a=k.shape({__apiCheckData:n}),u=k.oneOfType([o,a])(e,r,t);return d(u)?u:"function"==typeof e||e.hasOwnProperty(e.__apiCheckData.type)?void 0:O(r,t,i.type)}function a(e,r,t){var n=u(r,t);return n=n?" - "+n:"",e.message+n}function u(e,r){var t=e.help;return t?("function"==typeof t&&(t=t(r)),t):""}function p(e,r){var t=e.filter(function(e){return!e.isOptional});return r.lengthe||e>t?y(o,i,n):void 0},{type:n},e)}function E(r){var t="lessThan["+r+"]";return b(function(e,n,o){return"number"!=typeof e||e>r?y(n,o,t):void 0},{type:t},e)}function D(r){var t="greaterThan["+r+"]";return b(function(e,n,o){return"number"!=typeof e||r>e?y(n,o,t):void 0},{type:t},e)}function N(){var r="empty object";return b(function(e,t,n){return"object"!==a(e)||null===e||Object.keys(e).length?y(t,n,r):void 0},{type:r},e)}return{array:r("Array"),bool:r("Boolean"),number:r("Number"),string:r("String"),func:t(),object:n(),emptyObject:N(),instanceOf:i,oneOf:v,oneOfType:O,arrayOf:k,objectOf:C,typeOrArrayOf:j,range:w,lessThan:E,greaterThan:D,shape:x(),args:_(),any:A(),"null":T()}}var o=t(1),i=t(2),a=i.typeOf,u=i.each,p=i.copy,f=i.getCheckerDisplay,c=i.isError,s=i.arrayify,l=i.list,y=i.getError,h=i.nAtL,d=i.t,v=i.checkerHelpers,g=i.undef,b=v.setupChecker,m=e.exports=n();e.exports.getCheckers=n}])}); +//# sourceMappingURL=api-check.min.js.map \ No newline at end of file diff --git a/dist/api-check.min.js.map b/dist/api-check.min.js.map new file mode 100644 index 0000000..095d1af --- /dev/null +++ b/dist/api-check.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///dist/api-check.min.js","webpack:///webpack/bootstrap 0063d8845a3f72305aa5","webpack:///./index.js","webpack:///../~/json-stringify-safe/stringify.js","webpack:///./api-check-util.js","webpack:///./api-check.js","webpack:///./checkers.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","Object","defineProperty","value","_apiCheck","_apiCheck2","getSerialize","fn","decycle","seen","keys","key","getPath","ret","indexOf","push","index","path","unshift","join","stringify","spaces","JSON","_defineProperty","enumerable","configurable","writable","copy","type","typeOf","daCopy","undefined","each","val","Array","isArray","RegExp","getCheckerDisplay","checker","options","display","short","shortType","getCheckerType","displayName","name","_ref","__apiCheckData","typeTypes","arrayify","iterator","context","eachArry","eachObj","hasOwn","prototype","hasOwnProperty","length","i","isError","Error","list","arry","finalJoin","slice","last","pop","getError","location","checkerType","stringType","nAtL","t","tName","tLocation","thing","undef","setupChecker","properties","disabled","getNoop","isNoop","prop","notRequired","getRequiredVersion","notNullable","addNullable","notOptional","addOptional","requiredChecker","isOptional","copyProps","originalChecker","optionalCheck","optional","fixType","nullableCheck","isNullable","nullable","checkerCopy","apply","arguments","src","dest","noop","checkerHelpers","getApiCheckInstance","apiCheck","api","args","output","config","globalConfig","apiTypes","argTypes","passed","message","failed","checkApiCheckApi","messages","checkEnoughArgs","checkApiWithArgs","returnObject","getTypes","getErrorMessage","checkApiArgs","isArrayOrArgs","prefix","errors","apiCheckApis","handleErrorMessage","getApiCheck","shouldThrow","result","console","warn","getPrefix","onlyPrefix","gOut","trim","getSuffix","s","onlySuffix","suffix","getUrl","u","url","docsBaseUrl","urlSuffix","passedAndShouldHavePassed","buildMessageFromApiAndArgs","replaceFunctionWithName","replacedItems","getObjectString","types","generateMessage","n","useS","newLine","passedArgs","_getTypes","map","specified","terse","verbose","addHelpers","arg","getArgDisplay","extraCheckers","apiCheckApiCheck","getApiCheckInstanceCheckers","additionalProperties","throw","utils","apiCheckUtil","wrapper","checkers","getCheckers","checkerIndex","argIndex","res","lastChecker","argName","argFailed","skipPreviousChecker","getCheckerErrorMessage","checkerTypeType","apiCheckDataChecker","shape","string","bool","asFunc","func","withProperties","asShape","wrongShape","oneOfType","checkerHelp","getCheckerHelp","help","requiredArgs","filter","a","gottenArgs","hasKeys","getDisplayIfNotGotten","getDisplay","cName","constructor","argDisplay","v","k","getApiCheckApis","os","checkerFnChecker","strict","objectOf","typeOrArrayOf","any","VERSION","internalChecker","typeOfCheckGetter","lType","toLowerCase","funcCheckGetter","functionChecker","apiError","shapeChecker","notFunction","objectCheckGetter","nullType","objectNullOkChecker","objectChecker","nullOk","instanceCheckGetter","classToCheck","oneOfCheckGetter","enums","enum","enm","some","oneOfTypeCheckGetter","typeCheckers","checkersDisplay","arrayOfCheckGetter","shortCheckerDisplay","array","every","item","objectOfCheckGetter","checkerDisplay","notObject","object","allTypesSuccess","typeOrArrayOfCheckGetter","arrayOf","getShapeCheckGetter","shapeCheckGetter","nonObject","modifyTypeDisplayToHelpOut","theRet","required","addHelper","property","objectMessage","stringMessage","error","toUpperCase","parentRequired","strictType","shapeTypes","isObject","shapePropError","shapeError","allowedProperties","extraProps","getRequiredIfNotChecker","all","otherProps","propChecker","props","ifProps","description","getTypeForShapeChild","propName","propExists","iteration","otherPropsExist","otherProp","ifNot","onlyIf","othersPresent","requiredIfNot","argumentsCheckerGetter","number","anyCheckGetter","nullCheckGetter","rangeCheckGetter","min","max","lessThanCheckGetter","greaterThanCheckGetter","emptyObjectCheckGetter","emptyObject","instanceOf","oneOf","range","lessThan","greaterThan","null","_require"],"mappings":";CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAAH,GACA,gBAAAC,SACAA,QAAA,SAAAD,IAEAD,EAAA,SAAAC,KACCK,KAAA,WACD,MCEgB,UAAUC,GCR1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDkBM,SAASL,EAAQD,EAASM,GAE/B,YAMA,SAASS,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,UAAWF,GAJzFG,OAAOC,eAAepB,EAAS,cAC7BqB,OAAO,GAKT,IAAIC,GAAYhB,EElEW,GFoEvBiB,EAAaR,EAAuBO,EAExCtB,GAAQ,WAAauB,EAAW,WAChCtB,EAAOD,QAAUA,EAAQ,YAIpB,SAASC,EAAQD,GGzEvB,QAAAwB,GAAAC,EAA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EAAJzP,KAAMM,EAAQmP,EAARnP,SAAUI,EAAI+O,EAAJ/O,KAAMC,EAAC8O,EAAD9O,EAAGiC,EAAc6M,EAAd7M,eACnC7B,EAAK0O,EAAL1O,MAEKC,EAAgB4B,EAAhB5B,aAEDmG,EAAWjM,EAAOD,QAAUmM,GAClClM,GAAOD,QAAQmM,YAAcA","file":"dist/api-check.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"apiCheck\"] = factory();\n\telse\n\t\troot[\"apiCheck\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","//! api-check version 7.5.4 built with ♥ by Kent C. Dodds (http://kent.doddsfamily.us) (ó ì_í)=óò=(ì_í ò)\n\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"apiCheck\"] = factory();\n\telse\n\t\troot[\"apiCheck\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _apiCheck = __webpack_require__(3);\n\t\n\tvar _apiCheck2 = _interopRequireDefault(_apiCheck);\n\n\texports['default'] = _apiCheck2['default'];\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = stringify;\n\t\n\tfunction getSerialize (fn, decycle) {\n\t var seen = [], keys = [];\n\t decycle = decycle || function(key, value) {\n\t return '[Circular ' + getPath(value, seen, keys) + ']'\n\t };\n\t return function(key, value) {\n\t var ret = value;\n\t if (typeof value === 'object' && value) {\n\t if (seen.indexOf(value) !== -1)\n\t ret = decycle(key, value);\n\t else {\n\t seen.push(value);\n\t keys.push(key);\n\t }\n\t }\n\t if (fn) ret = fn(key, ret);\n\t return ret;\n\t }\n\t}\n\t\n\tfunction getPath (value, seen, keys) {\n\t var index = seen.indexOf(value);\n\t var path = [ keys[index] ];\n\t for (index--; index >= 0; index--) {\n\t if (seen[index][ path[0] ] === value) {\n\t value = seen[index];\n\t path.unshift(keys[index]);\n\t }\n\t }\n\t return '~' + path.join('.');\n\t}\n\t\n\tfunction stringify(obj, fn, spaces, decycle) {\n\t return JSON.stringify(obj, getSerialize(fn, decycle), spaces);\n\t}\n\t\n\tstringify.getSerialize = getSerialize;\n\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\t\n\tvar stringify = __webpack_require__(1);\n\tvar checkerHelpers = {\n\t addOptional: addOptional, getRequiredVersion: getRequiredVersion, setupChecker: setupChecker, addNullable: addNullable\n\t};\n\t\n\tmodule.exports = {\n\t each: each, copy: copy, typeOf: typeOf, arrayify: arrayify, getCheckerDisplay: getCheckerDisplay,\n\t isError: isError, list: list, getError: getError, nAtL: nAtL, t: t, undef: undef, checkerHelpers: checkerHelpers,\n\t noop: noop\n\t};\n\t\n\tfunction copy(obj) {\n\t var type = typeOf(obj);\n\t var daCopy = undefined;\n\t if (type === 'array') {\n\t daCopy = [];\n\t } else if (type === 'object') {\n\t daCopy = {};\n\t } else {\n\t return obj;\n\t }\n\t each(obj, function (val, key) {\n\t daCopy[key] = val; // cannot single-line this because we don't want to abort the each\n\t });\n\t return daCopy;\n\t}\n\t\n\tfunction typeOf(obj) {\n\t if (Array.isArray(obj)) {\n\t return 'array';\n\t } else if (obj instanceof RegExp) {\n\t return 'object';\n\t } else {\n\t return typeof obj;\n\t }\n\t}\n\t\n\tfunction getCheckerDisplay(checker, options) {\n\t /* eslint complexity:[2, 7] */\n\t var display = undefined;\n\t var short = options && options.short;\n\t if (short && checker.shortType) {\n\t display = checker.shortType;\n\t } else if (!short && typeof checker.type === 'object' || checker.type === 'function') {\n\t display = getCheckerType(checker, options);\n\t } else {\n\t display = getCheckerType(checker, options) || checker.displayName || checker.name;\n\t }\n\t return display;\n\t}\n\t\n\tfunction getCheckerType(_ref, options) {\n\t var type = _ref.type;\n\t\n\t if (typeof type === 'function') {\n\t var __apiCheckData = type.__apiCheckData;\n\t var typeTypes = type(options);\n\t type = _defineProperty({\n\t __apiCheckData: __apiCheckData\n\t }, __apiCheckData.type, typeTypes);\n\t }\n\t return type;\n\t}\n\t\n\tfunction arrayify(obj) {\n\t if (!obj) {\n\t return [];\n\t } else if (Array.isArray(obj)) {\n\t return obj;\n\t } else {\n\t return [obj];\n\t }\n\t}\n\t\n\tfunction each(obj, iterator, context) {\n\t if (Array.isArray(obj)) {\n\t return eachArry(obj, iterator, context);\n\t } else {\n\t return eachObj(obj, iterator, context);\n\t }\n\t}\n\t\n\tfunction eachObj(obj, iterator, context) {\n\t var ret = undefined;\n\t var hasOwn = Object.prototype.hasOwnProperty;\n\t /* eslint prefer-const:0 */ // some weird eslint bug?\n\t for (var key in obj) {\n\t if (hasOwn.call(obj, key)) {\n\t ret = iterator.call(context, obj[key], key, obj);\n\t if (ret === false) {\n\t return ret;\n\t }\n\t }\n\t }\n\t return true;\n\t}\n\t\n\tfunction eachArry(obj, iterator, context) {\n\t var ret = undefined;\n\t var length = obj.length;\n\t for (var i = 0; i < length; i++) {\n\t ret = iterator.call(context, obj[i], i, obj);\n\t if (ret === false) {\n\t return ret;\n\t }\n\t }\n\t return true;\n\t}\n\t\n\tfunction isError(obj) {\n\t return obj instanceof Error;\n\t}\n\t\n\tfunction list(arry, join, finalJoin) {\n\t arry = arrayify(arry);\n\t var copy = arry.slice();\n\t var last = copy.pop();\n\t if (copy.length === 1) {\n\t join = ' ';\n\t }\n\t return copy.join(join) + ('' + (copy.length ? join + finalJoin : '') + last);\n\t}\n\t\n\tfunction getError(name, location, checkerType) {\n\t if (typeof checkerType === 'function') {\n\t checkerType = checkerType({ short: true });\n\t }\n\t var stringType = typeof checkerType !== 'object' ? checkerType : stringify(checkerType);\n\t return new Error(nAtL(name, location) + ' must be ' + t(stringType));\n\t}\n\t\n\tfunction nAtL(name, location) {\n\t var tName = t(name || 'value');\n\t var tLocation = !location ? '' : ' at ' + t(location);\n\t return '' + tName + tLocation;\n\t}\n\t\n\tfunction t(thing) {\n\t return '`' + thing + '`';\n\t}\n\t\n\tfunction undef(thing) {\n\t return typeof thing === 'undefined';\n\t}\n\t\n\t/**\n\t * This will set up the checker with all of the defaults that most checkers want like required by default and an\n\t * optional version\n\t *\n\t * @param {Function} checker - the checker to setup with properties\n\t * @param {Object} properties - properties to add to the checker\n\t * @param {boolean} disabled - when set to true, this will set the checker to a no-op function\n\t * @returns {Function} checker - the setup checker\n\t */\n\tfunction setupChecker(checker, properties, disabled) {\n\t /* eslint complexity:[2, 9] */\n\t if (disabled) {\n\t // swap out the checker for its own copy of noop\n\t checker = getNoop();\n\t checker.isNoop = true;\n\t }\n\t\n\t if (typeof checker.type === 'string') {\n\t checker.shortType = checker.type;\n\t }\n\t\n\t // assign all properties given\n\t each(properties, function (prop, name) {\n\t return checker[name] = prop;\n\t });\n\t\n\t if (!checker.displayName) {\n\t checker.displayName = 'apiCheck ' + t(checker.shortType || checker.type || checker.name) + ' type checker';\n\t }\n\t\n\t if (!checker.notRequired) {\n\t checker = getRequiredVersion(checker, disabled);\n\t }\n\t\n\t if (!checker.notNullable) {\n\t addNullable(checker, disabled);\n\t }\n\t\n\t if (!checker.notOptional) {\n\t addOptional(checker, disabled);\n\t }\n\t\n\t return checker;\n\t}\n\t\n\tfunction getRequiredVersion(checker, disabled) {\n\t var requiredChecker = disabled ? getNoop() : function requiredChecker(val, name, location, obj) {\n\t if (undef(val) && !checker.isOptional) {\n\t var tLocation = location ? ' in ' + t(location) : '';\n\t var type = getCheckerDisplay(checker, { short: true });\n\t var stringType = typeof type !== 'object' ? type : stringify(type);\n\t return new Error('Required ' + t(name) + ' not specified' + tLocation + '. Must be ' + t(stringType));\n\t } else {\n\t return checker(val, name, location, obj);\n\t }\n\t };\n\t copyProps(checker, requiredChecker);\n\t requiredChecker.originalChecker = checker;\n\t return requiredChecker;\n\t}\n\t\n\tfunction addOptional(checker, disabled) {\n\t var optionalCheck = disabled ? getNoop() : function optionalCheck(val, name, location, obj) {\n\t if (!undef(val)) {\n\t return checker(val, name, location, obj);\n\t }\n\t };\n\t // inherit all properties on the original checker\n\t copyProps(checker, optionalCheck);\n\t\n\t optionalCheck.isOptional = true;\n\t optionalCheck.displayName = checker.displayName + ' (optional)';\n\t optionalCheck.originalChecker = checker;\n\t\n\t // the magic line that allows you to add .optional to the end of the checkers\n\t checker.optional = optionalCheck;\n\t\n\t fixType(checker, checker.optional);\n\t}\n\t\n\tfunction addNullable(checker, disabled) {\n\t var nullableCheck = disabled ? getNoop() : function nullableCheck(val, name, location, obj) {\n\t if (val !== null) {\n\t return checker(val, name, location, obj);\n\t }\n\t };\n\t // inherit all properties on the original checker\n\t copyProps(checker, nullableCheck);\n\t\n\t nullableCheck.isNullable = true;\n\t nullableCheck.displayName = checker.displayName + ' (nullable)';\n\t nullableCheck.originalChecker = checker;\n\t\n\t // the magic line that allows you to add .nullable to the end of the checkers\n\t checker.nullable = nullableCheck;\n\t\n\t fixType(checker, checker.nullable);\n\t if (!checker.notOptional) {\n\t addOptional(checker.nullable, disabled);\n\t }\n\t}\n\t\n\tfunction fixType(checker, checkerCopy) {\n\t // fix type, because it's not a straight copy...\n\t // the reason is we need to specify type.__apiCheckData.optional as true for the terse/verbose option.\n\t // we also want to add \"(optional)\" to the types with a string\n\t if (typeof checkerCopy.type === 'object') {\n\t checkerCopy.type = copy(checkerCopy.type); // make our own copy of this\n\t } else if (typeof checkerCopy.type === 'function') {\n\t checkerCopy.type = function () {\n\t return checker.type.apply(checker, arguments);\n\t };\n\t } else {\n\t checkerCopy.type += ' (optional)';\n\t return;\n\t }\n\t checkerCopy.type.__apiCheckData = copy(checker.type.__apiCheckData) || {}; // and this\n\t checkerCopy.type.__apiCheckData.optional = true;\n\t}\n\t\n\t// UTILS\n\t\n\tfunction copyProps(src, dest) {\n\t each(Object.keys(src), function (key) {\n\t return dest[key] = src[key];\n\t });\n\t}\n\t\n\tfunction noop() {}\n\t\n\tfunction getNoop() {\n\t /* eslint no-shadow:0 */\n\t /* istanbul ignore next */\n\t return function noop() {};\n\t}\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar stringify = __webpack_require__(1);\n\tvar apiCheckUtil = __webpack_require__(2);\n\tvar each = apiCheckUtil.each;\n\tvar isError = apiCheckUtil.isError;\n\tvar t = apiCheckUtil.t;\n\tvar arrayify = apiCheckUtil.arrayify;\n\tvar getCheckerDisplay = apiCheckUtil.getCheckerDisplay;\n\tvar typeOf = apiCheckUtil.typeOf;\n\tvar getError = apiCheckUtil.getError;\n\t\n\tvar checkers = __webpack_require__(4);\n\tvar apiCheckApis = getApiCheckApis();\n\t\n\tmodule.exports = getApiCheckInstance;\n\tmodule.exports.VERSION = (\"7.5.4\");\n\tmodule.exports.utils = apiCheckUtil;\n\tmodule.exports.globalConfig = {\n\t verbose: false,\n\t disabled: false\n\t};\n\t\n\tvar apiCheckApiCheck = getApiCheckInstance({\n\t output: { prefix: 'apiCheck' }\n\t});\n\tmodule.exports.internalChecker = apiCheckApiCheck;\n\t\n\teach(checkers, function (checker, name) {\n\t return module.exports[name] = checker;\n\t});\n\t\n\tfunction getApiCheckInstance() {\n\t var config = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t var extraCheckers = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\t\n\t /* eslint complexity:[2, 6] */\n\t if (apiCheckApiCheck && arguments.length) {\n\t apiCheckApiCheck['throw'](apiCheckApis.getApiCheckInstanceCheckers, arguments, {\n\t prefix: 'creating an apiCheck instance'\n\t });\n\t }\n\t\n\t var additionalProperties = {\n\t 'throw': getApiCheck(true),\n\t warn: getApiCheck(false),\n\t getErrorMessage: getErrorMessage,\n\t handleErrorMessage: handleErrorMessage,\n\t config: {\n\t output: config.output || {\n\t prefix: '',\n\t suffix: '',\n\t docsBaseUrl: ''\n\t },\n\t verbose: config.verbose || false,\n\t disabled: config.disabled || false\n\t },\n\t utils: apiCheckUtil\n\t };\n\t\n\t each(additionalProperties, function (wrapper, name) {\n\t return apiCheck[name] = wrapper;\n\t });\n\t\n\t var disabled = apiCheck.disabled || module.exports.globalConfig.disabled;\n\t each(checkers.getCheckers(disabled), function (checker, name) {\n\t return apiCheck[name] = checker;\n\t });\n\t each(extraCheckers, function (checker, name) {\n\t return apiCheck[name] = checker;\n\t });\n\t\n\t return apiCheck;\n\t\n\t /**\n\t * This is the instance function. Other things are attached to this see additional properties above.\n\t * @param {Array} api - the checkers to check with\n\t * @param {Array} args - the args to check\n\t * @param {Object} output - output options\n\t * @returns {Object} - if this has a failed = true property, then it failed\n\t */\n\t function apiCheck(api, args, output) {\n\t /* eslint complexity:[2, 8] */\n\t if (apiCheck.config.disabled || module.exports.globalConfig.disabled) {\n\t return {\n\t apiTypes: {}, argTypes: {},\n\t passed: true, message: '',\n\t failed: false\n\t }; // empty version of what is normally returned\n\t }\n\t checkApiCheckApi(arguments);\n\t if (!Array.isArray(api)) {\n\t api = [api];\n\t args = [args];\n\t } else {\n\t // turn arguments into an array\n\t args = Array.prototype.slice.call(args);\n\t }\n\t var messages = checkEnoughArgs(api, args);\n\t if (!messages.length) {\n\t // this is where we actually go perform the checks.\n\t messages = checkApiWithArgs(api, args);\n\t }\n\t\n\t var returnObject = getTypes(api, args);\n\t returnObject.args = args;\n\t if (messages.length) {\n\t returnObject.message = apiCheck.getErrorMessage(api, args, messages, output);\n\t returnObject.failed = true;\n\t returnObject.passed = false;\n\t } else {\n\t returnObject.message = '';\n\t returnObject.failed = false;\n\t returnObject.passed = true;\n\t }\n\t return returnObject;\n\t }\n\t\n\t /**\n\t * checkApiCheckApi, should be read like: check apiCheck api. As in, check the api for apiCheck :-)\n\t * @param {Array} checkApiArgs - args provided to apiCheck function\n\t */\n\t function checkApiCheckApi(checkApiArgs) {\n\t var api = checkApiArgs[0];\n\t var args = checkApiArgs[1];\n\t var isArrayOrArgs = Array.isArray(args) || args && typeof args === 'object' && typeof args.length === 'number';\n\t\n\t if (Array.isArray(api) && !isArrayOrArgs) {\n\t throw new Error(getErrorMessage(api, [args], ['If an array is provided for the api, an array must be provided for the args as well.'], { prefix: 'apiCheck' }));\n\t }\n\t // dog fooding here\n\t var errors = checkApiWithArgs(apiCheckApis.checkApiCheckApi, checkApiArgs);\n\t if (errors.length) {\n\t var message = apiCheck.getErrorMessage(apiCheckApis.checkApiCheckApi, checkApiArgs, errors, {\n\t prefix: 'apiCheck'\n\t });\n\t apiCheck.handleErrorMessage(message, true);\n\t }\n\t }\n\t\n\t function getApiCheck(shouldThrow) {\n\t return function apiCheckWrapper(api, args, output) {\n\t var result = apiCheck(api, args, output);\n\t apiCheck.handleErrorMessage(result.message, shouldThrow);\n\t return result; // wont get here if an error is thrown\n\t };\n\t }\n\t\n\t function handleErrorMessage(message, shouldThrow) {\n\t if (shouldThrow && message) {\n\t throw new Error(message);\n\t } else if (message) {\n\t /* eslint no-console:0 */\n\t console.warn(message);\n\t }\n\t }\n\t\n\t function getErrorMessage(api, args) {\n\t var messages = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];\n\t var output = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];\n\t\n\t var gOut = apiCheck.config.output || {};\n\t var prefix = getPrefix();\n\t var suffix = getSuffix();\n\t var url = getUrl();\n\t var message = 'apiCheck failed! ' + messages.join(', ');\n\t var passedAndShouldHavePassed = '\\n\\n' + buildMessageFromApiAndArgs(api, args);\n\t return (prefix + ' ' + message + ' ' + suffix + ' ' + (url || '') + passedAndShouldHavePassed).trim();\n\t\n\t function getPrefix() {\n\t var p = output.onlyPrefix;\n\t if (!p) {\n\t p = ((gOut.prefix || '') + ' ' + (output.prefix || '')).trim();\n\t }\n\t return p;\n\t }\n\t\n\t function getSuffix() {\n\t var s = output.onlySuffix;\n\t if (!s) {\n\t s = ((output.suffix || '') + ' ' + (gOut.suffix || '')).trim();\n\t }\n\t return s;\n\t }\n\t\n\t function getUrl() {\n\t var u = output.url;\n\t if (!u) {\n\t u = gOut.docsBaseUrl && output.urlSuffix && ('' + gOut.docsBaseUrl + output.urlSuffix).trim();\n\t }\n\t return u;\n\t }\n\t }\n\t\n\t function buildMessageFromApiAndArgs(api, args) {\n\t var _getTypes = getTypes(api, args);\n\t\n\t var apiTypes = _getTypes.apiTypes;\n\t var argTypes = _getTypes.argTypes;\n\t\n\t var copy = Array.prototype.slice.call(args || []);\n\t var replacedItems = [];\n\t replaceFunctionWithName(copy);\n\t var passedArgs = getObjectString(copy);\n\t argTypes = getObjectString(argTypes);\n\t apiTypes = getObjectString(apiTypes);\n\t\n\t return generateMessage();\n\t\n\t // functions\n\t\n\t function replaceFunctionWithName(obj) {\n\t each(obj, function (val, name) {\n\t /* eslint complexity:[2, 6] */\n\t if (replacedItems.indexOf(val) === -1) {\n\t // avoid recursive problems\n\t replacedItems.push(val);\n\t if (typeof val === 'object') {\n\t replaceFunctionWithName(obj);\n\t } else if (typeof val === 'function') {\n\t obj[name] = val.displayName || val.name || 'anonymous function';\n\t }\n\t }\n\t });\n\t }\n\t\n\t function getObjectString(types) {\n\t if (!types || !types.length) {\n\t return 'nothing';\n\t } else if (types && types.length === 1) {\n\t types = types[0];\n\t }\n\t return stringify(types, null, 2);\n\t }\n\t\n\t function generateMessage() {\n\t var n = '\\n';\n\t var useS = true;\n\t if (args && args.length === 1) {\n\t if (typeof args[0] === 'object' && args[0] !== null) {\n\t useS = !!Object.keys(args[0]).length;\n\t } else {\n\t useS = false;\n\t }\n\t }\n\t var types = 'type' + (useS ? 's' : '');\n\t var newLine = n + n;\n\t return 'You passed:' + n + passedArgs + newLine + ('With the ' + types + ':' + n + argTypes + newLine) + ('The API calls for:' + n + apiTypes);\n\t }\n\t }\n\t\n\t function getTypes(api, args) {\n\t api = arrayify(api);\n\t args = arrayify(args);\n\t var apiTypes = api.map(function (checker, index) {\n\t var specified = module.exports.globalConfig.hasOwnProperty('verbose');\n\t return getCheckerDisplay(checker, {\n\t terse: specified ? !module.exports.globalConfig.verbose : !apiCheck.config.verbose,\n\t obj: args[index],\n\t addHelpers: true\n\t });\n\t });\n\t var argTypes = args.map(function (arg) {\n\t return getArgDisplay(arg, []);\n\t });\n\t return { argTypes: argTypes, apiTypes: apiTypes };\n\t }\n\t}\n\t\n\t// STATELESS FUNCTIONS\n\t\n\t/**\n\t * This is where the magic happens for actually checking the arguments with the api.\n\t * @param {Array} api - checkers\n\t * @param {Array} args - and arguments object\n\t * @returns {Array} - the error messages\n\t */\n\tfunction checkApiWithArgs(api, args) {\n\t /* eslint complexity:[2, 7] */\n\t var messages = [];\n\t var failed = false;\n\t var checkerIndex = 0;\n\t var argIndex = 0;\n\t var arg = undefined,\n\t checker = undefined,\n\t res = undefined,\n\t lastChecker = undefined,\n\t argName = undefined,\n\t argFailed = undefined,\n\t skipPreviousChecker = undefined;\n\t /* jshint -W084 */\n\t while ((checker = api[checkerIndex++]) && argIndex < args.length) {\n\t arg = args[argIndex++];\n\t argName = 'Argument ' + argIndex + (checker.isOptional ? ' (optional)' : '');\n\t res = checker(arg, 'value', argName);\n\t argFailed = isError(res);\n\t lastChecker = checkerIndex >= api.length;\n\t skipPreviousChecker = checkerIndex > 1 && api[checkerIndex - 1].isOptional;\n\t if (argFailed && lastChecker || argFailed && !lastChecker && !checker.isOptional && !skipPreviousChecker) {\n\t failed = true;\n\t messages.push(getCheckerErrorMessage(res, checker, arg));\n\t } else if (argFailed && checker.isOptional) {\n\t argIndex--;\n\t } else {\n\t messages.push(t(argName) + ' passed');\n\t }\n\t }\n\t return failed ? messages : [];\n\t}\n\t\n\tcheckerTypeType.type = 'function with __apiCheckData property and `${function.type}` property';\n\tfunction checkerTypeType(checkerType, name, location) {\n\t var apiCheckDataChecker = checkers.shape({\n\t type: checkers.string,\n\t optional: checkers.bool\n\t });\n\t var asFunc = checkers.func.withProperties({ __apiCheckData: apiCheckDataChecker });\n\t var asShape = checkers.shape({ __apiCheckData: apiCheckDataChecker });\n\t var wrongShape = checkers.oneOfType([asFunc, asShape])(checkerType, name, location);\n\t if (isError(wrongShape)) {\n\t return wrongShape;\n\t }\n\t if (typeof checkerType !== 'function' && !checkerType.hasOwnProperty(checkerType.__apiCheckData.type)) {\n\t return getError(name, location, checkerTypeType.type);\n\t }\n\t}\n\t\n\tfunction getCheckerErrorMessage(res, checker, val) {\n\t var checkerHelp = getCheckerHelp(checker, val);\n\t checkerHelp = checkerHelp ? ' - ' + checkerHelp : '';\n\t return res.message + checkerHelp;\n\t}\n\t\n\tfunction getCheckerHelp(_ref, val) {\n\t var help = _ref.help;\n\t\n\t if (!help) {\n\t return '';\n\t }\n\t if (typeof help === 'function') {\n\t help = help(val);\n\t }\n\t return help;\n\t}\n\t\n\tfunction checkEnoughArgs(api, args) {\n\t var requiredArgs = api.filter(function (a) {\n\t return !a.isOptional;\n\t });\n\t if (args.length < requiredArgs.length) {\n\t return ['Not enough arguments specified. Requires `' + requiredArgs.length + '`, you passed `' + args.length + '`'];\n\t } else {\n\t return [];\n\t }\n\t}\n\t\n\tfunction getArgDisplay(arg, gottenArgs) {\n\t /* eslint complexity:[2, 7] */\n\t var cName = arg && arg.constructor && arg.constructor.name;\n\t var type = typeOf(arg);\n\t if (type === 'function') {\n\t if (hasKeys()) {\n\t var properties = stringify(getDisplayIfNotGotten());\n\t return cName + ' (with properties: ' + properties + ')';\n\t }\n\t return cName;\n\t }\n\t\n\t if (arg === null) {\n\t return 'null';\n\t }\n\t\n\t if (type !== 'array' && type !== 'object') {\n\t return type;\n\t }\n\t\n\t if (hasKeys()) {\n\t return getDisplayIfNotGotten();\n\t }\n\t\n\t return cName;\n\t\n\t // utility functions\n\t function hasKeys() {\n\t return arg && Object.keys(arg).length;\n\t }\n\t\n\t function getDisplayIfNotGotten() {\n\t if (gottenArgs.indexOf(arg) !== -1) {\n\t return '[Circular]';\n\t }\n\t gottenArgs.push(arg);\n\t return getDisplay(arg, gottenArgs);\n\t }\n\t}\n\t\n\tfunction getDisplay(obj, gottenArgs) {\n\t var argDisplay = {};\n\t each(obj, function (v, k) {\n\t return argDisplay[k] = getArgDisplay(v, gottenArgs);\n\t });\n\t return argDisplay;\n\t}\n\t\n\tfunction getApiCheckApis() {\n\t var os = checkers.string.optional;\n\t\n\t var checkerFnChecker = checkers.func.withProperties({\n\t type: checkers.oneOfType([checkers.string, checkerTypeType]).optional,\n\t displayName: checkers.string.optional,\n\t shortType: checkers.string.optional,\n\t notOptional: checkers.bool.optional,\n\t notRequired: checkers.bool.optional\n\t });\n\t\n\t var getApiCheckInstanceCheckers = [checkers.shape({\n\t output: checkers.shape({\n\t prefix: checkers.string.optional,\n\t suffix: checkers.string.optional,\n\t docsBaseUrl: checkers.string.optional\n\t }).strict.optional,\n\t verbose: checkers.bool.optional,\n\t disabled: checkers.bool.optional\n\t }).strict.optional, checkers.objectOf(checkerFnChecker).optional];\n\t\n\t var checkApiCheckApi = [checkers.typeOrArrayOf(checkerFnChecker), checkers.any.optional, checkers.shape({\n\t prefix: os, suffix: os, urlSuffix: os, // appended case\n\t onlyPrefix: os, onlySuffix: os, url: os // override case\n\t }).strict.optional];\n\t\n\t return {\n\t checkerFnChecker: checkerFnChecker,\n\t getApiCheckInstanceCheckers: getApiCheckInstanceCheckers,\n\t checkApiCheckApi: checkApiCheckApi\n\t };\n\t}\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tvar stringify = __webpack_require__(1);\n\t\n\tvar _require = __webpack_require__(2);\n\t\n\tvar typeOf = _require.typeOf;\n\tvar each = _require.each;\n\tvar copy = _require.copy;\n\tvar getCheckerDisplay = _require.getCheckerDisplay;\n\tvar isError = _require.isError;\n\tvar arrayify = _require.arrayify;\n\tvar list = _require.list;\n\tvar getError = _require.getError;\n\tvar nAtL = _require.nAtL;\n\tvar t = _require.t;\n\tvar checkerHelpers = _require.checkerHelpers;\n\tvar undef = _require.undef;\n\tvar setupChecker = checkerHelpers.setupChecker;\n\t\n\tvar checkers = module.exports = getCheckers();\n\tmodule.exports.getCheckers = getCheckers;\n\t\n\tfunction getCheckers(disabled) {\n\t return {\n\t array: typeOfCheckGetter('Array'),\n\t bool: typeOfCheckGetter('Boolean'),\n\t number: typeOfCheckGetter('Number'),\n\t string: typeOfCheckGetter('String'),\n\t func: funcCheckGetter(),\n\t object: objectCheckGetter(),\n\t\n\t emptyObject: emptyObjectCheckGetter(),\n\t\n\t instanceOf: instanceCheckGetter,\n\t oneOf: oneOfCheckGetter,\n\t oneOfType: oneOfTypeCheckGetter,\n\t\n\t arrayOf: arrayOfCheckGetter,\n\t objectOf: objectOfCheckGetter,\n\t typeOrArrayOf: typeOrArrayOfCheckGetter,\n\t\n\t range: rangeCheckGetter,\n\t lessThan: lessThanCheckGetter,\n\t greaterThan: greaterThanCheckGetter,\n\t\n\t shape: getShapeCheckGetter(),\n\t args: argumentsCheckerGetter(),\n\t\n\t any: anyCheckGetter(),\n\t 'null': nullCheckGetter()\n\t\n\t };\n\t\n\t function typeOfCheckGetter(type) {\n\t var lType = type.toLowerCase();\n\t return setupChecker(function typeOfCheckerDefinition(val, name, location) {\n\t if (typeOf(val) !== lType) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function funcCheckGetter() {\n\t var type = 'Function';\n\t var functionChecker = setupChecker(function functionCheckerDefinition(val, name, location) {\n\t if (typeOf(val) !== 'function') {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t\n\t functionChecker.withProperties = function getWithPropertiesChecker(properties) {\n\t var apiError = checkers.objectOf(checkers.func)(properties, 'properties', 'apiCheck.func.withProperties');\n\t if (isError(apiError)) {\n\t throw apiError;\n\t }\n\t var shapeChecker = checkers.shape(properties, true);\n\t shapeChecker.type.__apiCheckData.type = 'func.withProperties';\n\t\n\t return setupChecker(function functionWithPropertiesChecker(val, name, location) {\n\t var notFunction = checkers.func(val, name, location);\n\t if (isError(notFunction)) {\n\t return notFunction;\n\t }\n\t return shapeChecker(val, name, location);\n\t }, { type: shapeChecker.type, shortType: 'func.withProperties' }, disabled);\n\t };\n\t return functionChecker;\n\t }\n\t\n\t function objectCheckGetter() {\n\t var type = 'Object';\n\t var nullType = 'Object (null ok)';\n\t var objectNullOkChecker = setupChecker(function objectNullOkCheckerDefinition(val, name, location) {\n\t if (typeOf(val) !== 'object') {\n\t return getError(name, location, nullType);\n\t }\n\t }, { type: nullType }, disabled);\n\t\n\t var objectChecker = setupChecker(function objectCheckerDefinition(val, name, location) {\n\t if (val === null || isError(objectNullOkChecker(val, name, location))) {\n\t return getError(name, location, objectChecker.type);\n\t }\n\t }, { type: type, nullOk: objectNullOkChecker }, disabled);\n\t\n\t return objectChecker;\n\t }\n\t\n\t function instanceCheckGetter(classToCheck) {\n\t return setupChecker(function instanceCheckerDefinition(val, name, location) {\n\t if (!(val instanceof classToCheck)) {\n\t return getError(name, location, classToCheck.name);\n\t }\n\t }, { type: classToCheck.name }, disabled);\n\t }\n\t\n\t function oneOfCheckGetter(enums) {\n\t var type = {\n\t __apiCheckData: { optional: false, type: 'enum' },\n\t 'enum': enums\n\t };\n\t var shortType = 'oneOf[' + enums.map(function (enm) {\n\t return stringify(enm);\n\t }).join(', ') + ']';\n\t return setupChecker(function oneOfCheckerDefinition(val, name, location) {\n\t if (!enums.some(function (enm) {\n\t return enm === val;\n\t })) {\n\t return getError(name, location, shortType);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t }\n\t\n\t function oneOfTypeCheckGetter(typeCheckers) {\n\t var checkersDisplay = typeCheckers.map(function (checker) {\n\t return getCheckerDisplay(checker, { short: true });\n\t });\n\t var shortType = 'oneOfType[' + checkersDisplay.join(', ') + ']';\n\t function type(options) {\n\t if (options && options.short) {\n\t return shortType;\n\t }\n\t return typeCheckers.map(function (checker) {\n\t return getCheckerDisplay(checker, options);\n\t });\n\t }\n\t type.__apiCheckData = { optional: false, type: 'oneOfType' };\n\t return setupChecker(function oneOfTypeCheckerDefinition(val, name, location) {\n\t if (!typeCheckers.some(function (checker) {\n\t return !isError(checker(val, name, location));\n\t })) {\n\t return getError(name, location, shortType);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t }\n\t\n\t function arrayOfCheckGetter(checker) {\n\t var shortCheckerDisplay = getCheckerDisplay(checker, { short: true });\n\t var shortType = 'arrayOf[' + shortCheckerDisplay + ']';\n\t\n\t function type(options) {\n\t if (options && options.short) {\n\t return shortType;\n\t }\n\t return getCheckerDisplay(checker, options);\n\t }\n\t type.__apiCheckData = { optional: false, type: 'arrayOf' };\n\t\n\t return setupChecker(function arrayOfCheckerDefinition(val, name, location) {\n\t if (isError(checkers.array(val)) || !val.every(function (item) {\n\t return !isError(checker(item));\n\t })) {\n\t return getError(name, location, shortType);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t }\n\t\n\t function objectOfCheckGetter(checker) {\n\t var checkerDisplay = getCheckerDisplay(checker, { short: true });\n\t var shortType = 'objectOf[' + checkerDisplay + ']';\n\t\n\t function type(options) {\n\t if (options && options.short) {\n\t return shortType;\n\t }\n\t return getCheckerDisplay(checker, options);\n\t }\n\t type.__apiCheckData = { optional: false, type: 'objectOf' };\n\t\n\t return setupChecker(function objectOfCheckerDefinition(val, name, location) {\n\t var notObject = checkers.object(val, name, location);\n\t if (isError(notObject)) {\n\t return notObject;\n\t }\n\t var allTypesSuccess = each(val, function (item, key) {\n\t if (isError(checker(item, key, name))) {\n\t return false;\n\t }\n\t });\n\t if (!allTypesSuccess) {\n\t return getError(name, location, shortType);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t }\n\t\n\t function typeOrArrayOfCheckGetter(checker) {\n\t var checkerDisplay = getCheckerDisplay(checker, { short: true });\n\t var shortType = 'typeOrArrayOf[' + checkerDisplay + ']';\n\t\n\t function type(options) {\n\t if (options && options.short) {\n\t return shortType;\n\t }\n\t return getCheckerDisplay(checker, options);\n\t }\n\t\n\t type.__apiCheckData = { optional: false, type: 'typeOrArrayOf' };\n\t return setupChecker(function typeOrArrayOfDefinition(val, name, location, obj) {\n\t if (isError(checkers.oneOfType([checker, checkers.arrayOf(checker)])(val, name, location, obj))) {\n\t return getError(name, location, shortType);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t }\n\t\n\t function getShapeCheckGetter() {\n\t function shapeCheckGetter(shape, nonObject) {\n\t var shapeTypes = {};\n\t each(shape, function (checker, prop) {\n\t shapeTypes[prop] = getCheckerDisplay(checker);\n\t });\n\t function type() {\n\t var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t var ret = {};\n\t var terse = options.terse;\n\t var obj = options.obj;\n\t var addHelpers = options.addHelpers;\n\t\n\t var parentRequired = options.required;\n\t each(shape, function (checker, prop) {\n\t /* eslint complexity:[2, 6] */\n\t var specified = obj && obj.hasOwnProperty(prop);\n\t var required = undef(parentRequired) ? !checker.isOptional : parentRequired;\n\t if (!terse || (specified || !checker.isOptional)) {\n\t ret[prop] = getCheckerDisplay(checker, { terse: terse, obj: obj && obj[prop], required: required, addHelpers: addHelpers });\n\t }\n\t if (addHelpers) {\n\t modifyTypeDisplayToHelpOut(ret, prop, specified, checker, required);\n\t }\n\t });\n\t return ret;\n\t\n\t function modifyTypeDisplayToHelpOut(theRet, prop, specified, checker, required) {\n\t if (!specified && required && !checker.isOptional) {\n\t var item = 'ITEM';\n\t if (checker.type && checker.type.__apiCheckData) {\n\t item = checker.type.__apiCheckData.type.toUpperCase();\n\t }\n\t addHelper('missing', 'MISSING THIS ' + item, ' <-- YOU ARE MISSING THIS');\n\t } else if (specified) {\n\t var error = checker(obj[prop], prop, null, obj);\n\t if (isError(error)) {\n\t addHelper('error', 'THIS IS THE PROBLEM: ' + error.message, ' <-- THIS IS THE PROBLEM: ' + error.message);\n\t }\n\t }\n\t\n\t function addHelper(property, objectMessage, stringMessage) {\n\t if (typeof theRet[prop] === 'string') {\n\t theRet[prop] += stringMessage;\n\t } else {\n\t theRet[prop].__apiCheckData[property] = objectMessage;\n\t }\n\t }\n\t }\n\t }\n\t\n\t type.__apiCheckData = { strict: false, optional: false, type: 'shape' };\n\t var shapeChecker = setupChecker(function shapeCheckerDefinition(val, name, location) {\n\t /* eslint complexity:[2, 6] */\n\t var isObject = !nonObject && checkers.object(val, name, location);\n\t if (isError(isObject)) {\n\t return isObject;\n\t }\n\t var shapePropError = undefined;\n\t location = location ? location + (name ? '/' : '') : '';\n\t name = name || '';\n\t each(shape, function (checker, prop) {\n\t if (val.hasOwnProperty(prop) || !checker.isOptional) {\n\t shapePropError = checker(val[prop], prop, '' + location + name, val);\n\t return !isError(shapePropError);\n\t }\n\t });\n\t if (isError(shapePropError)) {\n\t return shapePropError;\n\t }\n\t }, { type: type, shortType: 'shape' }, disabled);\n\t\n\t function strictType() {\n\t return type.apply(undefined, arguments);\n\t }\n\t\n\t strictType.__apiCheckData = copy(shapeChecker.type.__apiCheckData);\n\t strictType.__apiCheckData.strict = true;\n\t shapeChecker.strict = setupChecker(function strictShapeCheckerDefinition(val, name, location) {\n\t var shapeError = shapeChecker(val, name, location);\n\t if (isError(shapeError)) {\n\t return shapeError;\n\t }\n\t var allowedProperties = Object.keys(shape);\n\t var extraProps = Object.keys(val).filter(function (prop) {\n\t return allowedProperties.indexOf(prop) === -1;\n\t });\n\t if (extraProps.length) {\n\t return new Error(nAtL(name, location) + ' cannot have extra properties: ' + t(extraProps.join('`, `')) + '.' + ('It is limited to ' + t(allowedProperties.join('`, `'))));\n\t }\n\t }, { type: strictType, shortType: 'strict shape' }, disabled);\n\t\n\t return shapeChecker;\n\t }\n\t\n\t shapeCheckGetter.ifNot = function ifNot(otherProps, propChecker) {\n\t if (!Array.isArray(otherProps)) {\n\t otherProps = [otherProps];\n\t }\n\t var description = undefined;\n\t if (otherProps.length === 1) {\n\t description = 'specified only if ' + otherProps[0] + ' is not specified';\n\t } else {\n\t description = 'specified only if none of the following are specified: [' + list(otherProps, ', ', 'and ') + ']';\n\t }\n\t var shortType = 'ifNot[' + otherProps.join(', ') + ']';\n\t var type = getTypeForShapeChild(propChecker, description, shortType);\n\t return setupChecker(function ifNotChecker(prop, propName, location, obj) {\n\t var propExists = obj && obj.hasOwnProperty(propName);\n\t var otherPropsExist = otherProps.some(function (otherProp) {\n\t return obj && obj.hasOwnProperty(otherProp);\n\t });\n\t if (propExists === otherPropsExist) {\n\t return getError(propName, location, type);\n\t } else if (propExists) {\n\t return propChecker(prop, propName, location, obj);\n\t }\n\t }, { notRequired: true, type: type, shortType: shortType }, disabled);\n\t };\n\t\n\t shapeCheckGetter.onlyIf = function onlyIf(otherProps, propChecker) {\n\t otherProps = arrayify(otherProps);\n\t var description = undefined;\n\t if (otherProps.length === 1) {\n\t description = 'specified only if ' + otherProps[0] + ' is also specified';\n\t } else {\n\t description = 'specified only if all of the following are specified: [' + list(otherProps, ', ', 'and ') + ']';\n\t }\n\t var shortType = 'onlyIf[' + otherProps.join(', ') + ']';\n\t var type = getTypeForShapeChild(propChecker, description, shortType);\n\t return setupChecker(function onlyIfCheckerDefinition(prop, propName, location, obj) {\n\t var othersPresent = otherProps.every(function (property) {\n\t return obj.hasOwnProperty(property);\n\t });\n\t if (!othersPresent) {\n\t return getError(propName, location, type);\n\t } else {\n\t return propChecker(prop, propName, location, obj);\n\t }\n\t }, { type: type, shortType: shortType }, disabled);\n\t };\n\t\n\t shapeCheckGetter.requiredIfNot = function shapeRequiredIfNot(otherProps, propChecker) {\n\t if (!Array.isArray(otherProps)) {\n\t otherProps = [otherProps];\n\t }\n\t return getRequiredIfNotChecker(false, otherProps, propChecker);\n\t };\n\t\n\t shapeCheckGetter.requiredIfNot.all = function shapeRequiredIfNotAll(otherProps, propChecker) {\n\t if (!Array.isArray(otherProps)) {\n\t throw new Error('requiredIfNot.all must be passed an array');\n\t }\n\t return getRequiredIfNotChecker(true, otherProps, propChecker);\n\t };\n\t\n\t function getRequiredIfNotChecker(all, otherProps, propChecker) {\n\t var props = t(otherProps.join(', '));\n\t var ifProps = 'if ' + (all ? 'all of' : 'at least one of');\n\t var description = 'specified ' + ifProps + ' these are not specified: ' + props + ' (otherwise it\\'s optional)';\n\t var shortType = 'requiredIfNot' + (all ? '.all' : '') + '[' + otherProps.join(', ') + '}]';\n\t var type = getTypeForShapeChild(propChecker, description, shortType);\n\t return setupChecker(function shapeRequiredIfNotDefinition(prop, propName, location, obj) {\n\t var propExists = obj && obj.hasOwnProperty(propName);\n\t var iteration = all ? 'every' : 'some';\n\t var otherPropsExist = otherProps[iteration](function (otherProp) {\n\t return obj && obj.hasOwnProperty(otherProp);\n\t });\n\t if (!otherPropsExist && !propExists) {\n\t return getError(propName, location, type);\n\t } else if (propExists) {\n\t return propChecker(prop, propName, location, obj);\n\t }\n\t }, { type: type, notRequired: true }, disabled);\n\t }\n\t\n\t return shapeCheckGetter;\n\t\n\t function getTypeForShapeChild(propChecker, description, shortType) {\n\t function type(options) {\n\t if (options && options.short) {\n\t return shortType;\n\t }\n\t return getCheckerDisplay(propChecker);\n\t }\n\t type.__apiCheckData = { optional: false, type: 'ifNot', description: description };\n\t return type;\n\t }\n\t }\n\t\n\t function argumentsCheckerGetter() {\n\t var type = 'function arguments';\n\t return setupChecker(function argsCheckerDefinition(val, name, location) {\n\t if (Array.isArray(val) || isError(checkers.object(val)) || isError(checkers.number(val.length))) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function anyCheckGetter() {\n\t return setupChecker(function anyCheckerDefinition() {\n\t // don't do anything\n\t }, { type: 'any' }, disabled);\n\t }\n\t\n\t function nullCheckGetter() {\n\t var type = 'null';\n\t return setupChecker(function nullChecker(val, name, location) {\n\t if (val !== null) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function rangeCheckGetter(min, max) {\n\t var type = 'Range (' + min + ' - ' + max + ')';\n\t return setupChecker(function rangeChecker(val, name, location) {\n\t if (typeof val !== 'number' || val < min || val > max) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function lessThanCheckGetter(min) {\n\t var type = 'lessThan[' + min + ']';\n\t return setupChecker(function lessThanChecker(val, name, location) {\n\t if (typeof val !== 'number' || val > min) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function greaterThanCheckGetter(max) {\n\t var type = 'greaterThan[' + max + ']';\n\t return setupChecker(function greaterThanChecker(val, name, location) {\n\t if (typeof val !== 'number' || val < max) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t\n\t function emptyObjectCheckGetter() {\n\t var type = 'empty object';\n\t return setupChecker(function emptyObjectChecker(val, name, location) {\n\t if (typeOf(val) !== 'object' || val === null || Object.keys(val).length) {\n\t return getError(name, location, type);\n\t }\n\t }, { type: type }, disabled);\n\t }\n\t}\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** dist/api-check.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 0063d8845a3f72305aa5\n **/","import apiCheckFactory from './api-check';\n\nexport default apiCheckFactory;\n\n\n\n/** WEBPACK FOOTER **\n ** ../~/eslint-loader!./index.js\n **/","module.exports = stringify;\n\nfunction getSerialize (fn, decycle) {\n var seen = [], keys = [];\n decycle = decycle || function(key, value) {\n return '[Circular ' + getPath(value, seen, keys) + ']'\n };\n return function(key, value) {\n var ret = value;\n if (typeof value === 'object' && value) {\n if (seen.indexOf(value) !== -1)\n ret = decycle(key, value);\n else {\n seen.push(value);\n keys.push(key);\n }\n }\n if (fn) ret = fn(key, ret);\n return ret;\n }\n}\n\nfunction getPath (value, seen, keys) {\n var index = seen.indexOf(value);\n var path = [ keys[index] ];\n for (index--; index >= 0; index--) {\n if (seen[index][ path[0] ] === value) {\n value = seen[index];\n path.unshift(keys[index]);\n }\n }\n return '~' + path.join('.');\n}\n\nfunction stringify(obj, fn, spaces, decycle) {\n return JSON.stringify(obj, getSerialize(fn, decycle), spaces);\n}\n\nstringify.getSerialize = getSerialize;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ../~/json-stringify-safe/stringify.js\n ** module id = 1\n ** module chunks = 0\n **/","const stringify = require('json-stringify-safe');\nconst checkerHelpers = {\n addOptional, getRequiredVersion, setupChecker, addNullable\n};\n\nmodule.exports = {\n each, copy, typeOf, arrayify, getCheckerDisplay,\n isError, list, getError, nAtL, t, undef, checkerHelpers,\n noop\n};\n\nfunction copy(obj) {\n const type = typeOf(obj);\n let daCopy;\n if (type === 'array') {\n daCopy = [];\n } else if (type === 'object') {\n daCopy = {};\n } else {\n return obj;\n }\n each(obj, (val, key) => {\n daCopy[key] = val; // cannot single-line this because we don't want to abort the each\n });\n return daCopy;\n}\n\n\nfunction typeOf(obj) {\n if (Array.isArray(obj)) {\n return 'array';\n } else if (obj instanceof RegExp) {\n return 'object';\n } else {\n return typeof obj;\n }\n}\n\nfunction getCheckerDisplay(checker, options) {\n /* eslint complexity:[2, 7] */\n let display;\n const short = options && options.short;\n if (short && checker.shortType) {\n display = checker.shortType;\n } else if (!short && typeof checker.type === 'object' || checker.type === 'function') {\n display = getCheckerType(checker, options);\n } else {\n display = getCheckerType(checker, options) || checker.displayName || checker.name;\n }\n return display;\n}\n\nfunction getCheckerType({type}, options) {\n if (typeof type === 'function') {\n const __apiCheckData = type.__apiCheckData;\n const typeTypes = type(options);\n type = {\n __apiCheckData,\n [__apiCheckData.type]: typeTypes\n };\n }\n return type;\n}\n\nfunction arrayify(obj) {\n if (!obj) {\n return [];\n } else if (Array.isArray(obj)) {\n return obj;\n } else {\n return [obj];\n }\n}\n\n\nfunction each(obj, iterator, context) {\n if (Array.isArray(obj)) {\n return eachArry(obj, iterator, context);\n } else {\n return eachObj(obj, iterator, context);\n }\n}\n\nfunction eachObj(obj, iterator, context) {\n let ret;\n const hasOwn = Object.prototype.hasOwnProperty;\n /* eslint prefer-const:0 */ // some weird eslint bug?\n for (let key in obj) {\n if (hasOwn.call(obj, key)) {\n ret = iterator.call(context, obj[key], key, obj);\n if (ret === false) {\n return ret;\n }\n }\n }\n return true;\n}\n\nfunction eachArry(obj, iterator, context) {\n let ret;\n const length = obj.length;\n for (let i = 0; i < length; i++) {\n ret = iterator.call(context, obj[i], i, obj);\n if (ret === false) {\n return ret;\n }\n }\n return true;\n}\n\nfunction isError(obj) {\n return obj instanceof Error;\n}\n\nfunction list(arry, join, finalJoin) {\n arry = arrayify(arry);\n const copy = arry.slice();\n const last = copy.pop();\n if (copy.length === 1) {\n join = ' ';\n }\n return copy.join(join) + `${copy.length ? join + finalJoin : ''}${last}`;\n}\n\n\nfunction getError(name, location, checkerType) {\n if (typeof checkerType === 'function') {\n checkerType = checkerType({short: true});\n }\n const stringType = typeof checkerType !== 'object' ? checkerType : stringify(checkerType);\n return new Error(`${nAtL(name, location)} must be ${t(stringType)}`);\n}\n\nfunction nAtL(name, location) {\n const tName = t(name || 'value');\n let tLocation = !location ? '' : ' at ' + t(location);\n return `${tName}${tLocation}`;\n}\n\nfunction t(thing) {\n return '`' + thing + '`';\n}\n\nfunction undef(thing) {\n return typeof thing === 'undefined';\n}\n\n\n/**\n * This will set up the checker with all of the defaults that most checkers want like required by default and an\n * optional version\n *\n * @param {Function} checker - the checker to setup with properties\n * @param {Object} properties - properties to add to the checker\n * @param {boolean} disabled - when set to true, this will set the checker to a no-op function\n * @returns {Function} checker - the setup checker\n */\nfunction setupChecker(checker, properties, disabled) {\n /* eslint complexity:[2, 9] */\n if (disabled) { // swap out the checker for its own copy of noop\n checker = getNoop();\n checker.isNoop = true;\n }\n\n if (typeof checker.type === 'string') {\n checker.shortType = checker.type;\n }\n\n // assign all properties given\n each(properties, (prop, name) => checker[name] = prop);\n\n if (!checker.displayName) {\n checker.displayName = `apiCheck ${t(checker.shortType || checker.type || checker.name)} type checker`;\n }\n\n\n if (!checker.notRequired) {\n checker = getRequiredVersion(checker, disabled);\n }\n\n if (!checker.notNullable) {\n addNullable(checker, disabled);\n }\n\n if (!checker.notOptional) {\n addOptional(checker, disabled);\n }\n\n return checker;\n}\n\nfunction getRequiredVersion(checker, disabled) {\n const requiredChecker = disabled ? getNoop() : function requiredChecker(val, name, location, obj) {\n if (undef(val) && !checker.isOptional) {\n let tLocation = location ? ` in ${t(location)}` : '';\n const type = getCheckerDisplay(checker, {short: true});\n const stringType = typeof type !== 'object' ? type : stringify(type);\n return new Error(`Required ${t(name)} not specified${tLocation}. Must be ${t(stringType)}`);\n } else {\n return checker(val, name, location, obj);\n }\n };\n copyProps(checker, requiredChecker);\n requiredChecker.originalChecker = checker;\n return requiredChecker;\n}\n\nfunction addOptional(checker, disabled) {\n const optionalCheck = disabled ? getNoop() : function optionalCheck(val, name, location, obj) {\n if (!undef(val)) {\n return checker(val, name, location, obj);\n }\n };\n // inherit all properties on the original checker\n copyProps(checker, optionalCheck);\n\n optionalCheck.isOptional = true;\n optionalCheck.displayName = checker.displayName + ' (optional)';\n optionalCheck.originalChecker = checker;\n\n\n // the magic line that allows you to add .optional to the end of the checkers\n checker.optional = optionalCheck;\n\n fixType(checker, checker.optional);\n}\n\nfunction addNullable(checker, disabled) {\n const nullableCheck = disabled ? getNoop() : function nullableCheck(val, name, location, obj) {\n if (val !== null) {\n return checker(val, name, location, obj);\n }\n };\n // inherit all properties on the original checker\n copyProps(checker, nullableCheck);\n\n nullableCheck.isNullable = true;\n nullableCheck.displayName = checker.displayName + ' (nullable)';\n nullableCheck.originalChecker = checker;\n\n // the magic line that allows you to add .nullable to the end of the checkers\n checker.nullable = nullableCheck;\n\n fixType(checker, checker.nullable);\n if (!checker.notOptional) {\n addOptional(checker.nullable, disabled);\n }\n}\n\nfunction fixType(checker, checkerCopy) {\n // fix type, because it's not a straight copy...\n // the reason is we need to specify type.__apiCheckData.optional as true for the terse/verbose option.\n // we also want to add \"(optional)\" to the types with a string\n if (typeof checkerCopy.type === 'object') {\n checkerCopy.type = copy(checkerCopy.type); // make our own copy of this\n } else if (typeof checkerCopy.type === 'function') {\n checkerCopy.type = function() {\n return checker.type(...arguments);\n };\n } else {\n checkerCopy.type += ' (optional)';\n return;\n }\n checkerCopy.type.__apiCheckData = copy(checker.type.__apiCheckData) || {}; // and this\n checkerCopy.type.__apiCheckData.optional = true;\n}\n\n\n// UTILS\n\nfunction copyProps(src, dest) {\n each(Object.keys(src), key => dest[key] = src[key]);\n}\n\nfunction noop() {\n}\n\nfunction getNoop() {\n /* eslint no-shadow:0 */\n /* istanbul ignore next */\n return function noop() {\n };\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ../~/eslint-loader!./api-check-util.js\n **/","const stringify = require('json-stringify-safe');\nconst apiCheckUtil = require('./api-check-util');\nconst {each, isError, t, arrayify, getCheckerDisplay, typeOf, getError} = apiCheckUtil;\nconst checkers = require('./checkers');\nconst apiCheckApis = getApiCheckApis();\n\nmodule.exports = getApiCheckInstance;\nmodule.exports.VERSION = VERSION;\nmodule.exports.utils = apiCheckUtil;\nmodule.exports.globalConfig = {\n verbose: false,\n disabled: false\n};\n\nconst apiCheckApiCheck = getApiCheckInstance({\n output: {prefix: 'apiCheck'}\n});\nmodule.exports.internalChecker = apiCheckApiCheck;\n\n\neach(checkers, (checker, name) => module.exports[name] = checker);\n\nfunction getApiCheckInstance(config = {}, extraCheckers = {}) {\n /* eslint complexity:[2, 6] */\n if (apiCheckApiCheck && arguments.length) {\n apiCheckApiCheck.throw(apiCheckApis.getApiCheckInstanceCheckers, arguments, {\n prefix: 'creating an apiCheck instance'\n });\n }\n\n const additionalProperties = {\n throw: getApiCheck(true),\n warn: getApiCheck(false),\n getErrorMessage,\n handleErrorMessage,\n config: {\n output: config.output || {\n prefix: '',\n suffix: '',\n docsBaseUrl: ''\n },\n verbose: config.verbose || false,\n disabled: config.disabled || false\n },\n utils: apiCheckUtil\n };\n\n each(additionalProperties, (wrapper, name) => apiCheck[name] = wrapper);\n\n const disabled = apiCheck.disabled || module.exports.globalConfig.disabled;\n each(checkers.getCheckers(disabled), (checker, name) => apiCheck[name] = checker);\n each(extraCheckers, (checker, name) => apiCheck[name] = checker);\n\n return apiCheck;\n\n\n /**\n * This is the instance function. Other things are attached to this see additional properties above.\n * @param {Array} api - the checkers to check with\n * @param {Array} args - the args to check\n * @param {Object} output - output options\n * @returns {Object} - if this has a failed = true property, then it failed\n */\n function apiCheck(api, args, output) {\n /* eslint complexity:[2, 8] */\n if (apiCheck.config.disabled || module.exports.globalConfig.disabled) {\n return {\n apiTypes: {}, argTypes: {},\n passed: true, message: '',\n failed: false\n }; // empty version of what is normally returned\n }\n checkApiCheckApi(arguments);\n if (!Array.isArray(api)) {\n api = [api];\n args = [args];\n } else {\n // turn arguments into an array\n args = Array.prototype.slice.call(args);\n }\n let messages = checkEnoughArgs(api, args);\n if (!messages.length) {\n // this is where we actually go perform the checks.\n messages = checkApiWithArgs(api, args);\n }\n\n const returnObject = getTypes(api, args);\n returnObject.args = args;\n if (messages.length) {\n returnObject.message = apiCheck.getErrorMessage(api, args, messages, output);\n returnObject.failed = true;\n returnObject.passed = false;\n } else {\n returnObject.message = '';\n returnObject.failed = false;\n returnObject.passed = true;\n }\n return returnObject;\n }\n\n /**\n * checkApiCheckApi, should be read like: check apiCheck api. As in, check the api for apiCheck :-)\n * @param {Array} checkApiArgs - args provided to apiCheck function\n */\n function checkApiCheckApi(checkApiArgs) {\n const api = checkApiArgs[0];\n const args = checkApiArgs[1];\n const isArrayOrArgs = Array.isArray(args) || (args && typeof args === 'object' && typeof args.length === 'number');\n\n if (Array.isArray(api) && !isArrayOrArgs) {\n throw new Error(getErrorMessage(api, [args],\n ['If an array is provided for the api, an array must be provided for the args as well.'],\n {prefix: 'apiCheck'}\n ));\n }\n // dog fooding here\n const errors = checkApiWithArgs(apiCheckApis.checkApiCheckApi, checkApiArgs);\n if (errors.length) {\n const message = apiCheck.getErrorMessage(apiCheckApis.checkApiCheckApi, checkApiArgs, errors, {\n prefix: 'apiCheck'\n });\n apiCheck.handleErrorMessage(message, true);\n }\n }\n\n\n function getApiCheck(shouldThrow) {\n return function apiCheckWrapper(api, args, output) {\n const result = apiCheck(api, args, output);\n apiCheck.handleErrorMessage(result.message, shouldThrow);\n return result; // wont get here if an error is thrown\n };\n }\n\n function handleErrorMessage(message, shouldThrow) {\n if (shouldThrow && message) {\n throw new Error(message);\n } else if (message) {\n /* eslint no-console:0 */\n console.warn(message);\n }\n }\n\n function getErrorMessage(api, args, messages = [], output = {}) {\n const gOut = apiCheck.config.output || {};\n const prefix = getPrefix();\n const suffix = getSuffix();\n const url = getUrl();\n const message = `apiCheck failed! ${messages.join(', ')}`;\n const passedAndShouldHavePassed = '\\n\\n' + buildMessageFromApiAndArgs(api, args);\n return `${prefix} ${message} ${suffix} ${url || ''}${passedAndShouldHavePassed}`.trim();\n\n function getPrefix() {\n let p = output.onlyPrefix;\n if (!p) {\n p = `${gOut.prefix || ''} ${output.prefix || ''}`.trim();\n }\n return p;\n }\n\n function getSuffix() {\n let s = output.onlySuffix;\n if (!s) {\n s = `${output.suffix || ''} ${gOut.suffix || ''}`.trim();\n }\n return s;\n }\n\n function getUrl() {\n let u = output.url;\n if (!u) {\n u = gOut.docsBaseUrl && output.urlSuffix && `${gOut.docsBaseUrl}${output.urlSuffix}`.trim();\n }\n return u;\n }\n }\n\n function buildMessageFromApiAndArgs(api, args) {\n let {apiTypes, argTypes} = getTypes(api, args);\n const copy = Array.prototype.slice.call(args || []);\n const replacedItems = [];\n replaceFunctionWithName(copy);\n const passedArgs = getObjectString(copy);\n argTypes = getObjectString(argTypes);\n apiTypes = getObjectString(apiTypes);\n\n return generateMessage();\n\n\n // functions\n\n function replaceFunctionWithName(obj) {\n each(obj, (val, name) => {\n /* eslint complexity:[2, 6] */\n if (replacedItems.indexOf(val) === -1) { // avoid recursive problems\n replacedItems.push(val);\n if (typeof val === 'object') {\n replaceFunctionWithName(obj);\n } else if (typeof val === 'function') {\n obj[name] = val.displayName || val.name || 'anonymous function';\n }\n }\n });\n }\n\n function getObjectString(types) {\n if (!types || !types.length) {\n return 'nothing';\n } else if (types && types.length === 1) {\n types = types[0];\n }\n return stringify(types, null, 2);\n }\n\n function generateMessage() {\n const n = '\\n';\n let useS = true;\n if (args && args.length === 1) {\n if (typeof args[0] === 'object' && args[0] !== null) {\n useS = !!Object.keys(args[0]).length;\n } else {\n useS = false;\n }\n }\n const types = `type${useS ? 's' : ''}`;\n const newLine = n + n;\n return `You passed:${n}${passedArgs}${newLine}` +\n `With the ${types}:${n}${argTypes}${newLine}` +\n `The API calls for:${n}${apiTypes}`;\n }\n }\n\n function getTypes(api, args) {\n api = arrayify(api);\n args = arrayify(args);\n const apiTypes = api.map((checker, index) => {\n const specified = module.exports.globalConfig.hasOwnProperty('verbose');\n return getCheckerDisplay(checker, {\n terse: specified ? !module.exports.globalConfig.verbose : !apiCheck.config.verbose,\n obj: args[index],\n addHelpers: true\n });\n });\n const argTypes = args.map((arg) => getArgDisplay(arg, []));\n return {argTypes, apiTypes};\n }\n\n}\n\n\n// STATELESS FUNCTIONS\n\n/**\n * This is where the magic happens for actually checking the arguments with the api.\n * @param {Array} api - checkers\n * @param {Array} args - and arguments object\n * @returns {Array} - the error messages\n */\nfunction checkApiWithArgs(api, args) {\n /* eslint complexity:[2, 7] */\n const messages = [];\n let failed = false;\n let checkerIndex = 0;\n let argIndex = 0;\n let arg, checker, res, lastChecker, argName, argFailed, skipPreviousChecker;\n /* jshint -W084 */\n while ((checker = api[checkerIndex++]) && (argIndex < args.length)) {\n arg = args[argIndex++];\n argName = 'Argument ' + argIndex + (checker.isOptional ? ' (optional)' : '');\n res = checker(arg, 'value', argName);\n argFailed = isError(res);\n lastChecker = checkerIndex >= api.length;\n skipPreviousChecker = checkerIndex > 1 && api[checkerIndex - 1].isOptional;\n if ((argFailed && lastChecker) || (argFailed && !lastChecker && !checker.isOptional && !skipPreviousChecker)) {\n failed = true;\n messages.push(getCheckerErrorMessage(res, checker, arg));\n } else if (argFailed && checker.isOptional) {\n argIndex--;\n } else {\n messages.push(`${t(argName)} passed`);\n }\n }\n return failed ? messages : [];\n}\n\n\ncheckerTypeType.type = 'function with __apiCheckData property and `${function.type}` property';\nfunction checkerTypeType(checkerType, name, location) {\n const apiCheckDataChecker = checkers.shape({\n type: checkers.string,\n optional: checkers.bool\n });\n const asFunc = checkers.func.withProperties({__apiCheckData: apiCheckDataChecker});\n const asShape = checkers.shape({__apiCheckData: apiCheckDataChecker});\n const wrongShape = checkers.oneOfType([\n asFunc, asShape\n ])(checkerType, name, location);\n if (isError(wrongShape)) {\n return wrongShape;\n }\n if (typeof checkerType !== 'function' && !checkerType.hasOwnProperty(checkerType.__apiCheckData.type)) {\n return getError(name, location, checkerTypeType.type);\n }\n}\n\nfunction getCheckerErrorMessage(res, checker, val) {\n let checkerHelp = getCheckerHelp(checker, val);\n checkerHelp = checkerHelp ? ' - ' + checkerHelp : '';\n return res.message + checkerHelp;\n}\n\nfunction getCheckerHelp({help}, val) {\n if (!help) {\n return '';\n }\n if (typeof help === 'function') {\n help = help(val);\n }\n return help;\n}\n\n\nfunction checkEnoughArgs(api, args) {\n const requiredArgs = api.filter(a => !a.isOptional);\n if (args.length < requiredArgs.length) {\n return [\n 'Not enough arguments specified. Requires `' + requiredArgs.length + '`, you passed `' + args.length + '`'\n ];\n } else {\n return [];\n }\n}\n\nfunction getArgDisplay(arg, gottenArgs) {\n /* eslint complexity:[2, 7] */\n const cName = arg && arg.constructor && arg.constructor.name;\n const type = typeOf(arg);\n if (type === 'function') {\n if (hasKeys()) {\n const properties = stringify(getDisplayIfNotGotten());\n return cName + ' (with properties: ' + properties + ')';\n }\n return cName;\n }\n\n if (arg === null) {\n return 'null';\n }\n\n if (type !== 'array' && type !== 'object') {\n return type;\n }\n\n if (hasKeys()) {\n return getDisplayIfNotGotten();\n }\n\n return cName;\n\n // utility functions\n function hasKeys() {\n return arg && Object.keys(arg).length;\n }\n\n function getDisplayIfNotGotten() {\n if (gottenArgs.indexOf(arg) !== -1) {\n return '[Circular]';\n }\n gottenArgs.push(arg);\n return getDisplay(arg, gottenArgs);\n }\n}\n\nfunction getDisplay(obj, gottenArgs) {\n const argDisplay = {};\n each(obj, (v, k) => argDisplay[k] = getArgDisplay(v, gottenArgs));\n return argDisplay;\n}\n\nfunction getApiCheckApis() {\n const os = checkers.string.optional;\n\n const checkerFnChecker = checkers.func.withProperties({\n type: checkers.oneOfType([checkers.string, checkerTypeType]).optional,\n displayName: checkers.string.optional,\n shortType: checkers.string.optional,\n notOptional: checkers.bool.optional,\n notRequired: checkers.bool.optional\n });\n\n const getApiCheckInstanceCheckers = [\n checkers.shape({\n output: checkers.shape({\n prefix: checkers.string.optional,\n suffix: checkers.string.optional,\n docsBaseUrl: checkers.string.optional\n }).strict.optional,\n verbose: checkers.bool.optional,\n disabled: checkers.bool.optional\n }).strict.optional,\n checkers.objectOf(checkerFnChecker).optional\n ];\n\n const checkApiCheckApi = [\n checkers.typeOrArrayOf(checkerFnChecker),\n checkers.any.optional,\n checkers.shape({\n prefix: os, suffix: os, urlSuffix: os, // appended case\n onlyPrefix: os, onlySuffix: os, url: os // override case\n }).strict.optional\n ];\n\n return {\n checkerFnChecker,\n getApiCheckInstanceCheckers,\n checkApiCheckApi\n };\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ../~/eslint-loader!./api-check.js\n **/","const stringify = require('json-stringify-safe');\nconst {\n typeOf, each, copy, getCheckerDisplay, isError,\n arrayify, list, getError, nAtL, t, checkerHelpers,\n undef\n } = require('./api-check-util');\nconst {setupChecker} = checkerHelpers;\n\nconst checkers = module.exports = getCheckers();\nmodule.exports.getCheckers = getCheckers;\n\nfunction getCheckers(disabled) {\n return {\n array: typeOfCheckGetter('Array'),\n bool: typeOfCheckGetter('Boolean'),\n number: typeOfCheckGetter('Number'),\n string: typeOfCheckGetter('String'),\n func: funcCheckGetter(),\n object: objectCheckGetter(),\n\n emptyObject: emptyObjectCheckGetter(),\n\n instanceOf: instanceCheckGetter,\n oneOf: oneOfCheckGetter,\n oneOfType: oneOfTypeCheckGetter,\n\n arrayOf: arrayOfCheckGetter,\n objectOf: objectOfCheckGetter,\n typeOrArrayOf: typeOrArrayOfCheckGetter,\n\n range: rangeCheckGetter,\n lessThan: lessThanCheckGetter,\n greaterThan: greaterThanCheckGetter,\n\n shape: getShapeCheckGetter(),\n args: argumentsCheckerGetter(),\n\n any: anyCheckGetter(),\n null: nullCheckGetter()\n\n };\n\n function typeOfCheckGetter(type) {\n const lType = type.toLowerCase();\n return setupChecker(function typeOfCheckerDefinition(val, name, location) {\n if (typeOf(val) !== lType) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function funcCheckGetter() {\n const type = 'Function';\n const functionChecker = setupChecker(function functionCheckerDefinition(val, name, location) {\n if (typeOf(val) !== 'function') {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n\n functionChecker.withProperties = function getWithPropertiesChecker(properties) {\n const apiError = checkers.objectOf(checkers.func)(properties, 'properties', 'apiCheck.func.withProperties');\n if (isError(apiError)) {\n throw apiError;\n }\n const shapeChecker = checkers.shape(properties, true);\n shapeChecker.type.__apiCheckData.type = 'func.withProperties';\n\n return setupChecker(function functionWithPropertiesChecker(val, name, location) {\n const notFunction = checkers.func(val, name, location);\n if (isError(notFunction)) {\n return notFunction;\n }\n return shapeChecker(val, name, location);\n }, {type: shapeChecker.type, shortType: 'func.withProperties'}, disabled);\n };\n return functionChecker;\n }\n\n function objectCheckGetter() {\n const type = 'Object';\n const nullType = 'Object (null ok)';\n const objectNullOkChecker = setupChecker(function objectNullOkCheckerDefinition(val, name, location) {\n if (typeOf(val) !== 'object') {\n return getError(name, location, nullType);\n }\n }, {type: nullType}, disabled);\n\n const objectChecker = setupChecker(function objectCheckerDefinition(val, name, location) {\n if (val === null || isError(objectNullOkChecker(val, name, location))) {\n return getError(name, location, objectChecker.type);\n }\n }, {type, nullOk: objectNullOkChecker}, disabled);\n\n return objectChecker;\n }\n\n\n function instanceCheckGetter(classToCheck) {\n return setupChecker(function instanceCheckerDefinition(val, name, location) {\n if (!(val instanceof classToCheck)) {\n return getError(name, location, classToCheck.name);\n }\n }, {type: classToCheck.name}, disabled);\n }\n\n function oneOfCheckGetter(enums) {\n const type = {\n __apiCheckData: {optional: false, type: 'enum'},\n enum: enums\n };\n const shortType = `oneOf[${enums.map(enm => stringify(enm)).join(', ')}]`;\n return setupChecker(function oneOfCheckerDefinition(val, name, location) {\n if (!enums.some(enm => enm === val)) {\n return getError(name, location, shortType);\n }\n }, {type, shortType}, disabled);\n }\n\n function oneOfTypeCheckGetter(typeCheckers) {\n const checkersDisplay = typeCheckers.map((checker) => getCheckerDisplay(checker, {short: true}));\n const shortType = `oneOfType[${checkersDisplay.join(', ')}]`;\n function type(options) {\n if (options && options.short) {\n return shortType;\n }\n return typeCheckers.map((checker) => getCheckerDisplay(checker, options));\n }\n type.__apiCheckData = {optional: false, type: 'oneOfType'};\n return setupChecker(function oneOfTypeCheckerDefinition(val, name, location) {\n if (!typeCheckers.some(checker => !isError(checker(val, name, location)))) {\n return getError(name, location, shortType);\n }\n }, {type, shortType}, disabled);\n }\n\n function arrayOfCheckGetter(checker) {\n const shortCheckerDisplay = getCheckerDisplay(checker, {short: true});\n const shortType = `arrayOf[${shortCheckerDisplay}]`;\n\n function type(options) {\n if (options && options.short) {\n return shortType;\n }\n return getCheckerDisplay(checker, options);\n }\n type.__apiCheckData = {optional: false, type: 'arrayOf'};\n\n return setupChecker(function arrayOfCheckerDefinition(val, name, location) {\n if (isError(checkers.array(val)) || !val.every((item) => !isError(checker(item)))) {\n return getError(name, location, shortType);\n }\n }, {type, shortType}, disabled);\n }\n\n function objectOfCheckGetter(checker) {\n const checkerDisplay = getCheckerDisplay(checker, {short: true});\n const shortType = `objectOf[${checkerDisplay}]`;\n\n function type(options) {\n if (options && options.short) {\n return shortType;\n }\n return getCheckerDisplay(checker, options);\n }\n type.__apiCheckData = {optional: false, type: 'objectOf'};\n\n return setupChecker(function objectOfCheckerDefinition(val, name, location) {\n const notObject = checkers.object(val, name, location);\n if (isError(notObject)) {\n return notObject;\n }\n const allTypesSuccess = each(val, (item, key) => {\n if (isError(checker(item, key, name))) {\n return false;\n }\n });\n if (!allTypesSuccess) {\n return getError(name, location, shortType);\n }\n }, {type, shortType}, disabled);\n }\n\n function typeOrArrayOfCheckGetter(checker) {\n const checkerDisplay = getCheckerDisplay(checker, {short: true});\n const shortType = `typeOrArrayOf[${checkerDisplay}]`;\n\n function type(options) {\n if (options && options.short) {\n return shortType;\n }\n return getCheckerDisplay(checker, options);\n }\n\n type.__apiCheckData = {optional: false, type: 'typeOrArrayOf'};\n return setupChecker(function typeOrArrayOfDefinition(val, name, location, obj) {\n if (isError(checkers.oneOfType([checker, checkers.arrayOf(checker)])(val, name, location, obj))) {\n return getError(name, location, shortType);\n }\n }, {type, shortType}, disabled);\n }\n\n function getShapeCheckGetter() {\n function shapeCheckGetter(shape, nonObject) {\n const shapeTypes = {};\n each(shape, (checker, prop) => {\n shapeTypes[prop] = getCheckerDisplay(checker);\n });\n function type(options = {}) {\n const ret = {};\n const {terse, obj, addHelpers} = options;\n const parentRequired = options.required;\n each(shape, (checker, prop) => {\n /* eslint complexity:[2, 6] */\n const specified = obj && obj.hasOwnProperty(prop);\n const required = undef(parentRequired) ? !checker.isOptional : parentRequired;\n if (!terse || (specified || !checker.isOptional)) {\n ret[prop] = getCheckerDisplay(checker, {terse, obj: obj && obj[prop], required, addHelpers});\n }\n if (addHelpers) {\n modifyTypeDisplayToHelpOut(ret, prop, specified, checker, required);\n }\n });\n return ret;\n\n function modifyTypeDisplayToHelpOut(theRet, prop, specified, checker, required) {\n if (!specified && required && !checker.isOptional) {\n let item = 'ITEM';\n if (checker.type && checker.type.__apiCheckData) {\n item = checker.type.__apiCheckData.type.toUpperCase();\n }\n addHelper('missing', `MISSING THIS ${item}`, ' <-- YOU ARE MISSING THIS');\n } else if (specified) {\n const error = checker(obj[prop], prop, null, obj);\n if (isError(error)) {\n addHelper('error', `THIS IS THE PROBLEM: ${error.message}`, ` <-- THIS IS THE PROBLEM: ${error.message}`);\n }\n }\n\n function addHelper(property, objectMessage, stringMessage) {\n if (typeof theRet[prop] === 'string') {\n theRet[prop] += stringMessage;\n } else {\n theRet[prop].__apiCheckData[property] = objectMessage;\n }\n }\n }\n }\n\n type.__apiCheckData = {strict: false, optional: false, type: 'shape'};\n const shapeChecker = setupChecker(function shapeCheckerDefinition(val, name, location) {\n /* eslint complexity:[2, 6] */\n const isObject = !nonObject && checkers.object(val, name, location);\n if (isError(isObject)) {\n return isObject;\n }\n let shapePropError;\n location = location ? location + (name ? '/' : '') : '';\n name = name || '';\n each(shape, (checker, prop) => {\n if (val.hasOwnProperty(prop) || !checker.isOptional) {\n shapePropError = checker(val[prop], prop, `${location}${name}`, val);\n return !isError(shapePropError);\n }\n });\n if (isError(shapePropError)) {\n return shapePropError;\n }\n }, {type, shortType: 'shape'}, disabled);\n\n function strictType() {\n return type(...arguments);\n }\n\n strictType.__apiCheckData = copy(shapeChecker.type.__apiCheckData);\n strictType.__apiCheckData.strict = true;\n shapeChecker.strict = setupChecker(function strictShapeCheckerDefinition(val, name, location) {\n const shapeError = shapeChecker(val, name, location);\n if (isError(shapeError)) {\n return shapeError;\n }\n const allowedProperties = Object.keys(shape);\n const extraProps = Object.keys(val).filter(prop => allowedProperties.indexOf(prop) === -1);\n if (extraProps.length) {\n return new Error(\n `${nAtL(name, location)} cannot have extra properties: ${t(extraProps.join('`, `'))}.` +\n `It is limited to ${t(allowedProperties.join('`, `'))}`\n );\n }\n }, {type: strictType, shortType: 'strict shape'}, disabled);\n\n return shapeChecker;\n }\n\n shapeCheckGetter.ifNot = function ifNot(otherProps, propChecker) {\n if (!Array.isArray(otherProps)) {\n otherProps = [otherProps];\n }\n let description;\n if (otherProps.length === 1) {\n description = `specified only if ${otherProps[0]} is not specified`;\n } else {\n description = `specified only if none of the following are specified: [${list(otherProps, ', ', 'and ')}]`;\n }\n const shortType = `ifNot[${otherProps.join(', ')}]`;\n const type = getTypeForShapeChild(propChecker, description, shortType);\n return setupChecker(function ifNotChecker(prop, propName, location, obj) {\n const propExists = obj && obj.hasOwnProperty(propName);\n const otherPropsExist = otherProps.some(otherProp => obj && obj.hasOwnProperty(otherProp));\n if (propExists === otherPropsExist) {\n return getError(propName, location, type);\n } else if (propExists) {\n return propChecker(prop, propName, location, obj);\n }\n }, {notRequired: true, type, shortType}, disabled);\n };\n\n shapeCheckGetter.onlyIf = function onlyIf(otherProps, propChecker) {\n otherProps = arrayify(otherProps);\n let description;\n if (otherProps.length === 1) {\n description = `specified only if ${otherProps[0]} is also specified`;\n } else {\n description = `specified only if all of the following are specified: [${list(otherProps, ', ', 'and ')}]`;\n }\n const shortType = `onlyIf[${otherProps.join(', ')}]`;\n const type = getTypeForShapeChild(propChecker, description, shortType);\n return setupChecker(function onlyIfCheckerDefinition(prop, propName, location, obj) {\n const othersPresent = otherProps.every(property => obj.hasOwnProperty(property));\n if (!othersPresent) {\n return getError(propName, location, type);\n } else {\n return propChecker(prop, propName, location, obj);\n }\n }, {type, shortType}, disabled);\n };\n\n shapeCheckGetter.requiredIfNot = function shapeRequiredIfNot(otherProps, propChecker) {\n if (!Array.isArray(otherProps)) {\n otherProps = [otherProps];\n }\n return getRequiredIfNotChecker(false, otherProps, propChecker);\n };\n\n shapeCheckGetter.requiredIfNot.all = function shapeRequiredIfNotAll(otherProps, propChecker) {\n if (!Array.isArray(otherProps)) {\n throw new Error('requiredIfNot.all must be passed an array');\n }\n return getRequiredIfNotChecker(true, otherProps, propChecker);\n };\n\n function getRequiredIfNotChecker(all, otherProps, propChecker) {\n const props = t(otherProps.join(', '));\n const ifProps = `if ${all ? 'all of' : 'at least one of'}`;\n const description = `specified ${ifProps} these are not specified: ${props} (otherwise it's optional)`;\n const shortType = `requiredIfNot${all ? '.all' : ''}[${otherProps.join(', ')}}]`;\n const type = getTypeForShapeChild(propChecker, description, shortType);\n return setupChecker(function shapeRequiredIfNotDefinition(prop, propName, location, obj) {\n const propExists = obj && obj.hasOwnProperty(propName);\n const iteration = all ? 'every' : 'some';\n const otherPropsExist = otherProps[iteration](function(otherProp) {\n return obj && obj.hasOwnProperty(otherProp);\n });\n if (!otherPropsExist && !propExists) {\n return getError(propName, location, type);\n } else if (propExists) {\n return propChecker(prop, propName, location, obj);\n }\n }, {type, notRequired: true}, disabled);\n }\n\n return shapeCheckGetter;\n\n function getTypeForShapeChild(propChecker, description, shortType) {\n function type(options) {\n if (options && options.short) {\n return shortType;\n }\n return getCheckerDisplay(propChecker);\n }\n type.__apiCheckData = {optional: false, type: 'ifNot', description};\n return type;\n }\n }\n\n function argumentsCheckerGetter() {\n const type = 'function arguments';\n return setupChecker(function argsCheckerDefinition(val, name, location) {\n if (Array.isArray(val) || isError(checkers.object(val)) || isError(checkers.number(val.length))) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function anyCheckGetter() {\n return setupChecker(function anyCheckerDefinition() {\n // don't do anything\n }, {type: 'any'}, disabled);\n }\n\n function nullCheckGetter() {\n const type = 'null';\n return setupChecker(function nullChecker(val, name, location) {\n if (val !== null) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function rangeCheckGetter(min, max) {\n const type = `Range (${min} - ${max})`;\n return setupChecker(function rangeChecker(val, name, location) {\n if (typeof val !== 'number' || val < min || val > max) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function lessThanCheckGetter(min) {\n const type = `lessThan[${min}]`;\n return setupChecker(function lessThanChecker(val, name, location) {\n if (typeof val !== 'number' || val > min) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function greaterThanCheckGetter(max) {\n const type = `greaterThan[${max}]`;\n return setupChecker(function greaterThanChecker(val, name, location) {\n if (typeof val !== 'number' || val < max) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n function emptyObjectCheckGetter() {\n const type = 'empty object';\n return setupChecker(function emptyObjectChecker(val, name, location) {\n if (typeOf(val) !== 'object' || val === null || Object.keys(val).length) {\n return getError(name, location, type);\n }\n }, {type}, disabled);\n }\n\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ../~/eslint-loader!./checkers.js\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index 9b79252..dea1162 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "api-check", - "version": "0.0.0-semantically-released.0", + "version": "7.5.4", "description": "Validate the api to your functions to help people use them correctly. This is pretty much React's propTypes without React.", "main": "dist/api-check.js", "dependencies": {}, @@ -93,4 +93,4 @@ } } } -} +} \ No newline at end of file