File tree Expand file tree Collapse file tree 3 files changed +5
-19
lines changed Expand file tree Collapse file tree 3 files changed +5
-19
lines changed Original file line number Diff line number Diff line change 157157 "eslintConfig" : {
158158 "extends" : " ipfs" ,
159159 "parserOptions" : {
160- "sourceType" : " module" ,
161- "ecmaVersion" : 13
160+ "sourceType" : " module"
162161 }
163162 },
164163 "release" : {
Original file line number Diff line number Diff line change @@ -61,9 +61,6 @@ const baseCache = cid => {
6161 */
6262
6363export class CID {
64- /** @type {CID } */
65- #asCID
66-
6764 /**
6865 * @param {Version } version - Version of the CID
6966 * @param {Format } code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
@@ -89,11 +86,7 @@ export class CID {
8986
9087 // Circular reference
9188 /** @readonly */
92- this . #asCID = this
93- }
94-
95- get asCID ( ) {
96- return this . #asCID
89+ this . asCID = this
9790 }
9891
9992 /**
Original file line number Diff line number Diff line change @@ -697,21 +697,15 @@ describe('CID', () => {
697697 assert . throws ( ( ) => CID . decode ( encoded ) , 'Invalid CID version 2' )
698698 } )
699699
700- it ( 'asCID is non-enumerable' , ( ) => {
701- const cid = CID . parse ( 'bafybeif2pall7dybz7vecqka3zo24irdwabwdi4wc55jznaq75q7eaavvu' )
702-
703- assert . isFalse ( Object . prototype . propertyIsEnumerable . call ( cid , 'asCID' ) )
704- assert . isFalse ( Object . keys ( cid ) . includes ( 'asCID' ) )
705- assert . equal ( cid . asCID , cid )
706- } )
707-
708700 it ( 'CID can be moved across JS realms' , async ( ) => {
709701 const cid = CID . parse ( 'bafybeif2pall7dybz7vecqka3zo24irdwabwdi4wc55jznaq75q7eaavvu' )
710702 const { port1 : sender , port2 : receiver } = new MessageChannel ( )
711703 sender . postMessage ( cid )
712704 const cid2 = await new Promise ( ( resolve ) => {
713705 receiver . onmessage = ( event ) => { resolve ( event . data ) }
714706 } )
715- assert . equal ( cid2 . asCID , cid2 )
707+ assert . strictEqual ( cid2 . asCID , cid2 )
708+ sender . close ( )
709+ receiver . close ( )
716710 } )
717711} )
You can’t perform that action at this time.
0 commit comments