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

Function getAllNcmData

pages/api/ncm/v1/index.js:12–32  ·  view source on GitHub ↗
(request, response)

Source from the content-addressed store, hash-verified

10};
11
12async function getAllNcmData(request, response) {
13 let ncmData = await getNcmData();
14
15 if (request.query.search) {
16 const { search } = request.query;
17
18 ncmData = ncmData.filter((ncm) => {
19 return (
20 searchByDescription(ncm.descricao, search) ||
21 searchByCode(ncm.codigo, search)
22 );
23 });
24
25 // For search queries, return empty array if no results (preserving original behavior)
26 if (!ncmData || ncmData.length === 0) {
27 return response.status(200).json([]);
28 }
29 }
30
31 return response.status(200).json(ncmData);
32}
33
34export default app().get(getAllNcmData);

Callers

nothing calls this directly

Calls 3

getNcmDataFunction · 0.90
searchByDescriptionFunction · 0.85
searchByCodeFunction · 0.85

Tested by

no test coverage detected