New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@storeon/router

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storeon/router - npm Package Compare versions

Comparing version 1.2.0 to 2.0.0

3

CHANGELOG.md
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 2.0.0
* Improve types.
## 1.2.0

@@ -5,0 +8,0 @@ * Improve types.

52

index.d.ts
import { StoreonModule } from "storeon";
declare namespace createRouter{
export type RoutesState<MatchParams> = {
[routerKey]: {
match: MatchParams | boolean,
path: string,
params: string[],
}
}
}
/**
* Router key on store
*/
export const routerKey: unique symbol;
/**
* Event changes a path
*/
export const routerChanged: unique symbol;
/**
* Navigate event
*/
export const routerNavigate: unique symbol;
export type RouterRecordState<MatchParameters> = {
match: MatchParameters | false;
path: string;
params: string[];
};
export type RouterState<MatchParameters> = {
[routerKey]: RouterRecordState<MatchParameters>;
};
export type RouterEvents<MatchParameters> = {
[routerChanged]: RouterState<MatchParameters>;
[routerNavigate]: string;
};
export type Path = string | RegExp;
export type Callback<MatchParams> = (...props: string[]) => MatchParams;
export type Route<MatchParam> = [Path, Callback<MatchParam>];
export type Callback<MatchParameters> = (
...properties: string[]
) => MatchParameters;
export type Route<MatchParameter> = [Path, Callback<MatchParameter>];
export function createRouter<MatchParam>(routes: Route<MatchParam>[]): StoreonModule<createRouter.RoutesState<MatchParam>>;
export const routerKey: unique symbol;
export const routerChanged: unique symbol;
export const routerNavigate: unique symbol;
export function createRouter<MatchParameter>(
routes: Route<MatchParameter>[],
): StoreonModule<RouterState<MatchParameter>, RouterEvents<MatchParameter>>;

@@ -9,3 +9,3 @@ let loc = location

/**
* Changed event
* Event changes a path
*/

@@ -20,3 +20,3 @@ let routerChanged = Symbol()

/**
* Router routerKey on store
* Router key on store
*/

@@ -77,6 +77,3 @@ let routerKey = Symbol('route')

event.preventDefault()
store.dispatch(
routerNavigate,
link.href.slice(loc.origin.length)
)
store.dispatch(routerNavigate, link.href.slice(loc.origin.length))
}

@@ -83,0 +80,0 @@ })

{
"name": "@storeon/router",
"version": "1.2.0",
"version": "2.0.0",
"description": "Storeon module for URL routing",

@@ -13,8 +13,10 @@ "main": "index.cjs",

"exports": {
"./package.json": "./package.json",
".": {
"require": "./index.cjs",
"import": "./index.js"
}
"import": "./index.js",
"types": "./index.d.ts"
},
"./package.json": "./package.json",
"./index.d.ts": "./index.d.ts"
}
}

@@ -6,5 +6,5 @@ # Storeon Router

[Storeon] Router which solves the problem of routing your application, providing full control over the route.
[Storeon] Router solves the problems of routing while seamlessly providing full control.
It size is 577 bytes (minified and gzipped) and uses [Size Limit] to control size.
Its size is 577 bytes (minified and gzipped) and uses [Size Limit] to control size.

@@ -11,0 +11,0 @@ [Storeon]: https://github.com/storeon/storeon

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc