Comparing version 0.1.0 to 0.2.0
@@ -13,7 +13,12 @@ /** | ||
const a2 = a.slice(n2); | ||
let c = 0; | ||
while (c++ < n2) { | ||
while (a1.length > 1) { | ||
z.push(a1.shift()); | ||
z.push(a2.shift()); | ||
} | ||
// We moved the test for a2 outside the loop by stopping 1 element early in a1 | ||
z.push(a1.shift()); | ||
if (a2.length > 0) { | ||
z.push(a2.shift()); | ||
} | ||
return z; | ||
@@ -20,0 +25,0 @@ }; |
{ | ||
"name": "faro", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Faro out-shuffle a string", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -108,3 +108,8 @@ const assert = require('assert'); | ||
}); | ||
describe('Odd length array', () => { | ||
it('should have the same length as the original array', () => { | ||
assert.equal(weaveArray([1,2,3,4,5]).length, 5); | ||
}) | ||
}) | ||
}); | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6705
188