Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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));
}