Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@kollorg/vitae-quia-incidunt
Advanced tools
Safely flatten a nested JavaScript object.
$ npm i @kollorg/vitae-quia-incidunt
Flattens an object to one level deep. Optionally takes a custom delimiter
, otherwise uses .
by default. Circular references within the object will be replaced with [Circular]
.
const { flatten } = require('@kollorg/vitae-quia-incidunt')
const original = {
a: {
b: {
c: [{
val: 'one'
}, {
val: 'two'
}],
d: 'three'
},
e: 'four',
}
}
original.a.b.f = original.a.b
original.a.b.c.push(original.a)
const flat = flatten(original)
/*
{
'a.b.c.0.val': 'one',
'a.b.c.1.val': 'two',
'a.b.c.2': '[Circular]',
'a.b.d': 'three',
'a.e': 'four',
'a.b.f': '[Circular]'
}
*/
const underscoreFlat = flatten(original, '_')
/*
{
'a_b_c_0_val': 'one',
'a_b_c_1_val': 'two',
'a_b_c_2': '[Circular]',
'a_b_d': 'three',
'a_e': 'four',
'a_b_f': '[Circular]'
}
*/
Unflattens an object back to its original nested form. Optionally takes a custom delimiter
, otherwise uses .
by default. Circular references denoted by [Circular]
are treated as Strings.
const { unflatten } = require('@kollorg/vitae-quia-incidunt')
const original = {
'a.b.c.0.val': 'one',
'a.b.c.1.val': 'two',
'a.b.c.2': '[Circular]',
'a.b.d': 'three',
'a.e': 'four',
'a.b.f': '[Circular]'
}
const unflat = unflatten(original)
/*{
a:{
b:{
c:[
{
val:'one'
},
{
val:'two'
},
'[Circular]'
],
d:'three',
f:'[Circular]'
},
e:'four'
}
}*/
FAQs
security holding package
The npm package @kollorg/vitae-quia-incidunt receives a total of 2 weekly downloads. As such, @kollorg/vitae-quia-incidunt popularity was classified as not popular.
We found that @kollorg/vitae-quia-incidunt 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.