-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from formspree/swap-env-vars
Perform env var ref substitution
- Loading branch information
Showing
4 changed files
with
276 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function isArray(o) { | ||
return Object.prototype.toString.call(o) === '[object Array]'; | ||
} | ||
|
||
function traverse(obj, fn) { | ||
for (var key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
let value = obj[key]; | ||
|
||
if (isArray(value)) { | ||
value.forEach(element => { | ||
if (typeof element === 'object' && element !== null) | ||
traverse(element, fn); | ||
}); | ||
} else if (typeof value === 'object' && value !== null) { | ||
traverse(value, fn); | ||
} else { | ||
fn(key, value); | ||
} | ||
} | ||
} | ||
} | ||
|
||
module.exports = { traverse }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters