| | |
| | | const equalityCache = new WeakMap(); |
| | | |
| | | /** |
| | | * Checks whether source equal true, when both sources are equal. |
| | | * @param {Source} a a source |
| | | * @param {Source} b another source |
| | | * @returns {boolean} true, when both sources are equal |
| | | */ |
| | | const _isSourceEqual = (a, b) => { |
| | | // prefer .buffer(), it's called anyway during emit |
| | | /** @type {Buffer|string} */ |
| | | /** @type {Buffer | string} */ |
| | | let aSource = typeof a.buffer === "function" ? a.buffer() : a.source(); |
| | | /** @type {Buffer|string} */ |
| | | /** @type {Buffer | string} */ |
| | | let bSource = typeof b.buffer === "function" ? b.buffer() : b.source(); |
| | | if (aSource === bSource) return true; |
| | | if (typeof aSource === "string" && typeof bSource === "string") return false; |
| | |
| | | }; |
| | | |
| | | /** |
| | | * Checks whether this object is source equal. |
| | | * @param {Source} a a source |
| | | * @param {Source} b another source |
| | | * @returns {boolean} true, when both sources are equal |