Skip to content

Commit 21ab8d4

Browse files
committed
fix: Improve logic
1 parent eda6c65 commit 21ab8d4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/array-with-default.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export class ArrayWithDefault extends Array {
3737

3838
const value = target[property];
3939

40-
if (typeof property === "symbol") {
40+
// symbol properties excluded
41+
if (typeof property !== "string") {
4142
return value;
4243
}
4344

@@ -65,6 +66,9 @@ export class ArrayWithDefault extends Array {
6566
});
6667
}
6768

69+
/**
70+
* Ensure methods that produce arrays still use Array.
71+
*/
6872
static get[Symbol.species]() {
6973
return Array;
7074
}

0 commit comments

Comments
 (0)