ctan
Version:
CTAN (Comprehensive TeX Archive Network) API client for Node.js
41 lines (40 loc) • 1.82 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var mixin_exports = {};
__export(mixin_exports, {
Searchable: () => Searchable
});
module.exports = __toCommonJS(mixin_exports);
var import_client_base = require("../../client-base.js");
var import_paginator = require("./paginator.js");
var import_schemas = require("./schemas.js");
class Searchable extends import_client_base.ClientBase {
async search(params, config) {
params = typeof params === "string" ? { phrase: params } : params;
const result = await this.get("/search/json", (0, import_client_base.buildParams)(params, ["phrase", "offset", "max", "ext", "PKG", "AUTHORS", "TOPICS", "FILES", "PORTAL", "wildcard"]), import_schemas.SearchResult, config);
return new import_paginator.SearchPaginator(result, this, params, config);
}
static mixin(derived) {
Object.defineProperty(derived.prototype, "search", Object.getOwnPropertyDescriptor(Searchable.prototype, "search") ?? {});
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Searchable
});