mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 12:05:41 +03:00
feat(initial): Support readonly array in initial
(#444)
This commit is contained in:
parent
f7a1c8548a
commit
647c788016
@ -21,7 +21,7 @@
|
||||
* const newSingleElementArr = initial(singleElementArr);
|
||||
* // newSingleElementArr will be []
|
||||
*/
|
||||
export function initial<T>(arr: T[]): T[] {
|
||||
export function initial<T>(arr: readonly T[]): T[] {
|
||||
if (arr.length <= 1) {
|
||||
return [];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user