• File: flatten.js
  • Full Path: /var/www/nodejs/Notifications_Imali_API/node_modules/@hapi/hoek/lib/flatten.js
  • Date Modified: 10/26/1985 3:15 PM
  • File size: 349 bytes
  • MIME-type: text/plain
  • Charset: utf-8
'use strict';

const internals = {};


module.exports = internals.flatten = function (array, target) {

    const result = target || [];

    for (const entry of array) {
        if (Array.isArray(entry)) {
            internals.flatten(entry, result);
        }
        else {
            result.push(entry);
        }
    }

    return result;
};