es-toolkit
es-toolkit copied to clipboard
A modern JavaScript utility library that's 2-3 times faster and up to 97% smaller—a major upgrade to lodash.
PR #556 addressed an issue regarding how `merge` handles inconsistent source and target types by default. Looks like this should be applied to `mergeWith` as well, which still has identical...
```ts const throttledOnScroll = throttle(onScroll, 100, { edges: ["trailing"] }) ``` This code expects to work like a "Throttle" function, Which invokes onScroll function every 100ms while I keep scrolling,...
Hello, While trying to migrate away from lodash to es-toolkit/compat (btw, thanks a lot for this amazing work!) we noticed a few React components not behaving as expected. I managed...
`sample()` returns `undefined` when an empty array is given. This should also be reflected in the return type.
## Problem Both es-toolkit and lodash allow users to disable `leading` and `trailing` options at the same time on the debounce and throttle functions. This effectively makes the functions no-ops...
This PR implements the `pipe` function, as requested in the [current second](https://github.com/toss/es-toolkit/issues?q=is%3Aissue%20state%3Aopen%20sort%3Areactions-%2B1-desc) most upvoted issue (#1187). Added: - `pipe` function implementation - `pipe` tests (including type-level) - `pipe` docs (note:...
## Description This PR introduces a new `safeJSONParse` utility that provides a **non-throwing wrapper around `JSON.parse`**, complementing the existing `isJSON` predicate. The goal is to keep **validation** and **transformation** clearly...
## Summary Replaced real timer usage with fake timers in debounce and throttle tests to eliminate flaky test risks and significantly improve test execution time. ## Problem - Tests were...
## Problem Deprecation warning occurs when using the `done()` callback in Vitest tests ## Solution Replaced Vitest's deprecated `done()` callback with fake timers ### Before ### After