MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / _getNamespacesStackEntry

Method _getNamespacesStackEntry

packages/core/xml/index.ts:579–608  ·  view source on GitHub ↗
(attributes: any)

Source from the content-addressed store, hash-verified

577 }
578
579 private static _getNamespacesStackEntry(attributes: any): any {
580 const stackEntry = {};
581
582 if (!attributes) {
583 return stackEntry;
584 }
585
586 let attributeName;
587 let namespacePrefix;
588 for (const key in attributes) {
589 if (!attributes.hasOwnProperty(key)) {
590 continue;
591 }
592
593 attributeName = <string>key;
594 if (attributeName.indexOf('xmlns') !== 0) {
595 // This is a normal attribute, so go on.
596 continue;
597 }
598
599 namespacePrefix = '';
600 if (attributeName.indexOf(':') !== -1) {
601 namespacePrefix = attributeName.split(':')[1];
602 }
603
604 stackEntry[namespacePrefix] = attributes[key];
605 }
606
607 return stackEntry;
608 }
609
610 private _resolveNamespace(fullName: string): { prefix: string; namespace: string; name: string } {
611 const result: { prefix: string; namespace: string; name: string } = {

Callers 1

constructorMethod · 0.80

Calls 1

indexOfMethod · 0.80

Tested by

no test coverage detected