Skip to content

Commit d8d9f71

Browse files
authored
fix: fix assign function signature (#558)
* Return back to having target in assign function signature * Change index from 1 to 0
1 parent 9c19f83 commit d8d9f71

File tree

1 file changed

+5
-5
lines changed
  • packages/optimizely-sdk/lib/utils/fns

1 file changed

+5
-5
lines changed

packages/optimizely-sdk/lib/utils/fns/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ import { generateUUID as uuid, keyBy as keyByUtil } from '@optimizely/js-sdk-uti
1818
const MAX_SAFE_INTEGER_LIMIT = Math.pow(2, 53);
1919

2020
// eslint-disable-next-line
21-
export function assign(...sources: [any]): any {
22-
if (sources.length < 1) {
21+
export function assign(target: any, ...sources: any[]): any {
22+
if (!target) {
2323
return {};
2424
}
2525
if (typeof Object.assign === 'function') {
26-
return Object.assign(...sources);
26+
return Object.assign(target, ...sources);
2727
} else {
28-
const to = Object(sources[0]);
29-
for (let index = 1; index < sources.length; index++) {
28+
const to = Object(target);
29+
for (let index = 0; index < sources.length; index++) {
3030
const nextSource = sources[index];
3131
if (nextSource !== null && nextSource !== undefined) {
3232
for (const nextKey in nextSource) {

0 commit comments

Comments
 (0)