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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more