How to use the ferrum.foldl function in ferrum

To help you get started, we’ve selected a few ferrum examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adobe / jsonschema2md / lib / markdownBuilder.js View on Github external
  return schemas => foldl(schemas, {}, (pv, schema) => {
    const slugger = ghslugger();
    // eslint-disable-next-line no-param-reassign
    pv[schema[s.slug]] = root([
      // todo add more elements
      ...makeheader(schema),
      ...maketypesection(schema, 1),
      ...makeconstraintssection(schema, 1),
      ...makedefault(schema, 1),
      ...makeexamples(schema, 1),
      ...makedefinitions(schema, slugger),
      ...makeproperties(schema, slugger),
    ]);
    return pv;
  });
}
github adobe / helix-pipeline / src / html / shared-cache.js View on Github external
function cache(context) {
  const res = setdefault(context, 'response', {});
  const headers = setdefault(res, 'headers', {});
  const directives = {
    's-maxage': 30 * 24 * 3600, // serve from cache (without revalidation) for 30 days
    'stale-while-revalidate': 365 * 24 * 3600, // serve stale (while revalidating in background) for a year
  };

  headers['Cache-Control'] = foldl(
    pairs(directives),
    '',
    (a, [key, value]) => `${a + (a ? ', ' : '') + key}=${value}`,
  );
}
github adobe / jsonschema2md / lib / generateName.js View on Github external
function generatenames(schemas) {
  const slugger = new GithubSlugger();

  return foldl(schemas, {}, (container, schema) => {
    const name = {};
    name[slugger.slug(schema.title)] = schema;
    return Object.assign(container, name);
  });
}

ferrum

Features from the rust language in javascript: Provides Traits/Type classes & an advanced library for working with sequences/iterators in js.

Apache-2.0
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis