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 157
157
"eslintConfig" : {
158
158
"extends" : " ipfs" ,
159
159
"parserOptions" : {
160
- "sourceType" : " module" ,
161
- "ecmaVersion" : 13
160
+ "sourceType" : " module"
162
161
}
163
162
},
164
163
"release" : {
Original file line number Diff line number Diff line change @@ -61,9 +61,6 @@ const baseCache = cid => {
61
61
*/
62
62
63
63
export class CID {
64
- /** @type {CID } */
65
- #asCID
66
-
67
64
/**
68
65
* @param {Version } version - Version of the CID
69
66
* @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 {
89
86
90
87
// Circular reference
91
88
/** @readonly */
92
- this . #asCID = this
93
- }
94
-
95
- get asCID ( ) {
96
- return this . #asCID
89
+ this . asCID = this
97
90
}
98
91
99
92
/**
Original file line number Diff line number Diff line change @@ -697,21 +697,15 @@ describe('CID', () => {
697
697
assert . throws ( ( ) => CID . decode ( encoded ) , 'Invalid CID version 2' )
698
698
} )
699
699
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
-
708
700
it ( 'CID can be moved across JS realms' , async ( ) => {
709
701
const cid = CID . parse ( 'bafybeif2pall7dybz7vecqka3zo24irdwabwdi4wc55jznaq75q7eaavvu' )
710
702
const { port1 : sender , port2 : receiver } = new MessageChannel ( )
711
703
sender . postMessage ( cid )
712
704
const cid2 = await new Promise ( ( resolve ) => {
713
705
receiver . onmessage = ( event ) => { resolve ( event . data ) }
714
706
} )
715
- assert . equal ( cid2 . asCID , cid2 )
707
+ assert . strictEqual ( cid2 . asCID , cid2 )
708
+ sender . close ( )
709
+ receiver . close ( )
716
710
} )
717
711
} )
You can’t perform that action at this time.
0 commit comments