[Glitch] Use modern ES syntax rather than `.call`

Port 899eac1a92 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
shrike
Renaud Chaput 2024-02-27 16:42:05 +01:00 committed by Claire
parent c2f0ea415e
commit 0ff9800989
3 changed files with 8 additions and 8 deletions

View File

@ -80,7 +80,7 @@ export default class MediaContainer extends PureComponent {
return ( return (
<IntlProvider> <IntlProvider>
<> <>
{[].map.call(components, (component, i) => { {Array.from(components).map((component, i) => {
const componentName = component.getAttribute('data-component'); const componentName = component.getAttribute('data-component');
const Component = MEDIA_COMPONENTS[componentName]; const Component = MEDIA_COMPONENTS[componentName];
const { media, card, poll, hashtag, ...props } = JSON.parse(component.getAttribute('data-props')); const { media, card, poll, hashtag, ...props } = JSON.parse(component.getAttribute('data-props'));

View File

@ -36,7 +36,7 @@ Object.keys(emojiIndex.emojis).forEach(key => {
let emoji = emojiIndex.emojis[key]; let emoji = emojiIndex.emojis[key];
// Emojis with skin tone modifiers are stored like this // Emojis with skin tone modifiers are stored like this
if (Object.prototype.hasOwnProperty.call(emoji, '1')) { if (Object.hasOwn(emoji, '1')) {
emoji = emoji['1']; emoji = emoji['1'];
} }
@ -88,7 +88,7 @@ Object.keys(emojiIndex.emojis).forEach(key => {
let emoji = emojiIndex.emojis[key]; let emoji = emojiIndex.emojis[key];
// Emojis with skin tone modifiers are stored like this // Emojis with skin tone modifiers are stored like this
if (Object.prototype.hasOwnProperty.call(emoji, '1')) { if (Object.hasOwn(emoji, '1')) {
emoji = emoji['1']; emoji = emoji['1'];
} }

View File

@ -135,19 +135,19 @@ function getData(emoji, skin, set) {
} }
} }
if (Object.prototype.hasOwnProperty.call(data.short_names, emoji)) { if (Object.hasOwn(data.short_names, emoji)) {
emoji = data.short_names[emoji]; emoji = data.short_names[emoji];
} }
if (Object.prototype.hasOwnProperty.call(data.emojis, emoji)) { if (Object.hasOwn(data.emojis, emoji)) {
emojiData = data.emojis[emoji]; emojiData = data.emojis[emoji];
} }
} else if (emoji.id) { } else if (emoji.id) {
if (Object.prototype.hasOwnProperty.call(data.short_names, emoji.id)) { if (Object.hasOwn(data.short_names, emoji.id)) {
emoji.id = data.short_names[emoji.id]; emoji.id = data.short_names[emoji.id];
} }
if (Object.prototype.hasOwnProperty.call(data.emojis, emoji.id)) { if (Object.hasOwn(data.emojis, emoji.id)) {
emojiData = data.emojis[emoji.id]; emojiData = data.emojis[emoji.id];
skin = skin || emoji.skin; skin = skin || emoji.skin;
} }
@ -216,7 +216,7 @@ function deepMerge(a, b) {
let originalValue = a[key], let originalValue = a[key],
value = originalValue; value = originalValue;
if (Object.prototype.hasOwnProperty.call(b, key)) { if (Object.hasOwn(b, key)) {
value = b[key]; value = b[key];
} }