![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.
immutable-table
Advanced tools
Immutable.js powered Table data type.
immutable-table exports a Table
class which can be used to represent a sized
two dimensional array as an Immutable.js data type.
npm install --save immutable-table
To import in ES6:
import { Table } from 'immutable-table';
To import in ES5:
var Table = require('immutable-table').Table;
To create a table you must pass a width
and height
to the constructor. Here
a table of width 3
and height 4
is created:
var table = new Table(3, 4);
By default all values of the table are undefined
. To set a value in the table,
use the setCell(x, y, value)
function:
table = table.setCell(0,0,'value');
Negative indicies can be used to index from the right or bottom. This is true
for all index accepting methods. Here the bottom, right cell is set to 99
:
table = table.setCell(-1,-1,99);
Values can be any type. Likewise, get a value using getCell(x, y)
:
console.log(table.getCell(0,0));
will print value
.
You can get a range of values, as a Table, by using
slice(startX, startY, [endX], [endY])
. When endX
and endY
are not
provided, the ends of the table are used:
var subTable = table.slice(1,1);
will return the bottom right subtable of table of size 2,3.
The width and height of a table can be read using the width
and height
readonly properties:
console.log(table.width, table.height);
will print 3 4
.
You can compare a table to another table using the equal(otherTable)
method:
console.log(table.equal(subTable));
will print false
.
console.log(table.equal(table));
will print true
.
You can also create a table from a CSV string:
var otherTable = Table.fromCSV([
'1, 2',
'3, 4'
].join('\n'));
Tables can be serialized to JSON:
var text = JSON.stringify(otherTable);
and later deserialized using a reviver:
var sameTableAsBefore = JSON.parse(text, Table.makeReviver());
running:
sameTableAsBefore.equal(otherTable);
will evaluate to true
.
FAQs
Immutable.js powered Table data type
We found that immutable-table demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.