PHP 8.2.30
Preview: normalize-args.js Size: 1.09 KB
/home/byroehnu/easepay.easetack.com/node_modules/@apidevtools/json-schema-ref-parser/lib/normalize-args.js

"use strict";

const Options = require("./options");

module.exports = normalizeArgs;

/**
 * Normalizes the given arguments, accounting for optional args.
 *
 * @param {Arguments} args
 * @returns {object}
 */
function normalizeArgs (args) {
  let path, schema, options, callback;
  args = Array.prototype.slice.call(args);

  if (typeof args[args.length - 1] === "function") {
    // The last parameter is a callback function
    callback = args.pop();
  }

  if (typeof args[0] === "string") {
    // The first parameter is the path
    path = args[0];
    if (typeof args[2] === "object") {
      // The second parameter is the schema, and the third parameter is the options
      schema = args[1];
      options = args[2];
    }
    else {
      // The second parameter is the options
      schema = undefined;
      options = args[1];
    }
  }
  else {
    // The first parameter is the schema
    path = "";
    schema = args[0];
    options = args[1];
  }

  if (!(options instanceof Options)) {
    options = new Options(options);
  }

  return {
    path,
    schema,
    options,
    callback
  };
}

Directory Contents

Dirs: 3 × Files: 12

Name Size Perms Modified Actions
parsers DIR
- drwxr-xr-x 2026-03-14 01:49:07
Edit Download
resolvers DIR
- drwxr-xr-x 2026-03-14 01:49:07
Edit Download
util DIR
- drwxr-xr-x 2026-03-14 01:49:07
Edit Download
127 B lr--r--r-- 2026-03-14 01:49:07
Edit Download
10.59 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
7.22 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
29.88 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
11.56 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
1.09 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
3.79 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
5.37 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
8.42 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
8.34 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
5.24 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
4.18 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download

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