Skip to content

Commit

Permalink
feat(deps): remove lodash dependency
Browse files Browse the repository at this point in the history
Rewrites the lodash loops with ES5 Object.keys()
  • Loading branch information
amclin committed Mar 24, 2020
1 parent 9805ac8 commit 3775405
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
},
"dependencies": {
"command-line-args": "^5.1.1",
"lodash": "^4.17.11",
"maven": "^4.4.1",
"read-config-file": "^5.0.0"
},
Expand Down
10 changes: 4 additions & 6 deletions src/helpers.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
const _ = require('lodash')

/**
* Renames properties on an object by prepending a prefix to them. Mutates the original object.
* @param {Object} - Object to modify
* @param {String} - prefix to append to the name of all the properties in the object
* @returns {Object} - Updated object with renamed properties
**/
const prefixProperties = function (obj, prefix) {
_.forEach(obj, function (val, prop) {
obj[prefix + prop] = val
Object.keys(obj).forEach((prop) => {
obj[prefix + prop] = obj[prop]
delete obj[prop]
})

Expand Down Expand Up @@ -49,9 +47,9 @@ const getConfigsFromProcess = function (defaults) {
var result = {}

// Walk the defaults object and map the names back to process.env names so we can find them
_.forEach(defaults, (val, config) => {
Object.keys(defaults).forEach( (config) => {
result[config] = {}
_.forEach(defaults[config], (val, property) => {
Object.keys(defaults[config]).forEach( (property) => {
const searchSegments = [
'npm',
'package', // namespace of where package.json options are stored
Expand Down

0 comments on commit 3775405

Please sign in to comment.