![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.
@alizeait/flatto
Advanced tools
A tiny (~200B) and super fast nested object flattener.
Takes a nested object/array and returns a flattened object, e.i. an object with a single nested level.
It seperates the keys with a .
by default but this can be changed to anything with the seperator option.
$ npm install @alizeait/flatto
import { flatto } from "@alizeait/flatto";
const flattened = flatto({
key1: {
keyA: "valueI",
},
key2: {
keyB: "valueII",
},
key3: { a: { b: { c: 2 } } },
key4: [],
key5: {
a: [
"value1",
"value2",
{
key1: {
keyA: "valueI",
keyB: [1, 2, 3, 4],
},
},
],
b: null,
c: undefined,
},
key6: {},
});
/*
{
"key1.keyA": "valueI",
"key2.keyB": "valueII",
"key3.a.b.c": 2,
"key4": [],
"key5.a.0": "value1",
"key5.a.1": "value2",
"key5.a.2.key1.keyA": "valueI",
"key5.a.2.key1.keyB.0": 1,
"key5.a.2.key1.keyB.1": 2,
"key5.a.2.key1.keyB.2": 3,
"key5.a.2.key1.keyB.3": 4,
"key5.b": null,
"key5.c": undefined,
"key6": {}
}
*/
const flattoCustom = flatto(
{
key1: {
keyA: "valueI",
},
key2: {
keyB: "valueII",
},
key3: { a: { b: { c: 2 } } },
},
"-"
);
/*
{
"key1-keyA": "valueI",
"key2-keyB": "valueII",
"key3-a-b-c": 2,
}
*/
Benchmarks:
flat x 139,061 ops/sec ±0.70% (90 runs sampled)
objnest x 52,776 ops/sec ±0.48% (90 runs sampled)
@alizeait/flatto x 335,535 ops/sec ±0.45% (94 runs sampled)
flatify-obj x 103,834 ops/sec ±0.78% (93 runs sampled)
Running on Node.js v12.13.0, 64-bit OS, Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz, 16.0 GB RAM
Returns: Object
Returns a new flattened object that is only one level deep.
If the input is not an object or an array, the input itself is returned instead of an object.
FAQs
A tiny (~200B) and fast nested object flattener
We found that @alizeait/flatto 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.