@mtucourses/rate-my-professors
TypeScript icon, indicating that this package has built-in type declarations

2.2.1Β β€’Β PublicΒ β€’Β Published

πŸ§‘β€πŸ« @mtucourses/rate-my-professors

codecov

A basic wrapper for Rate My Professors's GraphQL API. Includes TypeScript definitions.

It is possible to pull full ratings with content as well, but currently this package just returns the average.

πŸ— Usage

// Change to 
// const ratings = require('@mtucourses/rate-my-professors').default;
// if using JS instead of TS
import ratings from '@mtucourses/rate-my-professors';

(async () => {
  const schools = await ratings.searchSchool('michigan technological university');

  console.log(schools);
  /*
    [
      {
        city: 'Houghton',
        id: 'U2Nob29sLTYwMg==',
        name: 'Michigan Technological University',
        state: 'MI'
      }
    ]
  */

  const teachers = await ratings.searchTeacher('mtu shene');

  console.log(teachers);
  /*
    [
      {
        firstName: 'Ching-Kuang',
        id: 'VGVhY2hlci0yMjkxNjI=',
        lastName: 'Shene',
        school: {
          id: 'U2Nob29sLTYwMg==',
          name: 'Michigan Technological University'
        }
      }
    ] 
  */

  const teacher = await ratings.getTeacher('VGVhY2hlci0yMjkxNjI=');

  console.log(teacher);
  /*
    {
      avgDifficulty: 4.4,
      avgRating: 3.3,
      numRatings: 28,
      department: 'Computer Science',
      firstName: 'Ching-Kuang',
      id: 'VGVhY2hlci0yMjkxNjI=',
      lastName: 'Shene',
      school: {
        city: 'Houghton',
        id: 'U2Nob29sLTYwMg==',
        name: 'Michigan Technological University',
        state: 'MI'
      },
      legacyId: 1234567
    }
  */
})();

🧰 Development

# First:
# install dependencies
yarn install

# then:
# build in watch mode
yarn build:watch

# and you can:

# run tests
yarn test

# run tests in watch mode
yarn test:watch

To publish a new package version, run npm version [patch|minor|major] and then git push && git push --tags on the master branch.

Package Sidebar

Install

npm i @mtucourses/rate-my-professors

Weekly Downloads

3

Version

2.2.1

License

MIT

Unpacked Size

12.2 kB

Total Files

12

Last publish

Collaborators

  • codetheweb