UNPKG

rxnormie

Version:

A simple but robust TypeScript client for the RxNorm API — for normies. This package provides a simple and intuitive way to interact with the RxNorm API.

32 lines (31 loc) 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("./index"); // Example usage of RxNormie SDK async function example() { // Create a new instance with default options (JSON format) const rxnormie = new index_1.RxNormie(); try { // Example 1: Get drug information for ibuprofen console.log('Getting drug information for ibuprofen...'); const drugs = await rxnormie.getDrugs('ibuprofen'); console.log('Drug information:', JSON.stringify(drugs, null, 2)); // Example 2: Find RxCUI by NDC console.log('\nFinding RxCUI by NDC...'); const result = await rxnormie.findRxcuiById('00071015773', 'NDC'); console.log('RxCUI result:', JSON.stringify(result, null, 2)); // Example 3: Get spelling suggestions console.log('\nGetting spelling suggestions for "ibprofin"...'); const suggestions = await rxnormie.getSpellingSuggestions('ibprofin'); console.log('Spelling suggestions:', suggestions); // Example 4: Get RxNorm version information console.log('\nGetting RxNorm version information...'); const version = await rxnormie.getRxNormVersion(); console.log('RxNorm version:', JSON.stringify(version, null, 2)); } catch (error) { console.error('Error in example:', error); } } // Run the example example();