https://github.com/hyfi06/unam-careers
A utility package for retrieving career information from UNAM.
https://github.com/hyfi06/unam-careers
career data npm-package unam
Last synced: about 1 month ago
JSON representation
A utility package for retrieving career information from UNAM.
- Host: GitHub
- URL: https://github.com/hyfi06/unam-careers
- Owner: hyfi06
- License: mit
- Created: 2023-07-21T22:36:18.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-22T07:13:46.000Z (almost 3 years ago)
- Last Synced: 2025-09-09T16:10:35.704Z (10 months ago)
- Topics: career, data, npm-package, unam
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@hyfi06/unam-careers
- Size: 121 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @hyfi06/unam-careers
A utility package for retrieving career information from UNAM.
## Install
You can install this package using npm:
```bash
npm install --save @hyfi06/unam-careers
```
## Usage
Here is an example of how to use the getCareerById function:
```javascript
const { getCareerById } = require('@hyfi06/unam-careers');
const id = 101;
const career = getCareerById(id);
console.log(career);
// Prints the career with id 101 { id: 101, name: 'Actuaría', alias: ['ACTUARIA', 'ACT'], siassId: 1, dgeciId: 11 }
```
And here is an example of how to use the getCareerByName function:
```javascript
Copy code
const { getCareerByName } = require('@hyfi06/unam-careers');
const careerName = 'Actuaría';
const career = getCareerByName(careerName);
console.log(career);
// Prints the career with name 'Actuaría' { id: 101, name: 'Actuaría', alias: ['ACTUARIA', 'ACT'], siassId: 1, dgeciId: 11 }
```
## Functions
- [`getCareerById(id: number): CareerItem`](#function-getcareerbyid): Retrieves a career from the `CAREERS` array by its `id`. Throws an error if no career with the specified ID is found.
- [`getCareerByName(careerName: string): CareerItem`](#function-getcareerbyname): Retrieves a career from the `CAREERS` array by its name. It sanitizes the input string by removing accents and converting to uppercase before comparing it with the career aliases. Throws an error if no career with the specified name is found.
### Function: getCareerById
The `getCareerById` function retrieves a career by its `id`.
#### Parameters
- `id` (number): The ID of the career to retrieve.
#### Returns
- (CareerItem): The career with the specified ID.
#### Throws
- (Error): If no career with the specified ID is found.
#### Example
```javascript
const id = 101;
const career = getCareerById(id);
// career is { id: 101, name: 'Actuaría', alias: ['ACTUARIA', 'ACT'], siassId: 1, dgeciId: 11 }
```
### Function: getCareerByName
The `getCareerByName` function retrieves a career from the `CAREERS` array by its name. It sanitizes the input string by removing accents and converting to uppercase before comparing it with the career aliases.
#### Parameters
- `careerName` (string): The name of the career to retrieve.
#### Returns
- (CareerItem): The career with the specified name.
#### Throws
- (Error): If no career with the specified name is found.
#### Example
```javascript
const careerName = 'Actuaría';
const career = getCareerByName(careerName);
// career is { id: 101, name: 'Actuaría', alias: ['ACTUARIA', 'ACT'], siassId: 1, dgeciId: 11 }
```
## Copyright
Copyright (c) 2023 Héctor Olvera Vital
## License
This project is licensed under the [MIT License](LICENSE), which means you are free to use, modify, and distribute the code for both commercial and non-commercial purposes. However, the software is provided "as is," without any warranty or guarantee of its effectiveness or suitability for your specific needs. [Please review the license file for more details](LICENSE).