@simpleview/assertlib 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +4 -0
- package/dist/index.min.js +2 -7
- package/package.json +1 -1
- package/src/index.js +19 -9
package/changelog.md
CHANGED
package/dist/index.min.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("cheerio"),require("jsvalidator"));else if("function"==typeof define&&define.amd)define(["cheerio","jsvalidator"],e);else{var r="object"==typeof exports?e(require("cheerio"),require("jsvalidator")):e(t.cheerio,t.jsvalidator);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,function(t,e){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){var n=r(1),o=r(8),i=r(9),a=function(t,e,r){c(t,e,["root"],void 0,r=r||{})},c=function(t,e,r,o,u){var s,f=typeof e,l=["boolean","number","undefined"],p=["type","data","class","calls","allowExtraKeys"],d=e instanceof Date,y=e instanceof Array,h=null===e,g="function"===f,m=!1===d&&!1===y&&!1===h&&"object"===f,b=l.indexOf(f)>-1,v="string"===f,E=m&&0===Object.keys(e).filter(t=>-1===p.indexOf(t)).length&&void 0!==e.type,j=b||v||d||h||y||g||m&&!1===E,w=j?{type:g?"function":d?"date":m?"object":y?"array":h?"null":f,data:e}:e;s=j&&m&&void 0!==w.data._deepCheck_allowExtraKeys?w.data._deepCheck_allowExtraKeys:void 0!==w.allowExtraKeys?w.allowExtraKeys:void 0===u.allowExtraKeys||u.allowExtraKeys;i.validate(w,{type:"object",schema:[{name:"type",type:"string",enum:["boolean","string","array","number","undefined","function","object","date","null"],required:!0},{name:"data",type:"any"},{name:"class",type:"function"},{name:"calls",type:"array",schema:{type:"object",schema:[{name:"args",type:"array",default:function(){return[]}},{name:"result",type:"any"}],allowExtraKeys:!1}},{name:"allowExtraKeys",type:"boolean"}],throwOnInvalid:!0,allowExtraKeys:!1});if(l.indexOf(w.type)>-1)n.strictEqual(typeof t,w.type,"data at "+r.join(".")+" was not a "+w.type+", but it should be"),void 0!==w.data&&n.strictEqual(t,w.data,"data '"+t+"' did not equal '"+w.data+"' at "+r.join("."));else if("string"===w.type){if(n.strictEqual(typeof t,w.type,"data at "+r.join(".")+" was not a "+w.type+", but it should be"),void 0!==w.data)(w.data instanceof Array?w.data:[w.data]).forEach(function(e){e instanceof RegExp?n.ok(t.match(e),"data '"+t+"' did not contain '"+e+"' at "+r.join(".")):n.strictEqual(t,e,"data '"+t+"' did not equal '"+e+"' at "+r.join("."))})}else if("object"===w.type){if(n.strictEqual(typeof t,"object","data at "+r.join(".")+" was not an object, but it should be"),void 0!==w.class&&n.strictEqual(t instanceof w.class,!0,"data at "+r.join(".")+" was not instanceof the proper class"),!1===s){var x=Object.keys(t),O=Object.keys(w.data);x.forEach(t=>n.strictEqual(O.indexOf(t)>-1,!0,"extra key '"+t+"' at "+r.join(".")))}void 0!==w.data&&Object.keys(w.data).forEach(function(e,n){if("_deepCheck_allowExtraKeys"!==e){var o=r.slice(0);o.push(e),c(t[e],w.data[e],o,t,u)}})}else if("array"===w.type)n.strictEqual(t instanceof Array,!0,"data at "+r.join(".")+" was not an array, but it should be"),void 0!==w.data&&(n.strictEqual(t.length,w.data.length,"data at "+r.join(".")+" was length "+t.length+", should have been length "+w.data.length),w.data.forEach(function(e,n){var o=r.slice(0);o.push(n),c(t[n],w.data[n],o,t,u)}));else if("date"===w.type){if(n.strictEqual(t instanceof Date,!0,"data at "+r.join(".")+" was not of type date"),void 0!==w.data){var q=w.data instanceof Date?w.data.toISOString():w.data;n.strictEqual(t.toISOString(),q,"date data '"+t.toISOString()+"' did not equal '"+q+"' at "+r.join("."))}}else"function"===w.type?(n.strictEqual(typeof t,"function","data at "+r.join(".")+" was not of type function"),void 0!==w.data&&n.strictEqual(t,w.data,"data at "+r.join(".")+" was not the correct function reference"),void 0!==w.calls&&w.calls.forEach(function(e,i){var c=t.apply(o,e.args);try{a(c,e.result)}catch(t){n(!1,"data '"+c+"' did not match '"+e.result+"' returned by the function at "+r.join(".")+" on call index "+i)}})):"null"===w.type&&n.strictEqual(t,null,"data at "+r.join(".")+" was not null, but it should be")},u=function(t,e){i.validate(e,{type:"object",schema:[{name:"selector",type:"string"},{name:"count",type:"number"},{name:"childCount",type:"number"},{name:"html",type:"string"},{name:"text",type:"string"},{name:"textRegex",type:"regex"},{name:"eq",type:"number"},{name:"attrs",type:"indexObject"},{name:"css",type:"indexObject"},{name:"checks",type:"object"},{name:"exec",type:"function"},{name:"each",type:"function"}],allowExtraKeys:!1,throwOnInvalid:!0});var r=void 0!==e.selector?t.find(e.selector):t,a=void 0!==e.eq?r.eq(e.eq):r;if(void 0!==e.count&&n.strictEqual(a.length,e.count,`Count mismatch for selector '${e.selector}'. ${a.length} !== ${e.count}`),void 0!==e.html){var c=a.html().replace(/\s+/g," ").trim();n.strictEqual(c,e.html,`Html mismatch for selector '${e.selector}'. '${c}' !== '${e.html}'`)}if(void 0!==e.text){var s=a.text().replace(/\s+/g," ").trim();n.strictEqual(s,e.text,`Text mismatch for selector '${e.selector}'. '${s}' !== '${e.text}'`)}if(void 0!==e.textRegex){var f=a.text();n.ok(f.match(e.textRegex),`textRegex mismatch for selector '${e.selector}'. '${f}' did not contain '${e.textRegex}'`)}if(void 0!==e.childCount){var l=a.children().length;n.strictEqual(l,e.childCount,`childCount mismatch for selector '${e.selector}'. ${l} !== ${e.childCount}`)}if(void 0!==e.attrs)for(var p in e.attrs){var d=e.attrs[p],y=a.attr(p);(d instanceof Array?d:[d]).forEach(function(t){t instanceof RegExp?n.ok(y.match(t),`attrs mismatch for selector '${e.selector}' attr '${p}'. '${y}' did not contain '${t}'`):n.strictEqual(y,t,`attrs mismatch for selector '${e.selector}' attr '${p}'. '${y}' !== '${t}'`)})}if(void 0!==e.css)for(var p in e.css){d=e.css[p];var h=a.css(p);n.strictEqual(h,d,`css mismatch for selector '${e.selector}' css '${p}'. '${h}' !== '${d}'`)}void 0!==e.exec&&e.exec({$:o,node:a}),void 0!==e.each&&a.each(function(t,r){e.each({$:o,node:o(r),i:t})}),void 0!==e.checks&&e.checks.forEach(function(t){u(a,t)})};t.exports={assertHtml:function(t,e){if("string"==typeof t)var r=o.load(t,{decodeEntities:!1}).root();else r=t;return e.forEach(function(t,e){u(r,t)}),!0},deepCheck:a,throws:function(t,e){try{t()}catch(t){return void("string"==typeof e?n.strictEqual(t.message,e,t.message+" !== "+e):e instanceof RegExp?n.ok(t.message.match(e),"'"+t.message+"'.match("+e+") === null"):"function"==typeof e&&e(t))}throw new Error("Was supposed to throw but didn't")},trimErr:function(t,e){var r=function(t){return t.replace(/\s+/g," ").trim()},o=r(t.message),i=r(e);n.strictEqual(o,i,"'"+o+"' !== '"+i+"'")},xor:function(t,e){if(!1===(!0===t&&!1===e||!1===t&&!0===e))throw new Error(t+" === "+e)}}},function(t,e,r){"use strict";(function(e){var n=r(3);
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("cheerio"),require("jsvalidator"));else if("function"==typeof define&&define.amd)define(["cheerio","jsvalidator"],e);else{var r="object"==typeof exports?e(require("cheerio"),require("jsvalidator")):e(t.cheerio,t.jsvalidator);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,(function(t,e){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=8)}([function(t,e,r){"use strict";var n=r(16),o=r(17),i=r(18),a=r(19),c=r(6),u=r(1),f=r(20),l=Function,s=function(t){try{return l('"use strict"; return ('+t+").constructor;")()}catch(t){}},p=Object.getOwnPropertyDescriptor;if(p)try{p({},"")}catch(t){p=null}var y=function(){throw new u},d=p?function(){try{return y}catch(t){try{return p(arguments,"callee").get}catch(t){return y}}}():y,g=r(21)(),h=r(22)(),b=Object.getPrototypeOf||(h?function(t){return t.__proto__}:null),v={},m="undefined"!=typeof Uint8Array&&b?b(Uint8Array):void 0,w={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":g&&b?b([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":v,"%AsyncGenerator%":v,"%AsyncGeneratorFunction%":v,"%AsyncIteratorPrototype%":v,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?void 0:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?void 0:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":o,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":v,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":g&&b?b(b([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&g&&b?b((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":i,"%ReferenceError%":a,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&g&&b?b((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":g&&b?b(""[Symbol.iterator]()):void 0,"%Symbol%":g?Symbol:void 0,"%SyntaxError%":c,"%ThrowTypeError%":d,"%TypedArray%":m,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":f,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet};if(b)try{null.error}catch(t){var j=b(b(t));w["%Error.prototype%"]=j}var E={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},O=r(2),x=r(24),A=O.call(Function.call,Array.prototype.concat),S=O.call(Function.apply,Array.prototype.splice),P=O.call(Function.call,String.prototype.replace),k=O.call(Function.call,String.prototype.slice),q=O.call(Function.call,RegExp.prototype.exec),F=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,$=/\\(\\)?/g,I=function(t){var e=k(t,0,1),r=k(t,-1);if("%"===e&&"%"!==r)throw new c("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new c("invalid intrinsic syntax, expected opening `%`");var n=[];return P(t,F,(function(t,e,r,o){n[n.length]=r?P(o,$,"$1"):e||t})),n},R=function(t,e){var r,n=t;if(x(E,n)&&(n="%"+(r=E[n])[0]+"%"),x(w,n)){var o=w[n];if(o===v&&(o=function t(e){var r;if("%AsyncFunction%"===e)r=s("async function () {}");else if("%GeneratorFunction%"===e)r=s("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=s("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var o=t("%AsyncGenerator%");o&&b&&(r=b(o.prototype))}return w[e]=r,r}(n)),void 0===o&&!e)throw new u("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new c("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new u('"allowMissing" argument must be a boolean');if(null===q(/^%?[^%]*%?$/,t))throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=I(t),n=r.length>0?r[0]:"",o=R("%"+n+"%",e),i=o.name,a=o.value,f=!1,l=o.alias;l&&(n=l[0],S(r,A([0,1],l)));for(var s=1,y=!0;s<r.length;s+=1){var d=r[s],g=k(d,0,1),h=k(d,-1);if(('"'===g||"'"===g||"`"===g||'"'===h||"'"===h||"`"===h)&&g!==h)throw new c("property names with quotes must have matching quotes");if("constructor"!==d&&y||(f=!0),x(w,i="%"+(n+="."+d)+"%"))a=w[i];else if(null!=a){if(!(d in a)){if(!e)throw new u("base intrinsic for "+t+" exists, but the property is not available.");return}if(p&&s+1>=r.length){var b=p(a,d);a=(y=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:a[d]}else y=x(a,d),a=a[d];y&&!f&&(w[i]=a)}}return a}},function(t,e,r){"use strict";t.exports=TypeError},function(t,e,r){"use strict";var n=r(23);t.exports=Function.prototype.bind||n},function(t,e,r){"use strict";var n=r(0)("%Object.defineProperty%",!0)||!1;if(n)try{n({},"a",{value:1})}catch(t){n=!1}t.exports=n},function(t,e,r){"use strict";var n=Object.prototype.toString;t.exports=function(t){var e=n.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===n.call(t.callee)),r}},function(t,e,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},function(t,e,r){"use strict";t.exports=SyntaxError},function(t,e,r){"use strict";var n=r(0)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(t){n=null}t.exports=n},function(t,e,r){var n=r(9),o=r(33),i=r(34),a=function(t,e,r){r=r||{};try{c(t,e,["root"],void 0,r)}catch(e){try{console.log("deepCheck data:",JSON.stringify(t))}catch(t){}throw e}},c=function(t,e,r,o,u){var f,l=typeof e,s=["boolean","number","undefined"],p=["type","data","class","calls","allowExtraKeys"],y=e instanceof Date,d=e instanceof Array,g=null===e,h="function"===l,b=!1===y&&!1===d&&!1===g&&"object"===l,v=s.indexOf(l)>-1,m="string"===l,w=b&&0===Object.keys(e).filter(t=>-1===p.indexOf(t)).length&&void 0!==e.type,j=v||m||y||g||d||h||b&&!1===w,E=j?{type:h?"function":y?"date":b?"object":d?"array":g?"null":l,data:e}:e;f=j&&b&&void 0!==E.data._deepCheck_allowExtraKeys?E.data._deepCheck_allowExtraKeys:void 0!==E.allowExtraKeys?E.allowExtraKeys:void 0===u.allowExtraKeys||u.allowExtraKeys;i.validate(E,{type:"object",schema:[{name:"type",type:"string",enum:["boolean","string","array","number","undefined","function","object","date","null"],required:!0},{name:"data",type:"any"},{name:"class",type:"function"},{name:"calls",type:"array",schema:{type:"object",schema:[{name:"args",type:"array",default:function(){return[]}},{name:"result",type:"any"}],allowExtraKeys:!1}},{name:"allowExtraKeys",type:"boolean"}],throwOnInvalid:!0,allowExtraKeys:!1});if(s.indexOf(E.type)>-1)n.strictEqual(typeof t,E.type,"data at "+r.join(".")+" was not a "+E.type+", but it should be"),void 0!==E.data&&n.strictEqual(t,E.data,"data '"+t+"' did not equal '"+E.data+"' at "+r.join("."));else if("string"===E.type){if(n.strictEqual(typeof t,E.type,"data at "+r.join(".")+" was not a "+E.type+", but it should be"),void 0!==E.data)(E.data instanceof Array?E.data:[E.data]).forEach((function(e){e instanceof RegExp?n.ok(t.match(e),"data '"+t+"' did not contain '"+e+"' at "+r.join(".")):n.strictEqual(t,e,"data '"+t+"' did not equal '"+e+"' at "+r.join("."))}))}else if("object"===E.type){if(n.strictEqual(typeof t,"object","data at "+r.join(".")+" was not an object, but it should be"),void 0!==E.class&&n.strictEqual(t instanceof E.class,!0,"data at "+r.join(".")+" was not instanceof the proper class"),void 0!==E.data){if(!1===f){var O=Object.keys(t),x=Object.keys(E.data);O.forEach(t=>n.strictEqual(x.indexOf(t)>-1,!0,"extra key '"+t+"' at "+r.join(".")))}Object.keys(E.data).forEach((function(e,n){if("_deepCheck_allowExtraKeys"!==e){var o=r.slice(0);o.push(e),c(t[e],E.data[e],o,t,u)}}))}}else if("array"===E.type)n.strictEqual(t instanceof Array,!0,"data at "+r.join(".")+" was not an array, but it should be"),void 0!==E.data&&(n.strictEqual(t.length,E.data.length,"data at "+r.join(".")+" was length "+t.length+", should have been length "+E.data.length),E.data.forEach((function(e,n){var o=r.slice(0);o.push(n),c(t[n],E.data[n],o,t,u)})));else if("date"===E.type){if(n.strictEqual(t instanceof Date,!0,"data at "+r.join(".")+" was not of type date"),void 0!==E.data){var A=E.data instanceof Date?E.data.toISOString():E.data;n.strictEqual(t.toISOString(),A,"date data '"+t.toISOString()+"' did not equal '"+A+"' at "+r.join("."))}}else"function"===E.type?(n.strictEqual(typeof t,"function","data at "+r.join(".")+" was not of type function"),void 0!==E.data&&n.strictEqual(t,E.data,"data at "+r.join(".")+" was not the correct function reference"),void 0!==E.calls&&E.calls.forEach((function(e,i){var c=t.apply(o,e.args);try{a(c,e.result)}catch(t){n(!1,"data '"+c+"' did not match '"+e.result+"' returned by the function at "+r.join(".")+" on call index "+i)}}))):"null"===E.type&&n.strictEqual(t,null,"data at "+r.join(".")+" was not null, but it should be")},u=function(t,e){i.validate(e,{type:"object",schema:[{name:"selector",type:"string"},{name:"count",type:"number"},{name:"childCount",type:"number"},{name:"html",type:"string"},{name:"text",type:"string"},{name:"textRegex",type:"regex"},{name:"eq",type:"number"},{name:"attrs",type:"indexObject"},{name:"css",type:"indexObject"},{name:"checks",type:"object"},{name:"exec",type:"function"},{name:"each",type:"function"}],allowExtraKeys:!1,throwOnInvalid:!0});var r=void 0!==e.selector?t.find(e.selector):t,a=void 0!==e.eq?r.eq(e.eq):r;if(void 0!==e.count&&n.strictEqual(a.length,e.count,`Count mismatch for selector '${e.selector}'. ${a.length} !== ${e.count}`),void 0!==e.html){var c=a.html().replace(/\s+/g," ").trim();n.strictEqual(c,e.html,`Html mismatch for selector '${e.selector}'. '${c}' !== '${e.html}'`)}if(void 0!==e.text){var f=a.text().replace(/\s+/g," ").trim();n.strictEqual(f,e.text,`Text mismatch for selector '${e.selector}'. '${f}' !== '${e.text}'`)}if(void 0!==e.textRegex){var l=a.text();n.ok(l.match(e.textRegex),`textRegex mismatch for selector '${e.selector}'. '${l}' did not contain '${e.textRegex}'`)}if(void 0!==e.childCount){var s=a.children().length;n.strictEqual(s,e.childCount,`childCount mismatch for selector '${e.selector}'. ${s} !== ${e.childCount}`)}if(void 0!==e.attrs)for(var p in e.attrs){var y=e.attrs[p],d=a.attr(p);(y instanceof Array?y:[y]).forEach((function(t){t instanceof RegExp?n.ok(d.match(t),`attrs mismatch for selector '${e.selector}' attr '${p}'. '${d}' did not contain '${t}'`):n.strictEqual(d,t,`attrs mismatch for selector '${e.selector}' attr '${p}'. '${d}' !== '${t}'`)}))}if(void 0!==e.css)for(var p in e.css){y=e.css[p];var g=a.css(p);n.strictEqual(g,y,`css mismatch for selector '${e.selector}' css '${p}'. '${g}' !== '${y}'`)}void 0!==e.exec&&e.exec({$:o,node:a}),void 0!==e.each&&a.each((function(t,r){e.each({$:o,node:o(r),i:t})})),void 0!==e.checks&&e.checks.forEach((function(t){u(a,t)}))};t.exports={assertHtml:function(t,e){if("string"==typeof t)var r=o.load(t,{decodeEntities:!1}).root();else r=t;return e.forEach((function(t,e){u(r,t)})),!0},deepCheck:a,throws:function(t,e){try{t()}catch(t){return void("string"==typeof e?n.strictEqual(t.message,e,t.message+" !== "+e):e instanceof RegExp?n.ok(t.message.match(e),"'"+t.message+"'.match("+e+") === null"):"function"==typeof e&&e(t))}throw new Error("Was supposed to throw but didn't")},trimErr:function(t,e){var r=function(t){return t.replace(/\s+/g," ").trim()},o=r(t.message),i=r(e);n.strictEqual(o,i,"'"+o+"' !== '"+i+"'")},xor:function(t,e){if(!1===(!0===t&&!1===e||!1===t&&!0===e))throw new Error(t+" === "+e)}}},function(t,e,r){"use strict";(function(e){var n=r(11)();
|
|
2
2
|
/*!
|
|
3
3
|
* The buffer module from node.js, for the browser.
|
|
4
4
|
*
|
|
5
5
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
6
6
|
* @license MIT
|
|
7
|
-
*/function o(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0}function i(t){return e.Buffer&&"function"==typeof e.Buffer.isBuffer?e.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var a=r(4),c=Object.prototype.hasOwnProperty,u=Array.prototype.slice,s="foo"===function(){}.name;function f(t){return Object.prototype.toString.call(t)}function l(t){return!i(t)&&("function"==typeof e.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var p=t.exports=b,d=/\s*function\s+([^\(\s]*)\s*/;function y(t){if(a.isFunction(t)){if(s)return t.name;var e=t.toString().match(d);return e&&e[1]}}function h(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function g(t){if(s||!a.isFunction(t))return a.inspect(t);var e=y(t);return"[Function"+(e?": "+e:"")+"]"}function m(t,e,r,n,o){throw new p.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:o})}function b(t,e){t||m(t,!0,e,"==",p.ok)}function v(t,e,r,n){if(t===e)return!0;if(i(t)&&i(e))return 0===o(t,e);if(a.isDate(t)&&a.isDate(e))return t.getTime()===e.getTime();if(a.isRegExp(t)&&a.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(l(t)&&l(e)&&f(t)===f(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===o(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(i(t)!==i(e))return!1;var c=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==c&&c===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(a.isPrimitive(t)||a.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var o=E(t),i=E(e);if(o&&!i||!o&&i)return!1;if(o)return t=u.call(t),e=u.call(e),v(t,e,r);var c,s,f=x(t),l=x(e);if(f.length!==l.length)return!1;for(f.sort(),l.sort(),s=f.length-1;s>=0;s--)if(f[s]!==l[s])return!1;for(s=f.length-1;s>=0;s--)if(c=f[s],!v(t[c],e[c],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function E(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function j(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,n){var o;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),o=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!o&&m(o,r,"Missing expected exception"+n);var i="string"==typeof n,c=!t&&o&&!r;if((!t&&a.isError(o)&&i&&j(o,r)||c)&&m(o,r,"Got unwanted exception"+n),t&&o&&r&&!j(o,r)||!t&&o)throw o}p.AssertionError=function(t){var e;this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=h(g((e=this).actual),128)+" "+e.operator+" "+h(g(e.expected),128),this.generatedMessage=!0);var r=t.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var o=n.stack,i=y(r),a=o.indexOf("\n"+i);if(a>=0){var c=o.indexOf("\n",a+1);o=o.substring(c+1)}this.stack=o}}},a.inherits(p.AssertionError,Error),p.fail=m,p.ok=b,p.equal=function(t,e,r){t!=e&&m(t,e,r,"==",p.equal)},p.notEqual=function(t,e,r){t==e&&m(t,e,r,"!=",p.notEqual)},p.deepEqual=function(t,e,r){v(t,e,!1)||m(t,e,r,"deepEqual",p.deepEqual)},p.deepStrictEqual=function(t,e,r){v(t,e,!0)||m(t,e,r,"deepStrictEqual",p.deepStrictEqual)},p.notDeepEqual=function(t,e,r){v(t,e,!1)&&m(t,e,r,"notDeepEqual",p.notDeepEqual)},p.notDeepStrictEqual=function t(e,r,n){v(e,r,!0)&&m(e,r,n,"notDeepStrictEqual",t)},p.strictEqual=function(t,e,r){t!==e&&m(t,e,r,"===",p.strictEqual)},p.notStrictEqual=function(t,e,r){t===e&&m(t,e,r,"!==",p.notStrictEqual)},p.throws=function(t,e,r){w(!0,t,e,r)},p.doesNotThrow=function(t,e,r){w(!1,t,e,r)},p.ifError=function(t){if(t)throw t},p.strict=n(function t(e,r){e||m(e,!0,r,"==",t)},p,{equal:p.strictEqual,deepEqual:p.deepStrictEqual,notEqual:p.notStrictEqual,notDeepEqual:p.notDeepStrictEqual}),p.strict.strict=p.strict;var x=Object.keys||function(t){var e=[];for(var r in t)c.call(t,r)&&e.push(r);return e}}).call(this,r(2))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";
|
|
8
|
-
/*
|
|
9
|
-
object-assign
|
|
10
|
-
(c) Sindre Sorhus
|
|
11
|
-
@license MIT
|
|
12
|
-
*/var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,c,u=a(t),s=1;s<arguments.length;s++){for(var f in r=Object(arguments[s]))o.call(r,f)&&(u[f]=r[f]);if(n){c=n(r);for(var l=0;l<c.length;l++)i.call(r,c[l])&&(u[c[l]]=r[c[l]])}}return u}},function(t,e,r){(function(t){var n=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++)r[e[n]]=Object.getOwnPropertyDescriptor(t,e[n]);return r},o=/%[sdj%]/g;e.format=function(t){if(!m(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(c(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,i=n.length,a=String(t).replace(o,function(t){if("%%"===t)return"%";if(r>=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),u=n[r];r<i;u=n[++r])h(u)||!E(u)?a+=" "+u:a+=" "+c(u);return a},e.deprecate=function(r,n){if(void 0!==t&&!0===t.noDeprecation)return r;if(void 0===t)return function(){return e.deprecate(r,n).apply(this,arguments)};var o=!1;return function(){if(!o){if(t.throwDeprecation)throw new Error(n);t.traceDeprecation?console.trace(n):console.error(n),o=!0}return r.apply(this,arguments)}};var i,a={};function c(t,r){var n={seen:[],stylize:s};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),y(r)?n.showHidden=r:r&&e._extend(n,r),b(n.showHidden)&&(n.showHidden=!1),b(n.depth)&&(n.depth=2),b(n.colors)&&(n.colors=!1),b(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),f(n,t,n.depth)}function u(t,e){var r=c.styles[e];return r?"["+c.colors[r][0]+"m"+t+"["+c.colors[r][1]+"m":t}function s(t,e){return t}function f(t,r,n){if(t.customInspect&&r&&x(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var o=r.inspect(n,t);return m(o)||(o=f(t,o,n)),o}var i=function(t,e){if(b(e))return t.stylize("undefined","undefined");if(m(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(g(e))return t.stylize(""+e,"number");if(y(e))return t.stylize(""+e,"boolean");if(h(e))return t.stylize("null","null")}(t,r);if(i)return i;var a=Object.keys(r),c=function(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),w(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(r);if(0===a.length){if(x(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(v(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(j(r))return t.stylize(Date.prototype.toString.call(r),"date");if(w(r))return l(r)}var s,E="",O=!1,q=["{","}"];(d(r)&&(O=!0,q=["[","]"]),x(r))&&(E=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(E=" "+RegExp.prototype.toString.call(r)),j(r)&&(E=" "+Date.prototype.toUTCString.call(r)),w(r)&&(E=" "+l(r)),0!==a.length||O&&0!=r.length?n<0?v(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),s=O?function(t,e,r,n,o){for(var i=[],a=0,c=e.length;a<c;++a)T(e,String(a))?i.push(p(t,e,r,n,String(a),!0)):i.push("");return o.forEach(function(o){o.match(/^\d+$/)||i.push(p(t,e,r,n,o,!0))}),i}(t,r,n,c,a):a.map(function(e){return p(t,r,n,c,e,O)}),t.seen.pop(),function(t,e,r){if(t.reduce(function(t,e){return 0,e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(s,E,q)):q[0]+E+q[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function p(t,e,r,n,o,i){var a,c,u;if((u=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]}).get?c=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(c=t.stylize("[Setter]","special")),T(n,o)||(a="["+o+"]"),c||(t.seen.indexOf(u.value)<0?(c=h(r)?f(t,u.value,null):f(t,u.value,r-1)).indexOf("\n")>-1&&(c=i?c.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+c.split("\n").map(function(t){return" "+t}).join("\n")):c=t.stylize("[Circular]","special")),b(a)){if(i&&o.match(/^\d+$/))return c;(a=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+c}function d(t){return Array.isArray(t)}function y(t){return"boolean"==typeof t}function h(t){return null===t}function g(t){return"number"==typeof t}function m(t){return"string"==typeof t}function b(t){return void 0===t}function v(t){return E(t)&&"[object RegExp]"===O(t)}function E(t){return"object"==typeof t&&null!==t}function j(t){return E(t)&&"[object Date]"===O(t)}function w(t){return E(t)&&("[object Error]"===O(t)||t instanceof Error)}function x(t){return"function"==typeof t}function O(t){return Object.prototype.toString.call(t)}function q(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(b(i)&&(i=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(i)){var n=t.pid;a[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,n,t)}}else a[r]=function(){};return a[r]},e.inspect=c,c.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},c.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=y,e.isNull=h,e.isNullOrUndefined=function(t){return null==t},e.isNumber=g,e.isString=m,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=b,e.isRegExp=v,e.isObject=E,e.isDate=j,e.isError=w,e.isFunction=x,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(6);var S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(){var t=new Date,e=[q(t.getHours()),q(t.getMinutes()),q(t.getSeconds())].join(":");return[t.getDate(),S[t.getMonth()],e].join(" ")}function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",k(),e.format.apply(e,arguments))},e.inherits=r(7),e._extend=function(t,e){if(!e||!E(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};var $="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function P(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if($&&t[$]){var e;if("function"!=typeof(e=t[$]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,$,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,n=new Promise(function(t,n){e=t,r=n}),o=[],i=0;i<arguments.length;i++)o.push(arguments[i]);o.push(function(t,n){t?r(t):e(n)});try{t.apply(this,o)}catch(t){r(t)}return n}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),$&&Object.defineProperty(e,$,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,n(t))},e.promisify.custom=$,e.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var o=r.pop();if("function"!=typeof o)throw new TypeError("The last argument must be of type Function");var i=this,a=function(){return o.apply(i,arguments)};e.apply(this,r).then(function(e){t.nextTick(a,null,e)},function(e){t.nextTick(P,e,a)})}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,n(e)),r}}).call(this,r(5))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var u,s=[],f=!1,l=-1;function p(){f&&u&&(f=!1,u.length?s=u.concat(s):l=-1,s.length&&d())}function d(){if(!f){var t=c(p);f=!0;for(var e=s.length;e;){for(u=s,s=[];++l<e;)u&&u[l].run();l=-1,e=s.length}u=null,f=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function y(t,e){this.fun=t,this.array=e}function h(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];s.push(new y(t,e)),1!==s.length||f||c(d)},y.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=h,o.addListener=h,o.once=h,o.off=h,o.removeListener=h,o.removeAllListeners=h,o.emit=h,o.prependListener=h,o.prependOnceListener=h,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(e,r){e.exports=t},function(t,r){t.exports=e}])});
|
|
7
|
+
*/function o(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0}function i(t){return e.Buffer&&"function"==typeof e.Buffer.isBuffer?e.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var a=r(29),c=Object.prototype.hasOwnProperty,u=Array.prototype.slice,f="foo"===function(){}.name;function l(t){return Object.prototype.toString.call(t)}function s(t){return!i(t)&&("function"==typeof e.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var p=t.exports=v,y=/\s*function\s+([^\(\s]*)\s*/;function d(t){if(a.isFunction(t)){if(f)return t.name;var e=t.toString().match(y);return e&&e[1]}}function g(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function h(t){if(f||!a.isFunction(t))return a.inspect(t);var e=d(t);return"[Function"+(e?": "+e:"")+"]"}function b(t,e,r,n,o){throw new p.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:o})}function v(t,e){t||b(t,!0,e,"==",p.ok)}function m(t,e,r,n){if(t===e)return!0;if(i(t)&&i(e))return 0===o(t,e);if(a.isDate(t)&&a.isDate(e))return t.getTime()===e.getTime();if(a.isRegExp(t)&&a.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(s(t)&&s(e)&&l(t)===l(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===o(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(i(t)!==i(e))return!1;var c=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==c&&c===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(a.isPrimitive(t)||a.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var o=w(t),i=w(e);if(o&&!i||!o&&i)return!1;if(o)return t=u.call(t),e=u.call(e),m(t,e,r);var c,f,l=O(t),s=O(e);if(l.length!==s.length)return!1;for(l.sort(),s.sort(),f=l.length-1;f>=0;f--)if(l[f]!==s[f])return!1;for(f=l.length-1;f>=0;f--)if(c=l[f],!m(t[c],e[c],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function w(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function j(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function E(t,e,r,n){var o;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),o=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!o&&b(o,r,"Missing expected exception"+n);var i="string"==typeof n,c=!t&&o&&!r;if((!t&&a.isError(o)&&i&&j(o,r)||c)&&b(o,r,"Got unwanted exception"+n),t&&o&&r&&!j(o,r)||!t&&o)throw o}p.AssertionError=function(t){var e;this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=g(h((e=this).actual),128)+" "+e.operator+" "+g(h(e.expected),128),this.generatedMessage=!0);var r=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var o=n.stack,i=d(r),a=o.indexOf("\n"+i);if(a>=0){var c=o.indexOf("\n",a+1);o=o.substring(c+1)}this.stack=o}}},a.inherits(p.AssertionError,Error),p.fail=b,p.ok=v,p.equal=function(t,e,r){t!=e&&b(t,e,r,"==",p.equal)},p.notEqual=function(t,e,r){t==e&&b(t,e,r,"!=",p.notEqual)},p.deepEqual=function(t,e,r){m(t,e,!1)||b(t,e,r,"deepEqual",p.deepEqual)},p.deepStrictEqual=function(t,e,r){m(t,e,!0)||b(t,e,r,"deepStrictEqual",p.deepStrictEqual)},p.notDeepEqual=function(t,e,r){m(t,e,!1)&&b(t,e,r,"notDeepEqual",p.notDeepEqual)},p.notDeepStrictEqual=function t(e,r,n){m(e,r,!0)&&b(e,r,n,"notDeepStrictEqual",t)},p.strictEqual=function(t,e,r){t!==e&&b(t,e,r,"===",p.strictEqual)},p.notStrictEqual=function(t,e,r){t===e&&b(t,e,r,"!==",p.notStrictEqual)},p.throws=function(t,e,r){E(!0,t,e,r)},p.doesNotThrow=function(t,e,r){E(!1,t,e,r)},p.ifError=function(t){if(t)throw t},p.strict=n((function t(e,r){e||b(e,!0,r,"==",t)}),p,{equal:p.strictEqual,deepEqual:p.deepStrictEqual,notEqual:p.notStrictEqual,notDeepEqual:p.notDeepStrictEqual}),p.strict.strict=p.strict;var O=Object.keys||function(t){var e=[];for(var r in t)c.call(t,r)&&e.push(r);return e}}).call(this,r(10))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var n=r(12);t.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),r={},n=0;n<e.length;++n)r[e[n]]=e[n];var o=Object.assign({},r),i="";for(var a in o)i+=a;return t!==i}()||function(){if(!Object.assign||!Object.preventExtensions)return!1;var t=Object.preventExtensions({1:2});try{Object.assign(t,"xy")}catch(e){return"y"===t[1]}return!1}()?n:Object.assign:n}},function(t,e,r){"use strict";var n=r(13),o=r(5)(),i=r(15),a=Object,c=i("Array.prototype.push"),u=i("Object.prototype.propertyIsEnumerable"),f=o?Object.getOwnPropertySymbols:null;t.exports=function(t,e){if(null==t)throw new TypeError("target must be an object");var r=a(t);if(1===arguments.length)return r;for(var i=1;i<arguments.length;++i){var l=a(arguments[i]),s=n(l),p=o&&(Object.getOwnPropertySymbols||f);if(p)for(var y=p(l),d=0;d<y.length;++d){var g=y[d];u(l,g)&&c(s,g)}for(var h=0;h<s.length;++h){var b=s[h];if(u(l,b)){var v=l[b];r[b]=v}}}return r}},function(t,e,r){"use strict";var n=Array.prototype.slice,o=r(4),i=Object.keys,a=i?function(t){return i(t)}:r(14),c=Object.keys;a.shim=function(){Object.keys?function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2)||(Object.keys=function(t){return o(t)?c(n.call(t)):c(t)}):Object.keys=a;return Object.keys||a},t.exports=a},function(t,e,r){"use strict";var n;if(!Object.keys){var o=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=r(4),c=Object.prototype.propertyIsEnumerable,u=!c.call({toString:null},"toString"),f=c.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],s=function(t){var e=t.constructor;return e&&e.prototype===t},p={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},y=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!p["$"+t]&&o.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{s(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();n=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===i.call(t),n=a(t),c=e&&"[object String]"===i.call(t),p=[];if(!e&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var d=f&&r;if(c&&t.length>0&&!o.call(t,0))for(var g=0;g<t.length;++g)p.push(String(g));if(n&&t.length>0)for(var h=0;h<t.length;++h)p.push(String(h));else for(var b in t)d&&"prototype"===b||!o.call(t,b)||p.push(String(b));if(u)for(var v=function(t){if("undefined"==typeof window||!y)return s(t);try{return s(t)}catch(t){return!1}}(t),m=0;m<l.length;++m)v&&"constructor"===l[m]||!o.call(t,l[m])||p.push(l[m]);return p}}t.exports=n},function(t,e,r){"use strict";var n=r(0),o=r(25),i=o(n("String.prototype.indexOf"));t.exports=function(t,e){var r=n(t,!!e);return"function"==typeof r&&i(t,".prototype.")>-1?o(r):r}},function(t,e,r){"use strict";t.exports=Error},function(t,e,r){"use strict";t.exports=EvalError},function(t,e,r){"use strict";t.exports=RangeError},function(t,e,r){"use strict";t.exports=ReferenceError},function(t,e,r){"use strict";t.exports=URIError},function(t,e,r){"use strict";var n="undefined"!=typeof Symbol&&Symbol,o=r(5);t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&o())))}},function(t,e,r){"use strict";var n={__proto__:null,foo:{}},o=Object;t.exports=function(){return{__proto__:n}.foo===n.foo&&!(n instanceof o)}},function(t,e,r){"use strict";var n="Function.prototype.bind called on incompatible ",o=Object.prototype.toString,i=Math.max,a=function(t,e){for(var r=[],n=0;n<t.length;n+=1)r[n]=t[n];for(var o=0;o<e.length;o+=1)r[o+t.length]=e[o];return r},c=function(t,e){for(var r=[],n=e||0,o=0;n<t.length;n+=1,o+=1)r[o]=t[n];return r},u=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};t.exports=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==o.apply(e))throw new TypeError(n+e);for(var r,f=c(arguments,1),l=function(){if(this instanceof r){var n=e.apply(this,a(f,arguments));return Object(n)===n?n:this}return e.apply(t,a(f,arguments))},s=i(0,e.length-f.length),p=[],y=0;y<s;y++)p[y]="$"+y;if(r=Function("binder","return function ("+u(p,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,r.prototype=new d,d.prototype=null}return r}},function(t,e,r){"use strict";var n=Function.prototype.call,o=Object.prototype.hasOwnProperty,i=r(2);t.exports=i.call(n,o)},function(t,e,r){"use strict";var n=r(2),o=r(0),i=r(26),a=r(1),c=o("%Function.prototype.apply%"),u=o("%Function.prototype.call%"),f=o("%Reflect.apply%",!0)||n.call(u,c),l=r(3),s=o("%Math.max%");t.exports=function(t){if("function"!=typeof t)throw new a("a function is required");var e=f(n,u,arguments);return i(e,1+s(0,t.length-(arguments.length-1)),!0)};var p=function(){return f(n,c,arguments)};l?l(t.exports,"apply",{value:p}):t.exports.apply=p},function(t,e,r){"use strict";var n=r(0),o=r(27),i=r(28)(),a=r(7),c=r(1),u=n("%Math.floor%");t.exports=function(t,e){if("function"!=typeof t)throw new c("`fn` is not a function");if("number"!=typeof e||e<0||e>4294967295||u(e)!==e)throw new c("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,f=!0;if("length"in t&&a){var l=a(t,"length");l&&!l.configurable&&(n=!1),l&&!l.writable&&(f=!1)}return(n||f||!r)&&(i?o(t,"length",e,!0,!0):o(t,"length",e)),t}},function(t,e,r){"use strict";var n=r(3),o=r(6),i=r(1),a=r(7);t.exports=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new i("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,l=arguments.length>6&&arguments[6],s=!!a&&a(t,e);if(n)n(t,e,{configurable:null===f&&s?s.configurable:!f,enumerable:null===c&&s?s.enumerable:!c,value:r,writable:null===u&&s?s.writable:!u});else{if(!l&&(c||u||f))throw new o("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}}},function(t,e,r){"use strict";var n=r(3),o=function(){return!!n};o.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(t){return!0}},t.exports=o},function(t,e,r){(function(t){var n=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++)r[e[n]]=Object.getOwnPropertyDescriptor(t,e[n]);return r},o=/%[sdj%]/g;e.format=function(t){if(!b(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(c(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,i=n.length,a=String(t).replace(o,(function(t){if("%%"===t)return"%";if(r>=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),u=n[r];r<i;u=n[++r])g(u)||!w(u)?a+=" "+u:a+=" "+c(u);return a},e.deprecate=function(r,n){if(void 0!==t&&!0===t.noDeprecation)return r;if(void 0===t)return function(){return e.deprecate(r,n).apply(this,arguments)};var o=!1;return function(){if(!o){if(t.throwDeprecation)throw new Error(n);t.traceDeprecation?console.trace(n):console.error(n),o=!0}return r.apply(this,arguments)}};var i,a={};function c(t,r){var n={seen:[],stylize:f};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&e._extend(n,r),v(n.showHidden)&&(n.showHidden=!1),v(n.depth)&&(n.depth=2),v(n.colors)&&(n.colors=!1),v(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,t,n.depth)}function u(t,e){var r=c.styles[e];return r?"["+c.colors[r][0]+"m"+t+"["+c.colors[r][1]+"m":t}function f(t,e){return t}function l(t,r,n){if(t.customInspect&&r&&O(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var o=r.inspect(n,t);return b(o)||(o=l(t,o,n)),o}var i=function(t,e){if(v(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(h(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(g(e))return t.stylize("null","null")}(t,r);if(i)return i;var a=Object.keys(r),c=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),E(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return s(r);if(0===a.length){if(O(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(m(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(j(r))return t.stylize(Date.prototype.toString.call(r),"date");if(E(r))return s(r)}var f,w="",x=!1,A=["{","}"];(y(r)&&(x=!0,A=["[","]"]),O(r))&&(w=" [Function"+(r.name?": "+r.name:"")+"]");return m(r)&&(w=" "+RegExp.prototype.toString.call(r)),j(r)&&(w=" "+Date.prototype.toUTCString.call(r)),E(r)&&(w=" "+s(r)),0!==a.length||x&&0!=r.length?n<0?m(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),f=x?function(t,e,r,n,o){for(var i=[],a=0,c=e.length;a<c;++a)k(e,String(a))?i.push(p(t,e,r,n,String(a),!0)):i.push("");return o.forEach((function(o){o.match(/^\d+$/)||i.push(p(t,e,r,n,o,!0))})),i}(t,r,n,c,a):a.map((function(e){return p(t,r,n,c,e,x)})),t.seen.pop(),function(t,e,r){if(t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(f,w,A)):A[0]+w+A[1]}function s(t){return"["+Error.prototype.toString.call(t)+"]"}function p(t,e,r,n,o,i){var a,c,u;if((u=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]}).get?c=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(c=t.stylize("[Setter]","special")),k(n,o)||(a="["+o+"]"),c||(t.seen.indexOf(u.value)<0?(c=g(r)?l(t,u.value,null):l(t,u.value,r-1)).indexOf("\n")>-1&&(c=i?c.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+c.split("\n").map((function(t){return" "+t})).join("\n")):c=t.stylize("[Circular]","special")),v(a)){if(i&&o.match(/^\d+$/))return c;(a=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+c}function y(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function g(t){return null===t}function h(t){return"number"==typeof t}function b(t){return"string"==typeof t}function v(t){return void 0===t}function m(t){return w(t)&&"[object RegExp]"===x(t)}function w(t){return"object"==typeof t&&null!==t}function j(t){return w(t)&&"[object Date]"===x(t)}function E(t){return w(t)&&("[object Error]"===x(t)||t instanceof Error)}function O(t){return"function"==typeof t}function x(t){return Object.prototype.toString.call(t)}function A(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(v(i)&&(i=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(i)){var n=t.pid;a[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,n,t)}}else a[r]=function(){};return a[r]},e.inspect=c,c.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},c.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=y,e.isBoolean=d,e.isNull=g,e.isNullOrUndefined=function(t){return null==t},e.isNumber=h,e.isString=b,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=v,e.isRegExp=m,e.isObject=w,e.isDate=j,e.isError=E,e.isFunction=O,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(31);var S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(){var t=new Date,e=[A(t.getHours()),A(t.getMinutes()),A(t.getSeconds())].join(":");return[t.getDate(),S[t.getMonth()],e].join(" ")}function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",P(),e.format.apply(e,arguments))},e.inherits=r(32),e._extend=function(t,e){if(!e||!w(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};var q="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function F(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(q&&t[q]){var e;if("function"!=typeof(e=t[q]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,q,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,n=new Promise((function(t,n){e=t,r=n})),o=[],i=0;i<arguments.length;i++)o.push(arguments[i]);o.push((function(t,n){t?r(t):e(n)}));try{t.apply(this,o)}catch(t){r(t)}return n}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),q&&Object.defineProperty(e,q,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,n(t))},e.promisify.custom=q,e.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var o=r.pop();if("function"!=typeof o)throw new TypeError("The last argument must be of type Function");var i=this,a=function(){return o.apply(i,arguments)};e.apply(this,r).then((function(e){t.nextTick(a,null,e)}),(function(e){t.nextTick(F,e,a)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,n(e)),r}}).call(this,r(30))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var u,f=[],l=!1,s=-1;function p(){l&&u&&(l=!1,u.length?f=u.concat(f):s=-1,f.length&&y())}function y(){if(!l){var t=c(p);l=!0;for(var e=f.length;e;){for(u=f,f=[];++s<e;)u&&u[s].run();s=-1,e=f.length}u=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function g(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];f.push(new d(t,e)),1!==f.length||l||c(y)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(e,r){e.exports=t},function(t,r){t.exports=e}])}));
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -45,7 +45,17 @@ var trimErr = function(err, str) {
|
|
|
45
45
|
// such as when deeling with rich Objects and types like Date, mongolayer.Document, and functions (and their returns)
|
|
46
46
|
var deepCheck = function(data, schema, options) {
|
|
47
47
|
options = options || {};
|
|
48
|
-
|
|
48
|
+
try {
|
|
49
|
+
_deepCheck(data, schema, ["root"], undefined, options);
|
|
50
|
+
} catch(e) {
|
|
51
|
+
try {
|
|
52
|
+
console.log("deepCheck data:", JSON.stringify(data));
|
|
53
|
+
} catch(e) {
|
|
54
|
+
// if we're unable to stringify the result, we fail silently
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
throw e;
|
|
58
|
+
}
|
|
49
59
|
}
|
|
50
60
|
|
|
51
61
|
// recursive call used by _deepCheck
|
|
@@ -134,15 +144,15 @@ var _deepCheck = function(data, schema, chain, prevContext, options) {
|
|
|
134
144
|
if (schemaItem.class !== undefined) {
|
|
135
145
|
assert.strictEqual(data instanceof schemaItem.class, true, "data at " + chain.join(".") + " was not instanceof the proper class");
|
|
136
146
|
}
|
|
137
|
-
|
|
138
|
-
if (allowExtraKeys === false) {
|
|
139
|
-
var leftKeys = Object.keys(data);
|
|
140
|
-
var rightKeys = Object.keys(schemaItem.data);
|
|
141
|
-
|
|
142
|
-
leftKeys.forEach(val => assert.strictEqual(rightKeys.indexOf(val) > -1, true, "extra key '" + val + "' at " + chain.join(".")));
|
|
143
|
-
}
|
|
144
|
-
|
|
147
|
+
|
|
145
148
|
if (schemaItem.data !== undefined) {
|
|
149
|
+
if (allowExtraKeys === false) {
|
|
150
|
+
var leftKeys = Object.keys(data);
|
|
151
|
+
var rightKeys = Object.keys(schemaItem.data);
|
|
152
|
+
|
|
153
|
+
leftKeys.forEach(val => assert.strictEqual(rightKeys.indexOf(val) > -1, true, "extra key '" + val + "' at " + chain.join(".")));
|
|
154
|
+
}
|
|
155
|
+
|
|
146
156
|
Object.keys(schemaItem.data).forEach(function(key, i) {
|
|
147
157
|
if (key === "_deepCheck_allowExtraKeys") { return; }
|
|
148
158
|
|