mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-21 23:41:18 +01:00
don't rely on hasOwnProperty to exist
from MDN: JavaScript does not protect the property name hasOwnProperty; thus, if the possibility exists that an object might have a property with this name, it is necessary to use an external hasOwnProperty to get correct results
This commit is contained in:
parent
c6c203fc5e
commit
57115202d2
@ -11,7 +11,7 @@ Object.get = function(obj, pathstr) {
|
||||
|
||||
for (var i = 0; i < path.length; i++) {
|
||||
var key = path[i];
|
||||
if (!result || !result.hasOwnProperty(key)) {
|
||||
if (!result || !Object.prototype.hasOwnProperty.call(result, key)) {
|
||||
return undefined;
|
||||
} else {
|
||||
result = result[key];
|
||||
|
||||
@ -55,7 +55,7 @@ module.exports = function(req, callback) {
|
||||
var userId = (req.url.path_list[1] || "").split(".")[0];
|
||||
var size = parseInt(req.url.query.size) || config.avatars.default_size;
|
||||
var def = req.url.query.default;
|
||||
var overlay = req.url.query.hasOwnProperty("overlay") || req.url.query.hasOwnProperty("helm");
|
||||
var overlay = Object.prototype.hasOwnProperty.call(req.url.query, "overlay") || Object.prototype.hasOwnProperty.call(req.url.query, "helm");
|
||||
|
||||
// check for extra paths
|
||||
if (req.url.path_list.length > 2) {
|
||||
|
||||
@ -64,7 +64,7 @@ module.exports = function(req, callback) {
|
||||
var userId = (req.url.path_list[2] || "").split(".")[0];
|
||||
var def = req.url.query.default;
|
||||
var scale = parseInt(req.url.query.scale) || config.renders.default_scale;
|
||||
var overlay = req.url.query.hasOwnProperty("overlay") || req.url.query.hasOwnProperty("helm");
|
||||
var overlay = Object.prototype.hasOwnProperty.call(req.url.query, "overlay") || Object.prototype.hasOwnProperty.call(req.url.query, "helm");
|
||||
|
||||
// check for extra paths
|
||||
if (req.url.path_list.length > 3) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user