foxts
Version:
Opinionated collection of common TypeScript utils by @SukkaW
2 lines (1 loc) • 694 B
JavaScript
import{invariant as t}from"./guard.mjs";function e(r=Object.is){return async function(e,n){if(0===e.length)return!1;let o=e.length,a=-1,i=Symbol.asyncIterator in n?n[Symbol.asyncIterator]():Symbol.iterator in n?n[Symbol.iterator]():null;t(i,"source must be iterable or async iterable");let l=await i.next();if(!l.done){let t=l.value;do{if(++a===o||!r(e[a],t))return!1;t=(l=await i.next()).value}while(!l.done)}return a===o-1}}async function r(t,n,o=Object.is){return e(o)(t,n)}function n(t,e){if(0===t.length)return 0===e.length;let r=t.codePointAt(0);return r===e.codePointAt(0)&&(35===r||33===r||t===e)}export{r as compareSource,e as createCompareSource,n as fileEqualWithCommentComparator};