MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / matchPlatform

Method matchPlatform

tools/mcmanifest.js:2799–2827  ·  view source on GitHub ↗
(platforms, name, simple)

Source from the content-addressed store, hash-verified

2797 }
2798 }
2799 matchPlatform(platforms, name, simple) {
2800 let parts = name.split("/");
2801 while (parts.length) {
2802 let partial = parts.join("/");
2803 for (let n in platforms) {
2804 if (n.endsWith("/*")) {
2805 let head = n.slice(0, -1);
2806 if (partial.startsWith(head))
2807 return platforms[n];
2808 }
2809 else if (n.startsWith("*/")) {
2810 let tail = n.slice(1);
2811 if (partial.endsWith(tail))
2812 return platforms[n];
2813 }
2814 else if (partial === n)
2815 return platforms[n];
2816 }
2817 parts.length -= 1;
2818 }
2819
2820 if (simple)
2821 return;
2822
2823 for (let n in platforms) {
2824 if ("..." === n)
2825 return platforms[n];
2826 }
2827 }
2828 mergeManifest(all, manifest) {
2829 var currentDirectory = this.currentDirectory;
2830 this.currentDirectory = manifest.directory;

Callers 2

mergeManifestMethod · 0.95
parseManifestMethod · 0.95

Calls 1

sliceMethod · 0.65

Tested by

no test coverage detected