Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (schemas) => {
if (readme) {
console.log('building readme');
const toplevel = flist(pipe(
schemas,
filter(schema => !schema[s.parent]), // remove schemas with a parent
mapSort(schema => gentitle(schema[s.titles], schema[keyword`type`])),
map(schema => listItem(paragraph([
link(`./${schema[s.slug]}.md`, gendescription(schema), [text(gentitle(schema[s.titles], schema[keyword`type`]))]),
text(' – '),
inlineCode(schema[keyword`$id`] || '-'),
]))),
), Array);
const bytype = type => flist(pipe(
schemas,
filter(schema => schema[keyword`type`] === type), // remove schemas without matching type
filter(schema => !!schema[s.parent]), // keep only schemas with a parent
mapSort(schema => gentitle(schema[s.titles], schema[keyword`type`])),
map(schema => listItem(paragraph([
link(`./${schema[s.slug]}.md`, gendescription(schema), [text(gentitle(schema[s.titles], schema[keyword`type`]))]),
text(' – '),
inlineCode(`${schema[s.id]}#${schema[s.pointer]}`),
const bytype = type => flist(pipe(
schemas,
filter(schema => schema[keyword`type`] === type), // remove schemas without matching type
filter(schema => !!schema[s.parent]), // keep only schemas with a parent
mapSort(schema => gentitle(schema[s.titles], schema[keyword`type`])),
map(schema => listItem(paragraph([
link(`./${schema[s.slug]}.md`, gendescription(schema), [text(gentitle(schema[s.titles], schema[keyword`type`]))]),
text(' – '),
inlineCode(`${schema[s.id]}#${schema[s.pointer]}`),
]))),
), Array);