PHP 8.2.30
Preview: to-json.js Size: 1.69 KB
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/@jsdevtools/ono/cjs/to-json.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDeepKeys = exports.toJSON = void 0;
const nonJsonTypes = ["function", "symbol", "undefined"];
const protectedProps = ["constructor", "prototype", "__proto__"];
const objectPrototype = Object.getPrototypeOf({});
/**
 * Custom JSON serializer for Error objects.
 * Returns all built-in error properties, as well as extended properties.
 */
function toJSON() {
    // HACK: We have to cast the objects to `any` so we can use symbol indexers.
    // see https://github.com/Microsoft/TypeScript/issues/1863
    let pojo = {};
    let error = this;
    for (let key of getDeepKeys(error)) {
        if (typeof key === "string") {
            let value = error[key];
            let type = typeof value;
            if (!nonJsonTypes.includes(type)) {
                pojo[key] = value;
            }
        }
    }
    return pojo;
}
exports.toJSON = toJSON;
/**
 * Returns own, inherited, enumerable, non-enumerable, string, and symbol keys of `obj`.
 * Does NOT return members of the base Object prototype, or the specified omitted keys.
 */
function getDeepKeys(obj, omit = []) {
    let keys = [];
    // Crawl the prototype chain, finding all the string and symbol keys
    while (obj && obj !== objectPrototype) {
        keys = keys.concat(Object.getOwnPropertyNames(obj), Object.getOwnPropertySymbols(obj));
        obj = Object.getPrototypeOf(obj);
    }
    // De-duplicate the list of keys
    let uniqueKeys = new Set(keys);
    // Remove any omitted keys
    for (let key of omit.concat(protectedProps)) {
        uniqueKeys.delete(key);
    }
    return uniqueKeys;
}
exports.getDeepKeys = getDeepKeys;
//# sourceMappingURL=to-json.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.72 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
1.08 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
3.00 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
1.53 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
1.18 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
420 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
723 B lrw-r--r-- 2026-02-23 15:45:44
Edit Download
222 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.70 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
803 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.93 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
1.59 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.56 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
1.24 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
3.27 KB lrw-r--r-- 2026-02-23 15:45:44
Edit Download
2.17 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.69 KB lrw-r--r-- 2026-02-23 15:45:46
Edit Download
1.24 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
142 B lrw-r--r-- 2026-02-23 15:45:46
Edit Download
115 B lrw-r--r-- 2026-02-23 15:45:46
Edit Download

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