Platform
Resources
Pricing
Sign in
Get started
Neil Russell
Workspace
Fork
Published
Old
By
Neil Russell
Edited
Sep 1, 2018
3 stars
Insert cell
Insert cell
collection
=
[
{
id
:
'a'
,
name
:
'A'
,
number
:
1
}
,
{
id
:
'b'
,
name
:
'B'
,
number
:
2
}
]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
collection
.
reduce
(
(
acc
,
x
)
=>
(
{
...
acc
,
[
x
.
id
]
:
x
}
)
,
{
}
)
Insert cell
Insert cell
collection
.
reduce
(
(
acc
,
x
)
=>
(
{
...
acc
,
[
x
.
id
]
:
{
name
:
x
.
name
,
number
:
x
.
number
}
}
)
,
{
}
)
Insert cell
Insert cell
fields
=
[
'name'
,
'number'
]
Insert cell
Insert cell
objFilter
=
(
keys
,
obj
)
=>
{
return
Object
.
keys
(
obj
)
.
reduce
(
(
acc
,
x
)
=>
{
return
keys
.
includes
(
x
)
?
{
...
acc
,
[
x
]
:
obj
[
x
]
}
:
acc
}
,
{
}
)
}
Insert cell
collection
.
reduce
(
(
acc
,
x
)
=>
(
{
...
acc
,
[
x
.
id
]
:
objFilter
(
fields
,
x
)
}
)
,
{
}
)
Insert cell
Insert cell
collection
.
reduce
(
(
acc
,
x
)
=>
(
{
...
acc
,
[
x
.
id
]
:
R
.
pick
(
fields
,
x
)
}
)
,
{
}
)
Insert cell
Insert cell
Insert cell
Insert cell
reducer
=
(
acc
,
x
)
=>
(
{
...
acc
,
[
x
.
id
]
:
R
.
pick
(
fields
,
x
)
}
)
Insert cell
collection
.
reduce
(
reducer
,
{
}
)
Insert cell
Insert cell
configurableReducer
=
(
k
,
fields
)
=>
(
acc
,
x
)
=>
(
{
...
acc
,
[
x
[
k
]
]
:
R
.
pick
(
fields
,
x
)
}
)
Insert cell
collection
.
reduce
(
configurableReducer
(
'id'
,
fields
)
,
{
}
)
Insert cell
Insert cell
Insert cell
Insert cell
reduceObjWith
=
(
fn
)
=>
(
acc
,
x
)
=>
(
{
...
acc
,
...
fn
(
x
)
}
)
Insert cell
Insert cell
transformer
=
x
=>
(
{
[
x
.
id
]
:
objFilter
(
fields
,
x
)
}
)
Insert cell
Insert cell
collection
.
reduce
(
reduceObjWith
(
transformer
)
,
{
}
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
R
.
zipObj
(
[
'a'
,
'b'
]
,
[
{
name
:
'A'
,
number
:
1
}
,
{
name
:
'B'
,
number
:
2
}
]
)
Insert cell
Insert cell
R
.
zipObj
(
R
.
pluck
(
'id'
,
collection
)
,
R
.
map
(
R
.
pick
(
fields
)
,
collection
)
)
Insert cell
Insert cell
R
.
converge
(
R
.
zipObj
,
[
R
.
pluck
(
'id'
)
,
R
.
map
(
R
.
pick
(
fields
)
)
]
)
(
collection
)
Insert cell
Insert cell
Insert cell
R
.
map
(
n
=>
R
.
pick
(
fields
,
R
.
head
(
n
)
)
,
R
.
groupBy
(
R
.
prop
(
'id'
)
,
collection
)
)
Insert cell
Insert cell
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
collection
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
fields
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
objFilter
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
reducer
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
configurableReducer
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
reduceObjWith
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
transformer
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
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
Edit
Add comment
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
R
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML