How to use the ferrum.pairs 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 / writeMarkdown.js View on Github external
return (schemas) => {
    each(pairs(schemas), ([name, markdown]) => {
      const fileName = path.resolve(out, `${name}.md`);

      // add YAML frontmatter
      const output = (!meta ? '' : '---\n')
        + (!meta ? '' : yaml.safeDump(meta))
        + (!meta ? '' : '---\n\n')

        + processor.stringify(markdown);


      fs.writeFile(fileName, output, (err) => {
        if (err) {
          error(err);
        }
        // info(`${fileName} created`);
      });
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}`,
  );
}

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