Platform
Resources
Pricing
Sign in
Get started
Jonas
Workspace
Fork
Public
By
Jonas
Edited
May 15, 2023
Insert cell
Insert cell
Insert cell
obj
=
(
{
foo
:
{
id
:
"foo"
,
label
:
"Foo"
,
description
:
"Long"
}
,
bar
:
{
id
:
"bar"
,
label
:
"Bar"
,
description
:
"Long"
}
,
rom
:
{
id
:
"rom"
,
label
:
"Rom"
,
description
:
"Long"
}
,
}
)
Insert cell
function
stripObject
(
obj
,
remainingKeys
)
{
return
Object
.
fromEntries
(
Object
.
entries
(
obj
)
.
map
(
(
[
key
,
entries
]
)
=>
{
return
[
key
,
Object
.
fromEntries
(
Object
.
entries
(
entries
)
.
filter
(
(
[
k
,
e
]
)
=>
remainingKeys
.
includes
(
k
)
)
)
]
}
)
)
}
Insert cell
stripObject
(
obj
,
[
'label'
,
'id'
]
)
Insert cell
Insert cell
arr
=
[
{
id
:
"foo"
,
label
:
"Foo"
,
description
:
"Long"
}
,
{
id
:
"bar"
,
label
:
"Bar"
,
description
:
"Long"
}
,
{
id
:
"rom"
,
label
:
"Rom"
,
description
:
"Long"
}
]
Insert cell
function
stripArray
(
arr
,
remainingKeys
)
{
return
arr
.
map
(
(
d
)
=>
Object
.
fromEntries
(
(
remainingKeys
.
map
(
k
=>
[
k
,
d
[
k
]
]
)
)
)
)
;
}
Insert cell
stripArray
(
arr
,
[
'id'
,
'label'
]
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
obj
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
stripObject
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
arr
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
stripArray
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML