Skip to content

Commit 410ce00

Browse files
committed
docs(package): document anchor slightly better
1 parent 37d22a0 commit 410ce00

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ npm install mod-floor-ceiling
3434

3535
### `modFloor(value: number, modulus: number, anchor?: number = 0): number`
3636

37-
Returns the greatest (closest to positive infinity) multiple of `modulus` that is `<= value`.
37+
Returns the greatest (closest to positive infinity) multiple of `modulus`, plus `anchor`, that is `<= value`.
3838

3939
### `modCeiling(value: number, modulus: number, anchor?: number = 0): number`
4040

41-
Returns the least (closest to negative infinity) multiple of `modulus` that is `>= value`.
41+
Returns the least (closest to negative infinity) multiple of `modulus`, plus `anchor`, that is `>= value`.
4242

4343
### `modLower(value: number, modulus: number, anchor?: number = 0): number`
4444

45-
Returns the greatest (closest to positive infinity) multiple of `modulus` that is `< value`.
45+
Returns the greatest (closest to positive infinity) multiple of `modulus`, plus `anchor`, that is `< value`.
4646

4747
### `modHigher(value: number, modulus: number, anchor?: number = 0): number`
4848

49-
Returns the greatest (closest to positive infinity) multiple of `modulus` that is `> value`.
49+
Returns the greatest (closest to positive infinity) multiple of `modulus`, plus `anchor`, that is `> value`.
5050

5151
### What is `anchor`?
5252

lib/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @param {number} modulus - the modulus of division
44
* @param {number} [anchor=0] - controls the offset of multiples of modulus. For example, with a modulus of 3
55
* and an anchor of 1, possible return values include -2, 1, 4, 7, etc.
6-
* @return the greatest (closest to positive infinity) multiple of modulus that is <= value.
6+
* @return the greatest (closest to positive infinity) multiple of modulus, plus anchor, that is <= value.
77
*/
88
function modFloor(value, modulus, anchor) {
99
if (anchor) return anchor + modFloor(value - anchor, modulus)
@@ -17,7 +17,7 @@ function modFloor(value, modulus, anchor) {
1717
* @param {number} modulus - the modulus of division
1818
* @param {number} [anchor=0] - controls the offset of multiples of modulus. For example, with a modulus of 3
1919
* and an anchor of 1, possible return values include -2, 1, 4, 7, etc.
20-
* @return the least (closest to negative infinity) multiple of modulus that is >= value.
20+
* @return the least (closest to negative infinity) multiple of modulus, plus anchor, that is >= value.
2121
*/
2222
function modCeiling(value, modulus, anchor) {
2323
if (anchor) return anchor + modCeiling(value - anchor, modulus)
@@ -33,7 +33,7 @@ function modCeiling(value, modulus, anchor) {
3333
* @param {number} modulus - the modulus of division
3434
* @param {number} [anchor=0] - controls the offset of multiples of modulus. For example, with a modulus of 3
3535
* and an anchor of 1, possible return values include -2, 1, 4, 7, etc.
36-
* @return the greatest (closest to positive infinity) multiple of modulus that is < value.
36+
* @return the greatest (closest to positive infinity) multiple of modulus, plus anchor, that is < value.
3737
*/
3838
function modLower(value, modulus, anchor) {
3939
var result = modFloor(value, modulus, anchor)
@@ -45,7 +45,7 @@ function modLower(value, modulus, anchor) {
4545
* @param {number} modulus - the modulus of division
4646
* @param {number} [anchor=0] - controls the offset of multiples of modulus. For example, with a modulus of 3
4747
* and an anchor of 1, possible return values include -2, 1, 4, 7, etc.
48-
* @return the least (closest to negative infinity) multiple of modulus that is > value.
48+
* @return the least (closest to negative infinity) multiple of modulus, plus anchor, that is > value.
4949
*/
5050
function modHigher(value, modulus, anchor) {
5151
var result = modCeiling(value, modulus, anchor)

0 commit comments

Comments
 (0)