You've already forked codtracker-js
format: prettify entire project
This commit is contained in:
30
node_modules/array-flatten/array-flatten.js
generated
vendored
30
node_modules/array-flatten/array-flatten.js
generated
vendored
@ -1,9 +1,9 @@
|
||||
'use strict'
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Expose `arrayFlatten`.
|
||||
*/
|
||||
module.exports = arrayFlatten
|
||||
module.exports = arrayFlatten;
|
||||
|
||||
/**
|
||||
* Recursive flatten function with depth.
|
||||
@ -13,18 +13,18 @@ module.exports = arrayFlatten
|
||||
* @param {Number} depth
|
||||
* @return {Array}
|
||||
*/
|
||||
function flattenWithDepth (array, result, depth) {
|
||||
function flattenWithDepth(array, result, depth) {
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
var value = array[i]
|
||||
var value = array[i];
|
||||
|
||||
if (depth > 0 && Array.isArray(value)) {
|
||||
flattenWithDepth(value, result, depth - 1)
|
||||
flattenWithDepth(value, result, depth - 1);
|
||||
} else {
|
||||
result.push(value)
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,18 +34,18 @@ function flattenWithDepth (array, result, depth) {
|
||||
* @param {Array} result
|
||||
* @return {Array}
|
||||
*/
|
||||
function flattenForever (array, result) {
|
||||
function flattenForever(array, result) {
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
var value = array[i]
|
||||
var value = array[i];
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
flattenForever(value, result)
|
||||
flattenForever(value, result);
|
||||
} else {
|
||||
result.push(value)
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,10 +55,10 @@ function flattenForever (array, result) {
|
||||
* @param {Number} depth
|
||||
* @return {Array}
|
||||
*/
|
||||
function arrayFlatten (array, depth) {
|
||||
function arrayFlatten(array, depth) {
|
||||
if (depth == null) {
|
||||
return flattenForever(array, [])
|
||||
return flattenForever(array, []);
|
||||
}
|
||||
|
||||
return flattenWithDepth(array, [], depth)
|
||||
return flattenWithDepth(array, [], depth);
|
||||
}
|
||||
|
Reference in New Issue
Block a user