Skip to content

Instantly share code, notes, and snippets.

View gwmccull's full-sized avatar

Garrett McCullough gwmccull

View GitHub Profile
@gwmccull
gwmccull / flatten.js
Last active September 30, 2023 03:18
Flatten array of arrays
// returns a flattened array
function flattenArray(arr = []) {
return arr.reduce((prev, value) => {
if (Array.isArray(value)) {
// make a recursive call to flatten the inner array
return [...prev, ...flattenArray(value)];
}
return [...prev, value];
}, []);
}
0 info it worked if it ends with ok
1 verbose cli [ '/Users/gmccullough/.nvm/versions/node/v6.2.2/bin/node',
1 verbose cli '/Users/gmccullough/.nvm/versions/node/v6.2.2/bin/npm',
1 verbose cli 'ping' ]
2 info using npm@3.9.5
3 info using node@v6.2.2
4 verbose request uri http://artifactory-pr-1.build.internal:8081/artifactory/api/npm/-/ping?write=true
5 verbose request no auth needed
6 info attempt registry request try #1 at 9:21:49 PM
7 verbose request id 7bc9370a453be82f
# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
# name = Garrett McCullough
# email = garrett.mccullough@build.com
[user]
name = Garrett McCullough
email = garrett.mccullough@build.com
[alias]