Skip to content

Instantly share code, notes, and snippets.

@nhahv
Created February 8, 2022 05:03
Show Gist options
  • Save nhahv/2b571d2bd727e7c5e575dad8b4092b50 to your computer and use it in GitHub Desktop.
Save nhahv/2b571d2bd727e7c5e575dad8b4092b50 to your computer and use it in GitHub Desktop.
ESLINT
// 🔴 Error
var hasBarProperty = foo.hasOwnProperty("bar");

// 🟢 Correct 
var hasBarProperty = Object.prototype.hasOwnProperty.call(foo, "bar");
# 🔎 Find
([^\s-]*).hasOwnProperty\('(.*)'\)
# Replace
 Object.prototype.hasOwnProperty.call($1,'$2')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment