A modern TypeScript client library for the npms.io API. This library provides a simple and type-safe way to interact with the npms.io search API.
- 🎯 Fully type-safe
- 🔍 Search capabilities with modifiers and filters
- 💡 NPM package suggestions
- ℹ️ Single and multi-package information retrieval
- 📦 Zero dependencies
- 🧪 100% test coverage
npm install npms-sdk
import { NpmsIO } from 'npms-sdk';
const npms = new NpmsIO();
// Search for packages
const { results, total } = await npms.executeSearchQuery('react');
console.log(`Total results: ${total}`);
for (const result of results) {
console.log(result.package.description);
}
const { results } = await client.executeSearchQuery('react', {
size: 10,
modifiers: {
not: 'deprecated,insecure',
author: 'facebook'
}
});
const { flags, package, score, searchScore, highlight } = await npms.searchSuggestions('react', { size: 5 });
// Get info for a single package
const { analyzedAt, collected, evaluation, score } = await npms.getPackageInfo('react');
// Get info for multiple packages
const packages = await npms.getMultiPackageInfo(['react', 'typescript']);
console.log(packages.typescript.score)
The search API supports various modifiers to filter results:
scope:types
- Show/filter results that belong to the @types scopeauthor:username
- Filter by package authormaintainer:username
- Filter by package maintainerkeywords:keyword1,keyword2
- Filter by keywordsnot:deprecated
- Exclude deprecated packagesnot:unstable
- Exclude packages with version < 1.0.0not:insecure
- Exclude packages with security vulnerabilitiesis:deprecated
- Show only deprecated packagesis:unstable
- Show packages with version < 1.0.0is:insecure
- Show packages with security vulnerabilitiesboost-exact:false
- Disable boosting exact matches
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the ISC License - see the LICENSE file for details.
This package is powered by the npms.io API.