Skip to content
Myr

fix: use Array.prototype.slice() for copying arrays. Fixes #650

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michel Weststrate · committed by GitHub · parents 8f28982, bb40c36 · Browse files · 2 files+19 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+19 added−1 removed

  • tests:+18 added−0 removed
  • other:+1 added−1 removed

2 files+19 added−1 removed

modified:__tests__/regressions.js+18 added
modified:src/utils/common.ts+1 added-1 removed
152 unmodified lines
153}154155/*#__PURE__*/156export function shallowCopy(base: any) {157 if (Array.isArray(base)) return base.slice()157 if (Array.isArray(base)) return Array.prototype.slice.call(base)158 const descriptors = getOwnPropertyDescriptors(base)159 delete descriptors[DRAFT_STATE as any]160 let keys = ownKeys(descriptors)161 for (let i = 0; i < keys.length; i++) {
38 unmodified lines