forked from quic-issues/427e7578-d7bf-49c8-aee9-2dd999e25316
implemented frontend including separate message system; started to implement backend
This commit is contained in:
34
yjs-poll/node_modules/lib0/dist/equality.cjs
generated
vendored
Normal file
34
yjs-poll/node_modules/lib0/dist/equality.cjs
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
const EqualityTraitSymbol = Symbol('Equality');
|
||||
|
||||
/**
|
||||
* @typedef {{ [EqualityTraitSymbol]:(other:EqualityTrait)=>boolean }} EqualityTrait
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Utility function to compare any two objects.
|
||||
*
|
||||
* Note that it is expected that the first parameter is more specific than the latter one.
|
||||
*
|
||||
* @example js
|
||||
* class X { [traits.EqualityTraitSymbol] (other) { return other === this } }
|
||||
* class X2 { [traits.EqualityTraitSymbol] (other) { return other === this }, x2 () { return 2 } }
|
||||
* // this is fine
|
||||
* traits.equals(new X2(), new X())
|
||||
* // this is not, because the left type is less specific than the right one
|
||||
* traits.equals(new X(), new X2())
|
||||
*
|
||||
* @template {EqualityTrait} T
|
||||
* @param {NoInfer<T>} a
|
||||
* @param {T} b
|
||||
* @return {boolean}
|
||||
*/
|
||||
const equals = (a, b) => a === b || !!a?.[EqualityTraitSymbol]?.(b) || false;
|
||||
|
||||
exports.EqualityTraitSymbol = EqualityTraitSymbol;
|
||||
exports.equals = equals;
|
||||
//# sourceMappingURL=equality.cjs.map
|
||||
Reference in New Issue
Block a user