* Joins the elements of the given array slices to an array, separated by * the given glue array. * @param {array} slices Array of array slices * @param {array} glue Glue array separating each slice * @return {array} Array
(slices, glue = [])
| 133 | * @return {array} Array |
| 134 | */ |
| 135 | static joinSlices (slices, glue = []) { |
| 136 | const count = slices.length |
| 137 | const glueLength = glue.length |
| 138 | let array = [] |
| 139 | for (let i = 0; i < count; i++) { |
| 140 | if (glueLength > 0 && i > 0) { |
| 141 | array = array.concat(glue) |
| 142 | } |
| 143 | array = array.concat(slices[i]) |
| 144 | } |
| 145 | return array |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Returns the index of the first occurrence of the given slice. |