open-index/open-npm huggingface dataset:
npm package: @snappmarket/use-geolocation
Description: > 🗺 easily deal with navigator location API ----
Author: Jafar Rezaei
Latest version: 0.2.5
Deprecated: Please use @snappmarket/hooks instead

# useGeoLocation
> 🗺 easily deal with navigator location API
----

[![version](https://img.shields.io/npm/v/@snappmarket/use-geolocation.svg?style=flat-square)](https://www.npmjs.com/package/@snappmarket/use-geolocation)
[![downloads](https://img.shields.io/npm/dm/@snappmarket/use-geolocation.svg?style=flat-square)](http://www.npmtrends.com/@snappmarket/use-geolocation)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![MIT License](https://img.shields.io/npm/l/@snappmarket/use-geolocation.svg?style=flat-square)](https://github.com/snappmarket/frontend-toolbox/tree/master/packages/useDidUpdateEffect/blob/master/LICENSE.md)

[![Watch on GitHub](https://img.shields.io/github/watchers/snappmarket/frontend-toolbox.svg?style=social)](https://github.com/snappmarket/frontend-toolbox/watchers)
[![Star on GitHub](https://img.shields.io/github/stars/snappmarket/frontend-toolbox.svg?style=social)](https://github.com/snappmarket/frontend-toolbox/stargazers)


## get started 
We provide two way of using this package `single` or `multi` :
```bash
npm i @snappmarket/use-geolocation
OR
npm i @snappmarket/hooks
```

## usage 
```javascript
import useGeoLocation from '@snappmarket/use-geolocation';
// or 
// import { useGeoLocation } from '@snappmarket/hooks';


const MyComponenet = props => {
  const [position, error] = useGeoLocation(LOCATION_ACCESS_TIMEOUT || 5000);
};
```

### source code
```javascript
import { useEffect, useState } from 'react';

/**
 * Get access to geo location based on timeout
 * @note : if timeout error it will send TIMEOUT as error
 * @param timeout number
 * @param options object for getCurrentPosition options
 * @returns {[*, *]}
 */
const useGeoLocation = (timeout, options) => {
  let timeoutHandler;
  let canceled = false;

  const [position, setPosition] = useState();
  const [error, setError] = useState();

  useEffect(() => {
    /**
     * Handle timeout clear
     */
    const timeoutCanceler = () => {
      clearTimeout(timeoutHandler);
    };

    /**
     * Success getting geolocation
     * @param pos
     */
    const successGetLocation = pos => {
      if (!canceled) {
        setPosition(pos);
      }
      timeoutCanceler();
    };

    /**
     * Failure getting geolocation
     * @param err
     */
    const failGetLocation = err => {
      if (!canceled) {
        setError(err);
      }
      timeoutCanceler();
    };

    timeoutHandler = setTimeout(() => {
      setError('TIMEOUT');
    }, timeout);

    /**
     * Get geolocation access of navigator
     */
    navigator.geolocation.getCurrentPosition(
      successGetLocation,
      failGetLocation,
      options
    );

    return () => {
      canceled = true;
    };
  }, [options]);

  return [position, error];
};

export default useGeoLocation;
```
npm package: @snappmarket/use-route-change
Description: > 🏹 detect when react router dom route changes ----
Author: Jafar Rezaei
Latest version: 0.2.5
Deprecated: Please use @snappmarket/hooks instead

# useRouteChange
> 🏹 detect when react router dom route changes
----

[![version](https://img.shields.io/npm/v/@snappmarket/use-route-change.svg?style=flat-square)](https://www.npmjs.com/package/@snappmarket/use-route-change)
[![downloads](https://img.shields.io/npm/dm/@snappmarket/use-route-change.svg?style=flat-square)](http://www.npmtrends.com/@snappmarket/use-route-change)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![MIT License](https://img.shields.io/npm/l/@snappmarket/use-route-change.svg?style=flat-square)](https://github.com/snappmarket/frontend-toolbox/tree/master/packages/useDidUpdateEffect/blob/master/LICENSE.md)

[![Watch on GitHub](https://img.shields.io/github/watchers/snappmarket/frontend-toolbox.svg?style=social)](https://github.com/snappmarket/frontend-toolbox/watchers)
[![Star on GitHub](https://img.shields.io/github/stars/snappmarket/frontend-toolbox.svg?style=social)](https://github.com/snappmarket/frontend-toolbox/stargazers)


## get started 
We provide two way of using this package `single` or `multi` :
```bash
npm i @snappmarket/use-route-change
OR
npm i @snappmarket/hooks
```

## usage 
```javascript
import useRouteChange from '@snappmarket/use-route-change';
// or 
// import { useRouteChange } from '@snappmarket/hooks';


const MyComponenet = props => {
  useRouteChange(() => {
    // do sth here
  });
};
```

### source code
```javascript
import { useState, useEffect } from 'react';

/**
 * Debounce setting a value
 * @param value
 * @param delay
 * @returns {[string, fn, fn]}
 */
export default function useDebounce(value, delay) {
  // State and setters for debounced value
  const [debouncedValue, setDebouncedValue] = useState(value);

  let handler;
  const canceller = () => {
    clearTimeout(handler);
  };

  useEffect(() => {
    handler = setTimeout(() => {
      setDebouncedValue(value);
    }, delay);

    return canceller;
  }, [value]);

  return [debouncedValue, canceller, setDebouncedValue];
}
```
npm package: @snappmarket/window-helpers
Description: > ✴ Methods that helps us to manage window related stuffs
Author: Jafar Rezaei
Latest version: 0.2.5
Deprecated: Please use @snappmarket/helpers instead

# Window helpers
> ✴ Methods that helps us to manage window related stuffs

[![version](https://img.shields.io/npm/v/@snappmarket/window-helpers.svg?style=flat-square)](https://www.npmjs.com/package/@snappmarket/window-helpers)
[![downloads](https://img.shields.io/npm/dm/@snappmarket/window-helpers.svg?style=flat-square)](http://www.npmtrends.com/@snappmarket/window-helpers)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![MIT License](https://img.shields.io/npm/l/@snappmarket/window-helpers.svg?style=flat-square)](https://github.com/snappmarket/frontend-toolbox/tree/master/packages/useDidUpdateEffect/blob/master/LICENSE.md)

[![Watch on GitHub](https://img.shields.io/github/watchers/snappmarket/frontend-toolbox.svg?style=social)](https://github.com/snappmarket/frontend-toolbox/watchers)
[![Star on GitHub](https://img.shields.io/github/stars/snappmarket/frontend-toolbox.svg?style=social)](https://github.com/snappmarket/frontend-toolbox/stargazers)

## get started
We provide two way of using this package `single` or `multi` :
```bash
npm i @snappmarket/window-helpers
OR
npm i @snappmarket/helpers
```

## methods
|        |
| ------ |
| getPathName                                                 |
| getWindowSize                                                 |

## usage
```javascript
import { METHOD_NAME } from '@snappmarket/window-helpers';
// or
// import { METHOD_NAME } from '@snappmarket/helpers';
```
``
npm package: @snappwd/cli
Description: Official CLI for SnapPwd - Secure, zero-knowledge secret sharing
Author: SnapPwd
Latest version: 1.3.0

# SnapPwd CLI

The official command-line interface for [SnapPwd.io](https://snappwd.io).

Share secrets and files securely from your terminal. The CLI performs local encryption (AES-GCM) before uploading, ensuring the server never sees your data or keys.

## Features

- **Zero-Knowledge**: Secrets are encrypted on your machine.
- **Cross-Platform**: Windows, macOS, Linux (via Node.js).
- **Interoperable**: Secrets created via CLI can be opened in the web app.
- **Self-Hostable**: Supports custom backends (e.g., your own [snappwd-service](https://github.com/SnapPwd/snappwd-service)).

## Installation

```bash
npm install -g snappwd-cli
```

## Usage

### Share a Secret

```bash
snappwd put "My secret API key"
# Output: https://snappwd.io/g/uuid...#key...
```

### Share a File

```bash
snappwd put-file ./database.env
```

### Retrieve a Secret

```bash
snappwd get "https://snappwd.io/g/uuid...#key..."
```

## Self-Hosting

If you are running your own [SnapPwd Service](https://github.com/SnapPwd/snappwd-service), point the CLI to it:

```bash
snappwd put "Internal Secret" --api-url "https://secrets.internal.corp/api/v1"
```

You can also set the API URL permanently via environment variable:

```bash
export SNAPPWD_API_URL="https://secrets.internal.corp/api/v1"
snappwd put "Internal Secret"
```

## Security Model

1. **Key Gen**: A random AES key is generated locally.
2. **Encrypt**: Data is encrypted using AES-GCM.
3. **Upload**: Only the encrypted ciphertext is sent to the server.
4. **Link**: The CLI generates a link with the key in the URL fragment (`#`). This key never leaves your machine.

## License

MIT