![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/rowmap
Advanced tools
A lightweight library to map tabular data to objects effortlessly in JavaScript or TypeScript.
Effortlessly map tabular data (like CSV rows) to objects using lightweight dynamic mappers. RowMap is designed to be minimal, elegant, and developer-friendly, making it a powerful tool for working with structured data in JavaScript or TypeScript.
for...of
, spread syntax).JSON.stringify
or a toJSON()
method.Install using npm:
npm install @eaterable/rowmap
The rowmap
function provides a universal mapper that can function as both a class and a direct function, depending on how you use it. It works seamlessly to map rows to objects with descriptive properties.
import rowmap from '@eaterable/rowmap';
// Example data
const [headers, ...rows] = [
['id', 'name', 'email'], // Header row
[1, 'Alice', 'alice@example.com'],
[2, 'Bob', 'bob@example.com'],
];
// Create a universal mapper using headers
const User = rowmap(['id', 'name', 'email']);
// Map rows directly to objects
const objects = rows.map(User);
console.log(objects);
// Output:
// [
// { id: 1, name: 'Alice', email: 'alice@example.com' },
// { id: 2, name: 'Bob', email: 'bob@example.com' },
// ]
// Or use it as a class
const obj = new Row([3, 'Charlie', 'charlie@example.com']);
console.log(obj);
// Output: { id: 3, name: 'Charlie', email: 'charlie@example.com' }
const Row = rowmap({
headers: ['id', 'name', 'email'], // Required: column names
index: false, // Optional: disable row index (default: true)
array: false, // Optional: disable array access (default: true)
className: 'User', // Optional: custom class name
preventCollisions: true // Optional: prevent header collisions (default: false)
});
const row = new Row([1, 'Alice', 'alice@example.com']);
// Read values
console.log(row[0]); // 1
console.log(row.name); // 'Alice'
console.log(row.array); // [1, 'Alice', 'alice@example.com']
console.log(row.array.length); // 3
// Modify values
row.name = 'Alicia';
console.log([...row]); // [1, 'Alicia', 'alice@example.com']
// Advanced array operations
row.array.reverse();
console.log(row.name); // Still works with reversed array!
// Note: 'array' can be used as a header name if needed
const CustomRow = rowmap(['id', 'name', 'array']);
// Spread syntax
const values = [...row];
// Convert to string
console.log(String(row)); // '1,Alicia,alice@example.com'
// Convert to object
console.log(row.toJSON());
// JSON serialization
console.log(JSON.stringify(row));
We welcome contributions! Feel free to fork the repository, submit pull requests, or open issues.
This project is licensed under the MIT License.
Ready to map your tabular data effortlessly? Try RowMap today! 🎉
FAQs
A lightweight library to map tabular data to objects effortlessly in JavaScript or TypeScript.
The npm package @eaterable/rowmap receives a total of 1 weekly downloads. As such, @eaterable/rowmap popularity was classified as not popular.
We found that @eaterable/rowmap 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.