MCPcopy Create free account
hub / github.com/microsoft/SandDance / findLoaderByExamingInitialData

Function findLoaderByExamingInitialData

docs/app/js/sanddance-app.js:57133–57154  ·  view source on GitHub ↗
(loaders, data)

Source from the content-addressed store, hash-verified

57131 return null;
57132}
57133function findLoaderByExamingInitialData(loaders, data) {
57134 if (!data) return null;
57135 var _iterator5 = _createForOfIteratorHelper(loaders), _step5;
57136 try {
57137 for(_iterator5.s(); !(_step5 = _iterator5.n()).done;){
57138 var loader = _step5.value;
57139 if (typeof data === "string") {
57140 if (testDataAgainstText(data, loader)) return loader;
57141 } else if (ArrayBuffer.isView(data)) {
57142 if (testDataAgainstBinary(data.buffer, data.byteOffset, loader)) return loader;
57143 } else if (data instanceof ArrayBuffer) {
57144 var byteOffset = 0;
57145 if (testDataAgainstBinary(data, byteOffset, loader)) return loader;
57146 }
57147 }
57148 } catch (err) {
57149 _iterator5.e(err);
57150 } finally{
57151 _iterator5.f();
57152 }
57153 return null;
57154}
57155function testDataAgainstText(data, loader) {
57156 return loader.testText && loader.testText(data);
57157}

Callers 1

selectLoaderSyncFunction · 0.70

Calls 3

testDataAgainstTextFunction · 0.70
testDataAgainstBinaryFunction · 0.70

Tested by

no test coverage detected