Add utility for looping from 0 to n.

Closes #1518

Change-Id: I865f7a0311516d04ae84532dab873e1aaa31eb24
This commit is contained in:
Jacob Trimble
2019-06-17 14:51:41 -07:00
parent c1730ab09c
commit fd0dc8a5cc
26 changed files with 89 additions and 70 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ shaka.util.StringUtils = class {
const length = Math.floor(data.byteLength / 2);
const arr = new Uint16Array(length);
const dataView = new DataView(buffer);
for (let i = 0; i < length; i++) {
for (const i of shaka.util.Iterables.range(length)) {
arr[i] = dataView.getUint16(i * 2, littleEndian);
}
return shaka.util.StringUtils.fromCharCode(arr);