Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 7, 2024 via pnpm

flat 4.1.1

Take a nested Javascript object and flatten it, or unflatten an object with delimited keys
Package summary
Share
2
issues
2
critical severity
vulnerability
2
2
licenses
1
BSD-3-Clause
1
MIT
Package created
5 Oct 2012
Version published
14 Oct 2020
Maintainers
3
Total deps
2
Direct deps
1
License
BSD-3-Clause

Issues

2

2 critical severity issues

critical
Recommendation: Upgrade to version 5.0.1 or later
via: flat@4.1.1
Recommendation: Upgrade to version 5.0.1 or later
via: flat@4.1.1
Collapse
Expand

Licenses

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
flat@4.1.1

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
is-buffer@2.0.5
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of flat 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
is-buffer2.0.52.04 kBMIT
prod

Visualizations

Frequently Asked Questions

What does flat do?

Flat is a powerful JavaScript library that provides a simple way to flatten and unflatten deeply nested objects. This capability can simplify complex nested structures into a single-level object representation, or vice versa. This functionality proves especially useful when handling complex JSON objects or building data transformation pipelines in JavaScript.

How do you use flat?

You can use the flat library in a JavaScript project by first installing it with npm using npm install flat. After installation, you can import the flatten and unflatten functions from it.

Below are example usages:

Flattening an object:

import { flatten } from 'flat'

const result = flatten({
    key1: {
        keyA: 'valueI'
    },
    key2: {
        keyB: 'valueII'
    },
    key3: { a: { b: { c: 2 } } }
})

console.log(result);
// Outputs: { 'key1.keyA': 'valueI', 'key2.keyB': 'valueII', 'key3.a.b.c': 2 }

Unflattening an object:

import { unflatten } from 'flat'

const result = unflatten({
    'three.levels.deep': 42,
    'three.levels': {
        nested: true
    }
})

console.log(result);
// Outputs: { three: { levels: { deep: 42, nested: true } } }

Where are the flat docs?

The official documentation for flat can be found in the README file of its GitHub repository. Here you can find comprehensive details on installation, usage, options for customization, and examples. You can also learn about its command-line usage for directly dealing with JSON files.