diff --git a/.eslintrc b/.eslintrc index 0f14365..feda170 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,3 +1,7 @@ { - "extends": "./node_modules/kcd-common-tools/shared/.eslintrc" + // this exists solely for editors. The test and app eslints are slightly different + // and the app validates the app code via the other/app.eslintrc and validates the + // test code via the other/test.eslintrc + // we simply use the test.eslintrc so our editors don't get mad at us. + "extends": "./other/test.eslintrc" } diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d3b59e6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +sudo: false +language: node_js +cache: + directories: + - node_modules +branches: + only: + - master +notifications: + email: false +node_js: + - iojs +before_install: + - npm i -g npm@^2.0.0 +before_script: + - npm prune +script: + - npm run code-checks + - npm t + - npm run check-coverage +after_success: + - npm run report-coverage + - npm run semantic-release diff --git a/dist/api-check.js b/dist/api-check.js index c32612e..4dc1774 100644 --- a/dist/api-check.js +++ b/dist/api-check.js @@ -1,4 +1,4 @@ -//! api-check version 7.5.0 built with ♥ by Kent C. Dodds (http://kent.doddsfamily.us) (ó ì_í)=óò=(ì_í ò) +//! 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') @@ -91,7 +91,7 @@ return /******/ (function(modules) { // webpackBootstrap var apiCheckApis = getApiCheckApis(); module.exports = getApiCheckInstance; - module.exports.VERSION = ("7.5.0"); + module.exports.VERSION = ("0.0.0-semantically-released.0"); module.exports.utils = apiCheckUtil; module.exports.globalConfig = { verbose: false, @@ -151,9 +151,9 @@ return /******/ (function(modules) { // webpackBootstrap /** * This is the instance function. Other things are attached to this see additional properties above. - * @param api {Array} - * @param args {arguments} - * @param output {Object} + * @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) { @@ -195,7 +195,7 @@ return /******/ (function(modules) { // webpackBootstrap /** * checkApiCheckApi, should be read like: check apiCheck api. As in, check the api for apiCheck :-) - * @param checkApiArgs + * @param {Array} checkApiArgs - args provided to apiCheck function */ function checkApiCheckApi(checkApiArgs) { var api = checkApiArgs[0]; @@ -348,9 +348,9 @@ return /******/ (function(modules) { // webpackBootstrap /** * This is where the magic happens for actually checking the arguments with the api. - * @param api {Array} - checkers - * @param args {Array} - and arguments object - * @returns {Array} + * @param {Array} api - checkers + * @param {Array} args - and arguments object + * @returns {Array} - the error messages */ function checkApiWithArgs(api, args) { /* eslint complexity:[2, 7] */ @@ -641,15 +641,16 @@ return /******/ (function(modules) { // webpackBootstrap function each(obj, iterator, context) { if (Array.isArray(obj)) { - return eachArry.apply(undefined, arguments); + return eachArry(obj, iterator, context); } else { - return eachObj.apply(undefined, arguments); + return eachObj(obj, iterator, context); } } function eachObj(obj, iterator, context) { - var ret; + 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); @@ -662,7 +663,7 @@ return /******/ (function(modules) { // webpackBootstrap } function eachArry(obj, iterator, context) { - var ret; + var ret = undefined; var length = obj.length; for (var i = 0; i < length; i++) { ret = iterator.call(context, obj[i], i, obj); @@ -712,9 +713,11 @@ return /******/ (function(modules) { // webpackBootstrap /** * This will set up the checker with all of the defaults that most checkers want like required by default and an * optional version - * @param checker - * @param properties properties to add to the checker - * @param disabled - when set to true, this will set the checker to a no-op function + * + * @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] */ diff --git a/dist/api-check.min.js b/dist/api-check.min.js index cb962d2..df18585 100644 --- a/dist/api-check.min.js +++ b/dist/api-check.min.js @@ -1,3 +1,3 @@ -//! api-check version 7.5.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.apply(void 0,arguments):c.apply(void 0,arguments)}function c(e,r,t){var n,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,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=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 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}])}); +//! 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 index f202208..81cdfe2 100644 --- a/dist/api-check.min.js.map +++ b/dist/api-check.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///dist/api-check.min.js","webpack:///webpack/bootstrap 1e103014b7534be69cbc","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","apply","arguments","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","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,QAA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C4O,EAAD5O,EAAG+B,EAAc6M,EAAd7M,eACnC3B,EAAKwO,EAALxO,MAEKC,EAAgB0B,EAAhB1B,aAEHiG,EAAWjM,EAAOD,QAAUmM,GAChClM,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.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.apply(undefined, arguments);\n\t } else {\n\t return eachObj.apply(undefined, arguments);\n\t }\n\t}\n\t\n\tfunction eachObj(obj, iterator, context) {\n\t var ret;\n\t var hasOwn = Object.prototype.hasOwnProperty;\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;\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 * @param checker\n\t * @param properties properties to add to the checker\n\t * @param disabled - when set to true, this will set the checker to a no-op function\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.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 api {Array}\n\t * @param args {arguments}\n\t * @param output {Object}\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 checkApiArgs\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 api {Array} - checkers\n\t * @param args {Array} - and arguments object\n\t * @returns {Array}\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 1e103014b7534be69cbc\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 let 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 let 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 let __apiCheckData = type.__apiCheckData;\n let 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(...arguments);\n } else {\n return eachObj(...arguments);\n }\n}\n\nfunction eachObj(obj, iterator, context) {\n var ret;\n var hasOwn = Object.prototype.hasOwnProperty;\n for (var 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 var ret;\n var length = obj.length;\n for (var 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 let copy = arry.slice();\n let 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 * @param checker\n * @param properties properties to add to the checker\n * @param disabled - when set to true, this will set the checker to a no-op function\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 var 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 var 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 var 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 let 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 api {Array}\n * @param args {arguments}\n * @param output {Object}\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 let 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 checkApiArgs\n */\n function checkApiCheckApi(checkApiArgs) {\n const api = checkApiArgs[0];\n const args = checkApiArgs[1];\n var 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 let 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 let gOut = apiCheck.config.output || {};\n let prefix = getPrefix();\n let suffix = getSuffix();\n let url = getUrl();\n let message = `apiCheck failed! ${messages.join(', ')}`;\n var 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 let copy = Array.prototype.slice.call(args || []);\n let 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 let 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 let argTypes = args.map((arg) => getArgDisplay(arg, []));\n return {argTypes: 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 api {Array} - checkers\n * @param args {Array} - and arguments object\n * @returns {Array}\n */\nfunction checkApiWithArgs(api, args) {\n /* eslint complexity:[2, 7] */\n let 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 let 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 let 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 var 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\nlet 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 let 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 let 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 let 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 let 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 let shapeTypes = {};\n each(shape, (checker, prop) => {\n shapeTypes[prop] = getCheckerDisplay(checker);\n });\n function type(options = {}) {\n let 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 let 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 let shapeChecker = setupChecker(function shapeCheckerDefinition(val, name, location) {\n /* eslint complexity:[2, 6] */\n let 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 let propExists = obj && obj.hasOwnProperty(propName);\n let 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 +{"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,gB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,QAAOmD,GA7ab,OACEuK,MAAOzB,EAAkB,SACzB/B,KAAM+B,EAAkB,WACxByE,OAAQzE,EAAkB,UAC1BhC,OAAQgC,EAAkB,UAC1B7B,KAAMgC,IACN4B,OAAQvB,IAER0E,YAAaD,IAEbE,WAAYtE,EACZuE,MAAOrE,EACPxC,UAAW6C,EAEXc,QAASX,EACT5B,SAAUiC,EACVhC,cAAeqC,EAEfoD,MAAOT,EACPU,SAAUP,EACVQ,YAAaP,EAEbjH,MAAOoE,IACPnJ,KAAMwL,IAEN3E,IAAK6E,IACLc,OAAMb,KAtCV,GAAMpR,GAAYhC,EAAQ,GNw1BrBkU,EMn1BClU,EAAQ,GAHZyC,EAAMyR,EAANzR,OAAQG,EAAIsR,EAAJtR,KAAML,EAAI2R,EAAJ3R,KAAMU,EAAiBiR,EAAjBjR,kBAAmBsB,EAAO2P,EAAP3P,QACvCV,EAAQqQ,EAARrQ,SAAUY,EAAIyP,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 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 diff --git a/other/common.eslintrc b/other/common.eslintrc new file mode 100644 index 0000000..0f4381d --- /dev/null +++ b/other/common.eslintrc @@ -0,0 +1,17 @@ +{ + "rules": { + "func-names": 0, // I wish, but doing this right now would be a royal pain + "new-cap": [ + 2, + { + "newIsCap": true, + "capIsNew": true + } + ], + "max-params": [2, 10], + "max-statements": [2, 30], // TODO bring this down + }, + "globals": { + "VERSION": false + } +} diff --git a/other/src.eslintrc b/other/src.eslintrc new file mode 100644 index 0000000..4eee092 --- /dev/null +++ b/other/src.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": ["kentcdodds", "./common.eslintrc"] +} diff --git a/other/test.eslintrc b/other/test.eslintrc new file mode 100644 index 0000000..512fbfe --- /dev/null +++ b/other/test.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": ["kentcdodds/test", "./common.eslintrc"], +} diff --git a/package.json b/package.json index b014fd7..24cfc46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "api-check", - "version": "7.5.0", + "version": "0.0.0-semantically-released.0", "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": {}, @@ -9,11 +9,15 @@ "babel-core": "5.5.8", "babel-eslint": "3.1.17", "babel-loader": "5.1.4", + "bootstrap": "3.3.5", "chai": "2.1.0", "codecov.io": "0.1.4", - "eslint": "0.23.0", - "eslint-loader": "0.14.0", - "ghooks": "0.2.4", + "commitizen": "1.0.4", + "cz-conventional-changelog": "1.1.0", + "eslint": "1.5.1", + "eslint-config-kentcdodds": "4.0.0", + "eslint-loader": "1.0.0", + "ghooks": "0.3.2", "isparta": "3.0.3", "isparta-loader": "0.2.0", "istanbul": "0.3.5", @@ -29,32 +33,31 @@ "lodash": "3.9.3", "mocha": "2.1.0", "node-libs-browser": "^0.5.2", + "publish-latest": "1.1.0", + "semantic-release": "^4.3.5", "surge": "0.14.2", "uglify-loader": "1.2.0", - "webpack": "1.9.11", - "with-package": "0.2.0" + "validate-commit-msg": "1.0.0", + "webpack": "1.9.11" }, "scripts": { - "start": "npm run test", - "test": "COVERAGE=true NODE_ENV=test karma start", - "test:single": "COVERAGE=true NODE_ENV=test karma start --single-run", + "commit": "git-cz", + "start": "COVERAGE=true NODE_ENV=test karma start", + "test": "COVERAGE=true NODE_ENV=test karma start --single-run", "test:debug": "echo 'WARNING: This is currently not working quite right...' && NODE_ENV=test karma start --browsers Chrome", "build:dist": "NODE_ENV=development webpack --config node_modules/kcd-common-tools/shared/webpack.config.js --progress --colors", "build:prod": "NODE_ENV=production webpack --config node_modules/kcd-common-tools/shared/webpack.config.js --progress --colors", "build": "npm run build:dist & npm run build:prod", - "ci": "npm run code-checks && npm run test:single && npm run check-coverage && npm run build", "check-coverage": "./node_modules/istanbul/lib/cli.js check-coverage --statements 100 --functions 100 --lines 100 --branches 100", "report-coverage": "cat ./coverage/lcov.info | codecov", "deploy": "npm run deployClean && npm run deployCopy && npm run deploySurge", "deploySurge": "surge -p deploy.ignored -d api-check.surge.sh", "deployCopy": "cp index.html deploy.ignored/ && cp dist/api-check.js deploy.ignored/dist/", "deployClean": "rm -rf deploy.ignored/ && mkdir deploy.ignored/ && mkdir deploy.ignored/dist/", - "only-check": "node node_modules/kcd-common-tools/shared/scripts/only-check.js", - "console-check": "node node_modules/kcd-common-tools/shared/scripts/console-check.js", - "code-checks": "npm run only-check && npm run console-check", - "release": "npm run build && with-package git commit -am pkg.version && with-package git tag pkg.version && git push && npm publish && git push --tags", - "release:beta": "npm run release && npm run tag:beta", - "tag:beta": "with-package npm dist-tag add pkg.name@pkg.version beta" + "code-checks": "eslint src/", + "prepublish": "npm run build", + "postpublish": "publish-latest", + "semantic-release": "semantic-release pre && npm publish && semantic-release post" }, "repository": { "type": "git", @@ -75,9 +78,12 @@ "homepage": "https://github.com/kentcdodds/api-check", "config": { "ghooks": { - "pre-commit": "npm run ci" + "pre-commit": "./node_modules/.bin/validate-commit-msg && npm run code-checks && npm t && npm run check-coverage" } }, + "czConfig": { + "path": "node_modules/cz-conventional-changelog" + }, "kcdCommon": { "webpack": { "output": { diff --git a/src/api-check-util.js b/src/api-check-util.js index 2170af5..3844b2f 100644 --- a/src/api-check-util.js +++ b/src/api-check-util.js @@ -10,7 +10,7 @@ module.exports = { }; function copy(obj) { - let type = typeOf(obj); + const type = typeOf(obj); let daCopy; if (type === 'array') { daCopy = []; @@ -39,7 +39,7 @@ function typeOf(obj) { function getCheckerDisplay(checker, options) { /* eslint complexity:[2, 7] */ let display; - let short = options && options.short; + const short = options && options.short; if (short && checker.shortType) { display = checker.shortType; } else if (!short && typeof checker.type === 'object' || checker.type === 'function') { @@ -52,8 +52,8 @@ function getCheckerDisplay(checker, options) { function getCheckerType({type}, options) { if (typeof type === 'function') { - let __apiCheckData = type.__apiCheckData; - let typeTypes = type(options); + const __apiCheckData = type.__apiCheckData; + const typeTypes = type(options); type = { __apiCheckData, [__apiCheckData.type]: typeTypes @@ -75,16 +75,17 @@ function arrayify(obj) { function each(obj, iterator, context) { if (Array.isArray(obj)) { - return eachArry(...arguments); + return eachArry(obj, iterator, context); } else { - return eachObj(...arguments); + return eachObj(obj, iterator, context); } } function eachObj(obj, iterator, context) { - var ret; - var hasOwn = Object.prototype.hasOwnProperty; - for (var key in obj) { + let ret; + const hasOwn = Object.prototype.hasOwnProperty; + /* eslint prefer-const:0 */ // some weird eslint bug? + for (let key in obj) { if (hasOwn.call(obj, key)) { ret = iterator.call(context, obj[key], key, obj); if (ret === false) { @@ -96,9 +97,9 @@ function eachObj(obj, iterator, context) { } function eachArry(obj, iterator, context) { - var ret; - var length = obj.length; - for (var i = 0; i < length; i++) { + let ret; + const length = obj.length; + for (let i = 0; i < length; i++) { ret = iterator.call(context, obj[i], i, obj); if (ret === false) { return ret; @@ -113,8 +114,8 @@ function isError(obj) { function list(arry, join, finalJoin) { arry = arrayify(arry); - let copy = arry.slice(); - let last = copy.pop(); + const copy = arry.slice(); + const last = copy.pop(); if (copy.length === 1) { join = ' '; } @@ -148,9 +149,11 @@ function undef(thing) { /** * This will set up the checker with all of the defaults that most checkers want like required by default and an * optional version - * @param checker - * @param properties properties to add to the checker - * @param disabled - when set to true, this will set the checker to a no-op function + * + * @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] */ @@ -187,7 +190,7 @@ function setupChecker(checker, properties, disabled) { } function getRequiredVersion(checker, disabled) { - var requiredChecker = disabled ? getNoop() : function requiredChecker(val, name, location, obj) { + const requiredChecker = disabled ? getNoop() : function requiredChecker(val, name, location, obj) { if (undef(val) && !checker.isOptional) { let tLocation = location ? ` in ${t(location)}` : ''; const type = getCheckerDisplay(checker, {short: true}); @@ -203,7 +206,7 @@ function getRequiredVersion(checker, disabled) { } function addOptional(checker, disabled) { - var optionalCheck = disabled ? getNoop() : function optionalCheck(val, name, location, obj) { + const optionalCheck = disabled ? getNoop() : function optionalCheck(val, name, location, obj) { if (!undef(val)) { return checker(val, name, location, obj); } @@ -223,7 +226,7 @@ function addOptional(checker, disabled) { } function addNullable(checker, disabled) { - var nullableCheck = disabled ? getNoop() : function nullableCheck(val, name, location, obj) { + const nullableCheck = disabled ? getNoop() : function nullableCheck(val, name, location, obj) { if (val !== null) { return checker(val, name, location, obj); } diff --git a/src/api-check-util.test.js b/src/api-check-util.test.js index a1cfaf3..8c2d3be 100644 --- a/src/api-check-util.test.js +++ b/src/api-check-util.test.js @@ -9,7 +9,7 @@ describe('api-check-util', () => { describe('each', () => { it('should iterate over objects', () => { - var called = []; + const called = []; each({a: 'a', b: 'b'}, (val, prop) => { called.push({val, prop}); }); @@ -17,8 +17,8 @@ describe('api-check-util', () => { }); it('should exit objects early if false is explicitly returned', () => { - var called = []; - var ret = each({a: 'a', b: 'b', c: 'c', d: 'd'}, (val, prop) => { + const called = []; + const ret = each({a: 'a', b: 'b', c: 'c', d: 'd'}, (val, prop) => { if (prop === 'c') { return false; } @@ -29,13 +29,13 @@ describe('api-check-util', () => { }); it('should not iterate over properties that are not the object\'s own', () => { - var called = []; - var Daddy = function() { + const called = []; + function Daddy() { this.a = 'a'; this.b = 'b'; - }; + } Daddy.prototype.x = 'x'; - var man = new Daddy(); + const man = new Daddy(); each(man, (val, prop) => { called.push({val, prop}); }); @@ -43,7 +43,7 @@ describe('api-check-util', () => { }); it('should iterate over arrays', () => { - var called = []; + const called = []; each([1, 2], (val, index) => { called.push({val, index}); }); @@ -51,8 +51,8 @@ describe('api-check-util', () => { }); it('should exit arrays early if false is explicitly returned', () => { - var called = []; - var ret = each([1, 2, 3, 4], (val, index) => { + const called = []; + const ret = each([1, 2, 3, 4], (val, index) => { if (index > 1) { return false; } diff --git a/src/api-check.js b/src/api-check.js index 0da04ea..e5c2b36 100644 --- a/src/api-check.js +++ b/src/api-check.js @@ -28,7 +28,7 @@ function getApiCheckInstance(config = {}, extraCheckers = {}) { }); } - let additionalProperties = { + const additionalProperties = { throw: getApiCheck(true), warn: getApiCheck(false), getErrorMessage, @@ -56,9 +56,9 @@ function getApiCheckInstance(config = {}, extraCheckers = {}) { /** * This is the instance function. Other things are attached to this see additional properties above. - * @param api {Array} - * @param args {arguments} - * @param output {Object} + * @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) { @@ -84,7 +84,7 @@ function getApiCheckInstance(config = {}, extraCheckers = {}) { messages = checkApiWithArgs(api, args); } - let returnObject = getTypes(api, args); + const returnObject = getTypes(api, args); returnObject.args = args; if (messages.length) { returnObject.message = apiCheck.getErrorMessage(api, args, messages, output); @@ -100,12 +100,12 @@ function getApiCheckInstance(config = {}, extraCheckers = {}) { /** * checkApiCheckApi, should be read like: check apiCheck api. As in, check the api for apiCheck :-) - * @param checkApiArgs + * @param {Array} checkApiArgs - args provided to apiCheck function */ function checkApiCheckApi(checkApiArgs) { const api = checkApiArgs[0]; const args = checkApiArgs[1]; - var isArrayOrArgs = Array.isArray(args) || (args && typeof args === 'object' && typeof args.length === 'number'); + const isArrayOrArgs = Array.isArray(args) || (args && typeof args === 'object' && typeof args.length === 'number'); if (Array.isArray(api) && !isArrayOrArgs) { throw new Error(getErrorMessage(api, [args], @@ -126,7 +126,7 @@ function getApiCheckInstance(config = {}, extraCheckers = {}) { function getApiCheck(shouldThrow) { return function apiCheckWrapper(api, args, output) { - let result = apiCheck(api, args, output); + const result = apiCheck(api, args, output); apiCheck.handleErrorMessage(result.message, shouldThrow); return result; // wont get here if an error is thrown }; @@ -142,12 +142,12 @@ function getApiCheckInstance(config = {}, extraCheckers = {}) { } function getErrorMessage(api, args, messages = [], output = {}) { - let gOut = apiCheck.config.output || {}; - let prefix = getPrefix(); - let suffix = getSuffix(); - let url = getUrl(); - let message = `apiCheck failed! ${messages.join(', ')}`; - var passedAndShouldHavePassed = '\n\n' + buildMessageFromApiAndArgs(api, args); + const gOut = apiCheck.config.output || {}; + const prefix = getPrefix(); + const suffix = getSuffix(); + const url = getUrl(); + const message = `apiCheck failed! ${messages.join(', ')}`; + const passedAndShouldHavePassed = '\n\n' + buildMessageFromApiAndArgs(api, args); return `${prefix} ${message} ${suffix} ${url || ''}${passedAndShouldHavePassed}`.trim(); function getPrefix() { @@ -177,8 +177,8 @@ function getApiCheckInstance(config = {}, extraCheckers = {}) { function buildMessageFromApiAndArgs(api, args) { let {apiTypes, argTypes} = getTypes(api, args); - let copy = Array.prototype.slice.call(args || []); - let replacedItems = []; + const copy = Array.prototype.slice.call(args || []); + const replacedItems = []; replaceFunctionWithName(copy); const passedArgs = getObjectString(copy); argTypes = getObjectString(argTypes); @@ -233,7 +233,7 @@ function getApiCheckInstance(config = {}, extraCheckers = {}) { function getTypes(api, args) { api = arrayify(api); args = arrayify(args); - let apiTypes = api.map((checker, index) => { + const apiTypes = api.map((checker, index) => { const specified = module.exports.globalConfig.hasOwnProperty('verbose'); return getCheckerDisplay(checker, { terse: specified ? !module.exports.globalConfig.verbose : !apiCheck.config.verbose, @@ -241,8 +241,8 @@ function getApiCheckInstance(config = {}, extraCheckers = {}) { addHelpers: true }); }); - let argTypes = args.map((arg) => getArgDisplay(arg, [])); - return {argTypes: argTypes, apiTypes}; + const argTypes = args.map((arg) => getArgDisplay(arg, [])); + return {argTypes, apiTypes}; } } @@ -252,13 +252,13 @@ function getApiCheckInstance(config = {}, extraCheckers = {}) { /** * This is where the magic happens for actually checking the arguments with the api. - * @param api {Array} - checkers - * @param args {Array} - and arguments object - * @returns {Array} + * @param {Array} api - checkers + * @param {Array} args - and arguments object + * @returns {Array} - the error messages */ function checkApiWithArgs(api, args) { /* eslint complexity:[2, 7] */ - let messages = []; + const messages = []; let failed = false; let checkerIndex = 0; let argIndex = 0; @@ -321,7 +321,7 @@ function getCheckerHelp({help}, val) { function checkEnoughArgs(api, args) { - let requiredArgs = api.filter(a => !a.isOptional); + const requiredArgs = api.filter(a => !a.isOptional); if (args.length < requiredArgs.length) { return [ 'Not enough arguments specified. Requires `' + requiredArgs.length + '`, you passed `' + args.length + '`' @@ -337,7 +337,7 @@ function getArgDisplay(arg, gottenArgs) { const type = typeOf(arg); if (type === 'function') { if (hasKeys()) { - let properties = stringify(getDisplayIfNotGotten()); + const properties = stringify(getDisplayIfNotGotten()); return cName + ' (with properties: ' + properties + ')'; } return cName; @@ -372,7 +372,7 @@ function getArgDisplay(arg, gottenArgs) { } function getDisplay(obj, gottenArgs) { - var argDisplay = {}; + const argDisplay = {}; each(obj, (v, k) => argDisplay[k] = getArgDisplay(v, gottenArgs)); return argDisplay; } diff --git a/src/api-check.test.js b/src/api-check.test.js index d5342a2..423042b 100644 --- a/src/api-check.test.js +++ b/src/api-check.test.js @@ -1,6 +1,7 @@ /* eslint max-len:[2, 150] */ /* eslint no-console:0 */ -var expect = require('chai').expect; +/* eslint no-unused-vars:0 */ +const expect = require('chai').expect; const {coveredFunction} = require('./test.utils'); describe('apiCheck', () => { const apiCheck = require('./index'); @@ -87,28 +88,28 @@ describe('apiCheck', () => { it('should handle array with types', () => { (function(a, b, c) { - var message = apiCheckInstance([apiCheckInstance.string, apiCheckInstance.number, apiCheckInstance.bool], arguments).message; + const message = apiCheckInstance([apiCheckInstance.string, apiCheckInstance.number, apiCheckInstance.bool], arguments).message; expect(message).to.be.empty; })('a', 1, true); }); it('should handle optional arguments', () => { (function(a, b, c) { - var message = apiCheckInstance([apiCheckInstance.string, apiCheckInstance.number.optional, apiCheckInstance.bool], arguments).message; + const message = apiCheckInstance([apiCheckInstance.string, apiCheckInstance.number.optional, apiCheckInstance.bool], arguments).message; expect(message).to.be.empty; })('a', true); }); it(`should handle an any.optional that's in the middle of the arg list`, () => { (function(a, b, c) { - var message = apiCheckInstance([apiCheckInstance.string, apiCheckInstance.any.optional, apiCheckInstance.bool], arguments).message; + const message = apiCheckInstance([apiCheckInstance.string, apiCheckInstance.any.optional, apiCheckInstance.bool], arguments).message; expect(message).to.be.empty; })('a', true); }); it(`should handle the crazy optional specifications`, () => { function crazyFunction() { - var message = apiCheckInstance([ + const message = apiCheckInstance([ apiCheckInstance.string.optional, apiCheckInstance.number.optional, apiCheckInstance.bool, apiCheckInstance.object.optional, apiCheckInstance.func.optional, apiCheckInstance.array, apiCheckInstance.string.optional, apiCheckInstance.func @@ -122,7 +123,7 @@ describe('apiCheck', () => { it(`should handle a final two optional arguments`, () => { (function(a, b, c) { - var message = apiCheckInstance([apiCheckInstance.string, apiCheckInstance.oneOfType([ + const message = apiCheckInstance([apiCheckInstance.string, apiCheckInstance.oneOfType([ apiCheckInstance.arrayOf(apiCheckInstance.string), apiCheckInstance.shape({name: apiCheckInstance.string}) ]).optional, apiCheckInstance.shape({ @@ -148,7 +149,7 @@ describe('apiCheck', () => { const foo = new Foo(); (function(a) { - var message = apiCheckInstance(apiCheckInstance.number, a).message; + const message = apiCheckInstance(apiCheckInstance.number, a).message; expect(message).to.match(makeSpacedRegex('you passed bar "baz" baz 123 foobar with types string number date')); })(foo); }); @@ -159,7 +160,7 @@ describe('apiCheck', () => { const foo = new Foo(); (function(a) { - var message = apiCheckInstance(apiCheckInstance.number, a).message; + const message = apiCheckInstance(apiCheckInstance.number, a).message; expect(message).to.match(makeSpacedRegex('you passed {} with type Foo')); })(foo); }); @@ -169,39 +170,39 @@ describe('apiCheck', () => { func.foo = 'bar'; (function(a) { - var message = apiCheckInstance(apiCheckInstance.number, a).message; + const message = apiCheckInstance(apiCheckInstance.number, a).message; expect(message).to.match(makeSpacedRegex(`you passed ${func.name} with the type: Function with properties foo string`)); })(func); }); it(`should output an empty object`, () => { - var message = apiCheckInstance(apiCheckInstance.number, {}).message; + const message = apiCheckInstance(apiCheckInstance.number, {}).message; expect(message).to.match(makeSpacedRegex(`you passed {} with the type: object`)); }); it(`should output an empty array`, () => { - var message = apiCheckInstance(apiCheckInstance.number, []).message; + const message = apiCheckInstance(apiCheckInstance.number, []).message; expect(message).to.match(makeSpacedRegex(`you passed \\[\\] with the type: array`)); }); it(`should handle circular references properly`, () => { - var foo = {}; - var bar = {foo}; + const foo = {}; + const bar = {foo}; foo.bar = bar; - var message = apiCheckInstance(apiCheckInstance.number, foo).message; + const message = apiCheckInstance(apiCheckInstance.number, foo).message; expect(message).to.match(makeSpacedRegex(`bar foo \\[circular ~\\] bar foo \\[circular\\]`)); }); describe(`custom checkers`, () => { it('should be accepted', () => { (function(a, b) { - var message = apiCheckInstance([apiCheckInstance.string, ipAddressChecker], arguments).message; + const message = apiCheckInstance([apiCheckInstance.string, ipAddressChecker], arguments).message; expect(message).to.be.empty; })('a', '127.0.0.1'); (function(a, b) { - var message = apiCheckInstance([apiCheckInstance.string, ipAddressChecker], arguments).message; + const message = apiCheckInstance([apiCheckInstance.string, ipAddressChecker], arguments).message; expect(message).to.match(/argument.*?2.*?must.*?be.*?ipAddressString/i); })('a', 32); }); @@ -297,7 +298,7 @@ describe('apiCheck', () => { it(`should be printed as is as part of the message`, () => { ipAddressChecker.help = 'This needs to be a valid IP address. Like 127.0.0.1'; (function(a, b) { - var message = apiCheckInstance([apiCheckInstance.string, ipAddressChecker], arguments).message; + const message = apiCheckInstance([apiCheckInstance.string, ipAddressChecker], arguments).message; expect(message).to.contain(ipAddressChecker.help); })('a', 32); }); @@ -310,7 +311,7 @@ describe('apiCheck', () => { return val + suffix; }; (function(a, b) { - var message = apiCheckInstance([apiCheckInstance.string, ipAddressChecker], arguments).message; + const message = apiCheckInstance([apiCheckInstance.string, ipAddressChecker], arguments).message; expect(message).to.contain(suffix); })('a', 32); }); @@ -340,8 +341,7 @@ describe('apiCheck', () => { }); describe('#warn', () => { - var originalWarn; - var warnCalls; + let originalWarn, warnCalls; beforeEach(() => { originalWarn = console.warn; warnCalls = []; @@ -375,7 +375,7 @@ describe('apiCheck', () => { it(`should return the results`, () => { (function(a) { - let message = apiCheckInstance.warn(apiCheckInstance.number, a).message; + const message = apiCheckInstance.warn(apiCheckInstance.number, a).message; expect(message).to.match(makeSpacedRegex('you passed a the api calls for number')); })('a', 3); }); @@ -411,7 +411,7 @@ describe('apiCheck', () => { apiCheck.globalConfig.disabled = true; const customInstance = apiCheck(); check(customInstance, true); - var checkers = [ + const checkers = [ customInstance.string, customInstance.bool, customInstance.func, @@ -452,7 +452,7 @@ describe('apiCheck', () => { function check(instance, disabled) { const error = /not.*?enough.*?arguments.*?requires.*?2.*?passed.*?1/i; (function(a, b) { - var message = instance([instance.instanceOf(RegExp), instance.number], arguments).message; + const message = instance([instance.instanceOf(RegExp), instance.number], arguments).message; if (disabled) { expect(message).to.be.empty; } else { @@ -475,7 +475,7 @@ describe('apiCheck', () => { }); it(`should throw an error when the wrong types are passed`, () => { (function(a) { - var args = arguments; + const args = arguments; expect(() => apiCheckInstance(true, args)).to.throw(/argument.*1.*must.*be.*typeOrArrayOf.*func\.withProperties/i); })('a'); }); @@ -485,14 +485,14 @@ describe('apiCheck', () => { describe('output', () => { it('should fallback to an empty object is output is removed', () => { - var original = apiCheckInstance.config.output; + const original = apiCheckInstance.config.output; apiCheckInstance.config.output = null; expect(getFailureMessage).to.not.throw(); apiCheckInstance.config.output = original; }); describe('prefix', () => { - var gPrefix = 'global prefix'; + const gPrefix = 'global prefix'; beforeEach(() => { apiCheckInstance.config.output.prefix = gPrefix; }); @@ -501,7 +501,7 @@ describe('apiCheck', () => { }); it('should allow the specification of an additional prefix that comes after the global config prefix', () => { - var prefix = 'secondary prefix'; + const prefix = 'secondary prefix'; expect(getFailureMessage({prefix})).to.match(new RegExp(`^${gPrefix} ${prefix}`)); }); @@ -518,7 +518,7 @@ describe('apiCheck', () => { }); describe('suffix', () => { - var gSuffix = 'global suffix'; + const gSuffix = 'global suffix'; beforeEach(() => { apiCheckInstance.config.output.suffix = gSuffix; }); @@ -527,7 +527,7 @@ describe('apiCheck', () => { }); it('should allow the specification of an additional suffix that comes after the global config suffix', () => { - var suffix = 'secondary suffix'; + const suffix = 'secondary suffix'; expect(getFailureMessage({suffix})).to.contain(`${suffix} ${gSuffix}`); }); @@ -544,7 +544,7 @@ describe('apiCheck', () => { }); describe('url', () => { - var docsBaseUrl = 'http://www.example.com/errors#'; + const docsBaseUrl = 'http://www.example.com/errors#'; beforeEach(() => { apiCheckInstance.config.output.docsBaseUrl = docsBaseUrl; }); @@ -554,7 +554,7 @@ describe('apiCheck', () => { }); it('should be added to the message if a url is specified', () => { - var urlSuffix = 'some-error-message'; + const urlSuffix = 'some-error-message'; expect(getFailureMessage({urlSuffix})).to.contain(`${docsBaseUrl}${urlSuffix}`); }); @@ -575,7 +575,7 @@ describe('apiCheck', () => { }); function getFailureMessage(output) { - var message; + let message; (function(a) { message = apiCheckInstance(apiCheckInstance.string, a, output).message; })(1); @@ -620,10 +620,10 @@ describe('apiCheck', () => { }); it('should be overrideable', () => { - let originalGetErrorMessage = apiCheckInstance.getErrorMessage; - let api = [apiCheckInstance.string, apiCheckInstance.shape({}), apiCheckInstance.array]; + const originalGetErrorMessage = apiCheckInstance.getErrorMessage; + const api = [apiCheckInstance.string, apiCheckInstance.shape({}), apiCheckInstance.array]; let args; - let output = {}; + const output = {}; apiCheckInstance.getErrorMessage = (_api, _args, _message, _output) => { expect(_api).to.equal(api); expect(_args).to.eql(Array.prototype.slice.call(args)); // only eql because the args are cloned @@ -755,8 +755,8 @@ describe('apiCheck', () => { describe('#handleErrorMessage', () => { it('should send the message to console.warn when the second argument is falsy', () => { - var originalWarn = console.warn; - var warnCalls = []; + const originalWarn = console.warn; + const warnCalls = []; console.warn = function() { warnCalls.push([...arguments]); }; @@ -770,7 +770,7 @@ describe('apiCheck', () => { }); it('should be overrideable', () => { - var originalHandle = apiCheckInstance.handleErrorMessage; + const originalHandle = apiCheckInstance.handleErrorMessage; apiCheckInstance.handleErrorMessage = (message, shouldThrow) => { expect(message).to.match(makeSpacedRegex('you passed undefined type undefined api calls for string')); expect(shouldThrow).to.be.true; diff --git a/src/bugs.test.js b/src/bugs.test.js index 0edefaf..9ab7da2 100644 --- a/src/bugs.test.js +++ b/src/bugs.test.js @@ -1,6 +1,6 @@ /*jshint expr: true*/ /* jshint maxlen: 180 */ -var expect = require('chai').expect; +const expect = require('chai').expect; describe(`fixed bugs`, () => { const apiCheck = require('./index'); diff --git a/src/checkers.js b/src/checkers.js index d77d107..6a0cf5f 100644 --- a/src/checkers.js +++ b/src/checkers.js @@ -6,7 +6,7 @@ const { } = require('./api-check-util'); const {setupChecker} = checkerHelpers; -let checkers = module.exports = getCheckers(); +const checkers = module.exports = getCheckers(); module.exports.getCheckers = getCheckers; function getCheckers(disabled) { @@ -51,7 +51,7 @@ function getCheckers(disabled) { function funcCheckGetter() { const type = 'Function'; - let functionChecker = setupChecker(function functionCheckerDefinition(val, name, location) { + const functionChecker = setupChecker(function functionCheckerDefinition(val, name, location) { if (typeOf(val) !== 'function') { return getError(name, location, type); } @@ -62,7 +62,7 @@ function getCheckers(disabled) { if (isError(apiError)) { throw apiError; } - let shapeChecker = checkers.shape(properties, true); + const shapeChecker = checkers.shape(properties, true); shapeChecker.type.__apiCheckData.type = 'func.withProperties'; return setupChecker(function functionWithPropertiesChecker(val, name, location) { @@ -79,13 +79,13 @@ function getCheckers(disabled) { function objectCheckGetter() { const type = 'Object'; const nullType = 'Object (null ok)'; - let objectNullOkChecker = setupChecker(function objectNullOkCheckerDefinition(val, name, location) { + const objectNullOkChecker = setupChecker(function objectNullOkCheckerDefinition(val, name, location) { if (typeOf(val) !== 'object') { return getError(name, location, nullType); } }, {type: nullType}, disabled); - let objectChecker = setupChecker(function objectCheckerDefinition(val, name, location) { + const objectChecker = setupChecker(function objectCheckerDefinition(val, name, location) { if (val === null || isError(objectNullOkChecker(val, name, location))) { return getError(name, location, objectChecker.type); } @@ -201,12 +201,12 @@ function getCheckers(disabled) { function getShapeCheckGetter() { function shapeCheckGetter(shape, nonObject) { - let shapeTypes = {}; + const shapeTypes = {}; each(shape, (checker, prop) => { shapeTypes[prop] = getCheckerDisplay(checker); }); function type(options = {}) { - let ret = {}; + const ret = {}; const {terse, obj, addHelpers} = options; const parentRequired = options.required; each(shape, (checker, prop) => { @@ -230,7 +230,7 @@ function getCheckers(disabled) { } addHelper('missing', `MISSING THIS ${item}`, ' <-- YOU ARE MISSING THIS'); } else if (specified) { - let error = checker(obj[prop], prop, null, obj); + const error = checker(obj[prop], prop, null, obj); if (isError(error)) { addHelper('error', `THIS IS THE PROBLEM: ${error.message}`, ` <-- THIS IS THE PROBLEM: ${error.message}`); } @@ -247,9 +247,9 @@ function getCheckers(disabled) { } type.__apiCheckData = {strict: false, optional: false, type: 'shape'}; - let shapeChecker = setupChecker(function shapeCheckerDefinition(val, name, location) { + const shapeChecker = setupChecker(function shapeCheckerDefinition(val, name, location) { /* eslint complexity:[2, 6] */ - let isObject = !nonObject && checkers.object(val, name, location); + const isObject = !nonObject && checkers.object(val, name, location); if (isError(isObject)) { return isObject; } @@ -304,8 +304,8 @@ function getCheckers(disabled) { const shortType = `ifNot[${otherProps.join(', ')}]`; const type = getTypeForShapeChild(propChecker, description, shortType); return setupChecker(function ifNotChecker(prop, propName, location, obj) { - let propExists = obj && obj.hasOwnProperty(propName); - let otherPropsExist = otherProps.some(otherProp => obj && obj.hasOwnProperty(otherProp)); + const propExists = obj && obj.hasOwnProperty(propName); + const otherPropsExist = otherProps.some(otherProp => obj && obj.hasOwnProperty(otherProp)); if (propExists === otherPropsExist) { return getError(propName, location, type); } else if (propExists) { @@ -357,7 +357,7 @@ function getCheckers(disabled) { return setupChecker(function shapeRequiredIfNotDefinition(prop, propName, location, obj) { const propExists = obj && obj.hasOwnProperty(propName); const iteration = all ? 'every' : 'some'; - const otherPropsExist = otherProps[iteration](function (otherProp) { + const otherPropsExist = otherProps[iteration](function(otherProp) { return obj && obj.hasOwnProperty(otherProp); }); if (!otherPropsExist && !propExists) { diff --git a/src/checkers.test.js b/src/checkers.test.js index c6dc9f2..9ccbaa3 100644 --- a/src/checkers.test.js +++ b/src/checkers.test.js @@ -1,11 +1,11 @@ /* eslint max-nested-callbacks:0 */ -var expect = require('chai').expect; -var _ = require('lodash'); +const expect = require('chai').expect; +const _ = require('lodash'); const {coveredFunction} = require('./test.utils'); const {getCheckerDisplay} = require('./api-check-util'); describe('checkers', () => { - var checkers = require('./checkers'); + const checkers = require('./checkers'); describe('typeOfs', () => { it('should check string', () => { expect(checkers.string('string')).to.be.undefined; @@ -227,7 +227,7 @@ describe('checkers', () => { describe('shape', () => { it('should pass when the object contains at least the properties of the types specified', () => { - var check = checkers.shape({ + const check = checkers.shape({ name: checkers.shape({ first: checkers.string, last: checkers.string @@ -237,7 +237,7 @@ describe('checkers', () => { walk: checkers.func, childrenNames: checkers.arrayOf(checkers.string) }); - var obj = { + const obj = { name: { first: 'Matt', last: 'Meese' @@ -251,28 +251,28 @@ describe('checkers', () => { }); it('should fail when the object is missing any of the properties specified', () => { - var check = checkers.shape({ + const check = checkers.shape({ scores: checkers.objectOf(checkers.number) }); expect(check({sports: ['soccer', 'baseball']})).to.be.an.instanceOf(Error); }); it('should have an optional function that does the same thing', () => { - var check = checkers.shape({ + const check = checkers.shape({ appliances: checkers.arrayOf(checkers.object) }).optional; expect(check({appliances: [{name: 'refridgerator'}]})).to.be.undefined; }); it('should be false when passed a non-object', () => { - var check = checkers.shape({ + const check = checkers.shape({ friends: checkers.arrayOf(checkers.object) }); expect(check([3])).to.be.an.instanceOf(Error); }); it('should fail when the given object is missing properties', () => { - var check = checkers.shape({ + const check = checkers.shape({ mint: checkers.bool, chocolate: checkers.bool }); @@ -280,7 +280,7 @@ describe('checkers', () => { }); it('should pass when the given object is missing properties that are optional', () => { - var check = checkers.shape({ + const check = checkers.shape({ mint: checkers.bool, chocolate: checkers.bool.optional }); @@ -288,7 +288,7 @@ describe('checkers', () => { }); it('should pass when it is strict and the given object conforms to the shape exactly', () => { - var check = checkers.shape({ + const check = checkers.shape({ mint: checkers.bool, chocolate: checkers.bool, milk: checkers.bool @@ -297,7 +297,7 @@ describe('checkers', () => { }); it('should fail when it is strict and the given object has extra properties', () => { - var check = checkers.shape({ + const check = checkers.shape({ mint: checkers.bool, chocolate: checkers.bool, milk: checkers.bool @@ -306,7 +306,7 @@ describe('checkers', () => { }); it(`should fail when it is strict and it is an invalid shape`, () => { - var check = checkers.shape({ + const check = checkers.shape({ mint: checkers.bool, chocolate: checkers.bool, milk: checkers.bool @@ -315,7 +315,7 @@ describe('checkers', () => { }); it(`should display the location of sub-children well`, () => { - var obj = { + const obj = { person: { home: { location: { @@ -438,7 +438,7 @@ describe('checkers', () => { describe('ifNot', () => { it('should pass if the specified property exists but the other does not', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.ifNot('mint', checkers.bool), mint: checkers.shape.ifNot('cookies', checkers.bool) }); @@ -446,7 +446,7 @@ describe('checkers', () => { }); it('should fail if neither of the ifNot properties exists', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.ifNot('mint', checkers.bool), mint: checkers.shape.ifNot('cookies', checkers.bool) }); @@ -454,21 +454,21 @@ describe('checkers', () => { }); it('should pass if the specified array of properties do not exist', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.ifNot(['mint', 'chips'], checkers.bool) }); expect(check({cookies: true})).to.be.undefined; }); it('should fail if any of the specified array of properties exists', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.ifNot(['mint', 'chips'], checkers.bool) }); expect(check({cookies: true, chips: true})).to.be.an.instanceOf(Error); }); it('should fail even if both ifNots are optional', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.ifNot('mint', checkers.bool).optional, mint: checkers.shape.ifNot('cookies', checkers.bool).optional }); @@ -476,7 +476,7 @@ describe('checkers', () => { }); it('should fail if the specified property exists and the other does too', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.ifNot('mint', checkers.bool), mint: checkers.shape.ifNot('cookies', checkers.bool) }); @@ -484,14 +484,14 @@ describe('checkers', () => { }); it('should fail if it fails the specified checker', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.ifNot('mint', checkers.bool) }); expect(check({cookies: 43})).to.be.an.instanceOf(Error); }); it(`should have a legible type`, () => { - var check = checkers.shape({ + const check = checkers.shape({ name: checkers.shape({ first: checkers.string, last: checkers.string @@ -568,42 +568,42 @@ describe('checkers', () => { describe('onlyIf', () => { it('should pass only if the specified property is also present', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.onlyIf('mint', checkers.bool) }); expect(check({cookies: true, mint: true})).to.be.undefined; }); it('should pass only if all specified properties are also present', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.onlyIf(['mint', 'chip'], checkers.bool) }); expect(check({cookies: true, mint: true, chip: true})).to.be.undefined; }); it('should fail if the specified property is not present', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.onlyIf('mint', checkers.bool) }); expect(check({cookies: true})).to.be.an.instanceOf(Error); }); it('should fail if any specified properties are not present', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.onlyIf(['mint', 'chip'], checkers.bool) }); expect(check({cookies: true, chip: true})).to.be.an.instanceOf(Error); }); it('should fail if all specified properties are not present', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.onlyIf(['mint', 'chip'], checkers.bool) }); expect(check({cookies: true})).to.be.an.instanceOf(Error); }); it('should fail if it fails the specified checker', () => { - var check = checkers.shape({ + const check = checkers.shape({ cookies: checkers.shape.onlyIf(['mint', 'chip'], checkers.bool) }); expect(check({cookies: 42, mint: true, chip: true})).to.be.an.instanceOf(Error); diff --git a/src/prs-plz.test.js b/src/prs-plz.test.js index 773c187..6801d54 100644 --- a/src/prs-plz.test.js +++ b/src/prs-plz.test.js @@ -10,7 +10,7 @@ /*jshint expr: true*/ /* jshint maxlen: 180 */ -var expect = require('chai').expect; +const expect = require('chai').expect; /* istanbul ignore next */ // we're not running these tests... describe.skip(`PRs PLEASE!`, () => {