MCPcopy
hub / github.com/socketio/socket.io / hasBinary

Function hasBinary

packages/socket.io/client-dist/socket.io.js:3070–3094  ·  view source on GitHub ↗
(obj, toJSON)

Source from the content-addressed store, hash-verified

3068 return withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)) || withNativeBlob && obj instanceof Blob || withNativeFile && obj instanceof File;
3069 }
3070 function hasBinary(obj, toJSON) {
3071 if (!obj || _typeof(obj) !== "object") {
3072 return false;
3073 }
3074 if (Array.isArray(obj)) {
3075 for (var i = 0, l = obj.length; i < l; i++) {
3076 if (hasBinary(obj[i])) {
3077 return true;
3078 }
3079 }
3080 return false;
3081 }
3082 if (isBinary(obj)) {
3083 return true;
3084 }
3085 if (obj.toJSON && typeof obj.toJSON === "function" && arguments.length === 1) {
3086 return hasBinary(obj.toJSON(), true);
3087 }
3088 for (var key in obj) {
3089 if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {
3090 return true;
3091 }
3092 }
3093 return false;
3094 }
3095
3096 /**
3097 * Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder.

Callers 2

encodeMethod · 0.90
socket.io.jsFile · 0.70

Calls 2

_typeofFunction · 0.85
isBinaryFunction · 0.70

Tested by

no test coverage detected