MCPcopy Create free account
hub / github.com/BrasilAPI/BrasilAPI / project

Function project

pages/api/tuss/v1/search.js:4–11  ·  view source on GitHub ↗
(item, fields)

Source from the content-addressed store, hash-verified

2import { searchTussAdvanced } from '@/services/tuss';
3
4function project(item, fields) {
5 if (!Array.isArray(fields) || fields.length === 0) return item;
6 return fields.reduce(
7 (acc, key) =>
8 item[key] === undefined ? acc : { ...acc, [key]: item[key] },
9 {}
10 );
11}
12
13async function TussSearchAdvanced(request, response) {
14 const { q, name, tuss, match, sort, order, limit, offset, fields } =

Callers 1

TussSearchAdvancedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected