refactor: rename variable and adding some comments

This commit is contained in:
Luis Contreras 2020-10-09 01:39:14 +02:00
parent cfabae56d7
commit a8afcfe6b6
2 changed files with 4 additions and 2 deletions

View file

@ -6,6 +6,7 @@ function sourceNodes({ actions, createNodeId, createContentDigest }) {
people
.sort(() => Math.random() - 0.5)
.forEach(p => {
// Remove duplicated tags.
const person = { ...p, tags: [...new Set(p.tags)] };
const nodeMeta = {
id: createNodeId(`person-${person.name}`),

View file

@ -3,8 +3,9 @@ import people from '../data.js';
function merge(prop) {
return function(acc, obj) {
const propEntries = [...new Set(obj[prop])];
return [...propEntries, ...acc];
// Remove duplicated values.
const values = [...new Set(obj[prop])];
return [...values, ...acc];
};
}