Skip to content

Commit 5e22568

Browse files
cmdcolinclaude
andcommitted
Fix README: broken code example, Returns any → proper types, JSDoc cleanup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9bef37b commit 5e22568

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ Read .2bit sequence files using pure JavaScript, works in node or in the browser
1313

1414
```js
1515
import { TwoBitFile } from '@gmod/twobit'
16-
import { resolve } from 'import.meta.resolve'
1716

1817
const t = new TwoBitFile({
19-
path: resolve('@gmod/twobit', './data/foo.2bit'),
18+
path: 'path/to/file.2bit',
2019
})
2120

2221
// get the first 10 bases of a sequence from the file.
@@ -65,22 +64,21 @@ const seqNames = await t.getSequenceNames()
6564

6665
#### getSequenceNames
6766

68-
Returns **any** for an array of string sequence names that are found in the file
67+
Returns **Promise\<string[]>** array of sequence names in the file
6968

7069
#### getSequenceSizes
7170

72-
Returns **any** object listing the lengths of all sequences like `{seqName:
73-
length, ...}`.note: this is a relatively slow operation especially if there are many
74-
refseqs in the file, if you can get this information from a different file
75-
e.g. a chrom.sizes file, it will be much faster
71+
Returns **Promise\<Record\<string, number>>** object listing the lengths of all sequences like `{seqName: length, ...}`.
72+
73+
Note: this is a relatively slow operation especially if there are many refseqs in the file. If you can get this information from a different file e.g. a chrom.sizes file, it will be much faster.
7674

7775
#### getSequenceSize
7876

7977
##### Parameters
8078

8179
- `seqName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the sequence
8280

83-
Returns **any** sequence length, or undefined if it is not in the file
81+
Returns **Promise\<number | undefined>** sequence length, or undefined if not in the file
8482

8583
#### getSequence
8684

@@ -92,7 +90,7 @@ Returns **any** sequence length, or undefined if it is not in the file
9290
- `regionEnd` optional 0-based half-open end of the sequence region
9391
to fetch. defaults to end of the sequence (optional, default `Number.POSITIVE_INFINITY`)
9492

95-
Returns **any** for a string of sequence bases
93+
Returns **Promise\<string | undefined>** string of sequence bases, or undefined if sequence not found
9694

9795
## Publishing
9896

src/twoBitFile.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,15 @@ export default class TwoBitFile {
121121
}
122122

123123
/**
124-
* @returns for an array of string sequence names that are found in the file
124+
* @returns array of sequence names in the file
125125
*/
126126
async getSequenceNames() {
127127
const index = await this.getIndex()
128128
return Object.keys(index)
129129
}
130130

131131
/**
132-
* @returns object listing the lengths of all sequences like `{seqName:
133-
* length, ...}`.
132+
* @returns object listing the lengths of all sequences like `{seqName: length, ...}`.
134133
*
135134
* note: this is a relatively slow operation especially if there are many
136135
* refseqs in the file, if you can get this information from a different file

0 commit comments

Comments
 (0)