MCPcopy Create free account
hub / github.com/cryptii/cryptii / joinSlices

Method joinSlices

src/ArrayUtil.js:135–146  ·  view source on GitHub ↗

* 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 = [])

Source from the content-addressed store, hash-verified

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.

Callers 1

performEncodeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected