game-name-suggester
v1.0.1
Published
A simple and fast Node.js module to suggest PC game names based on user input. It supports **partial matches**, **case-insensitive search**, and **initials matching** (like "GTA" for "Grand Theft Auto").
Readme
Game Name Suggester
A simple and fast Node.js module to suggest PC game names based on user input. It supports partial matches, case-insensitive search, and initials matching (like "GTA" for "Grand Theft Auto").
Perfect for search bars, autocomplete fields, or recommendation engines in game-related apps.
Installation
Install via npm:
npm install game-name-suggesterUsage
const getGameSuggestions = require('game-name-suggester');
const suggestions = getGameSuggestions("gt");
console.log(suggestions);
// ["GTA V", "GT Racing", ...] (based on data in pc_games_fast.json)Features
- Matches start of name (
"gta"→ "GTA V") - Matches anywhere in name (
"auto"→ "Grand Theft Auto V") - Matches initials (
"gtav"→ "Grand Theft Auto V") - Case-insensitive by default
- Blazing fast (local JSON, no API calls)
- with over 10000 game-names
Input
getGameSuggestions(query)query— a string you want to search for.
Output
Returns an array of matching game names (string[]).
JSON Data Source
The module includes a local JSON file: pc_games_fast.json.
You can update it with your own structure:
[
{ "name": "GTA V", "slug": "grand-theft-auto-v" },
{ "name": "Call of Duty", "slug": "call-of-duty" },
...
]Example
const getGameSuggestions = require('game-name-suggester');
console.log(getGameSuggestions("cod"));
// ["Call of Duty"]
console.log(getGameSuggestions("gtav"));
// ["Grand Theft Auto V"]Custom Game List
You can modify pc_games_fast.json to include:
- More games
- Custom games
- Alternative spellings
Just ensure each entry has a "name" key.
License
MIT License
