Skip to content

Commit 11dd0ff

Browse files
committed
Fix lint errors
1 parent 0199cee commit 11dd0ff

File tree

1 file changed

+21
-13
lines changed
  • lib/node_modules/@stdlib/string/repeat/lib

1 file changed

+21
-13
lines changed

lib/node_modules/@stdlib/string/repeat/lib/repeat.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,39 @@ var MAX_SAFE_INTEGER = require( '@stdlib/constants/math/float64-max-safe-integer
1212
/**
1313
* Repeats a string a specified number of times and returns the concatenated result.
1414
*
15-
* #### Implementation
15+
* ## Methods
1616
*
1717
* The algorithmic trick used in the implementation is to treat string concatenation the same as binary addition (i.e., any natural number (nonnegative integer) can be expressed as a sum of powers of two).
1818
*
1919
* For example,
2020
*
21-
* ``` text
21+
* ```text
2222
* n = 10 => 1010 => 2^3 + 2^0 + 2^1 + 2^0
2323
* ```
2424
*
2525
* We can produce a 10-repeat string by "adding" the results of a 8-repeat string and a 2-repeat string.
2626
*
2727
* The implementation is then as follows:
2828
*
29-
* 1. Let `s` be the string to be repeated and `o` be an output string.
30-
* 2. Initialize an output string `o`.
31-
* 3. Check the least significant bit to determine if the current `s` string should be "added" to the output "total".
32-
* - if the bit is a one, add
33-
* - otherwise, move on
34-
* 4. Double the string `s` by adding `s` to `s`.
35-
* 5. Right-shift the bits of `n`.
36-
* 6. Check if we have shifted off all bits.
37-
* - if yes, done.
38-
* - otherwise, move on
39-
* 7. Repeat 3-6.
29+
* 1. Let `s` be the string to be repeated and `o` be an output string.
30+
*
31+
* 2. Initialize an output string `o`.
32+
*
33+
* 3. Check the least significant bit to determine if the current `s` string should be "added" to the output "total".
34+
*
35+
* - if the bit is a one, add
36+
* - otherwise, move on
37+
*
38+
* 4. Double the string `s` by adding `s` to `s`.
39+
*
40+
* 5. Right-shift the bits of `n`.
41+
*
42+
* 6. Check if we have shifted off all bits.
43+
*
44+
* - if yes, done.
45+
* - otherwise, move on
46+
*
47+
* 7. Repeat 3-6.
4048
*
4149
* The result is that, as the string is repeated, we continually check to see if the doubled string is one which we want to add to our "total".
4250
*

0 commit comments

Comments
 (0)