Skip to content

Commit

Permalink
refactor: use Object.hasOwn
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Jul 30, 2022
1 parent 83bc3ba commit ec1210a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/lambda/handler-runner/java-runner/JavaRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { log } from '@serverless/utils/log.js'
import { invokeJavaLocal } from 'java-invoke-local'

const { parse, stringify } = JSON
const { has } = Reflect
const { hasOwn } = Object

export default class JavaRunner {
#deployPackage = null
Expand Down Expand Up @@ -45,7 +45,7 @@ export default class JavaRunner {
if (
json &&
typeof json === 'object' &&
has(json, '__offline_payload__')
hasOwn(json, '__offline_payload__')
) {
return json.__offline_payload__
}
Expand Down
5 changes: 2 additions & 3 deletions src/lambda/handler-runner/python-runner/PythonRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { fileURLToPath } from 'node:url'
import { log } from '@serverless/utils/log.js'

const { parse, stringify } = JSON
const { assign } = Object
const { has } = Reflect
const { assign, hasOwn } = Object

const __dirname = dirname(fileURLToPath(import.meta.url))

Expand Down Expand Up @@ -83,7 +82,7 @@ export default class PythonRunner {
if (
json &&
typeof json === 'object' &&
has(json, '__offline_payload__')
hasOwn(json, '__offline_payload__')
) {
payload = json.__offline_payload__
// everything else is print(), logging, ...
Expand Down
4 changes: 2 additions & 2 deletions src/lambda/handler-runner/ruby-runner/RubyRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { log } from '@serverless/utils/log.js'
import { execa } from 'execa'

const { parse, stringify } = JSON
const { has } = Reflect
const { hasOwn } = Object

const __dirname = dirname(fileURLToPath(import.meta.url))

Expand Down Expand Up @@ -47,7 +47,7 @@ export default class RubyRunner {
if (
json &&
typeof json === 'object' &&
has(json, '__offline_payload__')
hasOwn(json, '__offline_payload__')
) {
payload = json.__offline_payload__
} else {
Expand Down

0 comments on commit ec1210a

Please sign in to comment.