Skip to content

Commit 5ea6dda

Browse files
fix(src): map to return object .prototype undefined (#147)
Co-authored-by: Restyled Commits <[email protected]> Signed-off-by: Derek Lewis <[email protected]> Signed-off-by: Restyled Commits <[email protected]>
1 parent d10341a commit 5ea6dda

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
.vscode
2-
node_modules
1+
.vscode/
2+
node_modules/
3+
lib/**/*
4+
.DS_Store
5+
tsconfig.tsbuildinfo

src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ const _hasOwn = Object.prototype.hasOwnProperty;
3434
export const map = <T>(opt_initial: T | null | undefined): object => {
3535
const object = Object.create(null);
3636
if (opt_initial) {
37-
Object.assign(object, opt_initial);
37+
Object.assign(object, { ...opt_initial });
3838
}
3939

40-
// FIXME(@DerekNonGeneric): Should we be creating objects w/ null protos?
41-
return { ...opt_initial };
40+
// FIXME(@DerekNonGeneric): Should we be returning these newly-created
41+
// objects w/ `null` prototypes instead of `undefined` ones, (which is
42+
// what had previously been doing and are still currently testing for)?
43+
return object;
4244
};
4345

4446
/**

0 commit comments

Comments
 (0)