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