Skip to content

Commit

Permalink
Fix #839: ARIA fixes (#3350)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Sep 21, 2022
1 parent 3ad2ed8 commit 008d670
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/lib/utils/ObjectUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,18 @@ export default class ObjectUtils {
* Removes keys from a JSON object that start with a string such as "data" to get all "data-id" type properties.
*
* @param {any} obj the JSON object to reduce
* @param {string} startsWiths the string(s) to check if the property starts with this key
* @param {string[]} startsWiths the string(s) to check if the property starts with this key
* @returns the JSON object containing only the key/values that match the startsWith string
*/
static reduceKeys(obj, ...startsWiths) {
static reduceKeys(obj, startsWiths) {
const result = {};

if (!obj || !startsWiths || !startsWiths.length) {
if (!obj || !startsWiths || startsWiths.length === 0) {
return result;
}

Object.keys(obj)
.filter((key) => startsWiths.some((sw) => key.startsWith(sw)))
.filter((key) => startsWiths.some((value) => key.startsWith(value)))
.forEach(function (key) {
result[key] = obj[key];
delete obj[key];
Expand Down

0 comments on commit 008d670

Please sign in to comment.