diff --git a/index.js b/index.js index 39e7fe1..c78212d 100644 --- a/index.js +++ b/index.js @@ -86,9 +86,11 @@ function is_nil (obj) { * @returns {Array} filtered data */ function recursive_filter (input, filters, children_key = 'children') { - const data = copy_object (input); + const data = [ ...input ]; const filtered = []; - for (const e of data) { + for (let i = 0; i < data.length; i++) { + const e = { ...data[i] }; + data[i] = e; let match = true; for (const filter of filters) { let search_str = '';