/** * Copyright (c) 2017-present A. Matías Quezada */ /** * Retuns every possible combination of a given set of elements. * * @example * combinations('abc'.split(''), 2); * > [['a'], ['b'], ['c'], ['a', 'b'], ['a', 'c'], ['b', 'a'], ['b', 'b'] ...] * * @param {Array} array Elements to combine. * @param {Number} length Max length for resulted combinations. * @returns {Array} A list with all the possible combinations. */ export default function combinations(array: T[], length: number): T[][];