bigint-crypto-utils/node_modules/reduce-flatten/lib/reduce-flatten.js

22 lines
381 B
JavaScript
Raw Normal View History

'use strict'
/**
* Flatten an array into the supplied array.
*
* @module reduce-flatten
* @example
* var flatten = require('reduce-flatten')
*/
module.exports = flatten
/**
* @alias module:reduce-flatten
* @example
* > numbers = [ 1, 2, [ 3, 4 ], 5 ]
* > numbers.reduce(flatten, [])
* [ 1, 2, 3, 4, 5 ]
*/
function flatten (prev, curr) {
return prev.concat(curr)
}