Skip to content

feat(common-expressions): add substr and split string functions#671

Merged
KetanReddy merged 2 commits intoplayer-ui:mainfrom
tusharagrawa:feat/substr-split-expression-support
Jul 7, 2025
Merged

feat(common-expressions): add substr and split string functions#671
KetanReddy merged 2 commits intoplayer-ui:mainfrom
tusharagrawa:feat/substr-split-expression-support

Conversation

@tusharagrawa
Copy link
Copy Markdown
Contributor

@tusharagrawa tusharagrawa commented Jun 29, 2025

Description

Adds two new string manipulation functions to the Common Expressions Plugin:

  • substr: Extracts substrings with support for negative indices and optional length
  • split: Splits strings with custom separators and optional limit

Changes

  • Implemented substr and split functions following existing patterns
  • Added comprehensive test coverage (13 new tests, 52 total passing)
  • Updated documentation with TypeScript signatures

Change Type (required)

Indicate the type of change your pull request is:

  • patch
  • minor
  • major
  • N/A

Does your PR have any documentation updates?

  • Updated docs
  • No Update needed
  • Unable to update docs

Release Notes

Added substr and split functions to common expressions plugin that mirror their javascript implementation

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 29, 2025

Codecov Report

Attention: Patch coverage is 89.65517% with 3 lines in your changes missing coverage. Please review.

Project coverage is 90.22%. Comparing base (570c426) to head (51b5669).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...s/common-expressions/core/src/expressions/index.ts 89.65% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #671      +/-   ##
==========================================
- Coverage   90.24%   90.22%   -0.02%     
==========================================
  Files         333      333              
  Lines       20605    20634      +29     
  Branches     1991     2002      +11     
==========================================
+ Hits        18595    18618      +23     
- Misses       1994     2000       +6     
  Partials       16       16              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread plugins/common-expressions/core/src/expressions/index.ts Outdated
Comment thread plugins/common-expressions/core/src/expressions/index.ts
Comment thread plugins/common-expressions/core/src/expressions/index.ts Outdated
): Array<string>;
```

### substr
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Potentially support substring as well, and maybe all the common JS standard lib functions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Definitely a good call, lets make that a followup story because we probably want to determine exactly what we should support from the standard library

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@tusharagrawa tusharagrawa force-pushed the feat/substr-split-expression-support branch from 7ec7c19 to eddb934 Compare July 2, 2025 06:52
- Add substr function with proper type safety and edge case handling
- Add split function with JavaScript-like behavior for empty string separator
- Include comprehensive tests for both functions
- Update documentation with examples and usage notes
- Apply proper formatting and linting fixes
@tusharagrawa tusharagrawa force-pushed the feat/substr-split-expression-support branch from eddb934 to 0894dd0 Compare July 2, 2025 07:01
@KetanReddy KetanReddy added the patch Increment the patch version when merged label Jul 7, 2025
@KetanReddy
Copy link
Copy Markdown
Member

Force merging because builds are being flaky but all tests passed during different builds.

@KetanReddy KetanReddy merged commit cc92bfe into player-ui:main Jul 7, 2025
5 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Increment the patch version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants