Skip to content

Commit

Permalink
fix(src): map to return object .prototype undefined (#147)
Browse files Browse the repository at this point in the history
Co-authored-by: Restyled Commits <commits@restyled.io>

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Signed-off-by: Restyled Commits <commits@restyled.io>
  • Loading branch information
DerekNonGeneric authored Oct 18, 2022
1 parent d10341a commit 5ea6dda
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.vscode
node_modules
.vscode/
node_modules/
lib/**/*
.DS_Store
tsconfig.tsbuildinfo
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ const _hasOwn = Object.prototype.hasOwnProperty;
export const map = <T>(opt_initial: T | null | undefined): object => {
const object = Object.create(null);
if (opt_initial) {
Object.assign(object, opt_initial);
Object.assign(object, { ...opt_initial });
}

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

/**
Expand Down

0 comments on commit 5ea6dda

Please sign in to comment.