snstr
Version:
Secure Nostr Software Toolkit for Renegades - A comprehensive TypeScript library for Nostr protocol implementation
23 lines (22 loc) • 720 B
JavaScript
;
/**
* NIP-50: Search Capability
*
* Provides helper utilities for creating search filters as defined in
* https://github.com/nostr-protocol/nips/blob/master/50.md
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSearchFilter = createSearchFilter;
/**
* Create a NIP-50 search filter.
*
* @param query - Human readable search query string
* @param other - Optional additional filter fields
* @returns Filter including the search term
*/
function createSearchFilter(query, other = {}) {
if (!query || typeof query !== "string" || query.trim() === "") {
throw new Error("Query must be a non-empty string");
}
return { ...other, search: query };
}