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

Function testBinary

docs/tests/v3/es6/js/sanddance-test-es6.js:5097–5108  ·  view source on GitHub ↗
(data, byteOffset, loader, test)

Source from the content-addressed store, hash-verified

5095 });
5096}
5097function testBinary(data, byteOffset, loader, test) {
5098 if (test instanceof ArrayBuffer) return (0, _loaderUtils.compareArrayBuffers)(test, data, test.byteLength);
5099 switch((0, _typeofDefault.default)(test)){
5100 case "function":
5101 return test(data, loader);
5102 case "string":
5103 var magic = getMagicString(data, byteOffset, test.length);
5104 return test === magic;
5105 default:
5106 return false;
5107 }
5108}
5109function getFirstCharacters(data) {
5110 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
5111 if (typeof data === "string") return data.slice(0, length);

Callers 1

testDataAgainstBinaryFunction · 0.70

Calls 2

testFunction · 0.70
getMagicStringFunction · 0.70

Tested by

no test coverage detected