Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
chain-able-lego / dist / universeView.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint complexity: "OFF" */
const chain_able_deps_1 = require("chain-able-deps");
// import recurse from 'chain-able-traverse'
const sortObj_1 = require("./sortObj");
function recurse(...args) {
    console.warn('REQUIRES CHAIN-ABLE-TRAVERSE');
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// OPENS ALL THE DOORS TO API HANDLING
//  /*, nestedSchema, input */
function toUniverseView(obj, onlyPrimitive = false, ordered = false, metadata = false) {
    let stringPathObj = {};
    const meta = {};
    recurse(obj).forEach((value, key, recurser) => {
        if (!key)
            return;
        // metadata
        const stringPath = recurser.path.join('.');
        meta[stringPath] = value;
        // coerce to empty versions when we want them
        // if (isNative(value) || isBuiltIn(value) || isTyped(value)) {
        //   // eslint-disable-next-line
        //   // debugger
        //   value = getEmpty(value)
        // }
        // else if (!isPrimitive(value)) {
        //   value = getEmpty(value)
        // }
        // add .length
        // if (metadata && isObjPure(meta[stringPath])) {
        //   defineFinal(meta[stringPath], 'length', size(meta[stringPath]))
        //   defineFinal(meta[stringPath], 'keys', Object.keys(meta[stringPath]))
        // }
        // check options
        if (onlyPrimitive && !chain_able_deps_1.isPrimitive(value))
            return;
        stringPathObj[recurser.path.join('.')] = value;
    });
    if (ordered) {
        stringPathObj = sortObj_1.sortObj(stringPathObj);
    }
    // Object.keys(stringPathObj).forEach(key => {
    //   if (!isPrimitive(stringPathObj[key])) {
    //     delete stringPathObj[key]
    //   }
    // })
    chain_able_deps_1.defineFinal(stringPathObj, '@@meta', meta);
    return stringPathObj;
}
exports.toUniverseView = toUniverseView;
exports.default = toUniverseView;
//# sourceMappingURL=universeView.js.map