Skip to content

Commit

Permalink
fix documentation for enum.filter (#359)
Browse files Browse the repository at this point in the history
* fix documentation for enum.filter

fixes #358

* update stdlib code comment for enum.filter
  • Loading branch information
misiek08 authored Feb 7, 2022
1 parent 1bcc189 commit 7b5d207
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/stdlib-enum.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ enum := import("enum")
iterate and returns undefined if `x` is not enumerable.`
- `filter(x, fn) => [object]`: iterates over elements of `x`, returning an
array of all elements `fn` returns truthy for. `fn` is invoked with two
arguments: `key` and `value`. `key` is an int index if `x` is array. `key` is
a string key if `x` is map. It returns undefined if `x` is not enumerable.
arguments: `key` and `value`. `key` is an int index if `x` is array. It returns
undefined if `x` is not array.
- `find(x, fn) => object`: iterates over elements of `x`, returning value of
the first element `fn` returns truthy for. `fn` is invoked with two
arguments: `key` and `value`. `key` is an int index if `x` is array. `key` is
Expand Down
2 changes: 1 addition & 1 deletion stdlib/source_modules.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions stdlib/srcmod_enum.tengo
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ export {
},
// filter iterates over elements of `x`, returning an array of all elements `fn`
// returns truthy for. `fn` is invoked with two arguments: `key` and `value`.
// `key` is an int index if `x` is array. `key` is a string key if `x` is map.
// It returns undefined if `x` is not enumerable.
// `key` is an int index if `x` is array. It returns undefined if `x` is not array.
filter: func(x, fn) {
if !is_array_like(x) { return undefined }

Expand Down

0 comments on commit 7b5d207

Please sign in to comment.