[WIP] Add array utility functions for expression evaluator#34
[WIP] Add array utility functions for expression evaluator#34Sander-Toonen merged 3 commits intomasterfrom
Conversation
Co-authored-by: Sander-Toonen <5106372+Sander-Toonen@users.noreply.github.com>
Co-authored-by: Sander-Toonen <5106372+Sander-Toonen@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds new array utilities and type-checking helpers to the expression evaluator, including parser registration, language-service docs, and tests.
Changes:
- Added array functions:
reduce(alias offold),find,some,every,unique,distinct. - Added type-checking functions:
isArray,isObject,isNumber,isString,isBoolean,isNull,isUndefined,isFunction. - Registered new built-ins in the parser, updated language-service documentation, updated syntax docs, and added tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/functions/functions-type-checking.ts | Adds test coverage for all new type-checking functions and some integration usage. |
| test/functions/functions-new-array.ts | Adds test coverage for new array utility functions and aliases. |
| src/parsing/parser.ts | Registers new functions in the default parser built-in function table. |
| src/language-service/language-service.documentation.ts | Adds hover/signature documentation for new built-in functions. |
| src/functions/utility/type-checking.ts | Implements the new type-checking utility functions. |
| src/functions/utility/index.ts | Exports the new type-checking utilities from the utility module. |
| src/functions/array/operations.ts | Implements new array operations and aliases (reduce, find, some, every, unique, distinct). |
| docs/syntax.md | Documents the new functions and adds usage examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fold: fold, | ||
| reduce: reduce, | ||
| find: find, | ||
| some: some, | ||
| every: every, | ||
| unique: unique, | ||
| distinct: distinct, |
There was a problem hiding this comment.
The PR description/original plan specifies signatures like reduce(arr, fn, initial) and find(arr, predicate), but the implementation registers these as reduce(f, init, a) and find(f, a) (function first), consistent with existing map/filter/fold. Please update the PR description (or any externally visible docs) to match the implemented argument order to avoid confusion for reviewers/users.
| | isString(v) | Returns `true` if `v` is a string, `false` otherwise. | | ||
| | isBoolean(v) | Returns `true` if `v` is a boolean, `false` otherwise. | | ||
| | isNull(v) | Returns `true` if `v` is null, `false` otherwise. | | ||
| | isUndefined(v)| Returns `true` if `v` is undefined, `false` otherwise. | |
There was a problem hiding this comment.
Markdown table row for isUndefined is missing a space before the column separator (| isUndefined(v)| ...), which makes the table formatting inconsistent with the surrounding rows. Consider aligning it with the other entries (| isUndefined(v) | ...).
| | isUndefined(v)| Returns `true` if `v` is undefined, `false` otherwise. | | |
| | isUndefined(v) | Returns `true` if `v` is undefined, `false` otherwise. | |
Plan: Add Array Utility and Type Checking Functions ✅
Array Functions
reduceas an alias forfoldin array operationsfind(arr, predicate)functionsome(arr, predicate)functionevery(arr, predicate)functionunique(arr)/distinct(arr)functionsType Checking Functions
isArray(value)functionisObject(value)functionisNumber(value)functionisString(value)functionisBoolean(value)functionisNull(value)functionisUndefined(value)functionisFunction(value)functionIntegration
Validation
Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.