Comparing version 2.2.3 to 2.2.4
{ | ||
"name": "deeks", | ||
"version": "2.2.3", | ||
"version": "2.2.4", | ||
"description": "Retrieve all keys and nested keys from objects and arrays of objects.", | ||
@@ -30,6 +30,5 @@ "main": "src/deeks.js", | ||
"homepage": "https://github.com/mrodrig/deeks#readme", | ||
"dependencies": { | ||
"underscore": "1.9.1" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"babel-eslint": "10.1.0", | ||
"eslint": "5.16.0", | ||
@@ -41,4 +40,4 @@ "nyc": "14.1.1", | ||
"engines": { | ||
"node": ">=6.0" | ||
"node": ">= 8" | ||
} | ||
} |
'use strict'; | ||
const _ = require('underscore'); | ||
const utils = require('./utils.js'); | ||
@@ -18,3 +18,3 @@ module.exports = { | ||
options = mergeOptions(options); | ||
if (_.isObject(object)) { | ||
if (utils.isObject(object)) { | ||
return generateDeepKeysList('', object, options); | ||
@@ -34,3 +34,3 @@ } | ||
return list.map((document) => { // for each document | ||
if (_.isObject(document)) { | ||
if (utils.isObject(document)) { | ||
// if the data at the key is a document, then we retrieve the subHeading starting with an empty string heading and the doc | ||
@@ -59,3 +59,3 @@ return deepKeys(document, options); | ||
return _.flatten(keys); | ||
return utils.flatten(keys); | ||
} | ||
@@ -76,3 +76,3 @@ | ||
return options.ignoreEmptyArraysWhenExpanding ? [] : [currentKeyPath]; | ||
} else if (subArray.length && _.flatten(subArrayKeys).length === 0) { | ||
} else if (subArray.length && utils.flatten(subArrayKeys).length === 0) { | ||
// Has items in the array, but no objects | ||
@@ -88,3 +88,3 @@ return [currentKeyPath]; | ||
return _.uniq(_.flatten(subArrayKeys)); | ||
return utils.unique(utils.flatten(subArrayKeys)); | ||
} | ||
@@ -112,3 +112,3 @@ } | ||
function isDocumentToRecurOn(val) { | ||
return _.isObject(val) && !_.isNull(val) && !Array.isArray(val) && Object.keys(val).length; | ||
return utils.isObject(val) && !utils.isNull(val) && !Array.isArray(val) && Object.keys(val).length; | ||
} | ||
@@ -135,6 +135,7 @@ | ||
function mergeOptions(options) { | ||
return _.defaults(options || {}, { | ||
return { | ||
expandArrayObjects: false, | ||
ignoreEmptyArraysWhenExpanding: false | ||
}); | ||
ignoreEmptyArraysWhenExpanding: false, | ||
...options || {} | ||
}; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11598
0
4
162
5
- Removedunderscore@1.9.1
- Removedunderscore@1.9.1(transitive)