# hscode-search

> A tool to quick search HS codes by number or description.

Latest version **1.3.0** (published 2023-09-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install hscode-search
pnpm add hscode-search
yarn add hscode-search
bun add hscode-search
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2023-09-07 |
| First published | 2023-09-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Miguel Suay |
| Maintainers | datos-solidarios |
| Keywords | HSCODE, HTSCODE, Trade |

## Links

- npm: https://www.npmjs.com/package/hscode-search
- npm.io page: https://npm.io/package/hscode-search

## Dependencies (1)

- [fuse.js](https://npm.io/package/fuse.js.md) ^6.6.2

## Recent versions

- 1.3.0 (latest) — 2023-09-07
- 1.2.0 — 2023-09-07
- 1.1.0 — 2023-09-07
- 1.0.0 — 2023-09-07

## README

# HSCodeSearch

A fast and efficient search utility for HS Codes. Allows users to search HS codes either by number or description.

## Features

- Numeric and Textual search capability.
- Fast search using Fuse.js under the hood.
- Debounced search, with customizable delay.
- Provides result based on the closeness of the search string.
- Integrated HS code dataset.

## Installation

To install the module, run: 
```bash
npm install HSCodeSearch --save
```

## Example of React Usage

import React, { useState, useEffect } from 'react';
import HSCodeSearch from 'hscode-search';

const HSCodeSearchComponent = () => {
    const [searchTerm, setSearchTerm] = useState('');
    const [results, setResults] = useState([]);
    const searcher = new HSCodeSearch();

    useEffect(() => {
        if (searchTerm) {
            searcher.search(searchTerm, (searchResults) => {
                setResults(searchResults);
            });
        } else {
            setResults([]);
        }
    }, [searchTerm]);

    return (
        <div>
            <input
                type="text"
                value={searchTerm}
                onChange={(e) => setSearchTerm(e.target.value)}
                placeholder="Search HSCode..."
            />
            {results.length > 0 && (
                <ul>
                    {results.map((item, index) => (
                        <li key={index}>
                            {item.HS} - {item.description}
                        </li>
                    ))}
                </ul>
            )}
        </div>
    );
};

export default HSCodeSearchComponent;

---
_Source: https://npm.io/package/hscode-search · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
