![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@eaterable/tsv-parser
Advanced tools
⚡️ Memory-efficient TSV string parser using native JavaScript iterators
⚡️ Memory-efficient TSV string parser using native JavaScript iterators
for...of
loops and spread operatorHere's how our TSV parser performs compared to naive approaches:
Method | Duration (ms) | Heap Used (MB) | RSS* (MB) | External (MB) |
---|---|---|---|---|
TSV.parse | 377.25 | 13.14 | 1.30 | 0.04 |
String.split (Naive) | 822.36 | 394.59 | 393.60 | 0.00 |
* RSS (Resident Set Size) represents the total physical memory (RAM) used by the process
npm install @eaterable/tsv-parser
import TSV from '@eaterable/tsv-parser';
// Example TSV data
const data = 'name\tage\tcity\nAlice\t30\tNew York\nBob\t25\tLondon';
// Parse all rows at once (includes headers)
const allRows = [...TSV.parse(data)];
console.log(allRows);
// Output:
// [
// ['name', 'age', 'city'],
// ['Alice', '30', 'New York'],
// ['Bob', '25', 'London']
// ]
// Get just the headers
const headers = TSV.headers(data);
console.log(headers);
// Output: ['name', 'age', 'city']
// Iterate over data rows (excluding headers)
for (const row of TSV.rows(data)) {
console.log(row);
}
// Output:
// ['Alice', '30', 'New York']
// ['Bob', '25', 'London']
const customData = 'name|age|city%Alice|30|New York%Bob|25|London';
const options = {
valueSeparator: '|', // Default: '\t'
lineSeparator: '%' // Default: '\n'
};
const rows = [...TSV.parse(customData, options)];
// Using the iterator directly
const iterator = new TSV.Iterator(data);
for (const row of iterator) {
console.log(row);
}
TSV.parse(raw: string, options?: TSVParserOptions): Iterable<string[]>
Creates an iterable that yields all rows (including headers) from the TSV string.
raw
: The raw TSV string to parseoptions
: Optional configuration object
valueSeparator
: Character used to separate values (default: '\t'
)lineSeparator
: Character used to separate lines (default: '\n'
)TSV.headers(raw: string, options?: TSVParserOptions): string[]
Returns just the headers (first row) from the TSV string.
TSV.rows(raw: string, options?: TSVParserOptions): Iterable<string[]>
Creates an iterable that yields data rows (excluding headers) from the TSV string.
TSV.Iterator
The underlying iterator class used for parsing. Useful for advanced use cases or when you need more control over the iteration process.
This package works in all modern browsers and Node.js environments that support:
Symbol.iterator
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
git checkout -b feature/amazing-feature
)git commit -m 'feat: add amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
⚡️ Memory-efficient TSV string parser using native JavaScript iterators
The npm package @eaterable/tsv-parser receives a total of 1 weekly downloads. As such, @eaterable/tsv-parser popularity was classified as not popular.
We found that @eaterable/tsv-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.