Skip to content

Conversation

aleclarson
Copy link
Member

@aleclarson aleclarson commented Apr 3, 2025

Summary

Adds a new concat function that:

  • Flattens input values one level
  • Filters out null/undefined values
  • Preserves type information
  • Works with mixed types and nested arrays
import { concat } from 'radashi'

const result = concat('a', null, ['b', undefined], 'c')
// => ['a', 'b', 'c']

Equivalent to doing this:

const result = ['a', null, ['b', undefined], 'c'].flat().filter(x => x != null)

Related issue, if any:

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed
  • Related benchmarks have been added or updated, if needed
  • Release notes in next-minor.md or next-major.md have been added, if needed

Does this PR introduce a breaking change?

No

Bundle impact

Status File Size 1
A src/array/concat.ts 130

Footnotes

  1. Function size includes the import dependencies of the function.

@radashi-bot
Copy link

radashi-bot commented Apr 3, 2025

Benchmark Results

Name Current
concat: concat with simple values 874,637.02 ops/sec ±0.19%
concat: concat with nested arrays 869,012.65 ops/sec ±0.18%
concat: concat with mixed types 1,047,948.58 ops/sec ±0.13%

Performance regressions of 30% or more should be investigated, unless they were anticipated. Smaller regressions may be due to normal variability, as we don't use dedicated CI infrastructure.

@aleclarson aleclarson moved this to Proposed in Radashi Apr 3, 2025
@aleclarson aleclarson added the new feature This PR adds a new function or extends an existing one label Apr 3, 2025
@aleclarson aleclarson moved this from Proposed to In Progress in Radashi Apr 12, 2025
@aleclarson aleclarson merged commit 8f54e73 into main Apr 12, 2025
7 of 8 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Released in Radashi Apr 12, 2025
aleclarson added a commit that referenced this pull request Apr 12, 2025
@radashi-bot
Copy link

A stable release 12.5.0 has been published to NPM. 🚀

To install:

pnpm add radashi@12.5.0
See the changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature This PR adds a new function or extends an existing one
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

2 participants