import { fn } from "https://deno.land/x/ddc_vim@v0.17.0/deps.ts";
const { flatten } = fn;
Flatten {list} up to {maxdepth} levels. Without {maxdepth} the result is a |List| without nesting, as if {maxdepth} is a very large number. The {list} is changed in place, use |flattennew()| if you do not want that. In Vim9 script flatten() cannot be used, you must always use |flattennew()|. {maxdepth} means how deep in nested lists changes are made. {list} is not modified when {maxdepth} is 0. {maxdepth} must be positive number. If there is an error the number zero is returned. Example: :echo flatten([1, [2, [3, 4]], 5]) [1, 2, 3, 4, 5] :echo flatten([1, [2, [3, 4]], 5], 1) [1, 2, [3, 4], 5]