PHP 8.2.30
Preview: normalize.js Size: 1.70 KB
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/@jsdevtools/ono/esm/normalize.js

import { format } from "./isomorphic.node";
/**
 * Normalizes Ono options, accounting for defaults and optional options.
 */
export function normalizeOptions(options) {
    options = options || {};
    return {
        concatMessages: options.concatMessages === undefined ? true : Boolean(options.concatMessages),
        format: options.format === undefined ? format
            : (typeof options.format === "function" ? options.format : false),
    };
}
/**
 * Normalizes the Ono arguments, accounting for defaults, options, and optional arguments.
 */
export function normalizeArgs(args, options) {
    let originalError;
    let props;
    let formatArgs;
    let message = "";
    // Determine which arguments were actually specified
    if (typeof args[0] === "string") {
        formatArgs = args;
    }
    else if (typeof args[1] === "string") {
        if (args[0] instanceof Error) {
            originalError = args[0];
        }
        else {
            props = args[0];
        }
        formatArgs = args.slice(1);
    }
    else {
        originalError = args[0];
        props = args[1];
        formatArgs = args.slice(2);
    }
    // If there are any format arguments, then format the error message
    if (formatArgs.length > 0) {
        if (options.format) {
            message = options.format.apply(undefined, formatArgs);
        }
        else {
            message = formatArgs.join(" ");
        }
    }
    if (options.concatMessages && originalError && originalError.message) {
        // The inner-error's message will be added to the new message
        message += (message ? " \n" : "") + originalError.message;
    }
    return { originalError, props, message };
}
//# sourceMappingURL=normalize.js.map

Directory Contents

Dirs: 0 × Files: 30

Name Size Perms Modified Actions
116 B lrw-r--r-- 2026-02-23 15:45:46
Edit Download
1.57 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
1.20 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
482 B lrw-r--r-- 2026-02-23 15:45:46
Edit Download
2.84 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
1.64 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
133 B lrw-r--r-- 2026-02-23 15:45:46
Edit Download
374 B lrw-r--r-- 2026-02-23 15:45:44
Edit Download
458 B lrw-r--r-- 2026-02-23 15:45:46
Edit Download
574 B lrw-r--r-- 2026-02-23 15:45:46
Edit Download
604 B lrw-r--r-- 2026-02-23 15:45:44
Edit Download
239 B lrw-r--r-- 2026-02-23 15:45:46
Edit Download
523 B lrw-r--r-- 2026-02-23 15:45:48
Edit Download
1.53 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
853 B lrw-r--r-- 2026-02-23 15:45:46
Edit Download
507 B lrw-r--r-- 2026-02-23 15:45:48
Edit Download
1.70 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
1.60 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
108 B lrw-r--r-- 2026-02-23 15:45:48
Edit Download
1.46 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
1.29 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
933 B lrw-r--r-- 2026-02-23 15:45:48
Edit Download
2.98 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
2.14 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
540 B lrw-r--r-- 2026-02-23 15:45:48
Edit Download
1.53 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
1.22 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
8.09 KB lrw-r--r-- 2026-02-23 15:45:48
Edit Download
65 B lrw-r--r-- 2026-02-23 15:45:46
Edit Download
141 B lrw-r--r-- 2026-02-23 15:45:46
Edit Download

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