Socket
Socket
Sign inDemoInstall

deeks

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deeks - npm Package Compare versions

Comparing version 2.2.3 to 2.2.4

src/utils.js

9

package.json
{
"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 || {}
};
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc