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

@atomico/hooks

Package Overview
Dependencies
Maintainers
1
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atomico/hooks - npm Package Compare versions

Comparing version 3.5.0 to 3.6.0

2

package.json
{
"name": "@atomico/hooks",
"description": "Series of utilities in hooks format to extend the operation of Atomico",
"version": "3.5.0",
"version": "3.6.0",
"type": "module",

@@ -6,0 +6,0 @@ "exports": {

import { useState, useEffect } from "atomico";
import { getPath, listener } from "./use-router/history.js";
import { matches } from "./use-router/matches.js";
import { matches, getMatch } from "./use-router/matches.js";
export { redirect, getPath } from "./use-router/history.js";

@@ -50,2 +50,22 @@

}
/**
* Create a match function to manually compare route matches,
* the instance of this hook listens for route changes
* @example
* ```js
* const match = useRouteMatch();
*
* if(match("/")){
* console.log("in root")
* }
*
* console.log(match("/:id"))
* ```
* @returns {(path:string)=>import("@uppercod/exp-route").Match}
*/
export function useRouteMatch() {
const [state, setState] = useState(getPath);
useEffect(() => listener(() => setState(getPath)), []);
return (path) => getMatch(path)(state);
}

@@ -52,0 +72,0 @@ /**

@@ -12,3 +12,4 @@ import { createMatch, getParts, searchParams } from "@uppercod/exp-route";

*/
const getMatch = (path) => (cache[path] = cache[path] || createMatch(path));
export const getMatch = (path) =>
(cache[path] = cache[path] || createMatch(path));
/**

@@ -15,0 +16,0 @@ *

@@ -12,2 +12,18 @@ /**

export function useRoute(path: string, callback?: import("./use-router/matches").RouterCallback): any;
/**
* Create a match function to manually compare route matches,
* the instance of this hook listens for route changes
* @example
* ```js
* const match = useRouteMatch();
*
* if(match("/")){
* console.log("in root")
* }
*
* console.log(match("/:id"))
* ```
* @returns {(path:string)=>import("@uppercod/exp-route").Match}
*/
export function useRouteMatch(): (path: string) => import("@uppercod/exp-route").Match;
export type InternalState = {

@@ -14,0 +30,0 @@ path?: string;

@@ -0,1 +1,3 @@

/// <reference types="@uppercod/exp-route" />
export function getMatch(path: string): import("@uppercod/exp-route").Match<import("@uppercod/exp-route").Params>;
export function matches(routes: Routes, currentPath: string): any[];

@@ -2,0 +4,0 @@ export type RouterCallback = (params: import("@uppercod/exp-route").Params, search: import("@uppercod/exp-route").Params) => any;

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