MCPcopy Create free account
hub / github.com/appium/appium / transformAttrs

Function transformAttrs

packages/universal-xml-plugin/lib/source.ts:204–224  ·  view source on GitHub ↗
(nodeObj: any, attrs: string[], platform: string)

Source from the content-addressed store, hash-verified

202 * @returns Array of unknown attribute names
203 */
204export function transformAttrs(nodeObj: any, attrs: string[], platform: string): string[] {
205 const unknownAttrs: string[] = [];
206 for (const attr of attrs) {
207 const cleanAttr = attr.substring(2);
208 if ((REMOVE_ATTRS as readonly string[]).includes(cleanAttr)) {
209 delete nodeObj[attr];
210 continue;
211 }
212 const universalAttr = getUniversalAttrName(cleanAttr, platform);
213 if (universalAttr === null) {
214 unknownAttrs.push(cleanAttr);
215 continue;
216 }
217 const newAttr = `${ATTR_PREFIX}${universalAttr}`;
218 if (newAttr !== attr) {
219 nodeObj[newAttr] = nodeObj[attr];
220 delete nodeObj[attr];
221 }
222 }
223 return unknownAttrs;
224}
225
226/**
227 * Gets the universal name for a platform-specific name from a name map

Callers 2

transformNodeFunction · 0.85
source.spec.tsFile · 0.85

Calls 2

getUniversalAttrNameFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected