How to use the deeks.deepKeysFromList function in deeks

To help you get started, we’ve selected a few deeks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mrodrig / json-2-csv / src / json-2-csv.js View on Github external
function generateHeading(data) {
    if (options.KEYS) { return promise.resolve(options.KEYS); }

    let keys = key.deepKeysFromList(data);
    
    let uniqueKeys = [];

    // If the user wants to check for the same schema:
    if (options.CHECK_SCHEMA_DIFFERENCES) {
        // Check for a consistent schema that does not require the same order:
        // if we only have one document - then there is no possibility of multiple schemas
        if (keys && keys.length <= 1) {
            return promise.resolve(_.flatten(keys) || []);
        }
        // else - multiple documents - ensure only one schema (regardless of field ordering)
        let firstDocSchema = keys[0],
            schemaDifferences = 0;

        _.each(keys, function (keys) {
            // If there is a difference between the schemas, increment the counter of schema inconsistencies
github mrodrig / json-2-csv / src / json2csv.js View on Github external
function getFieldNameList(data) {
        // If keys weren't specified, then we'll use the list of keys generated by the deeks module
        return Promise.resolve(deeks.deepKeysFromList(data, deeksOptions));
    }

deeks

Retrieve all keys and nested keys from objects and arrays of objects.

MIT
Latest version published 4 months ago

Package Health Score

67 / 100
Full package analysis

Popular deeks functions