@thorgate/spa-is

Internal type checking library for SPA packages

Usage no npm install needed!

<script type="module">
  import thorgateSpaIs from 'https://cdn.skypack.dev/@thorgate/spa-is';
</script>

README

@thorgate/spa-is

Internal type checking library for SPA packages used by Thorgate project template SPA variant

Available object type checks:

  • isRouteSagaObject(obj)
  • isIterable(obj)
  • isIterator(obj)
  • isPromise(obj)

Avalable utility checks:

  • isNode() - true if running on node, false if running in browser

Usage:

import { isNode } from '@thorgate/spa-is';

let history;
if (isNode()) {
    history = createMemoryHistory();
} else {
    history = createBrowserHistory();
}