Published
Edited
May 31, 2022
3 forks
Insert cell
# Test purpose
Insert cell
Insert cell
{
const { flow, map, sum } = _;

const users = [
{ id: 1, name: "sam", age: 10 },
{ id: 2, name: "john", age: 22 }
];

const func = flow([map((user) => user.age), sum]);
return func(users);
}
Insert cell
{
return _.chain([1, 2, 3])
.map((x) => [x, x * 2])
.flatten()
.sort()
.value();
}
Insert cell
{
const users = [
{ id: 1, name: "sam", age: 10 },
{ id: 2, name: "john", age: 22 }
];

const totalAge = _.flow([
(users) => _.map(users, (user) => user.age),
(users) => _.take(users, 2)
]);

// console.log(totalAge);
return totalAge(users);
}
Insert cell
axios = require('axios')
Insert cell
lodash = require('lodash')
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.
Learn more