Skip to content

Conversation

Copy link

Copilot AI commented Jan 20, 2026

Adds a new src/functions/object directory with four object manipulation functions for the expression parser:

  • merge(...objects) - Merges two or more objects together. Duplicate keys are overwritten by later arguments.
  • keys(obj) - Returns an array of strings containing the keys of the object.
  • values(obj) - Returns an array containing the values of the object.
  • flatten(obj, separator?) - Flattens a nested object's keys using an optional separator (default: _). For example, {foo: {bar: 1}} becomes {foo_bar: 1}.

Changes Made

  • Created src/functions/object/operations.ts with function implementations
  • Created src/functions/object/index.ts to export object functions
  • Updated src/functions/index.ts to include object module export
  • Updated src/parsing/parser.ts to register the new functions
  • Added documentation for object functions in docs/syntax.md
  • Added language server support with completions and hover documentation in src/language-service/language-service.documentation.ts

Testing

  • Added comprehensive test suite with 23 test cases in test/functions/functions-object.ts
  • All 1044 tests pass including 47 language service tests

Security Summary: No security vulnerabilities were discovered by CodeQL analysis.

Original prompt

Create a directory src/functions/object and implement the following functions for objects:

merge: Takes two or more objects and merges them together. Duplicate keys will be overwritten by later arguments.
keys: Accepts an object and returns an array of strings which are the keys of the object.
values: returns an array of object values
flatten: takes an object and returns an object but with flatten keys { foo: { bar: 1 }} becomes {foo_bar: 1}


💡 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.

Co-authored-by: Sander-Toonen <5106372+Sander-Toonen@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functions for object manipulation Add object manipulation functions: merge, keys, values, flatten Jan 20, 2026
Copilot AI requested a review from Sander-Toonen January 20, 2026 14:23
Copy link

@Sander-Toonen Sander-Toonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document the object functions.

Co-authored-by: Sander-Toonen <5106372+Sander-Toonen@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 20, 2026

Document the object functions.

Added documentation for the object functions in docs/syntax.md with a new "Object Manipulation Functions" section that includes function descriptions and usage examples. (d2b4d2c)

@Sander-Toonen Sander-Toonen marked this pull request as ready for review January 20, 2026 14:44
Copilot AI review requested due to automatic review settings January 20, 2026 14:44
Copy link

@Sander-Toonen Sander-Toonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the language server also works with the new functions

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive object manipulation functions to the expression parser, enabling users to work with objects in their expressions. The implementation includes four new functions: merge, keys, values, and flatten, along with complete test coverage and documentation.

Changes:

  • Added four object manipulation functions (merge, keys, values, flatten) with proper error handling and type safety
  • Created comprehensive test suite with 23 test cases covering all functions and edge cases
  • Updated documentation with clear descriptions, examples, and usage patterns

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/functions/object/operations.ts Implements the four object manipulation functions with proper validation and error handling
src/functions/object/index.ts Exports all object manipulation functions
src/functions/index.ts Re-exports object functions to make them available throughout the codebase
src/parsing/parser.ts Imports and registers the new object functions in the parser
test/functions/functions-object.ts Comprehensive test suite with 23 tests covering all functions and edge cases
docs/syntax.md Documentation for the new object functions with clear examples and usage patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Sander-Toonen
Copy link

@copilot Add language server support for the added functions

Copilot stopped work on behalf of Sander-Toonen due to an error January 20, 2026 14:57
@Sander-Toonen
Copy link

@copilot Add language server support for the added functions

Co-authored-by: Sander-Toonen <5106372+Sander-Toonen@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 20, 2026

@copilot Add language server support for the added functions

Added language server documentation for the object functions (merge, keys, values, flatten) in language-service.documentation.ts. The functions now appear in autocomplete with proper parameter hints and show hover documentation. (cfd6017)

@Sander-Toonen Sander-Toonen merged commit 9c77348 into master Jan 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants