mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-04 00:20:45 +00:00
c9c745740d
This commit was ammended to fix a missing import of Context from 'core'.
17 lines
569 B
JavaScript
17 lines
569 B
JavaScript
/**
|
|
* Instead of `myObject.hasOwnProperty(k)`, always write:
|
|
* `safeHasOwnProperty(myObject, k)`.
|
|
*
|
|
* This is a less verbose way to call `Object.prototype.hasOwnProperty.call`.
|
|
* This prevents unexpected behavior when `hasOwnProperty` is overridden,
|
|
* which is especially possible for objects parsed from user-sent JSON.
|
|
*
|
|
* explanation: https://eslint.org/docs/latest/rules/no-prototype-builtins
|
|
* @param {*} o
|
|
* @param {...any} a
|
|
* @returns
|
|
*/
|
|
export const safeHasOwnProperty = (o, ...a) => {
|
|
return Object.prototype.hasOwnProperty.call(o, ...a);
|
|
};
|