Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tmp = match$1[0].map((function (value) {
var match = Js_json.decodeObject(value);
if (match) {
var value$1 = match[0];
var value$2 = value$1["uid"];
var match$1 = Js_json.decodeString(value$2);
var tmp;
if (match$1) {
tmp = match$1[0];
} else {
throw Graphql_error;
}
var value$3 = value$1["image"];
var match$2 = Js_json.decodeNull(value$3);
var tmp$1;
if (match$2) {
tmp$1 = /* None */0;
} else {
var match$3 = Js_json.decodeObject(value$3);
var tmp$2;
if (match$3) {
var value$4 = match$3[0]["small"];
var match$4 = Js_json.decodeString(value$4);
var tmp$3;
if (match$4) {
tmp$3 = match$4[0];
} else {
throw Graphql_error;
}
tmp$2 = {
href: tmp$14,
album: tmp$15
};
} else {
tmp$9 = Js_exn.raiseError("graphql_ppx: Object is not a value");
}
tmp$8 = Caml_option.some(tmp$9);
}
} else {
tmp$8 = undefined;
}
var match$42 = Js_dict.get(value$5, "progressMs");
var tmp$18;
if (match$42 !== undefined) {
var value$17 = Caml_option.valFromOption(match$42);
var match$43 = Js_json.decodeNull(value$17);
if (match$43 !== undefined) {
tmp$18 = undefined;
} else {
var match$44 = Js_json.decodeNumber(value$17);
tmp$18 = match$44 !== undefined ? match$44 | 0 : Js_exn.raiseError("graphql_ppx: Expected int, got " + JSON.stringify(value$17));
}
} else {
tmp$18 = undefined;
}
tmp$5 = {
isPlaying: tmp$6,
currentlyPlayingType: tmp$7,
item: tmp$8,
progressMs: tmp$18
};
} else {
var match$36 = Js_dict.get(value$9, "album");
var tmp$15;
if (match$36 !== undefined) {
var value$15 = Caml_option.valFromOption(match$36);
var match$37 = Js_json.decodeNull(value$15);
if (match$37 !== undefined) {
tmp$15 = undefined;
} else {
var match$38 = Js_json.decodeObject(value$15);
var tmp$16;
if (match$38 !== undefined) {
var match$39 = Js_dict.get(Caml_option.valFromOption(match$38), "images");
var tmp$17;
if (match$39 !== undefined) {
var value$16 = Caml_option.valFromOption(match$39);
var match$40 = Js_json.decodeNull(value$16);
if (match$40 !== undefined) {
tmp$17 = undefined;
} else {
var match$41 = Js_json.decodeArray(value$16);
tmp$17 = match$41 !== undefined ? match$41.map((function (value) {
var match = Js_json.decodeObject(value);
if (match !== undefined) {
var match$1 = Js_dict.get(Caml_option.valFromOption(match), "url");
var tmp;
if (match$1 !== undefined) {
var value$1 = Caml_option.valFromOption(match$1);
var match$2 = Js_json.decodeNull(value$1);
if (match$2 !== undefined) {
tmp = undefined;
} else {
var match$3 = Js_json.decodeString(value$1);
var value$14 = Caml_option.valFromOption(match$33);
var match$34 = Js_json.decodeNull(value$14);
if (match$34 !== undefined) {
tmp$14 = undefined;
} else {
var match$35 = Js_json.decodeString(value$14);
tmp$14 = match$35 !== undefined ? match$35 : Js_exn.raiseError("graphql_ppx: Expected string, got " + JSON.stringify(value$14));
}
} else {
tmp$14 = undefined;
}
var match$36 = Js_dict.get(value$9, "album");
var tmp$15;
if (match$36 !== undefined) {
var value$15 = Caml_option.valFromOption(match$36);
var match$37 = Js_json.decodeNull(value$15);
if (match$37 !== undefined) {
tmp$15 = undefined;
} else {
var match$38 = Js_json.decodeObject(value$15);
var tmp$16;
if (match$38 !== undefined) {
var match$39 = Js_dict.get(Caml_option.valFromOption(match$38), "images");
var tmp$17;
if (match$39 !== undefined) {
var value$16 = Caml_option.valFromOption(match$39);
var match$40 = Js_json.decodeNull(value$16);
if (match$40 !== undefined) {
tmp$17 = undefined;
} else {
var match$41 = Js_json.decodeArray(value$16);
tmp$17 = match$41 !== undefined ? match$41.map((function (value) {
var tmp$4;
if (match$9 !== undefined) {
var value$4 = Caml_option.valFromOption(match$9);
var match$10 = Js_json.decodeNull(value$4);
if (match$10 !== undefined) {
tmp$4 = undefined;
} else {
var match$11 = Js_json.decodeObject(value$4);
var tmp$5;
if (match$11 !== undefined) {
var value$5 = Caml_option.valFromOption(match$11);
var match$12 = Js_dict.get(value$5, "isPlaying");
var tmp$6;
if (match$12 !== undefined) {
var value$6 = Caml_option.valFromOption(match$12);
var match$13 = Js_json.decodeNull(value$6);
if (match$13 !== undefined) {
tmp$6 = undefined;
} else {
var match$14 = Js_json.decodeBoolean(value$6);
tmp$6 = match$14 !== undefined ? match$14 : Js_exn.raiseError("graphql_ppx: Expected boolean, got " + JSON.stringify(value$6));
}
} else {
tmp$6 = undefined;
}
var match$15 = Js_dict.get(value$5, "currentlyPlayingType");
var tmp$7;
if (match$15 !== undefined) {
var value$7 = Caml_option.valFromOption(match$15);
var match$16 = Js_json.decodeNull(value$7);
if (match$16 !== undefined) {
tmp$7 = undefined;
var value$6 = Caml_option.valFromOption(match$12);
var match$13 = Js_json.decodeNull(value$6);
if (match$13 !== undefined) {
tmp$6 = undefined;
} else {
var match$14 = Js_json.decodeBoolean(value$6);
tmp$6 = match$14 !== undefined ? match$14 : Js_exn.raiseError("graphql_ppx: Expected boolean, got " + JSON.stringify(value$6));
}
} else {
tmp$6 = undefined;
}
var match$15 = Js_dict.get(value$5, "currentlyPlayingType");
var tmp$7;
if (match$15 !== undefined) {
var value$7 = Caml_option.valFromOption(match$15);
var match$16 = Js_json.decodeNull(value$7);
if (match$16 !== undefined) {
tmp$7 = undefined;
} else {
var match$17 = Js_json.decodeString(value$7);
tmp$7 = match$17 !== undefined ? match$17 : Js_exn.raiseError("graphql_ppx: Expected string, got " + JSON.stringify(value$7));
}
} else {
tmp$7 = undefined;
}
var match$18 = Js_dict.get(value$5, "item");
var tmp$8;
if (match$18 !== undefined) {
var value$8 = Caml_option.valFromOption(match$18);
var match$19 = Js_json.decodeNull(value$8);
if (match$19 !== undefined) {
tmp$8 = undefined;
var value$13 = Caml_option.valFromOption(match$30);
var match$31 = Js_json.decodeNull(value$13);
if (match$31 !== undefined) {
tmp$13 = undefined;
} else {
var match$32 = Js_json.decodeNumber(value$13);
tmp$13 = match$32 !== undefined ? match$32 | 0 : Js_exn.raiseError("graphql_ppx: Expected int, got " + JSON.stringify(value$13));
}
} else {
tmp$13 = undefined;
}
var match$33 = Js_dict.get(value$9, "href");
var tmp$14;
if (match$33 !== undefined) {
var value$14 = Caml_option.valFromOption(match$33);
var match$34 = Js_json.decodeNull(value$14);
if (match$34 !== undefined) {
tmp$14 = undefined;
} else {
var match$35 = Js_json.decodeString(value$14);
tmp$14 = match$35 !== undefined ? match$35 : Js_exn.raiseError("graphql_ppx: Expected string, got " + JSON.stringify(value$14));
}
} else {
tmp$14 = undefined;
}
var match$36 = Js_dict.get(value$9, "album");
var tmp$15;
if (match$36 !== undefined) {
var value$15 = Caml_option.valFromOption(match$36);
var match$37 = Js_json.decodeNull(value$15);
if (match$37 !== undefined) {
tmp$15 = undefined;
var tmp$1;
if (match$3 !== undefined) {
var value$1 = Caml_option.valFromOption(match$3);
var match$4 = Js_json.decodeNull(value$1);
if (match$4 !== undefined) {
tmp$1 = undefined;
} else {
var match$5 = Js_json.decodeObject(value$1);
var tmp$2;
if (match$5 !== undefined) {
var value$2 = Caml_option.valFromOption(match$5);
var match$6 = Js_dict.get(value$2, "id");
var tmp$3;
if (match$6 !== undefined) {
var value$3 = Caml_option.valFromOption(match$6);
var match$7 = Js_json.decodeNull(value$3);
if (match$7 !== undefined) {
tmp$3 = undefined;
} else {
var match$8 = Js_json.decodeString(value$3);
tmp$3 = match$8 !== undefined ? match$8 : Js_exn.raiseError("graphql_ppx: Expected string, got " + JSON.stringify(value$3));
}
} else {
tmp$3 = undefined;
}
var match$9 = Js_dict.get(value$2, "displayName");
var tmp$4;
if (match$9 !== undefined) {
var value$4 = Caml_option.valFromOption(match$9);
var match$10 = Js_json.decodeNull(value$4);
if (match$10 !== undefined) {
tmp$4 = undefined;
var value$7 = Caml_option.valFromOption(match$15);
var match$16 = Js_json.decodeNull(value$7);
if (match$16 !== undefined) {
tmp$7 = undefined;
} else {
var match$17 = Js_json.decodeString(value$7);
tmp$7 = match$17 !== undefined ? match$17 : Js_exn.raiseError("graphql_ppx: Expected string, got " + JSON.stringify(value$7));
}
} else {
tmp$7 = undefined;
}
var match$18 = Js_dict.get(value$5, "item");
var tmp$8;
if (match$18 !== undefined) {
var value$8 = Caml_option.valFromOption(match$18);
var match$19 = Js_json.decodeNull(value$8);
if (match$19 !== undefined) {
tmp$8 = undefined;
} else {
var match$20 = Js_json.decodeObject(value$8);
var tmp$9;
if (match$20 !== undefined) {
var value$9 = Caml_option.valFromOption(match$20);
var match$21 = Js_dict.get(value$9, "id");
var tmp$10;
if (match$21 !== undefined) {
var value$10 = Caml_option.valFromOption(match$21);
var match$22 = Js_json.decodeNull(value$10);
if (match$22 !== undefined) {
tmp$10 = undefined;
} else {
var match$23 = Js_json.decodeString(value$10);
var value$11 = Caml_option.valFromOption(match$24);
var match$25 = Js_json.decodeNull(value$11);
if (match$25 !== undefined) {
tmp$11 = undefined;
} else {
var match$26 = Js_json.decodeString(value$11);
tmp$11 = match$26 !== undefined ? match$26 : Js_exn.raiseError("graphql_ppx: Expected string, got " + JSON.stringify(value$11));
}
} else {
tmp$11 = undefined;
}
var match$27 = Js_dict.get(value$9, "artists");
var tmp$12;
if (match$27 !== undefined) {
var value$12 = Caml_option.valFromOption(match$27);
var match$28 = Js_json.decodeNull(value$12);
if (match$28 !== undefined) {
tmp$12 = undefined;
} else {
var match$29 = Js_json.decodeArray(value$12);
tmp$12 = match$29 !== undefined ? match$29.map((function (value) {
var match = Js_json.decodeObject(value);
if (match !== undefined) {
var match$1 = Js_dict.get(Caml_option.valFromOption(match), "name");
var tmp;
if (match$1 !== undefined) {
var value$1 = Caml_option.valFromOption(match$1);
var match$2 = Js_json.decodeNull(value$1);
if (match$2 !== undefined) {
tmp = undefined;
} else {
var match$3 = Js_json.decodeString(value$1);