Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
hasOwnProperty had a error if object does not have a this method, as example - from Object.create(null)
  • Loading branch information
salwador committed Apr 13, 2024
1 parent 58ff813 commit 88d665d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
9 changes: 7 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bsnext/nester",
"version": "1.1.3",
"version": "1.1.4",
"description": "Transforming \"raw-string\" keys in objects.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const parseKey = function (key: string) {
};

const isArray = Array.isArray;
const hasOwn = Object.hasOwn;

////////////////////////////////

Expand All @@ -36,7 +37,7 @@ export default class Nester {
let result = {};

for (let key in response) {
if (key === undefined || !response.hasOwnProperty(key)) {
if (key === undefined || !hasOwn(response, key)) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "ES2019",
"target": "ES2022",
"module": "commonjs",
"noImplicitAny": false,
"strictNullChecks": true,
Expand Down

0 comments on commit 88d665d

Please sign in to comment.