How to use the history.parsePath function in history

To help you get started, we’ve selected a few history 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 flow-typed / flow-typed / definitions / npm / history_v4.9.x / flow_v0.25.x- / test_history_v4.9.x.js View on Github external
it('should not allow to accept void', () => {
    // $ExpectError
    const location = parsePath()

    const state: {} = location
  });
});
github flow-typed / flow-typed / definitions / npm / history_v4.9.x / flow_v0.25.x- / test_history_v4.9.x.js View on Github external
it('should allow to use string argument', () => {
    const location = parsePath('/test?query#hash')

    const state: {} = location
    // $ExpectError
    const key: string = location
  });
github kaliberjs / build / library / lib / serve.js View on Github external
function serveIndexWithRouting (req, res, next) {
  const envRequire = isProduction ? require : require('import-fresh')
  const template = envRequire(indexWithRouting)

  const routes = template.routes
  const location = parsePath(req.url)

  return Promise.resolve(routes)
    .then(routes => (routes && routes.match(location, req)) || { status: 200, data: null })
    .then(({ status, headers, data }) =>
      Promise.resolve(template({ location, data })).then(html => [status, headers, html])
    )
    .then(([ status, headers, html ]) => res.status(status).set(headers).send(html))
}
github infernojs / inferno / packages / inferno-router / src / StaticRouter.ts View on Github external
function createLocation(location) {
  return typeof location === 'string' ? parsePath(location) : normalizeLocation(location);
}
github adam-26 / react-router-dispatcher / src / createRouteDispatchers.js View on Github external
function createDispatchAction(dispatchFuncName, pathAndQuery, params, options) {
    invariant(typeof pathAndQuery === 'string', 'pathAnyQuery expects a string');

    const { actionNames, routes, routeComponentPropNames } = options;
    return RouteDispatcher[dispatchFuncName](
        parsePath(pathAndQuery),
        actionNames,
        { routes, routeComponentPropNames },
        Object.assign({}, params));
}