Skip to content

Commit

Permalink
Switch from Object.prototype.hasOwnProperty.call to Object.hasOwn
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
Page- committed Jun 4, 2024
1 parent b6988c2 commit 69efa33
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/translations/v6/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const addReadOnlyHook = (
const translateDeviceTypeTo =
(toField: string) =>
async ({ request, api }: sbvrUtils.HookArgs) => {
if (Object.prototype.hasOwnProperty.call(request.values, 'device_type')) {
if (Object.hasOwn(request.values, 'device_type')) {
const resinApi = sbvrUtils.api.resin.clone({
passthrough: api.passthrough,
});
Expand Down Expand Up @@ -87,7 +87,7 @@ addReadOnlyHook(['PUT', 'POST', 'PATCH'], 'release', {

addReadOnlyHook(['PUT', 'POST', 'PATCH'], 'release', {
async POSTPARSE({ request }) {
if (!Object.prototype.hasOwnProperty.call(request.values, 'contract')) {
if (!Object.hasOwn(request.values, 'contract')) {
return;
}
try {
Expand Down
2 changes: 1 addition & 1 deletion test/21_fleet-target-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config.TEST_MOCK_ONLY.API_HEARTBEAT_STATE_TIMEOUT_SECONDS = TIMEOUT_SEC;

// test fleet default state helper
const appMatcherFunc = (svc: AnyObject, fxProp: AnyObject) =>
Object.prototype.hasOwnProperty.call(svc, 'environment') && !!fxProp;
Object.hasOwn(svc, 'environment') && !!fxProp;
const svcMatcherFunc = (svc: AnyObject, fxProp: AnyObject) =>
svc.id === fxProp.service.__id;
const imgMatcherFunc = (svc: AnyObject, fxProp: AnyObject) =>
Expand Down
5 changes: 1 addition & 4 deletions test/test-lib/device-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ export const loadDefaultFixtures = () =>
{} as Dictionary<Promise<Pick<DeviceType, 'id' | 'slug' | 'name'>>>,
{
get: (obj, slug) => {
if (
typeof slug === 'string' &&
!Object.prototype.hasOwnProperty.call(obj, slug)
) {
if (typeof slug === 'string' && !Object.hasOwn(obj, slug)) {
if (slug === 'then') {
// Something is checking if we're a thenable
return;
Expand Down
5 changes: 1 addition & 4 deletions test/test-lib/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,7 @@ export const load = async (fixtureName?: string): Promise<Fixtures> => {
.filter(
(file) =>
file.endsWith('.json') &&
Object.prototype.hasOwnProperty.call(
loaders,
file.slice(0, -'.json'.length),
),
Object.hasOwn(loaders, file.slice(0, -'.json'.length)),
)
.map((file) => file.slice(0, -'.json'.length).trim());

Expand Down

0 comments on commit 69efa33

Please sign in to comment.