PHP 8.2.30
Preview: format.js Size: 1.14 KB
/home/byroehnu/.trash/node_modules11/logform/format.js

'use strict';

/*
 * Displays a helpful message and the source of
 * the format when it is invalid.
 */
class InvalidFormatError extends Error {
  constructor(formatFn) {
    super(`Format functions must be synchronous taking a two arguments: (info, opts)
Found: ${formatFn.toString().split('\n')[0]}\n`);

    Error.captureStackTrace(this, InvalidFormatError);
  }
}

/*
 * function format (formatFn)
 * Returns a create function for the `formatFn`.
 */
module.exports = formatFn => {
  if (formatFn.length > 2) {
    throw new InvalidFormatError(formatFn);
  }

  /*
   * function Format (options)
   * Base prototype which calls a `_format`
   * function and pushes the result.
   */
  function Format(options = {}) {
    this.options = options;
  }

  Format.prototype.transform = formatFn;

  //
  // Create a function which returns new instances of
  // FormatWrap for simple syntax like:
  //
  // require('winston').formats.json();
  //
  function createFormatWrap(opts) {
    return new Format(opts);
  }

  //
  // Expose the FormatWrap through the create function
  // for testability.
  //
  createFormatWrap.Format = Format;
  return createFormatWrap;
};

Directory Contents

Dirs: 2 × Files: 30

Name Size Perms Modified Actions
dist DIR
- drwxr-xr-x 2026-02-21 00:53:58
Edit Download
- drwxr-xr-x 2026-02-21 00:53:12
Edit Download
39 B lrw-r--r-- 2026-02-21 00:53:16
Edit Download
105 B lrw-r--r-- 2026-02-21 00:53:18
Edit Download
25 B lrw-r--r-- 2026-02-21 00:53:20
Edit Download
367 B lrw-r--r-- 2026-02-21 00:53:22
Edit Download
1.72 KB lrw-r--r-- 2026-02-21 00:53:24
Edit Download
10.48 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
1.19 KB lrw-r--r-- 2026-02-21 00:53:28
Edit Download
2.97 KB lrw-r--r-- 2026-02-21 00:53:32
Edit Download
1.76 KB lrw-r--r-- 2026-02-21 00:53:34
Edit Download
1.19 KB lrw-r--r-- 2026-02-21 00:53:36
Edit Download
1.14 KB lrw-r--r-- 2026-02-21 00:53:38
Edit Download
6.04 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
1.83 KB lrw-r--r-- 2026-02-21 00:53:38
Edit Download
983 B lrw-r--r-- 2026-02-21 00:53:40
Edit Download
469 B lrw-r--r-- 2026-02-21 00:53:42
Edit Download
251 B lrw-r--r-- 2026-02-21 00:53:44
Edit Download
1.07 KB lrw-r--r-- 2026-02-21 00:53:22
Edit Download
759 B lrw-r--r-- 2026-02-21 00:53:46
Edit Download
1.30 KB lrw-r--r-- 2026-02-21 00:53:48
Edit Download
430 B lrw-r--r-- 2026-02-21 00:53:50
Edit Download
1.44 KB lrw-r--r-- 2026-02-21 00:53:58
Edit Download
2.81 KB lrw-r--r-- 2026-02-21 00:53:50
Edit Download
899 B lrw-r--r-- 2026-02-21 00:53:52
Edit Download
515 B lrw-r--r-- 2026-02-21 00:53:54
Edit Download
17.66 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
979 B lrw-r--r-- 2026-02-21 00:53:56
Edit Download
4.17 KB lrw-r--r-- 2026-02-21 00:53:58
Edit Download
757 B lrw-r--r-- 2026-02-21 00:53:58
Edit Download
384 B lrw-r--r-- 2026-02-21 00:53:58
Edit Download
705 B lrw-r--r-- 2026-02-21 00:53:58
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).