Skip to content

Commit 5e54de6

Browse files
authored
Merge pull request #450 from gabifs/translate/arraybuffer-binary-arrays
ArrayBuffer, binary arrays
2 parents 5d52b99 + 0170f48 commit 5e54de6

File tree

5 files changed

+127
-127
lines changed

5 files changed

+127
-127
lines changed

4-binary/01-arraybuffer-binary-arrays/01-concat/_js.view/solution.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
function concat(arrays) {
2-
// sum of individual array lengths
2+
// soma dos comprimentos individuais dos arrays
33
let totalLength = arrays.reduce((acc, value) => acc + value.length, 0);
44

55
let result = new Uint8Array(totalLength);
6-
6+
77
if (!arrays.length) return result;
88

9-
// for each array - copy it over result
10-
// next array is copied right after the previous one
9+
// para cada array - copie-o sobre o resultado
10+
// O próximo array é copiado imediatamente após o anterior.
1111
let length = 0;
1212
for(let array of arrays) {
1313
result.set(array, length);

4-binary/01-arraybuffer-binary-arrays/01-concat/_js.view/source.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function concat(arrays) {
2-
// ...your code...
2+
// ...seu código...
33
}
44

55
let chunks = [

4-binary/01-arraybuffer-binary-arrays/01-concat/_js.view/test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ describe("concat", function() {
55
new Uint8Array([6, 7, 8])
66
];
77

8-
it("result has the same array type", function() {
8+
it("resultado possui o mesmo tipo de array", function() {
99

1010
let result = concat(chunks);
1111

1212
assert.equal(result.constructor, Uint8Array);
1313
});
1414

15-
it("concatenates arrays", function() {
15+
it("concatena arrays", function() {
1616

1717
let result = concat(chunks);
1818

1919
assert.deepEqual(result, new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8]));
2020

2121
});
2222

23-
it("returns empty array on empty input", function() {
23+
it("Retorna um array vazio se a entrada estiver vazia.", function() {
2424

2525
let result = concat([]);
2626

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

2-
# Concatenate typed arrays
2+
# Concatenar arrays tipados
33

4-
Given an array of `Uint8Array`, write a function `concat(arrays)` that returns a concatenation of them into a single array.
4+
Dado um array de `Uint8Array`, escreva uma função `concat(arrays)` que retorna uma concatenação deles em um único array.

0 commit comments

Comments
 (0)