Skip to content

Add text search#46

Merged
bkeepers merged 1 commit intomainfrom
search
Feb 1, 2026
Merged

Add text search#46
bkeepers merged 1 commit intomainfrom
search

Conversation

@bkeepers
Copy link
Contributor

@bkeepers bkeepers commented Feb 1, 2026

You can search for stations by name, region, country, or continent using the search function. It supports fuzzy matching and prefix search:

import { search } from "@neaps/tide-database";

// Search for stations by name with fuzzy matching
const results = search("Boston");
console.log("Found:", results.length, "stations");
console.log(results[0].name);

// Search with a filter function
const usStations = search("harbor", {
  filter: (station) => station.country === "United States",
  maxResults: 10,
});
console.log("US harbor stations:", usStations);

// Combine multiple filters
const referenceStations = search("island", {
  filter: (station) =>
    station.type === "reference" &&
    station.continent === "Americas",
  maxResults: 20,
});
console.log("Reference stations:", referenceStations);

The search function takes the following parameters:

  • query (required): Search string. Supports fuzzy matching and prefix search.
  • options (optional):
    • filter: Function that takes a station and returns true to include it in results, or false to exclude it.
    • maxResults: Maximum number of results to return (default: 20).

@bkeepers bkeepers force-pushed the search branch 2 times, most recently from 6c17a27 to a4d3b06 Compare February 1, 2026 20:51
@bkeepers bkeepers merged commit 35b223f into main Feb 1, 2026
2 checks passed
@bkeepers bkeepers deleted the search branch February 1, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant