How to use the bs-platform/lib/es6/caml_option.js.valFromOption function in bs-platform

To help you get started, we’ve selected a few bs-platform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reason-association / reasonml.org / layouts / JsDocsLayout.bs.js View on Github external
function JsDocsLayout$Docs(Props) {
  var match = Props.components;
  var components = match !== undefined ? Caml_option.valFromOption(match) : SidebarLayout.ApiMd.components;
  var children = Props.children;
  var router = Router.useRouter();
  var route = router.route;
  var headers = Belt_Option.getWithDefault(Belt_Option.map(Js_dict.get(indexData, route), (function (data) {
              return data.headers;
            })), /* array */[]);
  var moduleName = Belt_Option.getWithDefault(Belt_Option.map(Js_dict.get(indexData, route), (function (data) {
              return data.moduleName;
            })), "?");
  var match$1 = React.useState((function () {
          return false;
        }));
  var setSidebarOpen = match$1[1];
  var toggleSidebar = function (param) {
    return Curry._1(setSidebarOpen, (function (prev) {
                  return !prev;
github sync / with-reasonml / src / components / ActiveLink.bs.js View on Github external
function ActiveLink(Props) {
  var href = Props.href;
  var activeClassName = Props.activeClassName;
  var match = Props.router;
  var router = match !== undefined ? Caml_option.valFromOption(match) : Caml_option.nullable_to_opt(Router.useRouter());
  var children = Props.children;
  var handleClick = function ($$event) {
    $$event.preventDefault();
    Belt_Option.map(router, (function (router) {
            return router.push(href);
          }));
    return /* () */0;
  };
  var className = Cn.make(/* :: */[
        Cn.ifTrue(activeClassName, Belt_Option.getWithDefault(Belt_Option.map(router, (function (router) {
                        return router.pathname;
                      })), "/") === href),
        /* [] */0
      ]);
  return React.createElement("a", {
              className: className,
github kgoggin / reason-react-apollo / src / ReasonReactApollo_Make.bs.js View on Github external
var useQuery = function (query, displayName, skip, variables, fetchPolicy, errorPolicy, pollInterval, client, notifyOnNetworkStatusChange, context, partialRefetch, returnPartialData, ssr, onCompleted, onError, param) {
      var tmp = { };
      if (displayName !== undefined) {
        tmp.displayName = Caml_option.valFromOption(displayName);
      }
      if (skip !== undefined) {
        tmp.skip = Caml_option.valFromOption(skip);
      }
      var tmp$1 = Belt_Option.map(variables, QueryConfig[/* parse */0]);
      if (tmp$1 !== undefined) {
        tmp.variables = Caml_option.valFromOption(tmp$1);
      }
      if (fetchPolicy !== undefined) {
        tmp.fetchPolicy = Caml_option.valFromOption(fetchPolicy);
      }
      if (errorPolicy !== undefined) {
        tmp.errorPolicy = Caml_option.valFromOption(errorPolicy);
      }
      if (pollInterval !== undefined) {
        tmp.pollInterval = Caml_option.valFromOption(pollInterval);
      }
      if (client !== undefined) {
        tmp.client = Caml_option.valFromOption(client);
      }
      if (notifyOnNetworkStatusChange !== undefined) {
        tmp.notifyOnNetworkStatusChange = Caml_option.valFromOption(notifyOnNetworkStatusChange);
      }
      if (context !== undefined) {
        tmp.context = Caml_option.valFromOption(context);
      }
github kgoggin / reason-react-apollo / packages / reason-react-apollo / src / Project.bs.js View on Github external
}
      if (skip !== undefined) {
        tmp.skip = Caml_option.valFromOption(skip);
      }
      var tmp$1 = Belt_Option.map(variables, QueryConfig[/* parse */0]);
      if (tmp$1 !== undefined) {
        tmp.variables = Caml_option.valFromOption(tmp$1);
      }
      if (fetchPolicy !== undefined) {
        tmp.fetchPolicy = Caml_option.valFromOption(fetchPolicy);
      }
      if (errorPolicy !== undefined) {
        tmp.errorPolicy = Caml_option.valFromOption(errorPolicy);
      }
      if (pollInterval !== undefined) {
        tmp.pollInterval = Caml_option.valFromOption(pollInterval);
      }
      if (client !== undefined) {
        tmp.client = Caml_option.valFromOption(client);
      }
      if (notifyOnNetworkStatusChange !== undefined) {
        tmp.notifyOnNetworkStatusChange = Caml_option.valFromOption(notifyOnNetworkStatusChange);
      }
      if (context !== undefined) {
        tmp.context = Caml_option.valFromOption(context);
      }
      if (partialRefetch !== undefined) {
        tmp.partialRefetch = Caml_option.valFromOption(partialRefetch);
      }
      if (returnPartialData !== undefined) {
        tmp.returnPartialData = Caml_option.valFromOption(returnPartialData);
      }
github kgoggin / reason-react-apollo / src / ReasonReactApollo_Make.bs.js View on Github external
}
      if (context !== undefined) {
        tmp.context = Caml_option.valFromOption(context);
      }
      if (partialRefetch !== undefined) {
        tmp.partialRefetch = Caml_option.valFromOption(partialRefetch);
      }
      if (returnPartialData !== undefined) {
        tmp.returnPartialData = Caml_option.valFromOption(returnPartialData);
      }
      if (ssr !== undefined) {
        tmp.ssr = Caml_option.valFromOption(ssr);
      }
      var tmp$2 = Belt_Option.map(onCompleted, mapOnCompleted);
      if (tmp$2 !== undefined) {
        tmp.onCompleted = Caml_option.valFromOption(tmp$2);
      }
      if (onError !== undefined) {
        tmp.onError = Caml_option.valFromOption(onError);
      }
      var opt = tmp;
      var response = ReactHooks.useQuery(query, opt);
      return /* record */[
              /* data */Belt_Option.map(Belt_Option.flatMap(Caml_option.undefined_to_opt(response.data), mapEmptyObject), Config[/* parse */0]),
              /* loading */response.loading,
              /* error */Caml_option.undefined_to_opt(response.error),
              /* variables */Curry._1(QueryConfig[/* parse */0], response.variables),
              /* networkStatus */response.networkStatus
            ];
    };
    return /* module */[
github kgoggin / reason-react-apollo / src / ReasonReactApollo_Make.bs.js View on Github external
}
      if (skip !== undefined) {
        tmp.skip = Caml_option.valFromOption(skip);
      }
      var tmp$1 = Belt_Option.map(variables, QueryConfig[/* parse */0]);
      if (tmp$1 !== undefined) {
        tmp.variables = Caml_option.valFromOption(tmp$1);
      }
      if (fetchPolicy !== undefined) {
        tmp.fetchPolicy = Caml_option.valFromOption(fetchPolicy);
      }
      if (errorPolicy !== undefined) {
        tmp.errorPolicy = Caml_option.valFromOption(errorPolicy);
      }
      if (pollInterval !== undefined) {
        tmp.pollInterval = Caml_option.valFromOption(pollInterval);
      }
      if (client !== undefined) {
        tmp.client = Caml_option.valFromOption(client);
      }
      if (notifyOnNetworkStatusChange !== undefined) {
        tmp.notifyOnNetworkStatusChange = Caml_option.valFromOption(notifyOnNetworkStatusChange);
      }
      if (context !== undefined) {
        tmp.context = Caml_option.valFromOption(context);
      }
      if (partialRefetch !== undefined) {
        tmp.partialRefetch = Caml_option.valFromOption(partialRefetch);
      }
      if (returnPartialData !== undefined) {
        tmp.returnPartialData = Caml_option.valFromOption(returnPartialData);
      }
github kgoggin / reason-react-apollo / packages / reason-react-apollo / src / Project.bs.js View on Github external
var useQuery = function (overrideQuery, displayName, skip, variables, fetchPolicy, errorPolicy, pollInterval, client, notifyOnNetworkStatusChange, context, partialRefetch, returnPartialData, ssr, onCompleted, onError, param) {
      var tmp = { };
      if (displayName !== undefined) {
        tmp.displayName = Caml_option.valFromOption(displayName);
      }
      if (skip !== undefined) {
        tmp.skip = Caml_option.valFromOption(skip);
      }
      var tmp$1 = Belt_Option.map(variables, QueryConfig[/* parse */0]);
      if (tmp$1 !== undefined) {
        tmp.variables = Caml_option.valFromOption(tmp$1);
      }
      if (fetchPolicy !== undefined) {
        tmp.fetchPolicy = Caml_option.valFromOption(fetchPolicy);
      }
      if (errorPolicy !== undefined) {
        tmp.errorPolicy = Caml_option.valFromOption(errorPolicy);
      }
      if (pollInterval !== undefined) {
        tmp.pollInterval = Caml_option.valFromOption(pollInterval);
      }
      if (client !== undefined) {
        tmp.client = Caml_option.valFromOption(client);
      }
      if (notifyOnNetworkStatusChange !== undefined) {
        tmp.notifyOnNetworkStatusChange = Caml_option.valFromOption(notifyOnNetworkStatusChange);
      }
      if (context !== undefined) {
        tmp.context = Caml_option.valFromOption(context);
      }
github kgoggin / reason-react-apollo / src / ReasonReactApollo_Make.bs.js View on Github external
tmp.pollInterval = Caml_option.valFromOption(pollInterval);
      }
      if (client !== undefined) {
        tmp.client = Caml_option.valFromOption(client);
      }
      if (notifyOnNetworkStatusChange !== undefined) {
        tmp.notifyOnNetworkStatusChange = Caml_option.valFromOption(notifyOnNetworkStatusChange);
      }
      if (context !== undefined) {
        tmp.context = Caml_option.valFromOption(context);
      }
      if (partialRefetch !== undefined) {
        tmp.partialRefetch = Caml_option.valFromOption(partialRefetch);
      }
      if (returnPartialData !== undefined) {
        tmp.returnPartialData = Caml_option.valFromOption(returnPartialData);
      }
      if (ssr !== undefined) {
        tmp.ssr = Caml_option.valFromOption(ssr);
      }
      var tmp$2 = Belt_Option.map(onCompleted, mapOnCompleted);
      if (tmp$2 !== undefined) {
        tmp.onCompleted = Caml_option.valFromOption(tmp$2);
      }
      if (onError !== undefined) {
        tmp.onError = Caml_option.valFromOption(onError);
      }
      var opt = tmp;
      var response = ReactHooks.useQuery(query, opt);
      return /* record */[
              /* data */Belt_Option.map(Belt_Option.flatMap(Caml_option.undefined_to_opt(response.data), mapEmptyObject), Config[/* parse */0]),
              /* loading */response.loading,
github kgoggin / reason-react-apollo / packages / reason-react-apollo / src / Project.bs.js View on Github external
tmp.variables = Caml_option.valFromOption(tmp$1);
      }
      if (fetchPolicy !== undefined) {
        tmp.fetchPolicy = Caml_option.valFromOption(fetchPolicy);
      }
      if (errorPolicy !== undefined) {
        tmp.errorPolicy = Caml_option.valFromOption(errorPolicy);
      }
      if (pollInterval !== undefined) {
        tmp.pollInterval = Caml_option.valFromOption(pollInterval);
      }
      if (client !== undefined) {
        tmp.client = Caml_option.valFromOption(client);
      }
      if (notifyOnNetworkStatusChange !== undefined) {
        tmp.notifyOnNetworkStatusChange = Caml_option.valFromOption(notifyOnNetworkStatusChange);
      }
      if (context !== undefined) {
        tmp.context = Caml_option.valFromOption(context);
      }
      if (partialRefetch !== undefined) {
        tmp.partialRefetch = Caml_option.valFromOption(partialRefetch);
      }
      if (returnPartialData !== undefined) {
        tmp.returnPartialData = Caml_option.valFromOption(returnPartialData);
      }
      if (ssr !== undefined) {
        tmp.ssr = Caml_option.valFromOption(ssr);
      }
      var tmp$2 = Belt_Option.map(onCompleted, mapOnCompleted);
      if (tmp$2 !== undefined) {
        tmp.onCompleted = Caml_option.valFromOption(tmp$2);
github kgoggin / reason-react-apollo / src / ReasonReactApollo_Make.bs.js View on Github external
tmp.errorPolicy = Caml_option.valFromOption(errorPolicy);
      }
      if (pollInterval !== undefined) {
        tmp.pollInterval = Caml_option.valFromOption(pollInterval);
      }
      if (client !== undefined) {
        tmp.client = Caml_option.valFromOption(client);
      }
      if (notifyOnNetworkStatusChange !== undefined) {
        tmp.notifyOnNetworkStatusChange = Caml_option.valFromOption(notifyOnNetworkStatusChange);
      }
      if (context !== undefined) {
        tmp.context = Caml_option.valFromOption(context);
      }
      if (partialRefetch !== undefined) {
        tmp.partialRefetch = Caml_option.valFromOption(partialRefetch);
      }
      if (returnPartialData !== undefined) {
        tmp.returnPartialData = Caml_option.valFromOption(returnPartialData);
      }
      if (ssr !== undefined) {
        tmp.ssr = Caml_option.valFromOption(ssr);
      }
      var tmp$2 = Belt_Option.map(onCompleted, mapOnCompleted);
      if (tmp$2 !== undefined) {
        tmp.onCompleted = Caml_option.valFromOption(tmp$2);
      }
      if (onError !== undefined) {
        tmp.onError = Caml_option.valFromOption(onError);
      }
      var opt = tmp;
      var response = ReactHooks.useQuery(query, opt);