Skip to content
This repository was archived by the owner on Sep 9, 2021. It is now read-only.

Commit ac11b5e

Browse files
committed
fix: add _key to the API functions using the instance
1 parent 4a74908 commit ac11b5e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/key.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Key {
8484
*
8585
*/
8686
static withNamespaces (list /* : Array<string> */) /* : Key */ {
87-
return new Key(list.join(pathSepS))
87+
return new _Key(list.join(pathSepS))
8888
}
8989

9090
/**
@@ -98,7 +98,7 @@ class Key {
9898
*
9999
*/
100100
static random () /* : Key */ {
101-
return new Key(uuid().replace(/-/g, ''))
101+
return new _Key(uuid().replace(/-/g, ''))
102102
}
103103

104104
/**
@@ -237,7 +237,7 @@ class Key {
237237
* // => Key('/Comedy/MontyPython/Actor:JohnCleese')
238238
*/
239239
instance (s /* : string */) /* : Key */ {
240-
return new Key(this.toString() + ':' + s)
240+
return new _Key(this.toString() + ':' + s)
241241
}
242242

243243
/**
@@ -256,7 +256,7 @@ class Key {
256256
p += pathSepS
257257
}
258258
p += this.type()
259-
return new Key(p)
259+
return new _Key(p)
260260
}
261261

262262
/**
@@ -272,10 +272,10 @@ class Key {
272272
parent () /* : Key */ {
273273
const list = this.list()
274274
if (list.length === 1) {
275-
return new Key(pathSepS)
275+
return new _Key(pathSepS)
276276
}
277277

278-
return new Key(list.slice(0, -1).join(pathSepS))
278+
return new _Key(list.slice(0, -1).join(pathSepS))
279279
}
280280

281281
/**
@@ -296,7 +296,7 @@ class Key {
296296
return this
297297
}
298298

299-
return new Key(this.toString() + key.toString(), false)
299+
return new _Key(this.toString() + key.toString(), false)
300300
}
301301

302302
/**
@@ -373,4 +373,6 @@ function namespaceValue (ns /* : string */) /* : string */ {
373373
return parts[parts.length - 1]
374374
}
375375

376-
module.exports = withIs(Key, { className: 'Key', symbolName: '@ipfs/interface-datastore/key' })
376+
const _Key = withIs(Key, { className: 'Key', symbolName: '@ipfs/interface-datastore/key' })
377+
378+
module.exports = _Key

0 commit comments

Comments
 (0)