Skip to content

Commit

Permalink
chore(stdlib): Fix spelling mistakes in Array library docs (#1974)
Browse files Browse the repository at this point in the history
  • Loading branch information
spotandjake authored Jan 23, 2024
1 parent dc21976 commit 42ba357
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
19 changes: 7 additions & 12 deletions stdlib/array.gr
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ provide let length = array => {
@unsafe
provide let make: (Number, a) => Array<a> = (length: Number, item: a) => {
from WasmI32 use { (+), (*), (<) }
let lengthArg = length
checkLength(length)
let length = coerceNumberToWasmI32(length)
let byteLength = length * 4n
Expand Down Expand Up @@ -464,7 +463,7 @@ provide let flatMap = (fn, array) => {
*
* @param fn: The function to call on each element, where the returned value indicates if the element satisfies the condition
* @param array: The array to check
* @returns `true` if all elements satify the condition or `false` otherwise
* @returns `true` if all elements satisfy the condition or `false` otherwise
*
* @since v0.3.0
*/
Expand All @@ -483,7 +482,7 @@ provide let every = (fn, array) => {
*
* @param fn: The function to call on each element, where the returned value indicates if the element satisfies the condition
* @param array: The array to iterate
* @returns `true` if one or more elements satify the condition or `false` otherwise
* @returns `true` if one or more elements satisfy the condition or `false` otherwise
*
* @since v0.3.0
*/
Expand Down Expand Up @@ -537,14 +536,10 @@ provide let fillRange = (value, start, stop, array) => {
stopIndex
}

if (startIndex > length) {
throw IndexOutOfBounds
}
if (startIndex > stopIndex) {
if (startIndex > length || startIndex > stopIndex) {
throw IndexOutOfBounds
}

let mut index = startIndex
for (let mut index = startIndex; index < stopIndex; index += 1) {
array[index] = value
}
Expand Down Expand Up @@ -636,7 +631,7 @@ provide let contains = (search, array) => {
}

/**
* Finds the first element in an array that satifies the given condition.
* Finds the first element in an array that satisfies the given condition.
*
* @param fn: The function to call on each element, where the returned value indicates if the element satisfies the condition
* @param array: The array to search
Expand All @@ -655,7 +650,7 @@ provide let find = (fn, array) => {
}

/**
* Finds the first index in an array where the element satifies the given condition.
* Finds the first index in an array where the element satisfies the given condition.
*
* @param fn: The function to call on each element, where the returned value indicates if the element satisfies the condition
* @param array: The array to search
Expand Down Expand Up @@ -1818,7 +1813,7 @@ provide module Immutable {
}

/**
* Finds the first element in an array that satifies the given condition.
* Finds the first element in an array that satisfies the given condition.
*
* @param fn: The function to call on each element, where the returned value indicates if the element satisfies the condition
* @param array: The array to search
Expand All @@ -1833,7 +1828,7 @@ provide module Immutable {
}

/**
* Finds the first index in an array where the element satifies the given condition.
* Finds the first index in an array where the element satisfies the given condition.
*
* @param fn: The function to call on each element, where the returned value indicates if the element satisfies the condition
* @param array: The array to search
Expand Down
12 changes: 6 additions & 6 deletions stdlib/array.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ Returns:

|type|description|
|----|-----------|
|`Bool`|`true` if all elements satify the condition or `false` otherwise|
|`Bool`|`true` if all elements satisfy the condition or `false` otherwise|

### Array.**some**

Expand All @@ -671,7 +671,7 @@ Returns:

|type|description|
|----|-----------|
|`Bool`|`true` if one or more elements satify the condition or `false` otherwise|
|`Bool`|`true` if one or more elements satisfy the condition or `false` otherwise|

### Array.**fill**

Expand Down Expand Up @@ -836,7 +836,7 @@ No other changes yet.
find : (fn: (a => Bool), array: Array<a>) => Option<a>
```

Finds the first element in an array that satifies the given condition.
Finds the first element in an array that satisfies the given condition.

Parameters:

Expand All @@ -862,7 +862,7 @@ No other changes yet.
findIndex : (fn: (a => Bool), array: Array<a>) => Option<Number>
```

Finds the first index in an array where the element satifies the given condition.
Finds the first index in an array where the element satisfies the given condition.

Parameters:

Expand Down Expand Up @@ -2187,7 +2187,7 @@ Returns:
find : (fn: (a => Bool), array: ImmutableArray<a>) => Option<a>
```

Finds the first element in an array that satifies the given condition.
Finds the first element in an array that satisfies the given condition.

Parameters:

Expand Down Expand Up @@ -2220,7 +2220,7 @@ Returns:
findIndex : (fn: (a => Bool), array: ImmutableArray<a>) => Option<Number>
```

Finds the first index in an array where the element satifies the given condition.
Finds the first index in an array where the element satisfies the given condition.

Parameters:

Expand Down

0 comments on commit 42ba357

Please sign in to comment.