@gjsify/assert 0.3.20 → 0.4.0

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.
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});export{__name};
@@ -1 +1 @@
1
- import{safeInspect as e}from"./inspect-fallback.js";var t=class extends Error{actual;expected;operator;code;generatedMessage;constructor(e){let{actual:t,expected:n,operator:i=`fail`,stackStartFn:a}=e,o=e.message==null,s=o?r(t,n,i):String(e.message);super(s),this.name=`AssertionError`,this.code=`ERR_ASSERTION`,this.actual=t,this.expected=n,this.operator=i,this.generatedMessage=o,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,a||this.constructor)}toString(){return`${this.name} [${this.code}]: ${this.message}`}[Symbol.for(`nodejs.util.inspect.custom`)](e,t){return this.toString()}};const n={deepStrictEqual:`Expected values to be strictly deep-equal:`,strictEqual:`Expected values to be strictly equal:`,strictEqualObject:`Expected "actual" to be reference-equal to "expected":`,deepEqual:`Expected values to be loosely deep-equal:`,notDeepStrictEqual:`Expected "actual" not to be strictly deep-equal to:`,notStrictEqual:`Expected "actual" to be strictly unequal to:`,notStrictEqualObject:`Expected "actual" not to be reference-equal to "expected":`,notDeepEqual:`Expected "actual" not to be loosely deep-equal to:`,notIdentical:`Values have same structure but are not reference-equal:`,notEqual:`Expected "actual" to be loosely unequal to:`,equal:`Expected values to be loosely equal:`,"==":`Expected values to be loosely equal:`,"!=":`Expected "actual" to be loosely unequal to:`,"===":`Expected values to be strictly equal:`,"!==":`Expected "actual" to be strictly unequal to:`,fail:`Failed`};function r(t,r,i){let a=n[i]||`Operator: ${i}`;return i===`fail`?`Failed`:`${a}\n\n+ actual - expected\n\n+ ${e(t)}\n- ${e(r)}\n`}export{t as AssertionError};
1
+ import"./_virtual/_rolldown/runtime.js";import{safeInspect as e}from"./inspect-fallback.js";var AssertionError=class extends Error{actual;expected;operator;code;generatedMessage;constructor(e){let{actual:t,expected:n,operator:r=`fail`,stackStartFn:i}=e,a=e.message==null,o=a?generateMessage(t,n,r):String(e.message);super(o),this.name=`AssertionError`,this.code=`ERR_ASSERTION`,this.actual=t,this.expected=n,this.operator=r,this.generatedMessage=a,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,i||this.constructor)}toString(){return`${this.name} [${this.code}]: ${this.message}`}[Symbol.for(`nodejs.util.inspect.custom`)](e,t){return this.toString()}};const t={deepStrictEqual:`Expected values to be strictly deep-equal:`,strictEqual:`Expected values to be strictly equal:`,strictEqualObject:`Expected "actual" to be reference-equal to "expected":`,deepEqual:`Expected values to be loosely deep-equal:`,notDeepStrictEqual:`Expected "actual" not to be strictly deep-equal to:`,notStrictEqual:`Expected "actual" to be strictly unequal to:`,notStrictEqualObject:`Expected "actual" not to be reference-equal to "expected":`,notDeepEqual:`Expected "actual" not to be loosely deep-equal to:`,notIdentical:`Values have same structure but are not reference-equal:`,notEqual:`Expected "actual" to be loosely unequal to:`,equal:`Expected values to be loosely equal:`,"==":`Expected values to be loosely equal:`,"!=":`Expected "actual" to be loosely unequal to:`,"===":`Expected values to be strictly equal:`,"!==":`Expected "actual" to be strictly unequal to:`,fail:`Failed`};function generateMessage(n,r,i){let a=t[i]||`Operator: ${i}`;return i===`fail`?`Failed`:`${a}\n\n+ actual - expected\n\n+ ${e(n)}\n- ${e(r)}\n`}export{AssertionError};
@@ -1 +1 @@
1
- function e(e){return e instanceof Date}function t(e){return e instanceof RegExp}function n(e){return e instanceof Map}function r(e){return e instanceof Set}function i(e){return e instanceof Error}function a(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer}function o(e){return ArrayBuffer.isView(e)}function s(e){return e instanceof Number||e instanceof String||e instanceof Boolean||e instanceof BigInt||e instanceof Symbol}function c(e){return e instanceof Number}function l(e){return e instanceof String}function u(e){return e instanceof Boolean}function d(e){return typeof BigInt<`u`&&e instanceof Object&&Object.prototype.toString.call(e)===`[object BigInt]`}function f(e){return e instanceof Object&&Object.prototype.toString.call(e)===`[object Symbol]`}function p(e){return e instanceof Float32Array||e instanceof Float64Array}const m=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),h=(e,t)=>Object.prototype.propertyIsEnumerable.call(e,t),g=new Set([Array,ArrayBuffer,Boolean,DataView,Date,Error,Float32Array,Float64Array,Function,Int8Array,Int16Array,Int32Array,Map,Number,Object,Promise,RegExp,Set,String,Symbol,Uint8Array,Uint16Array,Uint32Array,Uint8ClampedArray,BigInt64Array,BigUint64Array,WeakMap,WeakSet]);function _(e,t){let n=Object.getOwnPropertyNames(e),r=[];for(let t of n){let n=Number(t);Number.isInteger(n)&&n>=0&&n<2**32-1&&String(n)===t||h(e,t)&&r.push(t)}if(!t){let t=Object.getOwnPropertySymbols(e);for(let n of t)h(e,n)&&r.push(n)}return r}function v(e,t){return e.source===t.source&&e.flags===t.flags&&e.lastIndex===t.lastIndex}function y(e,t){if(e.byteLength!==t.byteLength)return!1;let n=e,r=t;for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function b(e,t){if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function x(e,t){if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function S(e,t){return c(e)?c(t)&&Object.is(e.valueOf(),t.valueOf()):l(e)?l(t)&&e.valueOf()===t.valueOf():u(e)?u(t)&&e.valueOf()===t.valueOf():d(e)?d(t)&&e[Symbol.toPrimitive](`number`)===t[Symbol.toPrimitive](`number`):f(e)?f(t)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(t):!1}function C(e){return Object.prototype.toString.call(e).slice(8,-1)}function w(e,t,n,r){if(e===t)return e!==0||Object.is(e,t)||n===0;if(n!==0){if(typeof e==`number`)return e!==e&&t!==t;if(typeof t!=`object`||typeof e!=`object`||!e||t===null)return!1}else{if(typeof e!=`object`||!e)return(typeof t!=`object`||!t)&&(e==t||e!==e&&t!==t);if(typeof t!=`object`||!t)return!1}return T(e,t,n,r)}function T(c,l,u,d){if(u===1){if(g.has(c.constructor)||c.constructor!==void 0&&!m(c,`constructor`)){if(c.constructor!==l.constructor)return!1}else if(Object.getPrototypeOf(c)!==Object.getPrototypeOf(l))return!1}let f=Object.prototype.toString.call(c);if(f!==Object.prototype.toString.call(l))return!1;if(Array.isArray(c)){if(!Array.isArray(l)||c.length!==l.length)return!1;let e=_(l,u===0);return e.length===_(c,u===0).length?D(c,l,u,d,1,e):!1}else if(f===`[object Object]`)return D(c,l,u,d,0);else if(e(c)){if(!e(l))return!1;let t=c.getTime(),n=l.getTime();if(t!==n&&!(Number.isNaN(t)&&Number.isNaN(n)))return!1}else if(t(c)){if(!t(l)||!v(c,l))return!1}else if(o(c)){if(C(c)!==C(l))return!1;if(u===0&&p(c)){if(!y(c,l))return!1}else if(!b(c,l))return!1;let e=_(l,u===0);return e.length===_(c,u===0).length?D(c,l,u,d,0,e):!1}else if(r(c))return!r(l)||c.size!==l.size?!1:D(c,l,u,d,2);else if(n(c))return!n(l)||c.size!==l.size?!1:D(c,l,u,d,3);else if(a(c)){if(!a(l)||!x(c,l))return!1}else if(i(c)){if(!i(l)||c.message!==l.message||c.name!==l.name||m(c,`cause`)!==m(l,`cause`)||m(c,`cause`)&&!w(c.cause,l.cause,u,d))return!1}else if(s(c)){if(!S(c,l))return!1}else if(Array.isArray(l)||o(l)||r(l)||n(l)||e(l)||t(l)||a(l)||s(l)||i(l))return!1;return D(c,l,u,d,0)}function E(e,t){return t.filter(t=>h(e,t))}function D(e,t,n,r,i,a){let o=a!==void 0;a===void 0&&(a=Object.keys(t));let s;if(!o){if(a.length!==(s=Object.keys(e)).length)return!1;if(n===1){let n=Object.getOwnPropertySymbols(e);if(n.length!==0){let r=0;for(let i of n)if(h(e,i)){if(!h(t,i))return!1;a.push(i),r++}else if(h(t,i))return!1;let i=Object.getOwnPropertySymbols(t);if(n.length!==i.length&&E(t,i).length!==r)return!1}else{let e=Object.getOwnPropertySymbols(t);if(e.length!==0&&E(t,e).length!==0)return!1}}}return a.length===0&&(i===0||i===1&&t.length===0||t.size===0)?!0:r===null?P(e,t,n,s,a,r,i):O(e,t,n,s,a,r,i)}function O(e,t,n,r,i,a,o){if(a===void 0)return a={set:void 0,a:e,b:t,c:void 0,d:void 0,deep:!1},P(e,t,n,r,i,a,o);if(a.set===void 0){if(a.deep===!1){if(a.a===e)return a.b===t;if(a.b===t)return!1;a.c=e,a.d=t,a.deep=!0;let s=P(e,t,n,r,i,a,o);return a.deep=!1,s}a.set=new Set,a.set.add(a.a),a.set.add(a.b),a.set.add(a.c),a.set.add(a.d)}let{set:s}=a,c=s.size;if(s.add(e),s.add(t),c!==s.size-2)return c===s.size;let l=P(e,t,n,r,i,a,o);return s.delete(e),s.delete(t),l}function k(e){switch(typeof e){case`undefined`:return null;case`object`:return;case`symbol`:return!1;case`string`:e=+e;case`number`:if(e!==e)return!1}return!0}function A(e,t,n){let r=k(n);return r??(!t.has(r)&&e.has(r))}function j(e,t,n,r,i){let a=k(n);if(a!=null)return a;let o=e.get(a);return o===void 0&&!e.has(a)||!w(o,r,0,i)?!1:!t.has(a)&&w(o,r,0,i)}function M(e,t,n,r){let i;for(let r of t)if(!e.has(r)){if((typeof r!=`object`||!r)&&(n!==0||!A(e,t,r)))return!1;i===void 0&&(i=[]),i.push(r)}if(i===void 0)return!0;for(let a of e)if(typeof a==`object`&&a){if(!t.has(a)){let e=!1;for(let t=0;t<i.length;t++)if(w(a,i[t],n,r)){i.splice(t,1),e=!0;break}if(!e)return!1}}else if(!t.has(a)&&(n!==0||!A(t,e,a))){let e=!1;for(let t=0;t<i.length;t++)if(w(a,i[t],n,r)){i.splice(t,1),e=!0;break}if(!e)return!1}return i.length===0}function N(e,t,n,r){let i;for(let[a,o]of t)if(typeof a==`object`&&a){if(i===void 0){if(e.size===1){let[t,i]=e.entries().next().value;return w(t,a,n,r)&&w(i,o,n,r)}i=[]}i.push(a)}else{let s=e.get(a);if(s===void 0&&!e.has(a)||!w(s,o,n,r)){if(n!==0||!j(e,t,a,o,r))return!1;i===void 0&&(i=[]),i.push(a)}}if(i===void 0)return!0;for(let[a,o]of e)if(typeof a==`object`&&a){if(!t.has(a)){let e=!1;for(let s=0;s<i.length;s++){let c=i[s];if(w(a,c,n,r)&&w(o,t.get(c),n,r)){i.splice(s,1),e=!0;break}}if(!e)return!1}}else n===0&&typeof a!=`object`&&(!e.has(a)||w(o,e.get(a),n,r));return i.length===0}function P(e,t,n,r,i,a,o){if(i.length>0){let o=e,s=t,c=0;if(r!==void 0)for(;c<i.length;c++){let e=i[c];if(r[c]!==e)break;if(!w(o[e],s[e],n,a))return!1}for(;c<i.length;c++){let t=i[c],r=Object.getOwnPropertyDescriptor(e,t);if(!r?.enumerable||!w(r.value===void 0?o[t]:r.value,s[t],n,a))return!1}}if(o===1){let r=e,i=t;for(let o=0;o<r.length;o++){if(i[o]===void 0&&!m(t,o)){if(r[o]!==void 0||m(e,o))return!1;continue}if(n!==0&&r[o]===void 0&&!m(e,o)||!w(r[o],i[o],n,a))return!1}}else if(o===2){if(!M(e,t,n,a))return!1}else if(o===3&&!N(e,t,n,a))return!1;return!0}let F=function(e,t,n){try{return w(e,t,n,null)}catch{return F=(e,t,n)=>w(e,t,n,void 0),w(e,t,n,void 0)}};function I(e,t){return F(e,t,0)}function L(e,t){return F(e,t,1)}export{I as isDeepEqual,L as isDeepStrictEqual};
1
+ import"./_virtual/_rolldown/runtime.js";function isDate(e){return e instanceof Date}function isRegExp(e){return e instanceof RegExp}function isMap(e){return e instanceof Map}function isSet(e){return e instanceof Set}function isError(e){return e instanceof Error}function isAnyArrayBuffer(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer}function isArrayBufferView(e){return ArrayBuffer.isView(e)}function isBoxedPrimitive(e){return e instanceof Number||e instanceof String||e instanceof Boolean||e instanceof BigInt||e instanceof Symbol}function isNumberObject(e){return e instanceof Number}function isStringObject(e){return e instanceof String}function isBooleanObject(e){return e instanceof Boolean}function isBigIntObject(e){return typeof BigInt<`u`&&e instanceof Object&&Object.prototype.toString.call(e)===`[object BigInt]`}function isSymbolObject(e){return e instanceof Object&&Object.prototype.toString.call(e)===`[object Symbol]`}function isFloatTypedArray(e){return e instanceof Float32Array||e instanceof Float64Array}const hasOwn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),hasEnumerable=(e,t)=>Object.prototype.propertyIsEnumerable.call(e,t),e=new Set([Array,ArrayBuffer,Boolean,DataView,Date,Error,Float32Array,Float64Array,Function,Int8Array,Int16Array,Int32Array,Map,Number,Object,Promise,RegExp,Set,String,Symbol,Uint8Array,Uint16Array,Uint32Array,Uint8ClampedArray,BigInt64Array,BigUint64Array,WeakMap,WeakSet]);function getOwnNonIndexProperties(e,t){let n=Object.getOwnPropertyNames(e),r=[];for(let t of n){let n=Number(t);Number.isInteger(n)&&n>=0&&n<2**32-1&&String(n)===t||hasEnumerable(e,t)&&r.push(t)}if(!t){let t=Object.getOwnPropertySymbols(e);for(let n of t)hasEnumerable(e,n)&&r.push(n)}return r}function areSimilarRegExps(e,t){return e.source===t.source&&e.flags===t.flags&&e.lastIndex===t.lastIndex}function areSimilarFloatArrays(e,t){if(e.byteLength!==t.byteLength)return!1;let n=e,r=t;for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function areSimilarTypedArrays(e,t){if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function areEqualArrayBuffers(e,t){if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function isEqualBoxedPrimitive(e,t){return isNumberObject(e)?isNumberObject(t)&&Object.is(e.valueOf(),t.valueOf()):isStringObject(e)?isStringObject(t)&&e.valueOf()===t.valueOf():isBooleanObject(e)?isBooleanObject(t)&&e.valueOf()===t.valueOf():isBigIntObject(e)?isBigIntObject(t)&&e[Symbol.toPrimitive](`number`)===t[Symbol.toPrimitive](`number`):isSymbolObject(e)?isSymbolObject(t)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(t):!1}function getTypedArrayTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function innerDeepEqual(e,t,n,r){if(e===t)return e!==0||Object.is(e,t)||n===0;if(n!==0){if(typeof e==`number`)return e!==e&&t!==t;if(typeof t!=`object`||typeof e!=`object`||!e||t===null)return!1}else{if(typeof e!=`object`||!e)return(typeof t!=`object`||!t)&&(e==t||e!==e&&t!==t);if(typeof t!=`object`||!t)return!1}return objectComparisonStart(e,t,n,r)}function objectComparisonStart(t,n,r,i){if(r===1){if(e.has(t.constructor)||t.constructor!==void 0&&!hasOwn(t,`constructor`)){if(t.constructor!==n.constructor)return!1}else if(Object.getPrototypeOf(t)!==Object.getPrototypeOf(n))return!1}let a=Object.prototype.toString.call(t);if(a!==Object.prototype.toString.call(n))return!1;if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;let e=getOwnNonIndexProperties(n,r===0);return e.length===getOwnNonIndexProperties(t,r===0).length?keyCheck(t,n,r,i,1,e):!1}else if(a===`[object Object]`)return keyCheck(t,n,r,i,0);else if(isDate(t)){if(!isDate(n))return!1;let e=t.getTime(),r=n.getTime();if(e!==r&&!(Number.isNaN(e)&&Number.isNaN(r)))return!1}else if(isRegExp(t)){if(!isRegExp(n)||!areSimilarRegExps(t,n))return!1}else if(isArrayBufferView(t)){if(getTypedArrayTag(t)!==getTypedArrayTag(n))return!1;if(r===0&&isFloatTypedArray(t)){if(!areSimilarFloatArrays(t,n))return!1}else if(!areSimilarTypedArrays(t,n))return!1;let e=getOwnNonIndexProperties(n,r===0);return e.length===getOwnNonIndexProperties(t,r===0).length?keyCheck(t,n,r,i,0,e):!1}else if(isSet(t))return!isSet(n)||t.size!==n.size?!1:keyCheck(t,n,r,i,2);else if(isMap(t))return!isMap(n)||t.size!==n.size?!1:keyCheck(t,n,r,i,3);else if(isAnyArrayBuffer(t)){if(!isAnyArrayBuffer(n)||!areEqualArrayBuffers(t,n))return!1}else if(isError(t)){if(!isError(n)||t.message!==n.message||t.name!==n.name||hasOwn(t,`cause`)!==hasOwn(n,`cause`)||hasOwn(t,`cause`)&&!innerDeepEqual(t.cause,n.cause,r,i))return!1}else if(isBoxedPrimitive(t)){if(!isEqualBoxedPrimitive(t,n))return!1}else if(Array.isArray(n)||isArrayBufferView(n)||isSet(n)||isMap(n)||isDate(n)||isRegExp(n)||isAnyArrayBuffer(n)||isBoxedPrimitive(n)||isError(n))return!1;return keyCheck(t,n,r,i,0)}function getEnumerables(e,t){return t.filter(t=>hasEnumerable(e,t))}function keyCheck(e,t,n,r,i,a){let o=a!==void 0;a===void 0&&(a=Object.keys(t));let s;if(!o){if(a.length!==(s=Object.keys(e)).length)return!1;if(n===1){let n=Object.getOwnPropertySymbols(e);if(n.length!==0){let r=0;for(let i of n)if(hasEnumerable(e,i)){if(!hasEnumerable(t,i))return!1;a.push(i),r++}else if(hasEnumerable(t,i))return!1;let i=Object.getOwnPropertySymbols(t);if(n.length!==i.length&&getEnumerables(t,i).length!==r)return!1}else{let e=Object.getOwnPropertySymbols(t);if(e.length!==0&&getEnumerables(t,e).length!==0)return!1}}}return a.length===0&&(i===0||i===1&&t.length===0||t.size===0)?!0:r===null?objEquiv(e,t,n,s,a,r,i):handleCycles(e,t,n,s,a,r,i)}function handleCycles(e,t,n,r,i,a,o){if(a===void 0)return a={set:void 0,a:e,b:t,c:void 0,d:void 0,deep:!1},objEquiv(e,t,n,r,i,a,o);if(a.set===void 0){if(a.deep===!1){if(a.a===e)return a.b===t;if(a.b===t)return!1;a.c=e,a.d=t,a.deep=!0;let s=objEquiv(e,t,n,r,i,a,o);return a.deep=!1,s}a.set=new Set,a.set.add(a.a),a.set.add(a.b),a.set.add(a.c),a.set.add(a.d)}let{set:s}=a,c=s.size;if(s.add(e),s.add(t),c!==s.size-2)return c===s.size;let l=objEquiv(e,t,n,r,i,a,o);return s.delete(e),s.delete(t),l}function findLooseMatchingPrimitives(e){switch(typeof e){case`undefined`:return null;case`object`:return;case`symbol`:return!1;case`string`:e=+e;case`number`:if(e!==e)return!1}return!0}function setMightHaveLoosePrim(e,t,n){let r=findLooseMatchingPrimitives(n);return r??(!t.has(r)&&e.has(r))}function mapMightHaveLoosePrim(e,t,n,r,i){let a=findLooseMatchingPrimitives(n);if(a!=null)return a;let o=e.get(a);return o===void 0&&!e.has(a)||!innerDeepEqual(o,r,0,i)?!1:!t.has(a)&&innerDeepEqual(o,r,0,i)}function setEquiv(e,t,n,r){let i;for(let r of t)if(!e.has(r)){if((typeof r!=`object`||!r)&&(n!==0||!setMightHaveLoosePrim(e,t,r)))return!1;i===void 0&&(i=[]),i.push(r)}if(i===void 0)return!0;for(let a of e)if(typeof a==`object`&&a){if(!t.has(a)){let e=!1;for(let t=0;t<i.length;t++)if(innerDeepEqual(a,i[t],n,r)){i.splice(t,1),e=!0;break}if(!e)return!1}}else if(!t.has(a)&&(n!==0||!setMightHaveLoosePrim(t,e,a))){let e=!1;for(let t=0;t<i.length;t++)if(innerDeepEqual(a,i[t],n,r)){i.splice(t,1),e=!0;break}if(!e)return!1}return i.length===0}function mapEquiv(e,t,n,r){let i;for(let[a,o]of t)if(typeof a==`object`&&a){if(i===void 0){if(e.size===1){let[t,i]=e.entries().next().value;return innerDeepEqual(t,a,n,r)&&innerDeepEqual(i,o,n,r)}i=[]}i.push(a)}else{let s=e.get(a);if(s===void 0&&!e.has(a)||!innerDeepEqual(s,o,n,r)){if(n!==0||!mapMightHaveLoosePrim(e,t,a,o,r))return!1;i===void 0&&(i=[]),i.push(a)}}if(i===void 0)return!0;for(let[a,o]of e)if(typeof a==`object`&&a){if(!t.has(a)){let e=!1;for(let s=0;s<i.length;s++){let c=i[s];if(innerDeepEqual(a,c,n,r)&&innerDeepEqual(o,t.get(c),n,r)){i.splice(s,1),e=!0;break}}if(!e)return!1}}else n===0&&typeof a!=`object`&&(!e.has(a)||innerDeepEqual(o,e.get(a),n,r));return i.length===0}function objEquiv(e,t,n,r,i,a,o){if(i.length>0){let o=e,s=t,c=0;if(r!==void 0)for(;c<i.length;c++){let e=i[c];if(r[c]!==e)break;if(!innerDeepEqual(o[e],s[e],n,a))return!1}for(;c<i.length;c++){let t=i[c],r=Object.getOwnPropertyDescriptor(e,t);if(!r?.enumerable||!innerDeepEqual(r.value===void 0?o[t]:r.value,s[t],n,a))return!1}}if(o===1){let r=e,i=t;for(let o=0;o<r.length;o++){if(i[o]===void 0&&!hasOwn(t,o)){if(r[o]!==void 0||hasOwn(e,o))return!1;continue}if(n!==0&&r[o]===void 0&&!hasOwn(e,o)||!innerDeepEqual(r[o],i[o],n,a))return!1}}else if(o===2){if(!setEquiv(e,t,n,a))return!1}else if(o===3&&!mapEquiv(e,t,n,a))return!1;return!0}let detectCycles=function(e,t,n){try{return innerDeepEqual(e,t,n,null)}catch{return detectCycles=(e,t,n)=>innerDeepEqual(e,t,n,void 0),innerDeepEqual(e,t,n,void 0)}};function isDeepEqual(e,t){return detectCycles(e,t,0)}function isDeepStrictEqual(e,t){return detectCycles(e,t,1)}export{isDeepEqual,isDeepStrictEqual};
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{AssertionError as e}from"./assertion-error.js";import{isDeepEqual as t,isDeepStrictEqual as n}from"./deep-equal.js";function r(t){throw t.message instanceof Error?t.message:new e({actual:t.actual,expected:t.expected,message:t.message,operator:t.operator,stackStartFn:t.stackStartFn})}function i(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}function a(e,t){e||r({actual:e,expected:!0,message:t,operator:`==`,stackStartFn:a})}function o(e,t,n){e!=t&&r({actual:e,expected:t,message:n,operator:`==`,stackStartFn:o})}function s(e,t,n){e==t&&r({actual:e,expected:t,message:n,operator:`!=`,stackStartFn:s})}function c(e,t,n){Object.is(e,t)||r({actual:e,expected:t,message:n,operator:`strictEqual`,stackStartFn:c})}function l(e,t,n){Object.is(e,t)&&r({actual:e,expected:t,message:n,operator:`notStrictEqual`,stackStartFn:l})}function u(e,n,i){t(e,n)||r({actual:e,expected:n,message:i,operator:`deepEqual`,stackStartFn:u})}function d(e,n,i){t(e,n)&&r({actual:e,expected:n,message:i,operator:`notDeepEqual`,stackStartFn:d})}function f(e,t,i){n(e,t)||r({actual:e,expected:t,message:i,operator:`deepStrictEqual`,stackStartFn:f})}function p(e,t,i){n(e,t)&&r({actual:e,expected:t,message:i,operator:`notDeepStrictEqual`,stackStartFn:p})}function m(e){let t=Symbol(`NO_EXCEPTION`);try{e()}catch(e){return e}return t}async function h(e){let t=Symbol(`NO_EXCEPTION`);try{if(typeof e==`function`){let t=e();i(t)&&await t}else await e}catch(e){return e}return t}function g(t,r,i,a){if(r===void 0)return!0;if(r instanceof RegExp){let n=String(t);if(r.test(n))return!0;throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}if(typeof r==`function`){if(r.prototype!==void 0&&t instanceof r)return!0;if(Error.isPrototypeOf(r))return!1;if(r.call({},t)!==!0)throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a});return!0}if(typeof r==`object`&&r){let o=Object.keys(r);for(let s of o){let o=r,c=t;if(typeof c[s]==`string`&&o[s]instanceof RegExp){if(!o[s].test(c[s]))throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}else if(!n(c[s],o[s]))throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}return!0}return!0}function _(e,t,n){if(typeof e!=`function`)throw TypeError(`The "fn" argument must be of type function.`);let i;typeof t==`string`?(n=t,i=void 0):i=t;let a=m(e);typeof a==`symbol`&&r({actual:void 0,expected:i,message:n||`Missing expected exception.`,operator:`throws`,stackStartFn:_}),i!==void 0&&g(a,i,n,_)}function v(e,t,n){if(typeof e!=`function`)throw TypeError(`The "fn" argument must be of type function.`);let i;typeof t==`string`?(n=t,i=void 0):i=t;let a=m(e);if(typeof a!=`symbol`)throw i!==void 0&&typeof i==`function`&&i.prototype!==void 0&&a instanceof i&&r({actual:a,expected:i,message:n||`Got unwanted exception.\n${a&&a.message?a.message:``}`,operator:`doesNotThrow`,stackStartFn:v}),(i===void 0||typeof i==`function`&&i.prototype!==void 0&&a instanceof i)&&r({actual:a,expected:i,message:n||`Got unwanted exception.\n${a&&a.message?a.message:``}`,operator:`doesNotThrow`,stackStartFn:v}),a}async function y(e,t,n){let i;typeof t==`string`?(n=t,i=void 0):i=t;let a=await h(e);typeof a==`symbol`&&r({actual:void 0,expected:i,message:n||`Missing expected rejection.`,operator:`rejects`,stackStartFn:y}),i!==void 0&&g(a,i,n,y)}async function b(e,t,n){let i;typeof t==`string`?(n=t,i=void 0):i=t;let a=await h(e);typeof a!=`symbol`&&r({actual:a,expected:i,message:n||`Got unwanted rejection.\n${a&&a.message?a.message:``}`,operator:`doesNotReject`,stackStartFn:b})}function x(t,n,r,i,a){if(arguments.length===0||arguments.length===1){let n=arguments.length===0?`Failed`:typeof t==`string`?t:void 0;throw t instanceof Error?t:new e({message:n||`Failed`,operator:`fail`,stackStartFn:x})}throw new e({actual:t,expected:n,message:r,operator:i||`fail`,stackStartFn:a||x})}function S(t){if(t!=null){let n=`ifError got unwanted exception: `;typeof t==`object`&&typeof t.message==`string`?t.message.length===0&&t.constructor?n+=t.constructor.name:n+=t.message:n+=String(t);let r=new e({actual:t,expected:null,message:n,operator:`ifError`,stackStartFn:S}),i=t instanceof Error?t.stack:void 0;throw i&&(r.origStack=i),r}}function C(e,t,n){if(typeof e!=`string`)throw TypeError(`The "actual" argument must be of type string.`);if(!(t instanceof RegExp))throw TypeError(`The "expected" argument must be an instance of RegExp.`);t.test(e)||r({actual:e,expected:t,message:n||`The input did not match the regular expression ${t}. Input:\n\n'${e}'\n`,operator:`match`,stackStartFn:C})}function w(e,t,n){if(typeof e!=`string`)throw TypeError(`The "actual" argument must be of type string.`);if(!(t instanceof RegExp))throw TypeError(`The "expected" argument must be an instance of RegExp.`);t.test(e)&&r({actual:e,expected:t,message:n||`The input was expected to not match the regular expression ${t}. Input:\n\n'${e}'\n`,operator:`doesNotMatch`,stackStartFn:w})}const T=Object.assign(function(e,t){a(e,t)},{AssertionError:e,ok:a,equal:c,notEqual:l,deepEqual:f,notDeepEqual:p,deepStrictEqual:f,notDeepStrictEqual:p,strictEqual:c,notStrictEqual:l,throws:_,doesNotThrow:v,rejects:y,doesNotReject:b,fail:x,ifError:S,match:C,doesNotMatch:w,strict:void 0});T.strict=T;const E=Object.assign(function(e,t){a(e,t)},{AssertionError:e,ok:a,equal:o,notEqual:s,strictEqual:c,notStrictEqual:l,deepEqual:u,notDeepEqual:d,deepStrictEqual:f,notDeepStrictEqual:p,throws:_,doesNotThrow:v,rejects:y,doesNotReject:b,fail:x,ifError:S,match:C,doesNotMatch:w,strict:T});export{e as AssertionError,u as deepEqual,f as deepStrictEqual,E as default,w as doesNotMatch,b as doesNotReject,v as doesNotThrow,o as equal,x as fail,S as ifError,C as match,d as notDeepEqual,p as notDeepStrictEqual,s as notEqual,l as notStrictEqual,a as ok,y as rejects,T as strict,c as strictEqual,_ as throws};
1
+ import"./_virtual/_rolldown/runtime.js";import{AssertionError as e}from"./assertion-error.js";import{isDeepEqual as t,isDeepStrictEqual as n}from"./deep-equal.js";function innerFail(t){throw t.message instanceof Error?t.message:new e({actual:t.actual,expected:t.expected,message:t.message,operator:t.operator,stackStartFn:t.stackStartFn})}function isPromiseLike(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}function ok(e,t){e||innerFail({actual:e,expected:!0,message:t,operator:`==`,stackStartFn:ok})}function equal(e,t,n){e!=t&&innerFail({actual:e,expected:t,message:n,operator:`==`,stackStartFn:equal})}function notEqual(e,t,n){e==t&&innerFail({actual:e,expected:t,message:n,operator:`!=`,stackStartFn:notEqual})}function strictEqual(e,t,n){Object.is(e,t)||innerFail({actual:e,expected:t,message:n,operator:`strictEqual`,stackStartFn:strictEqual})}function notStrictEqual(e,t,n){Object.is(e,t)&&innerFail({actual:e,expected:t,message:n,operator:`notStrictEqual`,stackStartFn:notStrictEqual})}function deepEqual(e,n,r){t(e,n)||innerFail({actual:e,expected:n,message:r,operator:`deepEqual`,stackStartFn:deepEqual})}function notDeepEqual(e,n,r){t(e,n)&&innerFail({actual:e,expected:n,message:r,operator:`notDeepEqual`,stackStartFn:notDeepEqual})}function deepStrictEqual(e,t,r){n(e,t)||innerFail({actual:e,expected:t,message:r,operator:`deepStrictEqual`,stackStartFn:deepStrictEqual})}function notDeepStrictEqual(e,t,r){n(e,t)&&innerFail({actual:e,expected:t,message:r,operator:`notDeepStrictEqual`,stackStartFn:notDeepStrictEqual})}function getActual(e){let t=Symbol(`NO_EXCEPTION`);try{e()}catch(e){return e}return t}async function getActualAsync(e){let t=Symbol(`NO_EXCEPTION`);try{if(typeof e==`function`){let t=e();isPromiseLike(t)&&await t}else await e}catch(e){return e}return t}function expectedException(t,r,i,a){if(r===void 0)return!0;if(r instanceof RegExp){let n=String(t);if(r.test(n))return!0;throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}if(typeof r==`function`){if(r.prototype!==void 0&&t instanceof r)return!0;if(Error.isPrototypeOf(r))return!1;if(r.call({},t)!==!0)throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a});return!0}if(typeof r==`object`&&r){let o=Object.keys(r);for(let s of o){let o=r,c=t;if(typeof c[s]==`string`&&o[s]instanceof RegExp){if(!o[s].test(c[s]))throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}else if(!n(c[s],o[s]))throw new e({actual:t,expected:r,message:i,operator:a.name,stackStartFn:a})}return!0}return!0}function throws(e,t,n){if(typeof e!=`function`)throw TypeError(`The "fn" argument must be of type function.`);let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=getActual(e);typeof i==`symbol`&&innerFail({actual:void 0,expected:r,message:n||`Missing expected exception.`,operator:`throws`,stackStartFn:throws}),r!==void 0&&expectedException(i,r,n,throws)}function doesNotThrow(e,t,n){if(typeof e!=`function`)throw TypeError(`The "fn" argument must be of type function.`);let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=getActual(e);if(typeof i!=`symbol`)throw r!==void 0&&typeof r==`function`&&r.prototype!==void 0&&i instanceof r&&innerFail({actual:i,expected:r,message:n||`Got unwanted exception.\n${i&&i.message?i.message:``}`,operator:`doesNotThrow`,stackStartFn:doesNotThrow}),(r===void 0||typeof r==`function`&&r.prototype!==void 0&&i instanceof r)&&innerFail({actual:i,expected:r,message:n||`Got unwanted exception.\n${i&&i.message?i.message:``}`,operator:`doesNotThrow`,stackStartFn:doesNotThrow}),i}async function rejects(e,t,n){let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=await getActualAsync(e);typeof i==`symbol`&&innerFail({actual:void 0,expected:r,message:n||`Missing expected rejection.`,operator:`rejects`,stackStartFn:rejects}),r!==void 0&&expectedException(i,r,n,rejects)}async function doesNotReject(e,t,n){let r;typeof t==`string`?(n=t,r=void 0):r=t;let i=await getActualAsync(e);typeof i!=`symbol`&&innerFail({actual:i,expected:r,message:n||`Got unwanted rejection.\n${i&&i.message?i.message:``}`,operator:`doesNotReject`,stackStartFn:doesNotReject})}function fail(t,n,r,i,a){if(arguments.length===0||arguments.length===1){let n=arguments.length===0?`Failed`:typeof t==`string`?t:void 0;throw t instanceof Error?t:new e({message:n||`Failed`,operator:`fail`,stackStartFn:fail})}throw new e({actual:t,expected:n,message:r,operator:i||`fail`,stackStartFn:a||fail})}function ifError(t){if(t!=null){let n=`ifError got unwanted exception: `;typeof t==`object`&&typeof t.message==`string`?t.message.length===0&&t.constructor?n+=t.constructor.name:n+=t.message:n+=String(t);let r=new e({actual:t,expected:null,message:n,operator:`ifError`,stackStartFn:ifError}),i=t instanceof Error?t.stack:void 0;throw i&&(r.origStack=i),r}}function match(e,t,n){if(typeof e!=`string`)throw TypeError(`The "actual" argument must be of type string.`);if(!(t instanceof RegExp))throw TypeError(`The "expected" argument must be an instance of RegExp.`);t.test(e)||innerFail({actual:e,expected:t,message:n||`The input did not match the regular expression ${t}. Input:\n\n'${e}'\n`,operator:`match`,stackStartFn:match})}function doesNotMatch(e,t,n){if(typeof e!=`string`)throw TypeError(`The "actual" argument must be of type string.`);if(!(t instanceof RegExp))throw TypeError(`The "expected" argument must be an instance of RegExp.`);t.test(e)&&innerFail({actual:e,expected:t,message:n||`The input was expected to not match the regular expression ${t}. Input:\n\n'${e}'\n`,operator:`doesNotMatch`,stackStartFn:doesNotMatch})}const r=Object.assign(function strict(e,t){ok(e,t)},{AssertionError:e,ok,equal:strictEqual,notEqual:notStrictEqual,deepEqual:deepStrictEqual,notDeepEqual:notDeepStrictEqual,deepStrictEqual,notDeepStrictEqual,strictEqual,notStrictEqual,throws,doesNotThrow,rejects,doesNotReject,fail,ifError,match,doesNotMatch,strict:void 0});r.strict=r;const i=Object.assign(function assert(e,t){ok(e,t)},{AssertionError:e,ok,equal,notEqual,strictEqual,notStrictEqual,deepEqual,notDeepEqual,deepStrictEqual,notDeepStrictEqual,throws,doesNotThrow,rejects,doesNotReject,fail,ifError,match,doesNotMatch,strict:r});export{e as AssertionError,deepEqual,deepStrictEqual,i as default,doesNotMatch,doesNotReject,doesNotThrow,equal,fail,ifError,match,notDeepEqual,notDeepStrictEqual,notEqual,notStrictEqual,ok,rejects,r as strict,strictEqual,throws};
@@ -1 +1 @@
1
- function e(e,n=3){if(e===null)return`null`;if(e===void 0)return`undefined`;switch(typeof e){case`string`:return e.length>128?`'${e.slice(0,128)}...'`:`'${e}'`;case`number`:case`boolean`:case`bigint`:return String(e);case`symbol`:return e.toString();case`function`:return`[Function: ${e.name||`anonymous`}]`;case`object`:return t(e,n)}return String(e)}function t(e,t,r=new WeakSet){if(r.has(e))return`[Circular]`;if(r.add(e),e instanceof Date)return e.toISOString();if(e instanceof RegExp)return e.toString();if(e instanceof Error)return`[${e.constructor.name}: ${e.message}]`;if(e instanceof Map){if(t<=0)return`Map(${e.size}) { ... }`;let i=[...e.entries()].slice(0,10).map(([e,i])=>`${n(e,t-1,r)} => ${n(i,t-1,r)}`),a=e.size>10?`, ...`:``;return`Map(${e.size}) { ${i.join(`, `)}${a} }`}if(e instanceof Set){if(t<=0)return`Set(${e.size}) { ... }`;let i=[...e.values()].slice(0,10).map(e=>n(e,t-1,r)),a=e.size>10?`, ...`:``;return`Set(${e.size}) { ${i.join(`, `)}${a} }`}if(ArrayBuffer.isView(e)){let t=e.constructor.name,n=e instanceof DataView?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e,r=`length`in n?n.length:0,i=Math.min(r,10),a=[];for(let e=0;e<i;e++)a.push(String(n[e]));let o=r>10?`, ...`:``;return`${t}(${r}) [ ${a.join(`, `)}${o} ]`}if(Array.isArray(e)){if(t<=0)return`[ ... ]`;let i=e.slice(0,10).map(e=>n(e,t-1,r)),a=e.length>10?`, ...`:``;return`[ ${i.join(`, `)}${a} ]`}if(t<=0)return`{ ... }`;let i=Object.keys(e),a=i.slice(0,10).map(i=>`${i}: ${n(e[i],t-1,r)}`),o=i.length>10?`, ...`:``;return`${e.constructor&&e.constructor.name!==`Object`?`${e.constructor.name} `:``}{ ${a.join(`, `)}${o} }`}function n(n,r,i){return n===null?`null`:n===void 0?`undefined`:typeof n==`object`?t(n,r,i):e(n,r)}export{e as safeInspect};
1
+ import"./_virtual/_rolldown/runtime.js";function safeInspect(e,t=3){if(e===null)return`null`;if(e===void 0)return`undefined`;switch(typeof e){case`string`:return e.length>128?`'${e.slice(0,128)}...'`:`'${e}'`;case`number`:case`boolean`:case`bigint`:return String(e);case`symbol`:return e.toString();case`function`:return`[Function: ${e.name||`anonymous`}]`;case`object`:return inspectObject(e,t)}return String(e)}function inspectObject(e,t,n=new WeakSet){if(n.has(e))return`[Circular]`;if(n.add(e),e instanceof Date)return e.toISOString();if(e instanceof RegExp)return e.toString();if(e instanceof Error)return`[${e.constructor.name}: ${e.message}]`;if(e instanceof Map){if(t<=0)return`Map(${e.size}) { ... }`;let r=[...e.entries()].slice(0,10).map(([e,r])=>`${inspectInner(e,t-1,n)} => ${inspectInner(r,t-1,n)}`),i=e.size>10?`, ...`:``;return`Map(${e.size}) { ${r.join(`, `)}${i} }`}if(e instanceof Set){if(t<=0)return`Set(${e.size}) { ... }`;let r=[...e.values()].slice(0,10).map(e=>inspectInner(e,t-1,n)),i=e.size>10?`, ...`:``;return`Set(${e.size}) { ${r.join(`, `)}${i} }`}if(ArrayBuffer.isView(e)){let t=e.constructor.name,n=e instanceof DataView?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e,r=`length`in n?n.length:0,i=Math.min(r,10),a=[];for(let e=0;e<i;e++)a.push(String(n[e]));let o=r>10?`, ...`:``;return`${t}(${r}) [ ${a.join(`, `)}${o} ]`}if(Array.isArray(e)){if(t<=0)return`[ ... ]`;let r=e.slice(0,10).map(e=>inspectInner(e,t-1,n)),i=e.length>10?`, ...`:``;return`[ ${r.join(`, `)}${i} ]`}if(t<=0)return`{ ... }`;let r=Object.keys(e),i=r.slice(0,10).map(r=>`${r}: ${inspectInner(e[r],t-1,n)}`),a=r.length>10?`, ...`:``;return`${e.constructor&&e.constructor.name!==`Object`?`${e.constructor.name} `:``}{ ${i.join(`, `)}${a} }`}function inspectInner(e,t,n){return e===null?`null`:e===void 0?`undefined`:typeof e==`object`?inspectObject(e,t,n):safeInspect(e,t)}export{safeInspect};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/assert",
3
- "version": "0.3.20",
3
+ "version": "0.4.0",
4
4
  "description": "Node.js assert module for Gjs",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -35,8 +35,8 @@
35
35
  "assert"
36
36
  ],
37
37
  "devDependencies": {
38
- "@gjsify/cli": "^0.3.20",
39
- "@gjsify/unit": "^0.3.20",
38
+ "@gjsify/cli": "^0.4.0",
39
+ "@gjsify/unit": "^0.4.0",
40
40
  "@types/node": "^25.6.2",
41
41
  "typescript": "^6.0.3"
42
42
  }